Merge branch 'dev' into feature0

Conflicts:
	org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/notifier/Notifier.java
	org.eclipse.om2m.site.in-cse/om2m.product
	org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/AccessControlPolicyTest.java
diff --git a/org.eclipse.om2m.binding.http/src/main/java/org/eclipse/om2m/binding/http/RestHttpClient.java b/org.eclipse.om2m.binding.http/src/main/java/org/eclipse/om2m/binding/http/RestHttpClient.java
index 8ed1e27..4062106 100644
--- a/org.eclipse.om2m.binding.http/src/main/java/org/eclipse/om2m/binding/http/RestHttpClient.java
+++ b/org.eclipse.om2m.binding.http/src/main/java/org/eclipse/om2m/binding/http/RestHttpClient.java
@@ -178,10 +178,6 @@
 				method.addHeader(HttpHeaders.RESPONSE_TYPE, uris);
 			}
 			
-			if (requestPrimitive.getName() != null){
-				method.addHeader(HttpHeaders.NAME, requestPrimitive.getName());
-			}
-			
 			LOGGER.info("Request to be send: " + method.toString());
 			String headers = "";
 			for (Header h : method.getAllHeaders()){
diff --git a/org.eclipse.om2m.binding.http/src/main/java/org/eclipse/om2m/binding/http/RestHttpServlet.java b/org.eclipse.om2m.binding.http/src/main/java/org/eclipse/om2m/binding/http/RestHttpServlet.java
index d087cc2..3c19338 100644
--- a/org.eclipse.om2m.binding.http/src/main/java/org/eclipse/om2m/binding/http/RestHttpServlet.java
+++ b/org.eclipse.om2m.binding.http/src/main/java/org/eclipse/om2m/binding/http/RestHttpServlet.java
@@ -305,19 +305,26 @@
 			primitive.setDiscoveryResultType(new BigInteger(request.getParameter(HttpParameters.DISCOVERY_RESULT_TYPE)));
 		}
 
+		// create filter criteria
+		FilterCriteria filterCriteria = new FilterCriteria();
+		primitive.setFilterCriteria(filterCriteria);
+		if (request.getParameter(HttpParameters.LEVEL) != null) {
+			filterCriteria.setLevel(new BigInteger(request.getParameter(HttpParameters.LEVEL)));
+		}
+		if (request.getParameter(HttpParameters.OFFSET) != null) {
+			filterCriteria.setOffset(new BigInteger(request.getParameter(HttpParameters.OFFSET)));
+		}
 		if(request.getParameter(HttpParameters.FILTER_USAGE) != null){
-			FilterCriteria filterCriteria = new FilterCriteria();
 			filterCriteria.setFilterUsage(new BigInteger(request.getParameter(HttpParameters.FILTER_USAGE)));
-			if(request.getParameter(HttpParameters.LIMIT) != null){
-				filterCriteria.setLimit(new BigInteger(request.getParameter(HttpParameters.LIMIT)));
-			}
-			if(request.getParameter(HttpParameters.LABELS) != null){
-				filterCriteria.getLabels().addAll(Arrays.asList(request.getParameterValues(HttpParameters.LABELS)));
-			}
-			if(request.getParameter(HttpParameters.RESOURCE_TYPE) != null){
-				filterCriteria.setResourceType(new BigInteger(request.getParameter(HttpParameters.RESOURCE_TYPE)));
-			}
-			primitive.setFilterCriteria(filterCriteria);
+		}
+		if(request.getParameter(HttpParameters.LIMIT) != null){
+			filterCriteria.setLimit(new BigInteger(request.getParameter(HttpParameters.LIMIT)));
+		}
+		if(request.getParameter(HttpParameters.LABELS) != null){
+			filterCriteria.getLabels().addAll(Arrays.asList(request.getParameterValues(HttpParameters.LABELS)));
+		}
+		if(request.getParameter(HttpParameters.RESOURCE_TYPE) != null){
+			filterCriteria.setResourceType(new BigInteger(request.getParameter(HttpParameters.RESOURCE_TYPE)));
 		}
 	}
 
@@ -389,12 +396,6 @@
 			request.setReturnContentType(request.getRequestContentType());
 		}
 
-		// Map name header
-		String nameHeader = httpServletRequest.getHeader(HttpHeaders.NAME);
-		if (nameHeader != null){
-			request.setName(nameHeader);
-		}
-
 		// Map Response Type Uri for non-blocking request
 		String rtuHeader = httpServletRequest.getHeader(HttpHeaders.RESPONSE_TYPE);
 		if(rtuHeader != null){
diff --git a/org.eclipse.om2m.binding.http/src/main/java/org/eclipse/om2m/binding/http/constants/HttpHeaders.java b/org.eclipse.om2m.binding.http/src/main/java/org/eclipse/om2m/binding/http/constants/HttpHeaders.java
index fad2b47..36c8def 100644
--- a/org.eclipse.om2m.binding.http/src/main/java/org/eclipse/om2m/binding/http/constants/HttpHeaders.java
+++ b/org.eclipse.om2m.binding.http/src/main/java/org/eclipse/om2m/binding/http/constants/HttpHeaders.java
@@ -31,7 +31,6 @@
 	public static final String CONTENT_LOCATION = "Content-Location";
 	public static final String ETAG = "Etag";
 	public static final String ORIGINATOR = "X-M2M-Origin";
-	public static final String NAME = "X-M2M-NM";
 	public static final String GROUP_REQUEST_IDENTIFIER = "X-M2M-GID";
 	public static final String RESPONSE_TYPE = "X-M2M-RTU";
 	public static final String HOST = "Host";
diff --git a/org.eclipse.om2m.binding.http/src/main/java/org/eclipse/om2m/binding/http/constants/HttpParameters.java b/org.eclipse.om2m.binding.http/src/main/java/org/eclipse/om2m/binding/http/constants/HttpParameters.java
index 936add5..e8e4ac7 100644
--- a/org.eclipse.om2m.binding.http/src/main/java/org/eclipse/om2m/binding/http/constants/HttpParameters.java
+++ b/org.eclipse.om2m.binding.http/src/main/java/org/eclipse/om2m/binding/http/constants/HttpParameters.java
@@ -43,6 +43,8 @@
 	public static final String SIZE_BELOW = "szb";
 	public static final String CONTENT_TYPE = "cty";
 	public static final String LIMIT = "lim";
+	public static final String LEVEL = "lvl";
+	public static final String OFFSET = "ofst";
 	public static final String ATTRIBUTE = "atr";
 	public static final String FILTER_USAGE = "fu";
 	public static final String DISCOVERY_RESULT_TYPE = "drt";
diff --git a/org.eclipse.om2m.commons/META-INF/MANIFEST.MF b/org.eclipse.om2m.commons/META-INF/MANIFEST.MF
index 59faa5e..79f26d2 100644
--- a/org.eclipse.om2m.commons/META-INF/MANIFEST.MF
+++ b/org.eclipse.om2m.commons/META-INF/MANIFEST.MF
@@ -14,6 +14,7 @@
  org.eclipse.om2m.commons.obix,
  org.eclipse.om2m.commons.obix.io,
  org.eclipse.om2m.commons.resource,
+ org.eclipse.om2m.commons.resource.flexcontainerspec,
  org.eclipse.om2m.commons.utils
 Bundle-ClassPath: .,
  libs/javax.persistence.jar
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/ResourceType.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/ResourceType.java
index ebaf001..b33a439 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/ResourceType.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/ResourceType.java
@@ -51,7 +51,7 @@
 	public static final int STATS_COLLECT = 21;
 	public static final int STATS_CONFIG = 22;
 	public static final int SUBSCRIPTION = 23;
-	public static final int FLEXCONTAINER = 24;
+	public static final int FLEXCONTAINER = 28;
 	public static final int DYNAMIC_AUTHORIZATION_CONSULTATION = 34;
 	public static final int ACCESS_CONTROL_POLICY_ANNC = 10001;
 	public static final int AE_ANNC = 10002;
@@ -63,7 +63,7 @@
 	public static final int NODE_ANNC = 10014;
 	public static final int REMOTE_CSE_ANNC = 10016;
 	public static final int SCHEDULE_ANNC = 10018;
-	public static final int FLEXCONTAINER_ANNC = 10024;
+	public static final int FLEXCONTAINER_ANNC = 10028;
 	
 	
 	
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/ShortName.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/ShortName.java
index 88618c9..7476dee 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/ShortName.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/constants/ShortName.java
@@ -175,6 +175,14 @@
 	/** Short name for DynamicAuthorizationConsultationIDs attribute */
 	public static final String DAC_IDS = "daci";
 	
+	// Attributes for Child Resources
+	/** Short name for name attribute of a ChildResourceRef */
+	public static final String CHILD_RESOURCE_NAME = "nm";
+	/** Short name for type attribute of a ChildResourceRef */
+	public static final String CHILD_RESOURCE_TYPE = "typ";
+	/** Short name for spid attribute of a ChildResourceRef */ 
+	public static final String CHILD_RESOURCE_SPID = "spid";
+	
 	// Attributes for CSEBase Entity
 	/** Short name for SupportedResourceTypes attribute */
 	public static final String SRT = "srt";
@@ -248,7 +256,7 @@
 	
 	// Attributes for FlexContainerEntity
 	/** Short name for ContainerDefinition attribute */
-	public static final String CONTAINER_DEFINITION = "cntDef";
+	public static final String CONTAINER_DEFINITION = "cnd";
 	
 	
 	// Attributes for Content Instance
@@ -360,6 +368,8 @@
 	public static final String FILTER_RESOURCETYPE = "rty";
 	public static final String CONTENT_TYPE = "cty";
 	public static final String LIMIT = "lim";
+	public static final String LEVEL = "lvl";
+	public static final String OFFSET = "ofst";
 	public static final String ATTRIBUTE = "atr";
 	public static final String FILTER_USAGE = "fu";
 	public static final String DISCOVERY_RESULT_TYPE = "drt";
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/AccessControlPolicyEntity.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/AccessControlPolicyEntity.java
index 1c24f5d..1dd9a48 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/AccessControlPolicyEntity.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/AccessControlPolicyEntity.java
@@ -45,7 +45,7 @@
 public class AccessControlPolicyEntity extends AnnounceableSubordinateEntity {
 	
 	// Database link to selfPrivilege
-	@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL }, orphanRemoval=true)
+	@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL }, orphanRemoval=true, mappedBy="selfAccessControlPolicy")
 	@JoinTable(
 			name=DBEntities.ACPACR_SEFPRIVILEGES,
 			joinColumns={@JoinColumn(name=DBEntities.ACPID_COLUMN,referencedColumnName=ShortName.RESOURCE_ID)},
@@ -54,7 +54,7 @@
 	protected List<AccessControlRuleEntity> selfPrivileges;
 
 	// Database link to privileges
-	@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL }, orphanRemoval=true)
+	@OneToMany(fetch = FetchType.LAZY, cascade = { CascadeType.ALL }, orphanRemoval=true, mappedBy="accessControlPolicy")
 	@JoinTable(
 			name=DBEntities.ACPACR_PRIVILEGES,
 			joinColumns={@JoinColumn(name=DBEntities.ACP_JOIN_ID,referencedColumnName=ShortName.RESOURCE_ID)},
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/AccessControlRuleEntity.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/AccessControlRuleEntity.java
index 341ee5d..7408e36 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/AccessControlRuleEntity.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/AccessControlRuleEntity.java
@@ -79,14 +79,30 @@
 			inverseJoinColumns={@JoinColumn(name=DBEntities.ACP_JOIN_ID,referencedColumnName=ShortName.RESOURCE_ID)},
 			joinColumns={@JoinColumn(name=DBEntities.ACRID_COLUMN,referencedColumnName=DBEntities.ACCESSCONTROLRULE_ID)}
 			)
-	protected List<AccessControlPolicyEntity> accessControlPolicies;
-
-	public List<AccessControlPolicyEntity> getAccessControlPolicies() {
-		return accessControlPolicies;
+	protected AccessControlPolicyEntity accessControlPolicy;
+	
+	@ManyToOne(targetEntity=AccessControlPolicyEntity.class)
+	@JoinTable(
+			name=DBEntities.ACPACR_SEFPRIVILEGES,
+			inverseJoinColumns={@JoinColumn(name=DBEntities.ACP_JOIN_ID,referencedColumnName=ShortName.RESOURCE_ID)},
+			joinColumns={@JoinColumn(name=DBEntities.ACRID_COLUMN,referencedColumnName=DBEntities.ACCESSCONTROLRULE_ID)}
+			)
+	protected AccessControlPolicyEntity selfAccessControlPolicy;
+	
+	public AccessControlPolicyEntity getSelfAccessControlPolicy() {
+		return selfAccessControlPolicy;
 	}
 
-	public void setAccessControlPolicies(List<AccessControlPolicyEntity> accessControlPolicies) {
-		this.accessControlPolicies = accessControlPolicies;
+	public void setSelfAccessControlPolicy(AccessControlPolicyEntity selfAccessControlPolicy) {
+		this.selfAccessControlPolicy = selfAccessControlPolicy;
+	}
+
+	public AccessControlPolicyEntity getAccessControlPolicy() {
+		return accessControlPolicy;
+	}
+
+	public void setAccessControlPolicy(AccessControlPolicyEntity accessControlPolicy) {
+		this.accessControlPolicy = accessControlPolicy;
 	}
 
 	/**
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/CustomAttributeEntity.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/CustomAttributeEntity.java
index f4d8193..b8fb355 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/CustomAttributeEntity.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/CustomAttributeEntity.java
@@ -26,9 +26,6 @@
 	@Column(name= ShortName.CUSTOM_ATTRIBUTE_NAME)

 	protected String customAttributeName;

 	

-	@Column(name = ShortName.CUSTOM_ATTRIBUTE_TYPE)

-	protected String customAttributeType;

-	

 	@Column(name = ShortName.CUSTOM_ATTRIBUTE_VALUE)

 	protected String customAttributeValue;

 	

@@ -46,14 +43,6 @@
 		this.customAttributeName = customAttributeName;

 	}

 

-	public String getCustomAttributeType() {

-		return customAttributeType;

-	}

-

-	public void setCustomAttributeType(String customAttributeType) {

-		this.customAttributeType = customAttributeType;

-	}

-

 	public String getCustomAttributeValue() {

 		return customAttributeValue;

 	}

diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/FlexContainerAnncEntity.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/FlexContainerAnncEntity.java
index c74187d..0ff96b4 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/FlexContainerAnncEntity.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/FlexContainerAnncEntity.java
@@ -23,6 +23,11 @@
 @Entity(name = DBEntities.FLEXCONTAINER_ANNC_ENTITY)

 @Inheritance(strategy = InheritanceType.JOINED)

 public class FlexContainerAnncEntity extends AnnouncedResourceEntity {

+	@Column(name="longName")

+	protected String longName;

+	@Column(name="shortName")

+	protected String shortName;

+	

 

 	@Column(name = ShortName.STATETAG)

 	protected BigInteger stateTag;

@@ -81,6 +86,34 @@
 			joinColumns={@JoinColumn(name=DBEntities.FCNTA_JOIN_ID, referencedColumnName=ShortName.RESOURCE_ID)}

 			)

 	protected AeAnncEntity parentAeAnnc;

+	

+	/**

+	 * @return the longName

+	 */

+	public String getLongName() {

+		return longName;

+	}

+

+	/**

+	 * @param longName the longName to set

+	 */

+	public void setLongName(String longName) {

+		this.longName = longName;

+	}

+

+	/**

+	 * @return the shortName

+	 */

+	public String getShortName() {

+		return shortName;

+	}

+

+	/**

+	 * @param shortName the shortName to set

+	 */

+	public void setShortName(String shortName) {

+		this.shortName = shortName;

+	}

 

 	/**

 	 * @return the stateTag

diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/FlexContainerEntity.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/FlexContainerEntity.java
index b40a69e..059c448 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/FlexContainerEntity.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/FlexContainerEntity.java
@@ -45,6 +45,11 @@
 @Entity(name=DBEntities.FLEXCONTAINER_ENTITY)
 @Inheritance(strategy = InheritanceType.JOINED)
 public class FlexContainerEntity extends AnnounceableSubordinateEntity{
+	@Column(name="longName")
+	protected String longName;
+	@Column(name="shortName")
+	protected String shortName;
+	
 	@Column(name= ShortName.STATETAG)
 	protected BigInteger stateTag;
 	@Column(name= ShortName.CREATOR)
@@ -150,6 +155,34 @@
 	protected ContainerEntity parentContainer;
 	
 	/**
+	 * @return the longName
+	 */
+	public String getLongName() {
+		return longName;
+	}
+
+	/**
+	 * @param longName the longName to set
+	 */
+	public void setLongName(String longName) {
+		this.longName = longName;
+	}
+
+	/**
+	 * @return the shortName
+	 */
+	public String getShortName() {
+		return shortName;
+	}
+
+	/**
+	 * @param shortName the shortName to set
+	 */
+	public void setShortName(String shortName) {
+		this.shortName = shortName;
+	}
+
+	/**
 	 * @return the parentFlexContainer
 	 */
 	public FlexContainerEntity getParentFlexContainer() {
@@ -383,7 +416,7 @@
 		this.customAttributes = customAttributes;
 	}
 	
-	public void createOrUpdateCustomAttribute(String name, String type, Object value) {
+	public void createOrUpdateCustomAttribute(String name, Object value) {
 		CustomAttributeEntity attToCreateOrUpdate = null;
 		for(CustomAttributeEntity cae : getCustomAttributes()) {
 			if (cae.getCustomAttributeName().equals(name)) {
@@ -395,7 +428,6 @@
 		if (attToCreateOrUpdate == null) {
 			attToCreateOrUpdate = new CustomAttributeEntity();
 			attToCreateOrUpdate.setCustomAttributeName(name);
-			attToCreateOrUpdate.setCustomAttributeType(type);
 			getCustomAttributes().add(attToCreateOrUpdate);
 		}
 		attToCreateOrUpdate.setCustomAttributeValue((value != null) ? value.toString() : null);
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/SubscriptionEntity.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/SubscriptionEntity.java
index afe78b8..f82c702 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/SubscriptionEntity.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/entities/SubscriptionEntity.java
@@ -87,6 +87,20 @@
 	@Column(name = ShortName.CREATOR)
 	protected String creator;
 	
+	/* 2017 07 25 - BONNARDEL Gregory */
+	/* notificationPayloadContentType contains the type of representation */
+	/* to be used when sending a notification */
+	/* either xml or json */
+	protected String notificationPayloadContentType;
+	
+	/*
+	 * 2017 07 25 - BONNARDEL Gregory (Thales)
+	 * nbOfFailedNotifications keep track of the number of notifications that 
+	 * have not been successfully delivered.
+	 */
+	@Column(name="nbOfFailedNotifications")
+	protected Integer nbOfFailedNotifications;
+	
 	protected String subscriberURI;
 	
 	// links to parents
@@ -571,5 +585,35 @@
 	public void setDynamicAuthorizationConsultations(List<DynamicAuthorizationConsultationEntity> list) {
 		this.dynamicAuthorizationConsultations = list;
 	}
+
+	/**
+	 * @return the notificationPayloadContentType
+	 */
+	public String getNotificationPayloadContentType() {
+		return notificationPayloadContentType;
+	}
+
+	/**
+	 * @param notificationPayloadContentType the notificationPayloadContentType to set
+	 */
+	public void setNotificationPayloadContentType(String notificationPayloadContentType) {
+		this.notificationPayloadContentType = notificationPayloadContentType;
+	}
+
+	/**
+	 * @return the nbOfFailedNotifications
+	 */
+	public Integer getNbOfFailedNotifications() {
+		return nbOfFailedNotifications;
+	}
+
+	/**
+	 * @param nbOfFailedNotifications the nbOfFailedNotifications to set
+	 */
+	public void setNbOfFailedNotifications(Integer nbOfFailedNotifications) {
+		this.nbOfFailedNotifications = nbOfFailedNotifications;
+	}
+	
+	
 	
 }
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AE.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AE.java
index 40c05f9..d1305d1 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AE.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AE.java
@@ -39,6 +39,7 @@
 import javax.xml.bind.annotation.XmlType;
 
 import org.eclipse.om2m.commons.constants.ShortName;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.*;
 
 /**
  * <p>
@@ -81,31 +82,81 @@
 @XmlType(name = "")
 @XmlRootElement(name = ShortName.AE)
 public class AE extends AnnounceableResource {
-	@XmlElement(name = ShortName.APP_NAME)
+	@XmlElement(name = ShortName.APP_NAME, required=false, namespace="")
 	protected String appName;
-	@XmlElement(name = ShortName.APP_ID, required = true)
+	@XmlElement(name = ShortName.APP_ID, required = true, namespace="")
 	protected String appID;
-	@XmlElement(name = ShortName.AE_ID, required = true)
+	@XmlElement(name = ShortName.AE_ID, required = true, namespace="")
 	protected String aeid;
 	@XmlList
-	@XmlElement(name = ShortName.POA)
+	@XmlElement(name = ShortName.POA, required=false, namespace="")
 	protected List<String> pointOfAccess;
 	@XmlSchemaType(name = "anyURI")
-	@XmlElement(name = ShortName.ONTOLOGY_REF)
+	@XmlElement(name = ShortName.ONTOLOGY_REF, required=false, namespace="")
 	protected String ontologyRef;
 	@XmlSchemaType(name = "anyURI")
-	@XmlElement(name = ShortName.NODE_LINK)
+	@XmlElement(name = ShortName.NODE_LINK, required=false, namespace="")
 	protected String nodeLink;
-	@XmlElement(name = ShortName.CHILD_RESOURCE)
+	@XmlElement(name = ShortName.CHILD_RESOURCE, namespace="")
 	protected List<ChildResourceRef> childResource;
-	@XmlElement(name = ShortName.REQUEST_REACHABILITY)
+	@XmlElement(name = ShortName.REQUEST_REACHABILITY, required=true, namespace="")
 	protected Boolean requestReachability;
 	@XmlElements({
 			@XmlElement(name = ShortName.CNT, namespace = "http://www.onem2m.org/xml/protocols", type = Container.class),
 			@XmlElement(name = ShortName.GROUP, namespace = "http://www.onem2m.org/xml/protocols", type = Group.class),
 			@XmlElement(name = ShortName.ACP, namespace = "http://www.onem2m.org/xml/protocols", type = AccessControlPolicy.class),
 			@XmlElement(name = ShortName.SUB, namespace = "http://www.onem2m.org/xml/protocols", type = Subscription.class),
-			@XmlElement(name = ShortName.PCH, namespace = "http://www.onem2m.org/xml/protocols", type = PollingChannel.class) })
+			@XmlElement(name = ShortName.PCH, namespace = "http://www.onem2m.org/xml/protocols", type = PollingChannel.class),
+			@XmlElement(name =  ShortName.FCNT, type = AbstractFlexContainer.class),
+			@XmlElement(name = DeviceLightFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceLightFlexContainer.class),
+			@XmlElement(name = DeviceSmartElectricMeterFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceSmartElectricMeterFlexContainer.class),
+			@XmlElement(name = DeviceWaterHeaterFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceWaterHeaterFlexContainer.class),
+			@XmlElement(name = DeviceCameraFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceCameraFlexContainer.class),
+			@XmlElement(name = DeviceCoffeeMachineFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceCoffeeMachineFlexContainer.class),
+			@XmlElement(name = DeviceContactDetectorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceContactDetectorFlexContainer.class),
+			@XmlElement(name = DeviceDoorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceDoorFlexContainer.class),
+			@XmlElement(name = DeviceFloodDetectorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceFloodDetectorFlexContainer.class),
+			@XmlElement(name = DeviceGasValveFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceGasValveFlexContainer.class),
+			@XmlElement(name = DeviceMotionDetectorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceMotionDetectorFlexContainer.class),
+			@XmlElement(name = DeviceSmokeDetectorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceSmokeDetectorFlexContainer.class),
+			@XmlElement(name = DeviceSmokeExtractorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceSmokeExtractorFlexContainer.class),
+			@XmlElement(name = DeviceSwitchButtonFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceSwitchButtonFlexContainer.class),
+			@XmlElement(name = DeviceTemperatureDetectorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceTemperatureDetectorFlexContainer.class),
+			@XmlElement(name = DeviceThermostatFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceThermostatFlexContainer.class),
+			@XmlElement(name = DeviceWarningDeviceFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceWarningDeviceFlexContainer.class),
+			@XmlElement(name = DeviceWaterValveFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceWaterValveFlexContainer.class),
+			@XmlElement(name = DeviceWeatherStationFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceWeatherStationFlexContainer.class),
+			@XmlElement(name = AlarmSpeakerFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = AlarmSpeakerFlexContainer.class),
+			@XmlElement(name = AudioVolumeFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = AudioVolumeFlexContainer.class),
+			@XmlElement(name = BinarySwitchFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = BinarySwitchFlexContainer.class),
+			@XmlElement(name = BoilerFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = BoilerFlexContainer.class),
+			@XmlElement(name = BrightnessFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = BrightnessFlexContainer.class),
+			@XmlElement(name = ClockFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ClockFlexContainer.class),
+			@XmlElement(name = ColourFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ColourFlexContainer.class),
+			@XmlElement(name = ColourSaturationFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ColourSaturationFlexContainer.class),
+			@XmlElement(name = DoorStatusFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DoorStatusFlexContainer.class),
+			@XmlElement(name = EnergyConsumptionFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = EnergyConsumptionFlexContainer.class),
+			@XmlElement(name = EnergyGenerationFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = EnergyGenerationFlexContainer.class),
+			@XmlElement(name = FaultDetectionFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = FaultDetectionFlexContainer.class),
+			@XmlElement(name = RelativeHumidityFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = RelativeHumidityFlexContainer.class),
+			@XmlElement(name = RunModeFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = RunModeFlexContainer.class),
+			@XmlElement(name = SmokeSensorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = SmokeSensorFlexContainer.class),
+			@XmlElement(name = TemperatureFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = TemperatureFlexContainer.class),
+			@XmlElement(name = WaterLevelFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = WaterLevelFlexContainer.class),
+			@XmlElement(name = WaterSensorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = WaterSensorFlexContainer.class),
+			@XmlElement(name = AtmosphericPressureSensorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = AtmosphericPressureSensorFlexContainer.class),
+			@XmlElement(name = BrewingFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = BrewingFlexContainer.class),
+			@XmlElement(name = ContactSensorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ContactSensorFlexContainer.class),
+			@XmlElement(name = ExtendedCarbonDioxideSensorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ExtendedCarbonDioxideSensorFlexContainer.class),
+			@XmlElement(name = FoamingFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = FoamingFlexContainer.class),
+			@XmlElement(name = GrinderFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = GrinderFlexContainer.class),
+			@XmlElement(name = NoiseFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = NoiseFlexContainer.class),
+			@XmlElement(name = PersonSensorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = PersonSensorFlexContainer.class),
+			@XmlElement(name = StreamingFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = StreamingFlexContainer.class),
+			@XmlElement(name = LockFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = LockFlexContainer.class),
+			@XmlElement(name = TimerFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = TimerFlexContainer.class),
+			@XmlElement(name = ToggleFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ToggleFlexContainer.class)
+			})
 	protected List<Resource> containerOrGroupOrAccessControlPolicy;
 
 	/**
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AEAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AEAnnc.java
index c9ca9b9..4af31c8 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AEAnnc.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AEAnnc.java
@@ -39,6 +39,54 @@
 import javax.xml.bind.annotation.XmlType;
 
 import org.eclipse.om2m.commons.constants.ShortName;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.AlarmSpeakerFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.AtmosphericPressureSensorFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.AudioVolumeFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.BinarySwitchFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.BoilerFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.BrewingFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.BrightnessFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.ClockFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.ColourFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.ColourSaturationFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.ContactSensorFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceCameraFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceCoffeeMachineFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceContactDetectorFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceDoorFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceFloodDetectorFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceGasValveFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceLightFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceMotionDetectorFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceSmartElectricMeterFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceSmokeDetectorFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceSmokeExtractorFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceSwitchButtonFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceTemperatureDetectorFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceThermostatFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceWarningDeviceFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceWaterHeaterFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceWaterValveFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceWeatherStationFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.DoorStatusFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.EnergyConsumptionFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.EnergyGenerationFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.ExtendedCarbonDioxideSensorFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.FaultDetectionFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.FoamingFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.GrinderFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.LockFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.NoiseFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.PersonSensorFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.RelativeHumidityFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.RunModeFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.SmokeSensorFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.StreamingFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.TemperatureFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.TimerFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.ToggleFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.WaterLevelFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.WaterSensorFlexContainerAnnc;
 
 /**
  * <p>
@@ -84,22 +132,22 @@
 @XmlType(name = "")
 @XmlRootElement(name = ShortName.AEA)
 public class AEAnnc extends AnnouncedResource {
-	@XmlElement(name = ShortName.APP_NAME)
+	@XmlElement(name = ShortName.APP_NAME, required=false, namespace="")
 	protected String appName;
-	@XmlElement(name = ShortName.APP_ID, required = true)
+	@XmlElement(name = ShortName.APP_ID, required = false, namespace="")
 	protected String appID;
-	@XmlElement(name = ShortName.AE_ID, required = true)
+	@XmlElement(name = ShortName.AE_ID, required = false, namespace="")
 	protected String aeid;
 	@XmlList
-	@XmlElement(name = ShortName.POA)
+	@XmlElement(name = ShortName.POA, required=false, namespace="")
 	protected List<String> pointOfAccess;
 	@XmlSchemaType(name = "anyURI")
-	@XmlElement(name = ShortName.ONTOLOGY_REF)
+	@XmlElement(name = ShortName.ONTOLOGY_REF, required=false, namespace="")
 	protected String ontologyRef;
 	@XmlSchemaType(name = "anyURI")
-	@XmlElement(name = ShortName.NODE_LINK)
+	@XmlElement(name = ShortName.NODE_LINK, required=false, namespace="")
 	protected String nodeLink;
-	@XmlElement(name = ShortName.CHILD_RESOURCE)
+	@XmlElement(name = ShortName.CHILD_RESOURCE, namespace="")
 	protected List<ChildResourceRef> childResource;
 	@XmlElements({
 			@XmlElement(name = "container", namespace = "http://www.onem2m.org/xml/protocols", type = Container.class),
@@ -109,7 +157,57 @@
 			@XmlElement(name = "accessControlPolicy", namespace = "http://www.onem2m.org/xml/protocols", type = AccessControlPolicy.class),
 			@XmlElement(name = "accessControlPolicyAnnc", namespace = "http://www.onem2m.org/xml/protocols", type = AccessControlPolicyAnnc.class),
 			@XmlElement(name = "subscription", namespace = "http://www.onem2m.org/xml/protocols", type = Subscription.class),
-			@XmlElement(name = "pollingChannel", namespace = "http://www.onem2m.org/xml/protocols", type = PollingChannel.class) })
+			@XmlElement(name = "pollingChannel", namespace = "http://www.onem2m.org/xml/protocols", type = PollingChannel.class),
+			@XmlElement(name = ShortName.FCNTA, namespace = "http://www.onem2m.org/xml/protocols", type = AbstractFlexContainerAnnc.class),
+			@XmlElement(name = DeviceLightFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceLightFlexContainerAnnc.class),
+			@XmlElement(name = DeviceSmartElectricMeterFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceSmartElectricMeterFlexContainerAnnc.class),
+			@XmlElement(name = DeviceWaterHeaterFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceWaterHeaterFlexContainerAnnc.class),
+			@XmlElement(name = DeviceCameraFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceCameraFlexContainerAnnc.class),
+			@XmlElement(name = DeviceCoffeeMachineFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceCoffeeMachineFlexContainerAnnc.class),
+			@XmlElement(name = DeviceContactDetectorFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceContactDetectorFlexContainerAnnc.class),
+			@XmlElement(name = DeviceDoorFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceDoorFlexContainerAnnc.class),
+			@XmlElement(name = DeviceFloodDetectorFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceFloodDetectorFlexContainerAnnc.class),
+			@XmlElement(name = DeviceGasValveFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceGasValveFlexContainerAnnc.class),
+			@XmlElement(name = DeviceMotionDetectorFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceMotionDetectorFlexContainerAnnc.class),
+			@XmlElement(name = DeviceSmokeDetectorFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceSmokeDetectorFlexContainerAnnc.class),
+			@XmlElement(name = DeviceSmokeExtractorFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceSmokeExtractorFlexContainerAnnc.class),
+			@XmlElement(name = DeviceSwitchButtonFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceSwitchButtonFlexContainerAnnc.class),
+			@XmlElement(name = DeviceTemperatureDetectorFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceTemperatureDetectorFlexContainerAnnc.class),
+			@XmlElement(name = DeviceThermostatFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceThermostatFlexContainerAnnc.class),
+			@XmlElement(name = DeviceWarningDeviceFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceWarningDeviceFlexContainerAnnc.class),
+			@XmlElement(name = DeviceWaterValveFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceWaterValveFlexContainerAnnc.class),
+			@XmlElement(name = DeviceWeatherStationFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceWeatherStationFlexContainerAnnc.class),
+			@XmlElement(name = AlarmSpeakerFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = AlarmSpeakerFlexContainerAnnc.class),
+			@XmlElement(name = AudioVolumeFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = AudioVolumeFlexContainerAnnc.class),
+			@XmlElement(name = BinarySwitchFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = BinarySwitchFlexContainerAnnc.class),
+			@XmlElement(name = BoilerFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = BoilerFlexContainerAnnc.class),
+			@XmlElement(name = BrightnessFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = BrightnessFlexContainerAnnc.class),
+			@XmlElement(name = ClockFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ClockFlexContainerAnnc.class),
+			@XmlElement(name = ColourFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ColourFlexContainerAnnc.class),
+			@XmlElement(name = ColourSaturationFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ColourSaturationFlexContainerAnnc.class),
+			@XmlElement(name = DoorStatusFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DoorStatusFlexContainerAnnc.class),
+			@XmlElement(name = EnergyConsumptionFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = EnergyConsumptionFlexContainerAnnc.class),
+			@XmlElement(name = EnergyGenerationFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = EnergyGenerationFlexContainerAnnc.class),
+			@XmlElement(name = FaultDetectionFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = FaultDetectionFlexContainerAnnc.class),
+			@XmlElement(name = RelativeHumidityFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = RelativeHumidityFlexContainerAnnc.class),
+			@XmlElement(name = RunModeFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = RunModeFlexContainerAnnc.class),
+			@XmlElement(name = SmokeSensorFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = SmokeSensorFlexContainerAnnc.class),
+			@XmlElement(name = TemperatureFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = TemperatureFlexContainerAnnc.class),
+			@XmlElement(name = WaterLevelFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = WaterLevelFlexContainerAnnc.class),
+			@XmlElement(name = WaterSensorFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = WaterSensorFlexContainerAnnc.class),
+			@XmlElement(name = AtmosphericPressureSensorFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = AtmosphericPressureSensorFlexContainerAnnc.class),
+			@XmlElement(name = BrewingFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = BrewingFlexContainerAnnc.class),
+			@XmlElement(name = ContactSensorFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ContactSensorFlexContainerAnnc.class),
+			@XmlElement(name = ExtendedCarbonDioxideSensorFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ExtendedCarbonDioxideSensorFlexContainerAnnc.class),
+			@XmlElement(name = FoamingFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = FoamingFlexContainerAnnc.class),
+			@XmlElement(name = GrinderFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = GrinderFlexContainerAnnc.class),
+			@XmlElement(name = NoiseFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = NoiseFlexContainerAnnc.class),
+			@XmlElement(name = PersonSensorFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = PersonSensorFlexContainerAnnc.class),
+			@XmlElement(name = StreamingFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = StreamingFlexContainerAnnc.class),
+			@XmlElement(name = LockFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = LockFlexContainerAnnc.class),
+			@XmlElement(name = TimerFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = TimerFlexContainerAnnc.class),
+			@XmlElement(name = ToggleFlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ToggleFlexContainerAnnc.class)		
+	})
 	protected List<Resource> containerOrContainerAnncOrGroup;
 
 	/**
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AbstractFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AbstractFlexContainer.java
new file mode 100644
index 0000000..dc1d612
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AbstractFlexContainer.java
@@ -0,0 +1,398 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.commons.resource;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElements;
+import javax.xml.bind.annotation.XmlSchemaType;
+import javax.xml.bind.annotation.XmlSeeAlso;
+import javax.xml.bind.annotation.XmlTransient;
+
+import org.eclipse.om2m.commons.constants.ShortName;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.*;
+
+/**
+ * <p>
+ * Java class for anonymous complex type.
+ * 
+ * <p>
+ * The following schema fragment specifies the expected content contained within
+ * this class.
+ * 
+ * <pre>
+ * &lt;complexType>
+ *   &lt;complexContent>
+ *     &lt;extension base="{http://www.onem2m.org/xml/protocols}announceableResource">
+ *       &lt;sequence>
+ *         &lt;element name="stateTag" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger"/>
+ *         &lt;element name="creator" type="{http://www.onem2m.org/xml/protocols}ID"/>
+ *         &lt;element name="maxNrOfInstances" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" minOccurs="0"/>
+ *         &lt;element name="maxByteSize" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" minOccurs="0"/>
+ *         &lt;element name="maxInstanceAge" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" minOccurs="0"/>
+ *         &lt;element name="currentNrOfInstances" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger"/>
+ *         &lt;element name="currentByteSize" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger"/>
+ *         &lt;element name="locationID" type="{http://www.w3.org/2001/XMLSchema}anyURI" minOccurs="0"/>
+ *         &lt;element name="ontologyRef" type="{http://www.w3.org/2001/XMLSchema}anyURI" minOccurs="0"/>
+ *         &lt;element name="latest" type="{http://www.w3.org/2001/XMLSchema}anyURI"/>
+ *         &lt;element name="oldest" type="{http://www.w3.org/2001/XMLSchema}anyURI"/>
+ *         &lt;choice minOccurs="0">
+ *           &lt;element name="childResource" type="{http://www.onem2m.org/xml/protocols}childResourceRef" maxOccurs="unbounded"/>
+ *           &lt;choice maxOccurs="unbounded">
+ *             &lt;element ref="{http://www.onem2m.org/xml/protocols}contentInstance"/>
+ *             &lt;element ref="{http://www.onem2m.org/xml/protocols}container"/>
+ *             &lt;element ref="{http://www.onem2m.org/xml/protocols}subscription"/>
+ *           &lt;/choice>
+ *         &lt;/choice>
+ *       &lt;/sequence>
+ *     &lt;/extension>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlSeeAlso({DeviceLightFlexContainer.class,
+	DeviceSmartElectricMeterFlexContainer.class, DeviceWaterHeaterFlexContainer.class,
+	DeviceCameraFlexContainer.class, DeviceCoffeeMachineFlexContainer.class,
+	DeviceContactDetectorFlexContainer.class, DeviceDoorFlexContainer.class,
+	DeviceFloodDetectorFlexContainer.class, DeviceGasValveFlexContainer.class,
+	DeviceMotionDetectorFlexContainer.class, DeviceSmokeDetectorFlexContainer.class,
+	DeviceSmokeExtractorFlexContainer.class, DeviceSwitchButtonFlexContainer.class,
+	DeviceTemperatureDetectorFlexContainer.class, DeviceThermostatFlexContainer.class,
+	DeviceWarningDeviceFlexContainer.class,
+	DeviceWaterValveFlexContainer.class, DeviceWeatherStationFlexContainer.class,
+	DeviceThermostatFlexContainer.class,
+	AlarmSpeakerFlexContainer.class, AudioVolumeFlexContainer.class,
+	BinarySwitchFlexContainer.class, BoilerFlexContainer.class,
+	BrightnessFlexContainer.class, ClockFlexContainer.class,
+	ColourFlexContainer.class, ColourSaturationFlexContainer.class,
+	DoorStatusFlexContainer.class, EnergyConsumptionFlexContainer.class,
+	EnergyGenerationFlexContainer.class, FaultDetectionFlexContainer.class,
+	RelativeHumidityFlexContainer.class, RunModeFlexContainer.class,
+	SmokeSensorFlexContainer.class, TemperatureFlexContainer.class,
+	WaterLevelFlexContainer.class, WaterSensorFlexContainer.class,
+	AtmosphericPressureSensorFlexContainer.class, BrewingFlexContainer.class,
+	ContactSensorFlexContainer.class, ExtendedCarbonDioxideSensorFlexContainer.class,
+	FoamingFlexContainer.class, GrinderFlexContainer.class,
+	NoiseFlexContainer.class, PersonSensorFlexContainer.class,
+	StreamingFlexContainer.class, LockFlexContainer.class,
+	BatteryFlexContainer.class,
+	LiquidLevelFlexContainer.class, TimerFlexContainer.class,
+	ToggleFlexContainer.class})
+public abstract class AbstractFlexContainer extends AnnounceableResource {
+	
+	@XmlTransient
+	private String shortName;
+	
+	@XmlTransient
+	private String longName;
+	
+	@XmlElement(name = ShortName.STATETAG, required = true, namespace="")
+	@XmlSchemaType(name = "nonNegativeInteger")
+	protected BigInteger stateTag;
+	@XmlElement(name = ShortName.CREATOR, required = false, namespace="")
+	protected String creator;
+	@XmlSchemaType(name = "anyURI")
+	@XmlElement(name = ShortName.ONTOLOGY_REF, required = false, namespace="")
+	protected String ontologyRef;
+	@XmlSchemaType(name="anyURI")
+	@XmlElement(name = ShortName.CONTAINER_DEFINITION, required=true, namespace="")
+	protected String containerDefinition;
+	@XmlElement(name = ShortName.CHILD_RESOURCE, namespace="")
+	protected List<ChildResourceRef> childResource;
+	@XmlElements({
+//			@XmlElement(name = ShortName.CNT, namespace = "http://www.onem2m.org/xml/protocols", type = Container.class),
+//			@XmlElement(name = ShortName.FCNT, namespace = "http://www.onem2m.org/xml/protocols", type = AbstractFlexContainer.class),
+//			@XmlElement(name = DeviceLightFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceLightFlexContainer.class),
+//			@XmlElement(name = DeviceSmartElectricMeterFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceSmartElectricMeterFlexContainer.class),
+//			@XmlElement(name = DeviceWaterHeaterFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceWaterHeaterFlexContainer.class),
+//			@XmlElement(name = DeviceCameraFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceCameraFlexContainer.class),
+//			@XmlElement(name = DeviceCoffeeMachineFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceCoffeeMachineFlexContainer.class),
+//			@XmlElement(name = DeviceContactDetectorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceContactDetectorFlexContainer.class),
+//			@XmlElement(name = DeviceDoorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceDoorFlexContainer.class),
+//			@XmlElement(name = DeviceFloodDetectorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceFloodDetectorFlexContainer.class),
+//			@XmlElement(name = DeviceGasValveFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceGasValveFlexContainer.class),
+//			@XmlElement(name = DeviceMotionDetectorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceMotionDetectorFlexContainer.class),
+//			@XmlElement(name = DeviceSmokeDetectorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceSmokeDetectorFlexContainer.class),
+//			@XmlElement(name = DeviceSmokeExtractorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceSmokeExtractorFlexContainer.class),
+//			@XmlElement(name = DeviceSwitchButtonFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceSwitchButtonFlexContainer.class),
+//			@XmlElement(name = DeviceTemperatureDetectorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceTemperatureDetectorFlexContainer.class),
+//			@XmlElement(name = DeviceThermostatFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceThermostatFlexContainer.class),
+//			@XmlElement(name = DeviceWarningDeviceFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceWarningDeviceFlexContainer.class),
+//			@XmlElement(name = DeviceWaterValveFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceWaterValveFlexContainer.class),
+//			@XmlElement(name = DeviceWeatherStationFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = DeviceWeatherStationFlexContainer.class),
+//			@XmlElement(name = ModuleAlarmSpeakerFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleAlarmSpeakerFlexContainer.class),
+//			@XmlElement(name = ModuleAudioVolumeFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleAudioVolumeFlexContainer.class),
+//			@XmlElement(name = ModuleBinarySwitchFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleBinarySwitchFlexContainer.class),
+//			@XmlElement(name = ModuleBoilerFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleBoilerFlexContainer.class),
+//			@XmlElement(name = ModuleBrightnessFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleBrightnessFlexContainer.class),
+//			@XmlElement(name = ModuleClockFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleClockFlexContainer.class),
+//			@XmlElement(name = ModuleColourFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleColourFlexContainer.class),
+//			@XmlElement(name = ModuleColourSaturationFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleColourSaturationFlexContainer.class),
+//			@XmlElement(name = ModuleDoorStatusFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleDoorStatusFlexContainer.class),
+//			@XmlElement(name = ModuleEnergyConsumptionFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleEnergyConsumptionFlexContainer.class),
+//			@XmlElement(name = ModuleEnergyGenerationFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleEnergyGenerationFlexContainer.class),
+//			@XmlElement(name = ModuleFaultDetectionFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleFaultDetectionFlexContainer.class),
+//			@XmlElement(name = ModuleRelativeHumidityFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleRelativeHumidityFlexContainer.class),
+//			@XmlElement(name = ModuleRunModeFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleRunModeFlexContainer.class),
+//			@XmlElement(name = ModuleSmokeSensorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleSmokeSensorFlexContainer.class),
+//			@XmlElement(name = ModuleTemperatureFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleTemperatureFlexContainer.class),
+//			@XmlElement(name = ModuleWaterLevelFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleWaterLevelFlexContainer.class),
+//			@XmlElement(name = ModuleWaterSensorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleWaterSensorFlexContainer.class),
+//			@XmlElement(name = ModuleAtmosphericPressureSensorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleAtmosphericPressureSensorFlexContainer.class),
+//			@XmlElement(name = ModuleBrewingFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleBrewingFlexContainer.class),
+//			@XmlElement(name = ModuleCarbonDioxideSensorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleCarbonDioxideSensorFlexContainer.class),
+//			@XmlElement(name = ModuleCarbonMonoxideSensorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleCarbonMonoxideSensorFlexContainer.class),
+//			@XmlElement(name = ModuleContactSensorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleContactSensorFlexContainer.class),
+//			@XmlElement(name = ModuleDimmingFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleDimmingFlexContainer.class),
+//			@XmlElement(name = ModuleEnergyOverloadCircuitBreakerFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleEnergyOverloadCircuitBreakerFlexContainer.class),
+//			@XmlElement(name = ModuleExtendedCarbonDioxideSensorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleExtendedCarbonDioxideSensorFlexContainer.class),
+//			@XmlElement(name = ModuleFoamingFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleFoamingFlexContainer.class),
+//			@XmlElement(name = ModuleGrinderFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleGrinderFlexContainer.class),
+//			@XmlElement(name = ModuleNoiseFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleNoiseFlexContainer.class),
+//			@XmlElement(name = ModulePersonSensorFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModulePersonSensorFlexContainer.class),
+//			@XmlElement(name = ModuleStreamingFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleStreamingFlexContainer.class),
+//			@XmlElement(name = ModuleRunStateFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleRunStateFlexContainer.class),
+//			@XmlElement(name = ModuleBatteryFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleBatteryFlexContainer.class),
+//			@XmlElement(name = ModuleLiquidLevelFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleLiquidLevelFlexContainer.class),
+//			@XmlElement(name = ModuleLockFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleLockFlexContainer.class),
+//			@XmlElement(name = ModuleTimerFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ModuleTimerFlexContainer.class),
+//			@XmlElement(name = ActionToggleFlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols/homedomain", type = ActionToggleFlexContainer.class),
+			@XmlElement(name = ShortName.SUB, namespace = "http://www.onem2m.org/xml/protocols", type = Subscription.class) })
+	protected List<Resource> flexContainerOrContainerOrSubscription;
+
+	@XmlAnyElement()
+	protected List<CustomAttribute> customAttributes;
+	
+	/**
+	 * @return the shortName
+	 */
+	public String getShortName() {
+		return shortName;
+	}
+
+	/**
+	 * @param shortName the shortName to set
+	 */
+	public void setShortName(String shortName) {
+		this.shortName = shortName;
+	}
+
+	/**
+	 * @return the longName
+	 */
+	public String getLongName() {
+		return longName;
+	}
+
+	/**
+	 * @param longName the longName to set
+	 */
+	public void setLongName(String longName) {
+		this.longName = longName;
+	}
+
+	public List<CustomAttribute> getCustomAttributes() {
+		if (customAttributes == null) {
+			customAttributes = new ArrayList<CustomAttribute>();
+		}
+		return customAttributes;
+	}
+
+	public void setCustomAttributes(List<CustomAttribute> customAttributes) {
+		this.customAttributes = customAttributes;
+	}
+	
+	@XmlTransient
+	public List<String> getCustomAttributeNames() {
+		List<String> names = new ArrayList<String>();
+		
+		for(CustomAttribute ca : getCustomAttributes()) {
+			names.add(ca.getCustomAttributeName());
+		}
+		
+		return names;
+	}
+	
+	@XmlTransient
+	public CustomAttribute getCustomAttribute(String name) {
+		for(CustomAttribute ca : getCustomAttributes()) {
+			if (ca.getCustomAttributeName().equals(name)) {
+				return ca;
+			}
+		}
+		return null;
+	}
+
+	/**
+	 * Gets the value of the stateTag property.
+	 * 
+	 * @return possible object is {@link BigInteger }
+	 * 
+	 */
+	public BigInteger getStateTag() {
+		return stateTag;
+	}
+
+	/**
+	 * Sets the value of the stateTag property.
+	 * 
+	 * @param value
+	 *            allowed object is {@link BigInteger }
+	 * 
+	 */
+	public void setStateTag(BigInteger value) {
+		this.stateTag = value;
+	}
+
+	/**
+	 * Gets the value of the creator property.
+	 * 
+	 * @return possible object is {@link String }
+	 * 
+	 */
+	public String getCreator() {
+		return creator;
+	}
+
+	/**
+	 * Sets the value of the creator property.
+	 * 
+	 * @param value
+	 *            allowed object is {@link String }
+	 * 
+	 */
+	public void setCreator(String value) {
+		this.creator = value;
+	}
+	
+	/**
+	 * Gets the value of the ontologyRef property.
+	 * 
+	 * @return possible object is {@link String }
+	 * 
+	 */
+	public String getOntologyRef() {
+		return ontologyRef;
+	}
+
+	/**
+	 * Sets the value of the ontologyRef property.
+	 * 
+	 * @param value
+	 *            allowed object is {@link String }
+	 * 
+	 */
+	public void setOntologyRef(String value) {
+		this.ontologyRef = value;
+	}
+
+	/**
+	 * Gets the value of the containerDefinition property.
+	 * 
+	 * @return object is {@link String}
+	 */
+	public String getContainerDefinition() {
+		return containerDefinition;
+	}
+	
+	/**
+	 * Sets the value of the containerDefinition property.
+	 * 
+	 * @param value allowed object is {@link String}
+	 */
+	public void setContainerDefinition(String value) {
+		this.containerDefinition = value;
+	}
+
+	/**
+	 * Gets the value of the childResource property.
+	 * 
+	 * <p>
+	 * This accessor method returns a reference to the live list, not a
+	 * snapshot. Therefore any modification you make to the returned list will
+	 * be present inside the JAXB object. This is why there is not a
+	 * <CODE>set</CODE> method for the childResource property.
+	 * 
+	 * <p>
+	 * For example, to add a new item, do as follows:
+	 * 
+	 * <pre>
+	 * getChildResource().add(newItem);
+	 * </pre>
+	 * 
+	 * 
+	 * <p>
+	 * Objects of the following type(s) are allowed in the list
+	 * {@link ChildResourceRef }
+	 * 
+	 * 
+	 */
+	public List<ChildResourceRef> getChildResource() {
+		if (childResource == null) {
+			childResource = new ArrayList<ChildResourceRef>();
+		}
+		return this.childResource;
+	}
+
+	/**
+	 * Gets the value of the flexContainerOrContainerOrSubscription property.
+	 * 
+	 * <p>
+	 * This accessor method returns a reference to the live list, not a
+	 * snapshot. Therefore any modification you make to the returned list will
+	 * be present inside the JAXB object. This is why there is not a
+	 * <CODE>set</CODE> method for the flexContainerOrContainerOrSubscription
+	 * property.
+	 * 
+	 * <p>
+	 * For example, to add a new item, do as follows:
+	 * 
+	 * <pre>
+	 * getFlexContainerOrContainerOrSubscription().add(newItem);
+	 * </pre>
+	 * 
+	 * 
+	 * <p>
+	 * Objects of the following type(s) are allowed in the list
+	 * {@link AbstractFlexContainer } {@link Container } {@link Subscription }
+	 * 
+	 * 
+	 */
+	public List<Resource> getFlexContainerOrContainerOrSubscription() {
+		if (flexContainerOrContainerOrSubscription == null) {
+			flexContainerOrContainerOrSubscription = new ArrayList<Resource>();
+		}
+		return this.flexContainerOrContainerOrSubscription;
+	}
+	
+	public void finalizeSerialization() {
+		// do nothing
+		// should be overwrote 
+	}
+
+	public Resource getResourceByName(String name) {
+		for(Resource r : getFlexContainerOrContainerOrSubscription()) {
+			if (r instanceof AbstractFlexContainer) {
+				AbstractFlexContainer absFcnt = (AbstractFlexContainer) r ;
+				if (absFcnt.getShortName().equals(name)) {
+					return absFcnt;
+				}
+			}
+		}
+		return null;
+	}
+}
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AbstractFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AbstractFlexContainerAnnc.java
new file mode 100644
index 0000000..e140c78
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AbstractFlexContainerAnnc.java
@@ -0,0 +1,355 @@
+package org.eclipse.om2m.commons.resource;

+

+import java.math.BigInteger;

+import java.util.ArrayList;

+import java.util.List;

+

+import javax.xml.bind.annotation.XmlAccessType;

+import javax.xml.bind.annotation.XmlAccessorType;

+import javax.xml.bind.annotation.XmlAnyElement;

+import javax.xml.bind.annotation.XmlElement;

+import javax.xml.bind.annotation.XmlElements;

+import javax.xml.bind.annotation.XmlSchemaType;

+import javax.xml.bind.annotation.XmlSeeAlso;

+import javax.xml.bind.annotation.XmlTransient;

+

+import org.eclipse.om2m.commons.constants.ShortName;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.AlarmSpeakerFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.AtmosphericPressureSensorFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.AudioVolumeFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.BatteryFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.BinarySwitchFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.BoilerFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.BrewingFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.BrightnessFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.ClockFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.ColourFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.ColourSaturationFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.ContactSensorFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceCameraFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceCoffeeMachineFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceContactDetectorFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceDoorFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceFloodDetectorFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceGasValveFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceLightFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceMotionDetectorFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceSmartElectricMeterFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceSmokeDetectorFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceSmokeExtractorFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceSwitchButtonFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceTemperatureDetectorFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceThermostatFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceWarningDeviceFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceWaterHeaterFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceWaterValveFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceWeatherStationFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DoorStatusFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.EnergyConsumptionFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.EnergyGenerationFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.ExtendedCarbonDioxideSensorFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.FaultDetectionFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.FoamingFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.GrinderFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.LiquidLevelFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.LockFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.NoiseFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.PersonSensorFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.RelativeHumidityFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.RunModeFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.SmokeSensorFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.StreamingFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.TemperatureFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.TimerFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.ToggleFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.WaterLevelFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.WaterSensorFlexContainerAnnc;

+

+@XmlAccessorType(XmlAccessType.FIELD)

+@XmlSeeAlso({DeviceLightFlexContainerAnnc.class,

+	DeviceSmartElectricMeterFlexContainerAnnc.class, DeviceWaterHeaterFlexContainerAnnc.class,

+	DeviceCameraFlexContainerAnnc.class, DeviceCoffeeMachineFlexContainerAnnc.class,

+	DeviceContactDetectorFlexContainerAnnc.class, DeviceDoorFlexContainerAnnc.class,

+	DeviceFloodDetectorFlexContainerAnnc.class, DeviceGasValveFlexContainerAnnc.class,

+	DeviceMotionDetectorFlexContainerAnnc.class, DeviceSmokeDetectorFlexContainerAnnc.class,

+	DeviceSmokeExtractorFlexContainerAnnc.class, DeviceSwitchButtonFlexContainerAnnc.class,

+	DeviceTemperatureDetectorFlexContainerAnnc.class, DeviceThermostatFlexContainerAnnc.class,

+	DeviceWarningDeviceFlexContainerAnnc.class,

+	DeviceWaterValveFlexContainerAnnc.class, DeviceWeatherStationFlexContainerAnnc.class,

+	DeviceThermostatFlexContainerAnnc.class,

+	AlarmSpeakerFlexContainerAnnc.class, AudioVolumeFlexContainerAnnc.class,

+	BinarySwitchFlexContainerAnnc.class, BoilerFlexContainerAnnc.class,

+	BrightnessFlexContainerAnnc.class, ClockFlexContainerAnnc.class,

+	ColourFlexContainerAnnc.class, ColourSaturationFlexContainerAnnc.class,

+	DoorStatusFlexContainerAnnc.class, EnergyConsumptionFlexContainerAnnc.class,

+	EnergyGenerationFlexContainerAnnc.class, FaultDetectionFlexContainerAnnc.class,

+	RelativeHumidityFlexContainerAnnc.class, RunModeFlexContainerAnnc.class,

+	SmokeSensorFlexContainerAnnc.class, TemperatureFlexContainerAnnc.class,

+	WaterLevelFlexContainerAnnc.class, WaterSensorFlexContainerAnnc.class,

+	AtmosphericPressureSensorFlexContainerAnnc.class, BrewingFlexContainerAnnc.class,

+	ContactSensorFlexContainerAnnc.class, ExtendedCarbonDioxideSensorFlexContainerAnnc.class,

+	FoamingFlexContainerAnnc.class, GrinderFlexContainerAnnc.class,

+	NoiseFlexContainerAnnc.class, PersonSensorFlexContainerAnnc.class,

+	StreamingFlexContainerAnnc.class, LockFlexContainerAnnc.class,

+	BatteryFlexContainerAnnc.class,

+	LiquidLevelFlexContainerAnnc.class, TimerFlexContainerAnnc.class,

+	ToggleFlexContainerAnnc.class})

+public class AbstractFlexContainerAnnc extends AnnouncedResource {

+	

+	@XmlTransient

+	private String shortName;

+	

+	@XmlTransient

+	private String longName;

+	

+	@XmlElement(name = ShortName.STATETAG, required = true, namespace="")

+	@XmlSchemaType(name = "nonNegativeInteger")

+	protected BigInteger stateTag;

+	@XmlElement(name = ShortName.CREATOR, required = true, namespace="")

+	protected String creator;

+	@XmlSchemaType(name = "anyURI")

+	@XmlElement(name = ShortName.ONTOLOGY_REF, namespace="")

+	protected String ontologyRef;

+	@XmlSchemaType(name = "anyURI")

+	@XmlElement(name = ShortName.CONTAINER_DEFINITION, namespace="")

+	protected String containerDefinition;

+	@XmlElement(name = ShortName.CHILD_RESOURCE, namespace="")

+	protected List<ChildResourceRef> childResource;

+	@XmlElements({

+//			@XmlElement(name = ShortName.CNT, namespace = "http://www.onem2m.org/xml/protocols", type = Container.class),

+//			@XmlElement(name = ShortName.FCNT, namespace = "http://www.onem2m.org/xml/protocols", type = AbstractFlexContainer.class),

+			@XmlElement(name = ShortName.SUB, namespace = "http://www.onem2m.org/xml/protocols", type = Subscription.class)

+//			@XmlElement(name = ShortName.FCNTA, namespace = "http://www.onem2m.org/xml/protocols", type = AbstractFlexContainerAnnc.class)

+			})

+	protected List<Resource> flexContainerOrContainerOrSubscription;

+

+	@XmlAnyElement()

+	protected List<CustomAttribute> customAttributes;

+	

+	

+	/**

+	 * @return the shortName

+	 */

+	public String getShortName() {

+		return shortName;

+	}

+

+	/**

+	 * @param shortName the shortName to set

+	 */

+	public void setShortName(String shortName) {

+		this.shortName = shortName;

+	}

+

+	/**

+	 * @return the longName

+	 */

+	public String getLongName() {

+		return longName;

+	}

+

+	/**

+	 * @param longName the longName to set

+	 */

+	public void setLongName(String longName) {

+		this.longName = longName;

+	}

+	

+

+	public List<CustomAttribute> getCustomAttributes() {

+		if (customAttributes == null) {

+			customAttributes = new ArrayList<CustomAttribute>();

+		}

+		return customAttributes;

+	}

+

+	public void setCustomAttributes(List<CustomAttribute> customAttributes) {

+		this.customAttributes = customAttributes;

+	}

+

+	@XmlTransient

+	public List<String> getCustomAttributeNames() {

+		List<String> names = new ArrayList<String>();

+

+		for (CustomAttribute ca : getCustomAttributes()) {

+			names.add(ca.getCustomAttributeName());

+		}

+

+		return names;

+	}

+

+	@XmlTransient

+	public CustomAttribute getCustomAttribute(String name) {

+		for (CustomAttribute ca : getCustomAttributes()) {

+			if (ca.getCustomAttributeName().equals(name)) {

+				return ca;

+			}

+		}

+		return null;

+	}

+

+	/**

+	 * Gets the value of the stateTag property.

+	 * 

+	 * @return possible object is {@link BigInteger }

+	 * 

+	 */

+	public BigInteger getStateTag() {

+		return stateTag;

+	}

+

+	/**

+	 * Sets the value of the stateTag property.

+	 * 

+	 * @param value

+	 *            allowed object is {@link BigInteger }

+	 * 

+	 */

+	public void setStateTag(BigInteger value) {

+		this.stateTag = value;

+	}

+

+	/**

+	 * Gets the value of the creator property.

+	 * 

+	 * @return possible object is {@link String }

+	 * 

+	 */

+	public String getCreator() {

+		return creator;

+	}

+

+	/**

+	 * Sets the value of the creator property.

+	 * 

+	 * @param value

+	 *            allowed object is {@link String }

+	 * 

+	 */

+	public void setCreator(String value) {

+		this.creator = value;

+	}

+

+	/**

+	 * Gets the value of the ontologyRef property.

+	 * 

+	 * @return possible object is {@link String }

+	 * 

+	 */

+	public String getOntologyRef() {

+		return ontologyRef;

+	}

+

+	/**

+	 * Sets the value of the ontologyRef property.

+	 * 

+	 * @param value

+	 *            allowed object is {@link String }

+	 * 

+	 */

+	public void setOntologyRef(String value) {

+		this.ontologyRef = value;

+	}

+

+	/**

+	 * Gets the value of the containerDefinition property.

+	 * 

+	 * @return object is {@link String}

+	 */

+	public String getContainerDefinition() {

+		return containerDefinition;

+	}

+

+	/**

+	 * Sets the value of the containerDefinition property.

+	 * 

+	 * @param value

+	 *            allowed object is {@link String}

+	 */

+	public void setContainerDefinition(String value) {

+		this.containerDefinition = value;

+	}

+

+	/**

+	 * Gets the value of the childResource property.

+	 * 

+	 * <p>

+	 * This accessor method returns a reference to the live list, not a

+	 * snapshot. Therefore any modification you make to the returned list will

+	 * be present inside the JAXB object. This is why there is not a

+	 * <CODE>set</CODE> method for the childResource property.

+	 * 

+	 * <p>

+	 * For example, to add a new item, do as follows:

+	 * 

+	 * <pre>

+	 * getChildResource().add(newItem);

+	 * </pre>

+	 * 

+	 * 

+	 * <p>

+	 * Objects of the following type(s) are allowed in the list

+	 * {@link ChildResourceRef }

+	 * 

+	 * 

+	 */

+	public List<ChildResourceRef> getChildResource() {

+		if (childResource == null) {

+			childResource = new ArrayList<ChildResourceRef>();

+		}

+		return this.childResource;

+	}

+

+	/**

+	 * Gets the value of the flexContainerOrContainerOrSubscription property.

+	 * 

+	 * <p>

+	 * This accessor method returns a reference to the live list, not a

+	 * snapshot. Therefore any modification you make to the returned list will

+	 * be present inside the JAXB object. This is why there is not a

+	 * <CODE>set</CODE> method for the flexContainerOrContainerOrSubscription

+	 * property.

+	 * 

+	 * <p>

+	 * For example, to add a new item, do as follows:

+	 * 

+	 * <pre>

+	 * getFlexContainerOrContainerOrSubscription().add(newItem);

+	 * </pre>

+	 * 

+	 * 

+	 * <p>

+	 * Objects of the following type(s) are allowed in the list

+	 * {@link AbstractFlexContainer } {@link Container } {@link Subscription }

+	 * 

+	 * 

+	 */

+	public List<Resource> getFlexContainerOrContainerOrSubscription() {

+		if (flexContainerOrContainerOrSubscription == null) {

+			flexContainerOrContainerOrSubscription = new ArrayList<Resource>();

+		}

+		return this.flexContainerOrContainerOrSubscription;

+	}

+	

+	public void finalizeSerialization() {

+		// do nothing

+		// should be overwrote 

+	}

+

+	public Resource getResourceByName(String name) {

+		for(Resource r : getFlexContainerOrContainerOrSubscription()) {

+			if (r instanceof AbstractFlexContainer) {

+				AbstractFlexContainer absFcnt = (AbstractFlexContainer) r ;

+				if (absFcnt.getShortName().equals(name)) {

+					return absFcnt;

+				}

+			} else if (r instanceof AbstractFlexContainerAnnc) {

+				AbstractFlexContainerAnnc absFcntAnnc = (AbstractFlexContainerAnnc) r ;

+				if (absFcntAnnc.getShortName().equals(name)) {

+					return absFcntAnnc;

+				}

+			}

+		}

+		return null;

+	}

+}

diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AccessControlPolicy.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AccessControlPolicy.java
index 0659ca4..d7e15ad 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AccessControlPolicy.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AccessControlPolicy.java
@@ -68,11 +68,11 @@
 @XmlType(name = "")
 @XmlRootElement(name = ShortName.ACP)
 public class AccessControlPolicy extends AnnounceableSubordinateResource {
-	@XmlElement(name=ShortName.PRIVILEGES, required = true)
+	@XmlElement(name=ShortName.PRIVILEGES, required = true, namespace="")
 	protected SetOfAcrs privileges;
-	@XmlElement(name=ShortName.SELF_PRIVILEGES, required = true)
+	@XmlElement(name=ShortName.SELF_PRIVILEGES, required = true, namespace="")
 	protected SetOfAcrs selfPrivileges;
-	@XmlElement(name=ShortName.CHILD_RESOURCE)
+	@XmlElement(name=ShortName.CHILD_RESOURCE, namespace="")
 	protected List<ChildResourceRef> childResource;
 	@XmlElement(name=ShortName.SUB, namespace = "http://www.onem2m.org/xml/protocols")
 	protected List<Subscription> subscription;
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AccessControlPolicyAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AccessControlPolicyAnnc.java
index f21a1af..b8da356 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AccessControlPolicyAnnc.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AccessControlPolicyAnnc.java
@@ -68,9 +68,9 @@
 @XmlRootElement(name = "accessControlPolicyAnnc")
 public class AccessControlPolicyAnnc extends AnnouncedSubordinateResource {
 
-	@XmlElement(required = true)
+	@XmlElement(required = true, namespace="")
 	protected SetOfAcrs privileges;
-	@XmlElement(required = true)
+	@XmlElement(required = true, namespace="")
 	protected SetOfAcrs selfPrivileges;
 	protected List<ChildResourceRef> childResource;
 	@XmlElement(namespace = "http://www.onem2m.org/xml/protocols")
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AccessControlRule.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AccessControlRule.java
index 4d8dbd6..1d4dd73 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AccessControlRule.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AccessControlRule.java
@@ -98,11 +98,11 @@
 public class AccessControlRule {
 
 	@XmlList
-	@XmlElement(name = ShortName.ACOR, required = true)
+	@XmlElement(name = ShortName.ACOR, required = true, namespace="")
 	protected List<String> accessControlOriginators;
-	@XmlElement(name = ShortName.ACOP, required = true)
+	@XmlElement(name = ShortName.ACOP, required = true, namespace="")
 	protected BigInteger accessControlOperations;
-	@XmlElement(name = ShortName.ACCO)
+	@XmlElement(name = ShortName.ACCO, namespace="")
 	protected List<AccessControlRule.AccessControlContexts> accessControlContexts;
 
 	/**
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnounceableResource.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnounceableResource.java
index 3b11a20..996a1d1 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnounceableResource.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnounceableResource.java
@@ -29,6 +29,7 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.persistence.MappedSuperclass;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
@@ -68,14 +69,15 @@
 @XmlAccessorType(XmlAccessType.FIELD)
 @XmlType(name = "announceableResource")
 @XmlSeeAlso({ LocationPolicy.class, RemoteCSE.class, Node.class, AE.class,
-		NodeAnnc.class, MgmtResource.class, Group.class, Container.class, FlexContainer.class })
+		NodeAnnc.class, MgmtResource.class, Group.class, Container.class, AbstractFlexContainer.class })
+@MappedSuperclass
 public class AnnounceableResource extends RegularResource {
 
 	@XmlList
-	@XmlElement(name=ShortName.ANNOUNCE_TO)
+	@XmlElement(name=ShortName.ANNOUNCE_TO, required=false, namespace="")
 	protected List<String> announceTo;
 	@XmlList
-	@XmlElement(name=ShortName.ANNOUNCED_ATTRIBUTE)
+	@XmlElement(name=ShortName.ANNOUNCED_ATTRIBUTE, required=false, namespace="")
 	protected List<String> announcedAttribute;
 
 	/**
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnounceableSubordinateResource.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnounceableSubordinateResource.java
index cf5656e..b449eee 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnounceableSubordinateResource.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnounceableSubordinateResource.java
@@ -73,13 +73,13 @@
 @MappedSuperclass
 public class AnnounceableSubordinateResource extends Resource {
 
-	@XmlElement(name=ShortName.EXPIRATION_TIME, required = true)
+	@XmlElement(name=ShortName.EXPIRATION_TIME, required = true, namespace="")
 	protected String expirationTime;
 	@XmlList
-	@XmlElement(name=ShortName.ANNOUNCE_TO)
+	@XmlElement(name=ShortName.ANNOUNCE_TO, required=false, namespace="")
 	protected List<String> announceTo;
 	@XmlList
-	@XmlElement(name=ShortName.ANNOUNCED_ATTRIBUTE)
+	@XmlElement(name=ShortName.ANNOUNCED_ATTRIBUTE, required=false, namespace="")
 	protected List<String> announcedAttribute;
 
 	/**
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnouncedResource.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnouncedResource.java
index 4b27a8b..097143f 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnouncedResource.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnouncedResource.java
@@ -69,19 +69,19 @@
 		"expirationTime", "link", "dynamicAuthorizationConsultationIDs" })
 @XmlSeeAlso({ LocationPolicyAnnc.class, RemoteCSEAnnc.class,
 		AnnouncedMgmtResource.class, GroupAnnc.class, ContainerAnnc.class,
-		AEAnnc.class, FlexContainerAnnc.class })
+		AEAnnc.class, AbstractFlexContainerAnnc.class })
 public class AnnouncedResource extends Resource {
 
 	@XmlList
-	@XmlElement(name=ShortName.ACP_IDS, required = true)
+	@XmlElement(name=ShortName.ACP_IDS, required=true, namespace="")
 	protected List<String> accessControlPolicyIDs;
-	@XmlElement(name=ShortName.EXPIRATION_TIME, required = true)
+	@XmlElement(name=ShortName.EXPIRATION_TIME, required = true, namespace="")
 	protected String expirationTime;
-	@XmlElement(name=ShortName.LINK, required = true)
+	@XmlElement(name=ShortName.LINK, required = true, namespace="")
 	@XmlSchemaType(name = "anyURI")
 	protected String link;
 	@XmlList
-	@XmlElement(name=ShortName.DAC_IDS, required=true)
+	@XmlElement(name=ShortName.DAC_IDS, required=false, namespace="")
 	protected List<String> dynamicAuthorizationConsultationIDs;
 
 	/**
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnouncedSubordinateResource.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnouncedSubordinateResource.java
index 9f4160d..3a50346 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnouncedSubordinateResource.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/AnnouncedSubordinateResource.java
@@ -63,9 +63,9 @@
 		ScheduleAnnc.class })
 public class AnnouncedSubordinateResource extends Resource {
 
-	@XmlElement(required = true)
+	@XmlElement(required = true, namespace="")
 	protected String expirationTime;
-	@XmlElement(required = true)
+	@XmlElement(required = true, namespace="")
 	@XmlSchemaType(name = "anyURI")
 	protected String link;
 
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CSEBase.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CSEBase.java
index 801552e..13443d1 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CSEBase.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CSEBase.java
@@ -38,6 +38,7 @@
 import javax.xml.bind.annotation.XmlRootElement;
 import javax.xml.bind.annotation.XmlSchemaType;
 import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
 
 import org.eclipse.om2m.commons.constants.ShortName;
 
@@ -101,25 +102,25 @@
 public class CSEBase extends Resource {
 
 	@XmlList
-	@XmlElement(name=ShortName.ACP_IDS)
+	@XmlElement(name=ShortName.ACP_IDS, required=false, namespace="")
 	protected List<String> accessControlPolicyIDs;
 	@XmlList
-	@XmlElement(name=ShortName.DAC_IDS, required=true)
+	@XmlElement(name=ShortName.DAC_IDS, required=false, namespace="")
 	protected List<String> dynamicAuthorizationConsultationIDs;
-	@XmlElement(name=ShortName.CSE_TYPE)
+	@XmlElement(name=ShortName.CSE_TYPE, required=false, namespace="")
 	protected BigInteger cseType;
-	@XmlElement(name = ShortName.CSE_ID, required = true)
+	@XmlElement(name = ShortName.CSE_ID, required = true, namespace="")
 	protected String cseid;
 	@XmlList
-	@XmlElement(name=ShortName.SRT, required = true)
+	@XmlElement(name=ShortName.SRT, required = true, namespace="")
 	protected List<BigInteger> supportedResourceType;
 	@XmlList
-	@XmlElement(name=ShortName.POA, required = true)
+	@XmlElement(name=ShortName.POA, required = true, namespace="")
 	protected List<String> pointOfAccess;
 	@XmlSchemaType(name = "anyURI")
-	@XmlElement(name=ShortName.NODE_LINK)
+	@XmlElement(name=ShortName.NODE_LINK, required=false, namespace="")
 	protected String nodeLink;
-	@XmlElement(name=ShortName.CHILD_RESOURCE)
+	@XmlElement(name=ShortName.CHILD_RESOURCE, namespace="")
 	protected List<ChildResourceRef> childResource;
 
 	@XmlElements({
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ChildResourceRef.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ChildResourceRef.java
index 2bda59d..64b1504 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ChildResourceRef.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ChildResourceRef.java
@@ -31,9 +31,9 @@
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlSchemaType;
 import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlValue;
 import javax.xml.bind.annotation.adapters.CollapsedStringAdapter;
 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 
@@ -61,18 +61,21 @@
  * 
  */
 @XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = ShortName.CHILD_RESOURCE, propOrder = { "value" })
+@XmlType(name = ShortName.CHILD_RESOURCE)
 public class ChildResourceRef {
 
-	@XmlValue
+	@XmlElement(name="val", namespace="")
 	@XmlSchemaType(name = "anyURI")
 	protected String value;
-	@XmlAttribute(name = ShortName.RESOURCE_NAME, required = true)
+	@XmlAttribute(name = ShortName.CHILD_RESOURCE_NAME, required = true)
 	@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
 	@XmlSchemaType(name = "NCName")
 	protected String resourceName;
-	@XmlAttribute(name = ShortName.TYPE, required = true)
+	@XmlAttribute(name = ShortName.CHILD_RESOURCE_TYPE, required = true)
 	protected BigInteger type;
+	@XmlAttribute(name=ShortName.CHILD_RESOURCE_SPID, required=false)
+	@XmlSchemaType(name = "anyURI")
+	protected String spid;
 
 	/**
 	 * Gets the value of the value property.
@@ -141,4 +144,20 @@
 		this.type = BigInteger.valueOf(value);
 	}
 
+	/**
+	 * @return the spid
+	 */
+	public String getSpid() {
+		return spid;
+	}
+
+	/**
+	 * @param spid the spid to set
+	 */
+	public void setSpid(String spid) {
+		this.spid = spid;
+	}
+	
+	
+
 }
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Container.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Container.java
index c5609ee..555e760 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Container.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Container.java
@@ -85,42 +85,42 @@
 @XmlRootElement(name = ShortName.CNT)
 public class Container extends AnnounceableResource {
 
-	@XmlElement(name = ShortName.STATETAG, required = true)
+	@XmlElement(name = ShortName.STATETAG, required = true, namespace="")
 	@XmlSchemaType(name = "nonNegativeInteger")
 	protected BigInteger stateTag;
-	@XmlElement(name = ShortName.CREATOR, required = true)
+	@XmlElement(name = ShortName.CREATOR, required = true, namespace="")
 	protected String creator;
 	@XmlSchemaType(name = "nonNegativeInteger")
-	@XmlElement(name = ShortName.MAX_NR_OF_INSTANCES)
+	@XmlElement(name = ShortName.MAX_NR_OF_INSTANCES, namespace="")
 	protected BigInteger maxNrOfInstances;
 	@XmlSchemaType(name = "nonNegativeInteger")
-	@XmlElement(name = ShortName.MAX_BYTE_SIZE)
+	@XmlElement(name = ShortName.MAX_BYTE_SIZE, namespace="")
 	protected BigInteger maxByteSize;
 	@XmlSchemaType(name = "nonNegativeInteger")
-	@XmlElement(name = ShortName.MAX_INSTANCE_AGE)
+	@XmlElement(name = ShortName.MAX_INSTANCE_AGE, namespace="")
 	protected BigInteger maxInstanceAge;
-	@XmlElement(name = ShortName.CURRENT_NUMBER_OF_INSTANCES, required = true)
+	@XmlElement(name = ShortName.CURRENT_NUMBER_OF_INSTANCES, required = true, namespace="")
 	@XmlSchemaType(name = "nonNegativeInteger")
 	protected BigInteger currentNrOfInstances;
-	@XmlElement(name = ShortName.CURRENT_BYTE_SIZE, required = true)
+	@XmlElement(name = ShortName.CURRENT_BYTE_SIZE, required = true, namespace="")
 	@XmlSchemaType(name = "nonNegativeInteger")
 	protected BigInteger currentByteSize;
 	@XmlSchemaType(name = "anyURI")
-	@XmlElement(name = ShortName.LOCATION_ID)
+	@XmlElement(name = ShortName.LOCATION_ID, namespace="")
 	protected String locationID;
 	@XmlSchemaType(name = "anyURI")
-	@XmlElement(name = ShortName.ONTOLOGY_REF)
+	@XmlElement(name = ShortName.ONTOLOGY_REF, namespace="")
 	protected String ontologyRef;
-	@XmlElement(name = ShortName.CHILD_RESOURCE)
+	@XmlElement(name = ShortName.CHILD_RESOURCE, namespace="")
 	protected List<ChildResourceRef> childResource;
 	@XmlElements({
 			@XmlElement(name = ShortName.CIN, namespace = "http://www.onem2m.org/xml/protocols", type = ContentInstance.class),
 			@XmlElement(name = ShortName.CNT, namespace = "http://www.onem2m.org/xml/protocols", type = Container.class),
 			@XmlElement(name = ShortName.SUB, namespace = "http://www.onem2m.org/xml/protocols", type = Subscription.class) })
 	protected List<Resource> contentInstanceOrContainerOrSubscription;
-	@XmlElement(name = ShortName.OLDEST)
+	@XmlElement(name = ShortName.OLDEST, namespace="")
 	protected String oldest;
-	@XmlElement(name = ShortName.LATEST)
+	@XmlElement(name = ShortName.LATEST, namespace="")
 	protected String latest;
 	/**
 	 * Gets the value of the stateTag property.
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ContainerAnnc.java
index aff4685..f12af09 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ContainerAnnc.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ContainerAnnc.java
@@ -84,31 +84,31 @@
 @XmlRootElement(name = ShortName.CNT_ANNC)
 public class ContainerAnnc extends AnnouncedResource {
 
-	@XmlElement(required = true, name = ShortName.STATETAG)
+	@XmlElement(required = true, name = ShortName.STATETAG, namespace="")
 	@XmlSchemaType(name = "nonNegativeInteger")
 	protected BigInteger stateTag;
 	@XmlSchemaType(name = "nonNegativeInteger")
-	@XmlElement(name = ShortName.MAX_NR_OF_INSTANCES)
+	@XmlElement(name = ShortName.MAX_NR_OF_INSTANCES, namespace="")
 	protected BigInteger maxNrOfInstances;
-	@XmlElement(name = ShortName.MAX_BYTE_SIZE)
+	@XmlElement(name = ShortName.MAX_BYTE_SIZE, namespace="")
 	@XmlSchemaType(name = "nonNegativeInteger")
 	protected BigInteger maxByteSize;
-	@XmlElement(name = ShortName.MAX_INSTANCE_AGE)
+	@XmlElement(name = ShortName.MAX_INSTANCE_AGE, namespace="")
 	@XmlSchemaType(name = "nonNegativeInteger")
 	protected BigInteger maxInstanceAge;
-	@XmlElement(required = true, name = ShortName.CURRENT_NUMBER_OF_INSTANCES)
+	@XmlElement(required = true, name = ShortName.CURRENT_NUMBER_OF_INSTANCES, namespace="")
 	@XmlSchemaType(name = "nonNegativeInteger")
 	protected BigInteger currentNrOfInstances;
-	@XmlElement(required = true, name = ShortName.CURRENT_BYTE_SIZE)
+	@XmlElement(required = true, name = ShortName.CURRENT_BYTE_SIZE, namespace="")
 	@XmlSchemaType(name = "nonNegativeInteger")
 	protected BigInteger currentByteSize;
 	@XmlSchemaType(name = "anyURI")
-	@XmlElement(name = ShortName.LOCATION_ID)
+	@XmlElement(name = ShortName.LOCATION_ID, namespace="")
 	protected String locationID;
 	@XmlSchemaType(name = "anyURI")
-	@XmlElement(name = ShortName.ONTOLOGY_REF)
+	@XmlElement(name = ShortName.ONTOLOGY_REF, namespace="")
 	protected String ontologyRef;
-	@XmlElement(name = ShortName.CHILD_RESOURCE)
+	@XmlElement(name = ShortName.CHILD_RESOURCE, namespace="")
 	protected List<ChildResourceRef> childResource;
 	@XmlElements({
 			@XmlElement(name = "contentInstance", namespace = "http://www.onem2m.org/xml/protocols", type = ContentInstance.class),
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ContentInstance.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ContentInstance.java
index 3593498..774c7da 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ContentInstance.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ContentInstance.java
@@ -69,20 +69,20 @@
 @XmlRootElement(name = ShortName.CIN)
 public class ContentInstance extends AnnounceableSubordinateResource {
 
-	@XmlElement(name = ShortName.STATETAG, required = true)
+	@XmlElement(name = ShortName.STATETAG, required = true, namespace="")
 	@XmlSchemaType(name = "nonNegativeInteger")
 	protected BigInteger stateTag;
-	@XmlElement(name = ShortName.CREATOR)
+	@XmlElement(name = ShortName.CREATOR, namespace="")
 	protected String creator;
-	@XmlElement(name = ShortName.CONTENT_INFO)
+	@XmlElement(name = ShortName.CONTENT_INFO, namespace="")
 	protected String contentInfo;
-	@XmlElement(name = ShortName.CONTENT_SIZE, required = true)
+	@XmlElement(name = ShortName.CONTENT_SIZE, required = true, namespace="")
 	@XmlSchemaType(name = "nonNegativeInteger")
 	protected BigInteger contentSize;
 	@XmlSchemaType(name = "anyURI")
-	@XmlElement(name = ShortName.ONTOLOGY_REF)
+	@XmlElement(name = ShortName.ONTOLOGY_REF, namespace="")
 	protected String ontologyRef;
-	@XmlElement(name = ShortName.CONTENT, required = true)
+	@XmlElement(name = ShortName.CONTENT, required = true, namespace="")
 	protected String content;
 
 	/**
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ContentInstanceAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ContentInstanceAnnc.java
index a6f05c1..a927c83 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ContentInstanceAnnc.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ContentInstanceAnnc.java
@@ -67,7 +67,7 @@
 @XmlRootElement(name = "contentInstanceAnnc")
 public class ContentInstanceAnnc extends AnnouncedSubordinateResource {
 
-	@XmlElement(required = true)
+	@XmlElement(required = true, namespace="")
 	@XmlSchemaType(name = "nonNegativeInteger")
 	protected BigInteger stateTag;
 	protected String contentInfo;
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CustomAttribute.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CustomAttribute.java
index 21cdd17..d42ea3f 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CustomAttribute.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CustomAttribute.java
@@ -9,15 +9,18 @@
 

 import javax.xml.bind.annotation.XmlAccessType;

 import javax.xml.bind.annotation.XmlAccessorType;

+import javax.xml.bind.annotation.XmlAttribute;

+import javax.xml.bind.annotation.XmlElement;

 import javax.xml.bind.annotation.XmlRootElement;

 import javax.xml.bind.annotation.XmlType;

+import javax.xml.bind.annotation.XmlValue;

 import javax.xml.bind.annotation.adapters.XmlAdapter;

 import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;

 

 import org.eclipse.om2m.commons.constants.ShortName;

 import org.w3c.dom.Element;

 

-@XmlAccessorType(XmlAccessType.FIELD)

+@XmlAccessorType(XmlAccessType.NONE)

 @XmlJavaTypeAdapter(CustomAttributeAdapter.class)

 public class CustomAttribute {

 	

@@ -25,8 +28,6 @@
 	

 	private String customAttributeValue;

 	

-	private String customAttributeType;

-

 	public String getCustomAttributeName() {

 		return customAttributeName;

 	}

@@ -43,14 +44,11 @@
 		this.customAttributeValue = customAttributeValue;

 	}

 

-	public String getCustomAttributeType() {

-		return customAttributeType;

-	}

 

-	public void setCustomAttributeType(String customAttributeType) {

-		this.customAttributeType = customAttributeType;

+	@Override

+	public String toString() {

+		return "<CustomAttribute " + customAttributeName + "/" +

+				customAttributeValue + "/>";

 	}

-

-	

 	

 }

diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CustomAttributeAdapter.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CustomAttributeAdapter.java
index a62655f..5f183a2 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CustomAttributeAdapter.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/CustomAttributeAdapter.java
@@ -7,10 +7,12 @@
  *******************************************************************************/

 package org.eclipse.om2m.commons.resource;

 

+import javax.xml.bind.JAXBElement;

 import javax.xml.bind.annotation.adapters.XmlAdapter;

 import javax.xml.parsers.DocumentBuilder;

 import javax.xml.parsers.DocumentBuilderFactory;

 

+import org.w3c.dom.Attr;

 import org.w3c.dom.Document;

 import org.w3c.dom.Element;

 

@@ -22,10 +24,17 @@
 	public CustomAttribute unmarshal(Element v) throws Exception {

 		CustomAttribute customAttribute = new CustomAttribute();

 

+		String value = null;

+		Attr att = v.getAttributeNode("val");

+		if (att != null) {

+			// json case

+			value = v.getAttribute("val");

+		} else {

+			// xml case

+			value = v.getTextContent();

+		}

 		customAttribute.setCustomAttributeName(v.getTagName());

-		customAttribute.setCustomAttributeValue(v.getTextContent());

-		customAttribute.setCustomAttributeType(v.getAttribute("type"));

-		

+		customAttribute.setCustomAttributeValue(value);

 

 		return customAttribute;

 	}

@@ -33,7 +42,6 @@
 	@Override

 	public Element marshal(CustomAttribute v) throws Exception {

 		

-		

 		if (null == v) {

 			return null;

 		}

@@ -45,7 +53,6 @@
 			Document document = getDocumentBuilder().newDocument();

 			e = document.createElement(v.getCustomAttributeName());

 			e.setTextContent((value != null ? value.toString() : ""));

-			e.setAttribute("type", v.getCustomAttributeType());

 			

 		} catch (Throwable t) {

 			t.printStackTrace();

diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DynamicAuthorizationConsultation.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DynamicAuthorizationConsultation.java
index 8d4fd05..34e2a6a 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DynamicAuthorizationConsultation.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/DynamicAuthorizationConsultation.java
@@ -17,14 +17,14 @@
 @XmlType(name = "")

 public class DynamicAuthorizationConsultation extends RegularResource {

 

-	@XmlElement(name = ShortName.DYNAMIC_AUTHORIZATION_ENABLED)

+	@XmlElement(name = ShortName.DYNAMIC_AUTHORIZATION_ENABLED, namespace="")

 	private Boolean dynamicAuthorizationEnabled;

 	

 	@XmlList

-	@XmlElement(name = ShortName.DYNAMIC_AUTHORIZATION_PoA)

+	@XmlElement(name = ShortName.DYNAMIC_AUTHORIZATION_PoA, namespace="")

 	private List<String> dynamicAuthorisationPoA;

 	

-	@XmlElement(name = ShortName.DYNAMIC_AUTHORIZATION_LIFETIME)

+	@XmlElement(name = ShortName.DYNAMIC_AUTHORIZATION_LIFETIME, namespace="")

 	private String dynamicAuthorizationLifetime;

 

 	public Boolean getDynamicAuthorizationEnabled() {

diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/FilterCriteria.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/FilterCriteria.java
index 705fafa..e910c83 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/FilterCriteria.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/FilterCriteria.java
@@ -117,6 +117,13 @@
 	@XmlSchemaType(name = "nonNegativeInteger")
 	@XmlElement(name = ShortName.LIMIT)
 	protected BigInteger limit;
+	@XmlSchemaType(name="positiveInteger")
+	@XmlElement(name=ShortName.LEVEL)
+	protected BigInteger level;
+	@XmlSchemaType(name="positiveInteger")
+	@XmlElement(name=ShortName.OFFSET)
+	protected BigInteger offset;
+	
 
 	/**
 	 * Gets the value of the createdBefore property.
@@ -479,4 +486,34 @@
 		this.limit = value;
 	}
 
+	/**
+	 * @return the level
+	 */
+	public BigInteger getLevel() {
+		return level;
+	}
+
+	/**
+	 * @param level the level to set
+	 */
+	public void setLevel(BigInteger level) {
+		this.level = level;
+	}
+
+	/**
+	 * @return the offset
+	 */
+	public BigInteger getOffset() {
+		return offset;
+	}
+
+	/**
+	 * @param offset the offset to set
+	 */
+	public void setOffset(BigInteger offset) {
+		this.offset = offset;
+	}
+	
+	
+
 }
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/FlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/FlexContainer.java
index 0f24515..4fd6f33 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/FlexContainer.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/FlexContainer.java
@@ -1,272 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2016 Orange.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.om2m.commons.resource;
-
-import java.math.BigInteger;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlAnyAttribute;
-import javax.xml.bind.annotation.XmlAnyElement;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlElements;
-import javax.xml.bind.annotation.XmlRootElement;
-import javax.xml.bind.annotation.XmlSchemaType;
-import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.annotation.XmlValue;
-
-import org.eclipse.om2m.commons.constants.ShortName;
-import org.w3c.dom.Element;
-
-/**
- * <p>
- * Java class for anonymous complex type.
- * 
- * <p>
- * The following schema fragment specifies the expected content contained within
- * this class.
- * 
- * <pre>
- * &lt;complexType>
- *   &lt;complexContent>
- *     &lt;extension base="{http://www.onem2m.org/xml/protocols}announceableResource">
- *       &lt;sequence>
- *         &lt;element name="stateTag" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger"/>
- *         &lt;element name="creator" type="{http://www.onem2m.org/xml/protocols}ID"/>
- *         &lt;element name="maxNrOfInstances" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" minOccurs="0"/>
- *         &lt;element name="maxByteSize" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" minOccurs="0"/>
- *         &lt;element name="maxInstanceAge" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger" minOccurs="0"/>
- *         &lt;element name="currentNrOfInstances" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger"/>
- *         &lt;element name="currentByteSize" type="{http://www.w3.org/2001/XMLSchema}nonNegativeInteger"/>
- *         &lt;element name="locationID" type="{http://www.w3.org/2001/XMLSchema}anyURI" minOccurs="0"/>
- *         &lt;element name="ontologyRef" type="{http://www.w3.org/2001/XMLSchema}anyURI" minOccurs="0"/>
- *         &lt;element name="latest" type="{http://www.w3.org/2001/XMLSchema}anyURI"/>
- *         &lt;element name="oldest" type="{http://www.w3.org/2001/XMLSchema}anyURI"/>
- *         &lt;choice minOccurs="0">
- *           &lt;element name="childResource" type="{http://www.onem2m.org/xml/protocols}childResourceRef" maxOccurs="unbounded"/>
- *           &lt;choice maxOccurs="unbounded">
- *             &lt;element ref="{http://www.onem2m.org/xml/protocols}contentInstance"/>
- *             &lt;element ref="{http://www.onem2m.org/xml/protocols}container"/>
- *             &lt;element ref="{http://www.onem2m.org/xml/protocols}subscription"/>
- *           &lt;/choice>
- *         &lt;/choice>
- *       &lt;/sequence>
- *     &lt;/extension>
- *   &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- * 
- * 
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "")
-@XmlRootElement(name = ShortName.FCNT)
-public class FlexContainer extends AnnounceableResource {
-
-	@XmlElement(name = ShortName.STATETAG, required = true)
-	@XmlSchemaType(name = "nonNegativeInteger")
-	protected BigInteger stateTag;
-	@XmlElement(name = ShortName.CREATOR, required = true)
-	protected String creator;
-	@XmlSchemaType(name = "anyURI")
-	@XmlElement(name = ShortName.ONTOLOGY_REF)
-	protected String ontologyRef;
-	@XmlSchemaType(name="anyURI")
-	@XmlElement(name = ShortName.CONTAINER_DEFINITION)
-	protected String containerDefinition;
-	@XmlElement(name = ShortName.CHILD_RESOURCE)
-	protected List<ChildResourceRef> childResource;
-	@XmlElements({
-			@XmlElement(name = ShortName.CNT, namespace = "http://www.onem2m.org/xml/protocols", type = Container.class),
-			@XmlElement(name = ShortName.FCNT, namespace = "http://www.onem2m.org/xml/protocols", type = FlexContainer.class),
-			@XmlElement(name = ShortName.SUB, namespace = "http://www.onem2m.org/xml/protocols", type = Subscription.class) })
-	protected List<Resource> flexContainerOrContainerOrSubscription;
-	
-	@XmlAnyElement()
-	protected List<CustomAttribute> customAttributes;
-
-	public List<CustomAttribute> getCustomAttributes() {
-		if (customAttributes == null) {
-			customAttributes = new ArrayList<CustomAttribute>();
-		}
-		return customAttributes;
-	}
-
-	public void setCustomAttributes(List<CustomAttribute> customAttributes) {
-		this.customAttributes = customAttributes;
-	}
-	
-	@XmlTransient
-	public List<String> getCustomAttributeNames() {
-		List<String> names = new ArrayList<String>();
-		
-		for(CustomAttribute ca : getCustomAttributes()) {
-			names.add(ca.getCustomAttributeName());
-		}
-		
-		return names;
-	}
-	
-	@XmlTransient
-	public CustomAttribute getCustomAttribute(String name) {
-		for(CustomAttribute ca : getCustomAttributes()) {
-			if (ca.getCustomAttributeName().equals(name)) {
-				return ca;
-			}
-		}
-		return null;
-	}
-
-	/**
-	 * Gets the value of the stateTag property.
-	 * 
-	 * @return possible object is {@link BigInteger }
-	 * 
-	 */
-	public BigInteger getStateTag() {
-		return stateTag;
-	}
-
-	/**
-	 * Sets the value of the stateTag property.
-	 * 
-	 * @param value
-	 *            allowed object is {@link BigInteger }
-	 * 
-	 */
-	public void setStateTag(BigInteger value) {
-		this.stateTag = value;
-	}
-
-	/**
-	 * Gets the value of the creator property.
-	 * 
-	 * @return possible object is {@link String }
-	 * 
-	 */
-	public String getCreator() {
-		return creator;
-	}
-
-	/**
-	 * Sets the value of the creator property.
-	 * 
-	 * @param value
-	 *            allowed object is {@link String }
-	 * 
-	 */
-	public void setCreator(String value) {
-		this.creator = value;
-	}
-	
-	/**
-	 * Gets the value of the ontologyRef property.
-	 * 
-	 * @return possible object is {@link String }
-	 * 
-	 */
-	public String getOntologyRef() {
-		return ontologyRef;
-	}
-
-	/**
-	 * Sets the value of the ontologyRef property.
-	 * 
-	 * @param value
-	 *            allowed object is {@link String }
-	 * 
-	 */
-	public void setOntologyRef(String value) {
-		this.ontologyRef = value;
-	}
-
-	/**
-	 * Gets the value of the containerDefinition property.
-	 * 
-	 * @return object is {@link String}
-	 */
-	public String getContainerDefinition() {
-		return containerDefinition;
-	}
-	
-	/**
-	 * Sets the value of the containerDefinition property.
-	 * 
-	 * @param value allowed object is {@link String}
-	 */
-	public void setContainerDefinition(String value) {
-		this.containerDefinition = value;
-	}
-
-	/**
-	 * Gets the value of the childResource property.
-	 * 
-	 * <p>
-	 * This accessor method returns a reference to the live list, not a
-	 * snapshot. Therefore any modification you make to the returned list will
-	 * be present inside the JAXB object. This is why there is not a
-	 * <CODE>set</CODE> method for the childResource property.
-	 * 
-	 * <p>
-	 * For example, to add a new item, do as follows:
-	 * 
-	 * <pre>
-	 * getChildResource().add(newItem);
-	 * </pre>
-	 * 
-	 * 
-	 * <p>
-	 * Objects of the following type(s) are allowed in the list
-	 * {@link ChildResourceRef }
-	 * 
-	 * 
-	 */
-	public List<ChildResourceRef> getChildResource() {
-		if (childResource == null) {
-			childResource = new ArrayList<ChildResourceRef>();
-		}
-		return this.childResource;
-	}
-
-	/**
-	 * Gets the value of the flexContainerOrContainerOrSubscription property.
-	 * 
-	 * <p>
-	 * This accessor method returns a reference to the live list, not a
-	 * snapshot. Therefore any modification you make to the returned list will
-	 * be present inside the JAXB object. This is why there is not a
-	 * <CODE>set</CODE> method for the flexContainerOrContainerOrSubscription
-	 * property.
-	 * 
-	 * <p>
-	 * For example, to add a new item, do as follows:
-	 * 
-	 * <pre>
-	 * getFlexContainerOrContainerOrSubscription().add(newItem);
-	 * </pre>
-	 * 
-	 * 
-	 * <p>
-	 * Objects of the following type(s) are allowed in the list
-	 * {@link FlexContainer } {@link Container } {@link Subscription }
-	 * 
-	 * 
-	 */
-	public List<Resource> getFlexContainerOrContainerOrSubscription() {
-		if (flexContainerOrContainerOrSubscription == null) {
-			flexContainerOrContainerOrSubscription = new ArrayList<Resource>();
-		}
-		return this.flexContainerOrContainerOrSubscription;
-	}
-
-}
+package org.eclipse.om2m.commons.resource;

+

+import javax.xml.bind.annotation.XmlAccessType;

+import javax.xml.bind.annotation.XmlAccessorType;

+import javax.xml.bind.annotation.XmlRootElement;

+import javax.xml.bind.annotation.XmlType;

+

+@XmlRootElement(name=FlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols")

+@XmlAccessorType(XmlAccessType.FIELD)

+@XmlType(name=FlexContainer.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols")

+public class FlexContainer extends AbstractFlexContainer {

+	

+	public static final String LONG_NAME = "flexContainer";

+	public static final String SHORT_NAME = "fcnt";

+	

+	

+	public FlexContainer() {

+		setLongName(LONG_NAME);

+		setShortName(SHORT_NAME);

+	}

+

+}

diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/FlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/FlexContainerAnnc.java
index da5dd95..0644f36 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/FlexContainerAnnc.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/FlexContainerAnnc.java
@@ -1,219 +1,21 @@
 package org.eclipse.om2m.commons.resource;

 

-import java.math.BigInteger;

-import java.util.ArrayList;

-import java.util.List;

-

 import javax.xml.bind.annotation.XmlAccessType;

 import javax.xml.bind.annotation.XmlAccessorType;

-import javax.xml.bind.annotation.XmlAnyElement;

-import javax.xml.bind.annotation.XmlElement;

-import javax.xml.bind.annotation.XmlElements;

 import javax.xml.bind.annotation.XmlRootElement;

-import javax.xml.bind.annotation.XmlSchemaType;

-import javax.xml.bind.annotation.XmlTransient;

 import javax.xml.bind.annotation.XmlType;

 

-import org.eclipse.om2m.commons.constants.ShortName;

-

+@XmlRootElement(name=FlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols")

 @XmlAccessorType(XmlAccessType.FIELD)

-@XmlType(name = "")

-@XmlRootElement(name = ShortName.FCNTA)

-public class FlexContainerAnnc extends AnnouncedResource {

-	@XmlElement(name = ShortName.STATETAG, required = true)

-	@XmlSchemaType(name = "nonNegativeInteger")

-	protected BigInteger stateTag;

-	@XmlElement(name = ShortName.CREATOR, required = true)

-	protected String creator;

-	@XmlSchemaType(name = "anyURI")

-	@XmlElement(name = ShortName.ONTOLOGY_REF)

-	protected String ontologyRef;

-	@XmlSchemaType(name = "anyURI")

-	@XmlElement(name = ShortName.CONTAINER_DEFINITION)

-	protected String containerDefinition;

-	@XmlElement(name = ShortName.CHILD_RESOURCE)

-	protected List<ChildResourceRef> childResource;

-	@XmlElements({

-			@XmlElement(name = ShortName.CNT, namespace = "http://www.onem2m.org/xml/protocols", type = Container.class),

-			@XmlElement(name = ShortName.FCNT, namespace = "http://www.onem2m.org/xml/protocols", type = FlexContainer.class),

-			@XmlElement(name = ShortName.SUB, namespace = "http://www.onem2m.org/xml/protocols", type = Subscription.class) })

-	protected List<Resource> flexContainerOrContainerOrSubscription;

-

-	@XmlAnyElement()

-	protected List<CustomAttribute> customAttributes;

-

-	public List<CustomAttribute> getCustomAttributes() {

-		if (customAttributes == null) {

-			customAttributes = new ArrayList<CustomAttribute>();

-		}

-		return customAttributes;

-	}

-

-	public void setCustomAttributes(List<CustomAttribute> customAttributes) {

-		this.customAttributes = customAttributes;

-	}

-

-	@XmlTransient

-	public List<String> getCustomAttributeNames() {

-		List<String> names = new ArrayList<String>();

-

-		for (CustomAttribute ca : getCustomAttributes()) {

-			names.add(ca.getCustomAttributeName());

-		}

-

-		return names;

-	}

-

-	@XmlTransient

-	public CustomAttribute getCustomAttribute(String name) {

-		for (CustomAttribute ca : getCustomAttributes()) {

-			if (ca.getCustomAttributeName().equals(name)) {

-				return ca;

-			}

-		}

-		return null;

-	}

-

-	/**

-	 * Gets the value of the stateTag property.

-	 * 

-	 * @return possible object is {@link BigInteger }

-	 * 

-	 */

-	public BigInteger getStateTag() {

-		return stateTag;

-	}

-

-	/**

-	 * Sets the value of the stateTag property.

-	 * 

-	 * @param value

-	 *            allowed object is {@link BigInteger }

-	 * 

-	 */

-	public void setStateTag(BigInteger value) {

-		this.stateTag = value;

-	}

-

-	/**

-	 * Gets the value of the creator property.

-	 * 

-	 * @return possible object is {@link String }

-	 * 

-	 */

-	public String getCreator() {

-		return creator;

-	}

-

-	/**

-	 * Sets the value of the creator property.

-	 * 

-	 * @param value

-	 *            allowed object is {@link String }

-	 * 

-	 */

-	public void setCreator(String value) {

-		this.creator = value;

-	}

-

-	/**

-	 * Gets the value of the ontologyRef property.

-	 * 

-	 * @return possible object is {@link String }

-	 * 

-	 */

-	public String getOntologyRef() {

-		return ontologyRef;

-	}

-

-	/**

-	 * Sets the value of the ontologyRef property.

-	 * 

-	 * @param value

-	 *            allowed object is {@link String }

-	 * 

-	 */

-	public void setOntologyRef(String value) {

-		this.ontologyRef = value;

-	}

-

-	/**

-	 * Gets the value of the containerDefinition property.

-	 * 

-	 * @return object is {@link String}

-	 */

-	public String getContainerDefinition() {

-		return containerDefinition;

-	}

-

-	/**

-	 * Sets the value of the containerDefinition property.

-	 * 

-	 * @param value

-	 *            allowed object is {@link String}

-	 */

-	public void setContainerDefinition(String value) {

-		this.containerDefinition = value;

-	}

-

-	/**

-	 * Gets the value of the childResource property.

-	 * 

-	 * <p>

-	 * This accessor method returns a reference to the live list, not a

-	 * snapshot. Therefore any modification you make to the returned list will

-	 * be present inside the JAXB object. This is why there is not a

-	 * <CODE>set</CODE> method for the childResource property.

-	 * 

-	 * <p>

-	 * For example, to add a new item, do as follows:

-	 * 

-	 * <pre>

-	 * getChildResource().add(newItem);

-	 * </pre>

-	 * 

-	 * 

-	 * <p>

-	 * Objects of the following type(s) are allowed in the list

-	 * {@link ChildResourceRef }

-	 * 

-	 * 

-	 */

-	public List<ChildResourceRef> getChildResource() {

-		if (childResource == null) {

-			childResource = new ArrayList<ChildResourceRef>();

-		}

-		return this.childResource;

-	}

-

-	/**

-	 * Gets the value of the flexContainerOrContainerOrSubscription property.

-	 * 

-	 * <p>

-	 * This accessor method returns a reference to the live list, not a

-	 * snapshot. Therefore any modification you make to the returned list will

-	 * be present inside the JAXB object. This is why there is not a

-	 * <CODE>set</CODE> method for the flexContainerOrContainerOrSubscription

-	 * property.

-	 * 

-	 * <p>

-	 * For example, to add a new item, do as follows:

-	 * 

-	 * <pre>

-	 * getFlexContainerOrContainerOrSubscription().add(newItem);

-	 * </pre>

-	 * 

-	 * 

-	 * <p>

-	 * Objects of the following type(s) are allowed in the list

-	 * {@link FlexContainer } {@link Container } {@link Subscription }

-	 * 

-	 * 

-	 */

-	public List<Resource> getFlexContainerOrContainerOrSubscription() {

-		if (flexContainerOrContainerOrSubscription == null) {

-			flexContainerOrContainerOrSubscription = new ArrayList<Resource>();

-		}

-		return this.flexContainerOrContainerOrSubscription;

+@XmlType(name=FlexContainerAnnc.SHORT_NAME, namespace="http://www.onem2m.org/xml/protocols")

+public class FlexContainerAnnc extends AbstractFlexContainerAnnc {

+	

+	public static final String LONG_NAME = "flexContainerAnnc";

+	public static final String SHORT_NAME = "fcntAnnc";

+	

+	

+	public FlexContainerAnnc() {

+		setLongName(LONG_NAME);

+		setShortName(SHORT_NAME);

 	}

 }

diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Group.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Group.java
index bf4d8ae..5b44b64 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Group.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Group.java
@@ -84,32 +84,32 @@
 @XmlRootElement(name = ShortName.GROUP)
 public class Group extends AnnounceableResource {
 
-	@XmlElement(name = ShortName.CREATOR)
+	@XmlElement(name = ShortName.CREATOR, namespace="")
 	protected String creator;
-	@XmlElement(name = ShortName.MEMBER_TYPE, required = true)
+	@XmlElement(name = ShortName.MEMBER_TYPE, required = true, namespace="")
 	protected BigInteger memberType;
-	@XmlElement(name = ShortName.CURRENT_NUM_MEMBERS, required = true)
+	@XmlElement(name = ShortName.CURRENT_NUM_MEMBERS, required = true, namespace="")
 	@XmlSchemaType(name = "nonNegativeInteger")
 	protected BigInteger currentNrOfMembers;
-	@XmlElement(name = ShortName.MAX_NUM_MEMBERS, required = true)
+	@XmlElement(name = ShortName.MAX_NUM_MEMBERS, required = true, namespace="")
 	@XmlSchemaType(name = "nonNegativeInteger")
 	protected BigInteger maxNrOfMembers;
 	@XmlList
-	@XmlElement(name = ShortName.MEMBER_ID, required = true)
+	@XmlElement(name = ShortName.MEMBER_ID, required = true, namespace="")
 	protected List<String> memberIDs;
 	@XmlList
-	@XmlElement(name = ShortName.MEMBER_ACP_ID)
+	@XmlElement(name = ShortName.MEMBER_ACP_ID, namespace="")
 	protected List<String> membersAccessControlPolicyIDs;
-	@XmlElement(name = ShortName.MEMBER_TYPE_VALIDATED)
+	@XmlElement(name = ShortName.MEMBER_TYPE_VALIDATED, namespace="")
 	protected Boolean memberTypeValidated;
-	@XmlElement(name = ShortName.CONSISTENCY_STRATEGY)
+	@XmlElement(name = ShortName.CONSISTENCY_STRATEGY, namespace="")
 	protected BigInteger consistencyStrategy;
-	@XmlElement(name = ShortName.GROUP_NAME)
+	@XmlElement(name = ShortName.GROUP_NAME, namespace="")
 	protected String groupName;
-	@XmlElement(name = ShortName.FANOUTPOINT, required = true)
+	@XmlElement(name = ShortName.FANOUTPOINT, required = true, namespace="")
 	@XmlSchemaType(name = "anyURI")
 	protected String fanOutPoint;
-	@XmlElement(name = ShortName.CHILD_RESOURCE)
+	@XmlElement(name = ShortName.CHILD_RESOURCE, namespace="")
 	protected List<ChildResourceRef> childResource;
 	@XmlElement(name = ShortName.SUB, namespace = "http://www.onem2m.org/xml/protocols")
 	protected List<Subscription> subscription;
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/MyDef.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/MyDef.java
new file mode 100644
index 0000000..06e05a4
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/MyDef.java
@@ -0,0 +1,18 @@
+package org.eclipse.om2m.commons.resource;

+

+import javax.xml.bind.annotation.XmlAccessType;

+import javax.xml.bind.annotation.XmlAccessorType;

+import javax.xml.bind.annotation.XmlRootElement;

+import javax.xml.bind.annotation.XmlType;

+

+@XmlAccessorType(XmlAccessType.FIELD)

+@XmlRootElement(name="myDef"/*, namespace="http://www.onem2m.org/xml/protocols/homedomain"*/)

+@XmlType(name="myDef")

+public class MyDef /* extends FlexContainer */ {

+	

+	public MyDef() {

+//		setLongName("myDef");

+//		setShortName("myDef");

+	}

+

+}

diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ObjectFactory.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ObjectFactory.java
index 66539ce..08a0ac8 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ObjectFactory.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/ObjectFactory.java
@@ -26,6 +26,7 @@
 
 package org.eclipse.om2m.commons.resource;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import javax.xml.bind.JAXBElement;
@@ -81,7 +82,7 @@
 			"update");
 	private final static QName _FirmwareAnncUpdateStatus_QNAME = new QName("",
 			"updateStatus");
-
+	
 	/**
 	 * Create a new ObjectFactory that can be used to create new instances of
 	 * schema derived classes for package: org.eclipse.om2m.commons.resource
@@ -211,20 +212,13 @@
 		return new DynamicAuthorizationConsultation();
 	}
 	
-	/**
-	 * Create an instance of {@link FlexContainer}
-	 * 
-	 */
-	public FlexContainer createFlexContainer() {
-		return new FlexContainer();
-	}
 	
 	/**
-	 * Create an instance of {@link FlexContainerAnnc}
+	 * Create an instance of {@link AbstractFlexContainerAnnc}
 	 * 
 	 */
-	public FlexContainerAnnc createFlexContainerAnnc() {
-		return new FlexContainerAnnc();
+	public AbstractFlexContainerAnnc createFlexContainerAnnc() {
+		return new AbstractFlexContainerAnnc();
 	}
 
 	/**
@@ -981,9 +975,7 @@
 		return new MetaInformation.EventCategory();
 	}
 	
-	public URIList createURIList(){
-		return new URIList();
-	}
+	
 	
 	/**
 	 * Create an instance of {@link JAXBElement }{@code <}{@link AttributeList }
@@ -1001,11 +993,11 @@
 	 * {@link String }{@code >}{@code >}
 	 * 
 	 */
-	@XmlElementDecl(namespace = "http://www.onem2m.org/xml/protocols", name = "URIlist")
-	public JAXBElement<List<String>> createURIlist(List<String> value) {
-		return new JAXBElement<List<String>>(_URIlist_QNAME,
-				((Class) List.class), null, ((List<String>) value));
-	}
+//	@XmlElementDecl(namespace = "http://www.onem2m.org/xml/protocols", name = "URIlist")
+//	public JAXBElement<List<String>> createURIlist(List<String> value) {
+//		return new JAXBElement<List<String>>(_URIlist_QNAME,
+//				((Class) List.class), null, ((List<String>) value));
+//	}
 
 	/**
 	 * Create an instance of {@link JAXBElement }{@code <}
@@ -1414,5 +1406,15 @@
 		return new JAXBElement<String>(_SoftwareVersion_QNAME, String.class,
 				SoftwareAnnc.class, value);
 	}
+	
+	
+	public FlexContainer createFcnt() {
+		return new FlexContainer();
+	}
+	
+	public List<String> createuril() {
+		return new ArrayList<String>();
+	}
+
 
 }
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/RegularResource.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/RegularResource.java
index 7d73b5d..703468e 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/RegularResource.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/RegularResource.java
@@ -29,12 +29,14 @@
 import java.util.ArrayList;
 import java.util.List;
 
+import javax.persistence.MappedSuperclass;
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlList;
 import javax.xml.bind.annotation.XmlSeeAlso;
 import javax.xml.bind.annotation.XmlType;
+import javax.xml.bind.annotation.XmlValue;
 
 import org.eclipse.om2m.commons.constants.ShortName;
 
@@ -69,15 +71,16 @@
 		Request.class, ServiceSubscribedNode.class,
 		M2MServiceSubscriptionProfile.class, EventConfig.class,
 		PollingChannel.class, Subscription.class, AnnounceableResource.class, DynamicAuthorizationConsultation.class })
+@MappedSuperclass
 public class RegularResource extends Resource {
 
 	@XmlList
-	@XmlElement(name=ShortName.ACP_IDS)
+	@XmlElement(name=ShortName.ACP_IDS, required=false, namespace="")
 	protected List<String> accessControlPolicyIDs;
 	@XmlList
-	@XmlElement(name=ShortName.DAC_IDS, required=true)
+	@XmlElement(name=ShortName.DAC_IDS, required=false, namespace="")
 	protected List<String> dynamicAuthorizationConsultationIDs;
-	@XmlElement(name=ShortName.EXPIRATION_TIME, required = true)
+	@XmlElement(name=ShortName.EXPIRATION_TIME, required = true, namespace="")
 	protected String expirationTime;
 
 	/**
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/RemoteCSE.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/RemoteCSE.java
index 66f09ef..bfeb892 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/RemoteCSE.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/RemoteCSE.java
@@ -88,30 +88,31 @@
 @XmlType(name = "")
 @XmlRootElement(name = ShortName.REMOTE_CSE)
 public class RemoteCSE extends AnnounceableResource {
-	@XmlElement(name=ShortName.CSE_TYPE)
+	@XmlElement(name=ShortName.CSE_TYPE, required=false, namespace="")
 	protected BigInteger cseType;
 	@XmlList
-	@XmlElement(name=ShortName.POA)
+	@XmlElement(name=ShortName.POA, required=false, namespace="")
 	protected List<String> pointOfAccess;
-	@XmlElement(name = ShortName.REMOTE_CSE_CSEBASE, required = true)
+	@XmlElement(name = ShortName.REMOTE_CSE_CSEBASE, required = true, namespace="")
 	@XmlSchemaType(name = "anyURI")
 	protected String cseBase;
-	@XmlElement(name = ShortName.CSE_ID, required = true)
+	@XmlElement(name = ShortName.CSE_ID, required = true, namespace="")
 	protected String cseid;
-	@XmlElement(name = ShortName.M2M_EXT_ID)
+	@XmlElement(name = ShortName.M2M_EXT_ID, required=false, namespace="")
 	@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
 	protected String m2MExtID;
-	@XmlElement(name = ShortName.TRIGGER_RECIPIENT_ID)
+	@XmlElement(name = ShortName.TRIGGER_RECIPIENT_ID, required=false, namespace="")
 	protected Long triggerRecipientID;
-	@XmlElement(name=ShortName.REQUEST_REACHABILITY)
+	@XmlElement(name=ShortName.REQUEST_REACHABILITY, required=true, namespace="")
 	protected Boolean requestReachability;
 	@XmlSchemaType(name = "anyURI")
-	@XmlElement(name=ShortName.NODE_LINK)
+	@XmlElement(name=ShortName.NODE_LINK, required=false, namespace="")
 	protected String nodeLink;
-	@XmlElement(name=ShortName.CHILD_RESOURCE)
+	@XmlElement(name=ShortName.CHILD_RESOURCE, namespace="")
 	protected List<ChildResourceRef> childResource;
 	@XmlElements({
 			@XmlElement(name = ShortName.AE, namespace = "http://www.onem2m.org/xml/protocols", type = AE.class),
+			@XmlElement(name = ShortName.AE_ANNC, namespace = "http://www.onem2m.org/xml/protocols", type = AEAnnc.class),
 			@XmlElement(name = ShortName.CNT, namespace = "http://www.onem2m.org/xml/protocols", type = Container.class),
 			@XmlElement(name = ShortName.GROUP, namespace = "http://www.onem2m.org/xml/protocols", type = Group.class),
 			@XmlElement(name = ShortName.ACP, namespace = "http://www.onem2m.org/xml/protocols", type = AccessControlPolicy.class),
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/RequestPrimitive.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/RequestPrimitive.java
index 9e35199..f593225 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/RequestPrimitive.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/RequestPrimitive.java
@@ -99,8 +99,6 @@
 	protected String requestIdentifier;
 	@XmlElement(name = ShortName.RESOURCE_TYPE)
 	protected BigInteger resourceType;
-	@XmlElement(name = ShortName.NAME)
-	protected String name;
 	@XmlTransient
 	protected Object content;
 	@XmlElement(name = ShortName.PRIMITIVE_CONTENT)
@@ -268,26 +266,6 @@
 		this.resourceType = BigInteger.valueOf(value);
 	}
 	
-	/**
-	 * Gets the value of the name property.
-	 * 
-	 * @return possible object is {@link String }
-	 * 
-	 */
-	public String getName() {
-		return name;
-	}
-
-	/**
-	 * Sets the value of the name property.
-	 * 
-	 * @param value
-	 *            allowed object is {@link String }
-	 * 
-	 */
-	public void setName(String value) {
-		this.name = value;
-	}
 
 	/**
 	 * Gets the value of the content property.
@@ -650,7 +628,6 @@
 						+ requestIdentifier + ",\n " : "")
 				+ (resourceType != null ? "resourceType=" + resourceType
 						+ ",\n " : "")
-				+ (name != null ? "name=" + name + ",\n " : "")
 				+ (content != null ? "content=" + content + ",\n " : "")
 				+ (originatingTimestamp != null ? "originatingTimestamp="
 						+ originatingTimestamp + ",\n " : "")
@@ -699,7 +676,6 @@
 		result.filterCriteria = this.filterCriteria;
 		result.from = this.from;
 		result.groupRequestIdentifier = this.groupRequestIdentifier;
-		result.name = this.name;
 		result.operation = this.operation;
 		result.operationExecutionTime = this.operationExecutionTime;
 		result.originatingTimestamp = this.originatingTimestamp;
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Resource.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Resource.java
index 1661b1f..3594b5d 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Resource.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/Resource.java
@@ -81,21 +81,21 @@
 @MappedSuperclass
 public class Resource {
 
-	@XmlElement(name=ShortName.RESOURCE_TYPE, required = true)
+	@XmlElement(name=ShortName.RESOURCE_TYPE, required = true, namespace="")
 	protected BigInteger resourceType;
-	@XmlElement(name=ShortName.RESOURCE_ID, required = true)
+	@XmlElement(name=ShortName.RESOURCE_ID, required = true, namespace="")
 	@Id
 	protected String resourceID;
-	@XmlElement(name=ShortName.PARENT_ID, required = true)
+	@XmlElement(name=ShortName.PARENT_ID, required = true, namespace="")
 	protected String parentID;
-	@XmlElement(name=ShortName.CREATION_TIME, required = true)
+	@XmlElement(name=ShortName.CREATION_TIME, required = true, namespace="")
 	protected String creationTime;
-	@XmlElement(name=ShortName.LAST_MODIFIED_TIME, required = true)
+	@XmlElement(name=ShortName.LAST_MODIFIED_TIME, required = true, namespace="")
 	protected String lastModifiedTime;
 	@XmlList
-	@XmlElement(name=ShortName.LABELS)
+	@XmlElement(name=ShortName.LABELS, required=false, namespace="")
 	protected List<String> labels;
-	@XmlAttribute(name = ShortName.RESOURCE_NAME, required = true)
+	@XmlAttribute(name = ShortName.RESOURCE_NAME, required = true, namespace="")
 	@XmlJavaTypeAdapter(CollapsedStringAdapter.class)
 	@XmlSchemaType(name = "token")
 	protected String name;
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/SetOfAcrs.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/SetOfAcrs.java
index 7aa6d8c..2a76ec3 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/SetOfAcrs.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/SetOfAcrs.java
@@ -62,7 +62,7 @@
 @XmlType(name = "setOfAcrs")
 public class SetOfAcrs {
 
-	@XmlElement(name = ShortName.ACR)
+	@XmlElement(name = ShortName.ACR, namespace="")
 	protected List<AccessControlRule> accessControlRule;
 
 	/**
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/URIList.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/URIList.java
index 2bd7129..71fb67c 100644
--- a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/URIList.java
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/URIList.java
@@ -5,20 +5,24 @@
 
 import javax.xml.bind.annotation.XmlAccessType;
 import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAnyElement;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlElementWrapper;
 import javax.xml.bind.annotation.XmlList;
 import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
 import javax.xml.bind.annotation.XmlValue;
+import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
 
 import org.eclipse.om2m.commons.constants.ShortName;
 
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlRootElement(name = ShortName.URI_LIST)
+@XmlAccessorType(XmlAccessType.NONE)
+@XmlRootElement(name = ShortName.URI_LIST, namespace="http://www.onem2m.org/xml/protocols")
+@XmlType(name="uril")
 public class URIList {
 
-	@XmlList
-	@XmlValue
 	protected List<String> listOfUri;
-
+	
 	/**
 	 * @return the listOfUri
 	 */
@@ -36,4 +40,6 @@
 		this.listOfUri = listOfUri;
 	}
 	
+	
+	
 }
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ActivateClockTimerFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ActivateClockTimerFlexContainer.java
new file mode 100644
index 0000000..6de4c8e
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ActivateClockTimerFlexContainer.java
@@ -0,0 +1,36 @@
+/*
+Action : activateClockTimer
+
+
+
+Activate current clock timer.
+
+Created: 2017-08-09 14:07:04
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = ActivateClockTimerFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = ActivateClockTimerFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class ActivateClockTimerFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "activateClockTimer";
+	public static final String SHORT_NAME = "acCTr";
+	
+	public ActivateClockTimerFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass.timer." + ActivateClockTimerFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ActivateClockTimerFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ActivateClockTimerFlexContainerAnnc.java
new file mode 100644
index 0000000..5ca5d66
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ActivateClockTimerFlexContainerAnnc.java
@@ -0,0 +1,36 @@
+/*
+Action : activateClockTimer
+
+
+
+Activate current clock timer.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = ActivateClockTimerFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = ActivateClockTimerFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class ActivateClockTimerFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "activateClockTimerAnnc";
+	public static final String SHORT_NAME = "acCTrAnnc";
+	
+	public ActivateClockTimerFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass.timer." + ActivateClockTimerFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AlarmSensorFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AlarmSensorFlexContainer.java
new file mode 100644
index 0000000..c489681
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AlarmSensorFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : AlarmSensor
+
+
+
+This ModuleClass manages alarmSensor feature.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = AlarmSensorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = AlarmSensorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class AlarmSensorFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "alarmSensor";
+	public static final String SHORT_NAME = "alSer";
+	
+	public AlarmSensorFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + AlarmSensorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AlarmSensorFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AlarmSensorFlexContainerAnnc.java
new file mode 100644
index 0000000..48d2eeb
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AlarmSensorFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : AlarmSensorAnnc
+
+
+
+This ModuleClass manages alarmSensor feature.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = AlarmSensorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = AlarmSensorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class AlarmSensorFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "alarmSensorAnnc";
+	public static final String SHORT_NAME = "alSerAnnc";
+	
+	public AlarmSensorFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + AlarmSensorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AlarmSpeakerFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AlarmSpeakerFlexContainer.java
new file mode 100644
index 0000000..1a2739e
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AlarmSpeakerFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : AlarmSpeaker
+
+
+
+This ModuleClass provides the capability to initiate an alarm.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = AlarmSpeakerFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = AlarmSpeakerFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class AlarmSpeakerFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "alarmSpeaker";
+	public static final String SHORT_NAME = "alaSr";
+	
+	public AlarmSpeakerFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + AlarmSpeakerFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AlarmSpeakerFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AlarmSpeakerFlexContainerAnnc.java
new file mode 100644
index 0000000..47d7c6b
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AlarmSpeakerFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : AlarmSpeakerAnnc
+
+
+
+This ModuleClass provides the capability to initiate an alarm.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = AlarmSpeakerFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = AlarmSpeakerFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class AlarmSpeakerFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "alarmSpeakerAnnc";
+	public static final String SHORT_NAME = "alaSrAnnc";
+	
+	public AlarmSpeakerFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + AlarmSpeakerFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AtmosphericPressureSensorFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AtmosphericPressureSensorFlexContainer.java
new file mode 100644
index 0000000..d5c881d
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AtmosphericPressureSensorFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : AtmosphericPressureSensor
+
+
+
+This ModuleClass provides data about pressure.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = AtmosphericPressureSensorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = AtmosphericPressureSensorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class AtmosphericPressureSensorFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "atmosphericPressureSensor";
+	public static final String SHORT_NAME = "atPSr";
+	
+	public AtmosphericPressureSensorFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + AtmosphericPressureSensorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AtmosphericPressureSensorFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AtmosphericPressureSensorFlexContainerAnnc.java
new file mode 100644
index 0000000..6ef95e3
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AtmosphericPressureSensorFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : AtmosphericPressureSensorAnnc
+
+
+
+This ModuleClass provides data about pressure.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = AtmosphericPressureSensorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = AtmosphericPressureSensorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class AtmosphericPressureSensorFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "atmosphericPressureSensorAnnc";
+	public static final String SHORT_NAME = "atPSrAnnc";
+	
+	public AtmosphericPressureSensorFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + AtmosphericPressureSensorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AudioVideoInputFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AudioVideoInputFlexContainer.java
new file mode 100644
index 0000000..15c086d
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AudioVideoInputFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : AudioVideoInput
+
+
+
+This ModuleClass provides capabilities to control and monitor  audio video input source of device such as TV or SetTopBox.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = AudioVideoInputFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = AudioVideoInputFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class AudioVideoInputFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "audioVideoInput";
+	public static final String SHORT_NAME = "auVIt";
+	
+	public AudioVideoInputFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + AudioVideoInputFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AudioVideoInputFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AudioVideoInputFlexContainerAnnc.java
new file mode 100644
index 0000000..fa1ed79
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AudioVideoInputFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : AudioVideoInputAnnc
+
+
+
+This ModuleClass provides capabilities to control and monitor  audio video input source of device such as TV or SetTopBox.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = AudioVideoInputFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = AudioVideoInputFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class AudioVideoInputFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "audioVideoInputAnnc";
+	public static final String SHORT_NAME = "auVItAnnc";
+	
+	public AudioVideoInputFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + AudioVideoInputFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AudioVolumeFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AudioVolumeFlexContainer.java
new file mode 100644
index 0000000..9b46e13
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AudioVolumeFlexContainer.java
@@ -0,0 +1,69 @@
+/*
+ModuleClass : AudioVolume
+
+
+
+This ModuleClass provides capabilities to control and monitor  volume.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = AudioVolumeFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = AudioVolumeFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class AudioVolumeFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "audioVolume";
+	public static final String SHORT_NAME = "audVe";
+	
+	public AudioVolumeFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + AudioVolumeFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getUpVolume();
+		getDownVolume();
+	}
+	
+	@XmlElement(name=UpVolumeFlexContainer.SHORT_NAME, required=true, type=UpVolumeFlexContainer.class)
+	private UpVolumeFlexContainer upVolume;
+	
+	
+	public void setUpVolume(UpVolumeFlexContainer upVolume) {
+		this.upVolume = upVolume;
+		getFlexContainerOrContainerOrSubscription().add(upVolume);
+	}
+	
+	public UpVolumeFlexContainer getUpVolume() {
+		this.upVolume = (UpVolumeFlexContainer) getResourceByName(UpVolumeFlexContainer.SHORT_NAME);
+		return upVolume;
+	}
+	
+	@XmlElement(name=DownVolumeFlexContainer.SHORT_NAME, required=true, type=DownVolumeFlexContainer.class)
+	private DownVolumeFlexContainer downVolume;
+	
+	
+	public void setDownVolume(DownVolumeFlexContainer downVolume) {
+		this.downVolume = downVolume;
+		getFlexContainerOrContainerOrSubscription().add(downVolume);
+	}
+	
+	public DownVolumeFlexContainer getDownVolume() {
+		this.downVolume = (DownVolumeFlexContainer) getResourceByName(DownVolumeFlexContainer.SHORT_NAME);
+		return downVolume;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AudioVolumeFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AudioVolumeFlexContainerAnnc.java
new file mode 100644
index 0000000..099900d
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/AudioVolumeFlexContainerAnnc.java
@@ -0,0 +1,69 @@
+/*
+ModuleClass : AudioVolumeAnnc
+
+
+
+This ModuleClass provides capabilities to control and monitor  volume.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = AudioVolumeFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = AudioVolumeFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class AudioVolumeFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "audioVolumeAnnc";
+	public static final String SHORT_NAME = "audVeAnnc";
+	
+	public AudioVolumeFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + AudioVolumeFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getUpVolumeAnnc();
+		getDownVolumeAnnc();
+	}
+	
+	@XmlElement(name=UpVolumeFlexContainerAnnc.SHORT_NAME, required=true, type=UpVolumeFlexContainerAnnc.class)
+	private UpVolumeFlexContainerAnnc upVolumeAnnc;
+	
+	
+	public void setUpVolume(UpVolumeFlexContainerAnnc upVolumeAnnc) {
+		this.upVolumeAnnc = upVolumeAnnc;
+		getFlexContainerOrContainerOrSubscription().add(upVolumeAnnc);
+	}
+	
+	public UpVolumeFlexContainerAnnc getUpVolumeAnnc() {
+		this.upVolumeAnnc = (UpVolumeFlexContainerAnnc) getResourceByName(UpVolumeFlexContainerAnnc.SHORT_NAME);
+		return upVolumeAnnc;
+	}
+	
+	@XmlElement(name=DownVolumeFlexContainerAnnc.SHORT_NAME, required=true, type=DownVolumeFlexContainerAnnc.class)
+	private DownVolumeFlexContainerAnnc downVolumeAnnc;
+	
+	
+	public void setDownVolume(DownVolumeFlexContainerAnnc downVolumeAnnc) {
+		this.downVolumeAnnc = downVolumeAnnc;
+		getFlexContainerOrContainerOrSubscription().add(downVolumeAnnc);
+	}
+	
+	public DownVolumeFlexContainerAnnc getDownVolumeAnnc() {
+		this.downVolumeAnnc = (DownVolumeFlexContainerAnnc) getResourceByName(DownVolumeFlexContainerAnnc.SHORT_NAME);
+		return downVolumeAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BatteryFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BatteryFlexContainer.java
new file mode 100644
index 0000000..961aebd
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BatteryFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : Battery
+
+
+
+Battery indicates the detection of low battery and gives an  alarm if triggering criterion is met. The charge value in the module  shows the current battery charge level.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = BatteryFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = BatteryFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class BatteryFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "battery";
+	public static final String SHORT_NAME = "batty";
+	
+	public BatteryFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + BatteryFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BatteryFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BatteryFlexContainerAnnc.java
new file mode 100644
index 0000000..c61bb1f
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BatteryFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : BatteryAnnc
+
+
+
+Battery indicates the detection of low battery and gives an  alarm if triggering criterion is met. The charge value in the module  shows the current battery charge level.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = BatteryFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = BatteryFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class BatteryFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "batteryAnnc";
+	public static final String SHORT_NAME = "battyAnnc";
+	
+	public BatteryFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + BatteryFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BinarySwitchFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BinarySwitchFlexContainer.java
new file mode 100644
index 0000000..462427d
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BinarySwitchFlexContainer.java
@@ -0,0 +1,54 @@
+/*
+ModuleClass : BinarySwitch
+
+
+
+This ModuleClass provides capabilities to control and monitor  the state of power.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = BinarySwitchFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = BinarySwitchFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class BinarySwitchFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "binarySwitch";
+	public static final String SHORT_NAME = "binSh";
+	
+	public BinarySwitchFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + BinarySwitchFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getToggle();
+	}
+	
+	@XmlElement(name=ToggleFlexContainer.SHORT_NAME, required=true, type=ToggleFlexContainer.class)
+	private ToggleFlexContainer toggle;
+	
+	
+	public void setToggle(ToggleFlexContainer toggle) {
+		this.toggle = toggle;
+		getFlexContainerOrContainerOrSubscription().add(toggle);
+	}
+	
+	public ToggleFlexContainer getToggle() {
+		this.toggle = (ToggleFlexContainer) getResourceByName(ToggleFlexContainer.SHORT_NAME);
+		return toggle;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BinarySwitchFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BinarySwitchFlexContainerAnnc.java
new file mode 100644
index 0000000..4444ab6
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BinarySwitchFlexContainerAnnc.java
@@ -0,0 +1,54 @@
+/*
+ModuleClass : BinarySwitchAnnc
+
+
+
+This ModuleClass provides capabilities to control and monitor  the state of power.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = BinarySwitchFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = BinarySwitchFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class BinarySwitchFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "binarySwitchAnnc";
+	public static final String SHORT_NAME = "binShAnnc";
+	
+	public BinarySwitchFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + BinarySwitchFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getToggleAnnc();
+	}
+	
+	@XmlElement(name=ToggleFlexContainerAnnc.SHORT_NAME, required=true, type=ToggleFlexContainerAnnc.class)
+	private ToggleFlexContainerAnnc toggleAnnc;
+	
+	
+	public void setToggle(ToggleFlexContainerAnnc toggleAnnc) {
+		this.toggleAnnc = toggleAnnc;
+		getFlexContainerOrContainerOrSubscription().add(toggleAnnc);
+	}
+	
+	public ToggleFlexContainerAnnc getToggleAnnc() {
+		this.toggleAnnc = (ToggleFlexContainerAnnc) getResourceByName(ToggleFlexContainerAnnc.SHORT_NAME);
+		return toggleAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BioElectricalImpedanceAnalysisFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BioElectricalImpedanceAnalysisFlexContainer.java
new file mode 100644
index 0000000..acdb9df
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BioElectricalImpedanceAnalysisFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : BioElectricalImpedanceAnalysis
+
+
+
+ModuleClass provides the analysis of human body tissue based on  impedance measurement.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = BioElectricalImpedanceAnalysisFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = BioElectricalImpedanceAnalysisFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class BioElectricalImpedanceAnalysisFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "bioElectricalImpedanceAnalysis";
+	public static final String SHORT_NAME = "bEIAs";
+	
+	public BioElectricalImpedanceAnalysisFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + BioElectricalImpedanceAnalysisFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BioElectricalImpedanceAnalysisFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BioElectricalImpedanceAnalysisFlexContainerAnnc.java
new file mode 100644
index 0000000..56c0a2a
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BioElectricalImpedanceAnalysisFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : BioElectricalImpedanceAnalysisAnnc
+
+
+
+ModuleClass provides the analysis of human body tissue based on  impedance measurement.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = BioElectricalImpedanceAnalysisFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = BioElectricalImpedanceAnalysisFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class BioElectricalImpedanceAnalysisFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "bioElectricalImpedanceAnalysisAnnc";
+	public static final String SHORT_NAME = "bEIAsAnnc";
+	
+	public BioElectricalImpedanceAnalysisFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + BioElectricalImpedanceAnalysisFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BoilerFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BoilerFlexContainer.java
new file mode 100644
index 0000000..77c18e1
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BoilerFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : Boiler
+
+
+
+This ModuleClass provides the status of boiling function for  water heaters.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = BoilerFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = BoilerFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class BoilerFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "boiler";
+	public static final String SHORT_NAME = "boilr";
+	
+	public BoilerFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + BoilerFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BoilerFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BoilerFlexContainerAnnc.java
new file mode 100644
index 0000000..58adb25
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BoilerFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : BoilerAnnc
+
+
+
+This ModuleClass provides the status of boiling function for  water heaters.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = BoilerFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = BoilerFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class BoilerFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "boilerAnnc";
+	public static final String SHORT_NAME = "boilrAnnc";
+	
+	public BoilerFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + BoilerFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BrewingFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BrewingFlexContainer.java
new file mode 100644
index 0000000..d93543b
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BrewingFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : Brewing
+
+
+
+This ModuleClass manages brewing feature.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = BrewingFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = BrewingFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class BrewingFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "brewing";
+	public static final String SHORT_NAME = "brewg";
+	
+	public BrewingFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + BrewingFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BrewingFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BrewingFlexContainerAnnc.java
new file mode 100644
index 0000000..c64f80f
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BrewingFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : BrewingAnnc
+
+
+
+This ModuleClass manages brewing feature.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = BrewingFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = BrewingFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class BrewingFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "brewingAnnc";
+	public static final String SHORT_NAME = "brewgAnnc";
+	
+	public BrewingFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + BrewingFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BrightnessFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BrightnessFlexContainer.java
new file mode 100644
index 0000000..a878be3
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BrightnessFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : Brightness
+
+
+
+This ModuleClass describes the brightness of a light, e.g. from  a lamp. Brightness is scaled as a percentage. A lamp or a monitor  can be adjusted to a level of light between very dim (0% is the  minimum brightness) and very bright (100% is the maximum  brightness).
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = BrightnessFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = BrightnessFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class BrightnessFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "brightness";
+	public static final String SHORT_NAME = "brigs";
+	
+	public BrightnessFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + BrightnessFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BrightnessFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BrightnessFlexContainerAnnc.java
new file mode 100644
index 0000000..a2c4dd7
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/BrightnessFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : BrightnessAnnc
+
+
+
+This ModuleClass describes the brightness of a light, e.g. from  a lamp. Brightness is scaled as a percentage. A lamp or a monitor  can be adjusted to a level of light between very dim (0% is the  minimum brightness) and very bright (100% is the maximum  brightness).
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = BrightnessFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = BrightnessFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class BrightnessFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "brightnessAnnc";
+	public static final String SHORT_NAME = "brigsAnnc";
+	
+	public BrightnessFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + BrightnessFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ClockFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ClockFlexContainer.java
new file mode 100644
index 0000000..35b9b78
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ClockFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : Clock
+
+
+
+This ModuleClass provides the information about current date and  time.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = ClockFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = ClockFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class ClockFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "clock";
+	public static final String SHORT_NAME = "clock";
+	
+	public ClockFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + ClockFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ClockFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ClockFlexContainerAnnc.java
new file mode 100644
index 0000000..dac6907
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ClockFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : ClockAnnc
+
+
+
+This ModuleClass provides the information about current date and  time.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = ClockFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = ClockFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class ClockFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "clockAnnc";
+	public static final String SHORT_NAME = "clockAnnc";
+	
+	public ClockFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + ClockFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ColourFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ColourFlexContainer.java
new file mode 100644
index 0000000..0222690
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ColourFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : Colour
+
+
+
+This ModuleClass provides the capabilities to set the value of  Red, Green, Blue for the color device.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = ColourFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = ColourFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class ColourFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "colour";
+	public static final String SHORT_NAME = "color";
+	
+	public ColourFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + ColourFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ColourFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ColourFlexContainerAnnc.java
new file mode 100644
index 0000000..a05f5ae
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ColourFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : ColourAnnc
+
+
+
+This ModuleClass provides the capabilities to set the value of  Red, Green, Blue for the color device.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = ColourFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = ColourFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class ColourFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "colourAnnc";
+	public static final String SHORT_NAME = "colorAnnc";
+	
+	public ColourFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + ColourFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ColourSaturationFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ColourSaturationFlexContainer.java
new file mode 100644
index 0000000..3d9957f
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ColourSaturationFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : ColourSaturation
+
+
+
+This ModuleClass describes a colour saturation value. The value  is an integer. A colourSaturation has a range of [0,100]. A  colourSaturation value of 0 means producing black and white images.  A colourSaturation value of 50 means producing device specific  normal colour images. A colourSaturation value of 100 means  producing device very colourfull images.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = ColourSaturationFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = ColourSaturationFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class ColourSaturationFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "colourSaturation";
+	public static final String SHORT_NAME = "colSn";
+	
+	public ColourSaturationFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + ColourSaturationFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ColourSaturationFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ColourSaturationFlexContainerAnnc.java
new file mode 100644
index 0000000..4440a7f
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ColourSaturationFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : ColourSaturationAnnc
+
+
+
+This ModuleClass describes a colour saturation value. The value  is an integer. A colourSaturation has a range of [0,100]. A  colourSaturation value of 0 means producing black and white images.  A colourSaturation value of 50 means producing device specific  normal colour images. A colourSaturation value of 100 means  producing device very colourfull images.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = ColourSaturationFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = ColourSaturationFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class ColourSaturationFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "colourSaturationAnnc";
+	public static final String SHORT_NAME = "colSnAnnc";
+	
+	public ColourSaturationFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + ColourSaturationFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ContactSensorFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ContactSensorFlexContainer.java
new file mode 100644
index 0000000..0979648
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ContactSensorFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : ContactSensor
+
+
+
+This ModuleClass manages alarmSensor feature.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = ContactSensorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = ContactSensorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class ContactSensorFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "contactSensor";
+	public static final String SHORT_NAME = "conSr";
+	
+	public ContactSensorFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + ContactSensorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ContactSensorFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ContactSensorFlexContainerAnnc.java
new file mode 100644
index 0000000..2de281e
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ContactSensorFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : ContactSensorAnnc
+
+
+
+This ModuleClass manages alarmSensor feature.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = ContactSensorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = ContactSensorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class ContactSensorFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "contactSensorAnnc";
+	public static final String SHORT_NAME = "conSrAnnc";
+	
+	public ContactSensorFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + ContactSensorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeactivateClockTimerFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeactivateClockTimerFlexContainer.java
new file mode 100644
index 0000000..c49a524
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeactivateClockTimerFlexContainer.java
@@ -0,0 +1,36 @@
+/*
+Action : deactivateClockTimer
+
+
+
+Deactivate current clock timer.
+
+Created: 2017-08-09 14:07:04
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeactivateClockTimerFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeactivateClockTimerFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeactivateClockTimerFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deactivateClockTimer";
+	public static final String SHORT_NAME = "deCTr";
+	
+	public DeactivateClockTimerFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass.timer." + DeactivateClockTimerFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeactivateClockTimerFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeactivateClockTimerFlexContainerAnnc.java
new file mode 100644
index 0000000..e56d0c5
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeactivateClockTimerFlexContainerAnnc.java
@@ -0,0 +1,36 @@
+/*
+Action : deactivateClockTimer
+
+
+
+Deactivate current clock timer.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeactivateClockTimerFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeactivateClockTimerFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeactivateClockTimerFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deactivateClockTimerAnnc";
+	public static final String SHORT_NAME = "deCTrAnnc";
+	
+	public DeactivateClockTimerFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass.timer." + DeactivateClockTimerFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceAirConditionerFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceAirConditionerFlexContainer.java
new file mode 100644
index 0000000..fc6893d
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceAirConditionerFlexContainer.java
@@ -0,0 +1,129 @@
+/*
+Device : DeviceAirConditioner
+
+
+
+An air conditioner is a home appliance used to alter the properties of air (primarily temperature and humidity) to more comfortable conditions. This air conditioner information model provides capabilities to control and monitor air conditioner specific functions and resources.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceAirConditionerFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceAirConditionerFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceAirConditionerFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceAirConditioner";
+	public static final String SHORT_NAME = "deACr";
+	
+	public DeviceAirConditionerFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceAirConditionerFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getBinarySwitch();
+		getRunMode();
+		getTemperature();
+		getTimer();
+		getTurbo();
+		getWind();
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainer.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainer.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="tempe", required=true, type=TemperatureFlexContainer.class)
+	private TemperatureFlexContainer temperature;
+	
+	
+	public void setTemperature(TemperatureFlexContainer temperature) {
+		this.temperature = temperature;
+		getFlexContainerOrContainerOrSubscription().add(temperature);
+	}
+	
+	public TemperatureFlexContainer getTemperature() {
+		this.temperature = (TemperatureFlexContainer) getResourceByName(TemperatureFlexContainer.SHORT_NAME);
+		return temperature;
+	}
+	
+	@XmlElement(name="timer", required=true, type=TimerFlexContainer.class)
+	private TimerFlexContainer timer;
+	
+	
+	public void setTimer(TimerFlexContainer timer) {
+		this.timer = timer;
+		getFlexContainerOrContainerOrSubscription().add(timer);
+	}
+	
+	public TimerFlexContainer getTimer() {
+		this.timer = (TimerFlexContainer) getResourceByName(TimerFlexContainer.SHORT_NAME);
+		return timer;
+	}
+	
+	@XmlElement(name="turbo", required=true, type=TurboFlexContainer.class)
+	private TurboFlexContainer turbo;
+	
+	
+	public void setTurbo(TurboFlexContainer turbo) {
+		this.turbo = turbo;
+		getFlexContainerOrContainerOrSubscription().add(turbo);
+	}
+	
+	public TurboFlexContainer getTurbo() {
+		this.turbo = (TurboFlexContainer) getResourceByName(TurboFlexContainer.SHORT_NAME);
+		return turbo;
+	}
+	
+	@XmlElement(name="wind", required=true, type=WindFlexContainer.class)
+	private WindFlexContainer wind;
+	
+	
+	public void setWind(WindFlexContainer wind) {
+		this.wind = wind;
+		getFlexContainerOrContainerOrSubscription().add(wind);
+	}
+	
+	public WindFlexContainer getWind() {
+		this.wind = (WindFlexContainer) getResourceByName(WindFlexContainer.SHORT_NAME);
+		return wind;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceAirConditionerFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceAirConditionerFlexContainerAnnc.java
new file mode 100644
index 0000000..5c7a8c9
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceAirConditionerFlexContainerAnnc.java
@@ -0,0 +1,219 @@
+/*
+Device : DeviceAirConditionerAnnc
+
+
+
+An air conditioner is a home appliance used to alter the properties of air (primarily temperature and humidity) to more comfortable conditions. This air conditioner information model provides capabilities to control and monitor air conditioner specific functions and resources.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceAirConditionerFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceAirConditionerFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceAirConditionerFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceAirConditionerAnnc";
+	public static final String SHORT_NAME = "deACrAnnc";
+	
+	public DeviceAirConditionerFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceAirConditionerFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getBinarySwitch();
+		getBinarySwitchAnnc();
+		getRunMode();
+		getRunModeAnnc();
+		getTemperature();
+		getTemperatureAnnc();
+		getTimer();
+		getTimerAnnc();
+		getTurbo();
+		getTurboAnnc();
+		getWind();
+		getWindAnnc();
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="binShAnnc", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainerAnnc binarySwitchAnnc;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainerAnnc binarySwitchAnnc) {
+		this.binarySwitchAnnc = binarySwitchAnnc;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitchAnnc);
+	}
+	
+	public BinarySwitchFlexContainerAnnc getBinarySwitchAnnc() {
+		this.binarySwitchAnnc = (BinarySwitchFlexContainerAnnc) getResourceByName(BinarySwitchFlexContainerAnnc.SHORT_NAME);
+		return binarySwitchAnnc;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="runMeAnnc", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainerAnnc runModeAnnc;
+	
+	
+	public void setRunMode(RunModeFlexContainerAnnc runModeAnnc) {
+		this.runModeAnnc = runModeAnnc;
+		getFlexContainerOrContainerOrSubscription().add(runModeAnnc);
+	}
+	
+	public RunModeFlexContainerAnnc getRunModeAnnc() {
+		this.runModeAnnc = (RunModeFlexContainerAnnc) getResourceByName(RunModeFlexContainerAnnc.SHORT_NAME);
+		return runModeAnnc;
+	}
+	
+	@XmlElement(name="tempe", required=true, type=TemperatureFlexContainerAnnc.class)
+	private TemperatureFlexContainer temperature;
+	
+	
+	public void setTemperature(TemperatureFlexContainer temperature) {
+		this.temperature = temperature;
+		getFlexContainerOrContainerOrSubscription().add(temperature);
+	}
+	
+	public TemperatureFlexContainer getTemperature() {
+		this.temperature = (TemperatureFlexContainer) getResourceByName(TemperatureFlexContainer.SHORT_NAME);
+		return temperature;
+	}
+	
+	@XmlElement(name="tempeAnnc", required=true, type=TemperatureFlexContainerAnnc.class)
+	private TemperatureFlexContainerAnnc temperatureAnnc;
+	
+	
+	public void setTemperature(TemperatureFlexContainerAnnc temperatureAnnc) {
+		this.temperatureAnnc = temperatureAnnc;
+		getFlexContainerOrContainerOrSubscription().add(temperatureAnnc);
+	}
+	
+	public TemperatureFlexContainerAnnc getTemperatureAnnc() {
+		this.temperatureAnnc = (TemperatureFlexContainerAnnc) getResourceByName(TemperatureFlexContainerAnnc.SHORT_NAME);
+		return temperatureAnnc;
+	}
+	
+	@XmlElement(name="timer", required=true, type=TimerFlexContainerAnnc.class)
+	private TimerFlexContainer timer;
+	
+	
+	public void setTimer(TimerFlexContainer timer) {
+		this.timer = timer;
+		getFlexContainerOrContainerOrSubscription().add(timer);
+	}
+	
+	public TimerFlexContainer getTimer() {
+		this.timer = (TimerFlexContainer) getResourceByName(TimerFlexContainer.SHORT_NAME);
+		return timer;
+	}
+	
+	@XmlElement(name="timerAnnc", required=true, type=TimerFlexContainerAnnc.class)
+	private TimerFlexContainerAnnc timerAnnc;
+	
+	
+	public void setTimer(TimerFlexContainerAnnc timerAnnc) {
+		this.timerAnnc = timerAnnc;
+		getFlexContainerOrContainerOrSubscription().add(timerAnnc);
+	}
+	
+	public TimerFlexContainerAnnc getTimerAnnc() {
+		this.timerAnnc = (TimerFlexContainerAnnc) getResourceByName(TimerFlexContainerAnnc.SHORT_NAME);
+		return timerAnnc;
+	}
+	
+	@XmlElement(name="turbo", required=true, type=TurboFlexContainerAnnc.class)
+	private TurboFlexContainer turbo;
+	
+	
+	public void setTurbo(TurboFlexContainer turbo) {
+		this.turbo = turbo;
+		getFlexContainerOrContainerOrSubscription().add(turbo);
+	}
+	
+	public TurboFlexContainer getTurbo() {
+		this.turbo = (TurboFlexContainer) getResourceByName(TurboFlexContainer.SHORT_NAME);
+		return turbo;
+	}
+	
+	@XmlElement(name="turboAnnc", required=true, type=TurboFlexContainerAnnc.class)
+	private TurboFlexContainerAnnc turboAnnc;
+	
+	
+	public void setTurbo(TurboFlexContainerAnnc turboAnnc) {
+		this.turboAnnc = turboAnnc;
+		getFlexContainerOrContainerOrSubscription().add(turboAnnc);
+	}
+	
+	public TurboFlexContainerAnnc getTurboAnnc() {
+		this.turboAnnc = (TurboFlexContainerAnnc) getResourceByName(TurboFlexContainerAnnc.SHORT_NAME);
+		return turboAnnc;
+	}
+	
+	@XmlElement(name="wind", required=true, type=WindFlexContainerAnnc.class)
+	private WindFlexContainer wind;
+	
+	
+	public void setWind(WindFlexContainer wind) {
+		this.wind = wind;
+		getFlexContainerOrContainerOrSubscription().add(wind);
+	}
+	
+	public WindFlexContainer getWind() {
+		this.wind = (WindFlexContainer) getResourceByName(WindFlexContainer.SHORT_NAME);
+		return wind;
+	}
+	
+	@XmlElement(name="windAnnc", required=true, type=WindFlexContainerAnnc.class)
+	private WindFlexContainerAnnc windAnnc;
+	
+	
+	public void setWind(WindFlexContainerAnnc windAnnc) {
+		this.windAnnc = windAnnc;
+		getFlexContainerOrContainerOrSubscription().add(windAnnc);
+	}
+	
+	public WindFlexContainerAnnc getWindAnnc() {
+		this.windAnnc = (WindFlexContainerAnnc) getResourceByName(WindFlexContainerAnnc.SHORT_NAME);
+		return windAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceCameraFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceCameraFlexContainer.java
new file mode 100644
index 0000000..de50a90
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceCameraFlexContainer.java
@@ -0,0 +1,84 @@
+/*
+Device : DeviceCamera
+
+
+
+A Camera is a device that provides video streaming feature.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceCameraFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceCameraFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceCameraFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceCamera";
+	public static final String SHORT_NAME = "devCa";
+	
+	public DeviceCameraFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceCameraFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getMotionSensor();
+		getStreaming();
+		getPersonSensor();
+	}
+	
+	@XmlElement(name="motSr", required=true, type=MotionSensorFlexContainer.class)
+	private MotionSensorFlexContainer motionSensor;
+	
+	
+	public void setMotionSensor(MotionSensorFlexContainer motionSensor) {
+		this.motionSensor = motionSensor;
+		getFlexContainerOrContainerOrSubscription().add(motionSensor);
+	}
+	
+	public MotionSensorFlexContainer getMotionSensor() {
+		this.motionSensor = (MotionSensorFlexContainer) getResourceByName(MotionSensorFlexContainer.SHORT_NAME);
+		return motionSensor;
+	}
+	
+	@XmlElement(name="streg", required=true, type=StreamingFlexContainer.class)
+	private StreamingFlexContainer streaming;
+	
+	
+	public void setStreaming(StreamingFlexContainer streaming) {
+		this.streaming = streaming;
+		getFlexContainerOrContainerOrSubscription().add(streaming);
+	}
+	
+	public StreamingFlexContainer getStreaming() {
+		this.streaming = (StreamingFlexContainer) getResourceByName(StreamingFlexContainer.SHORT_NAME);
+		return streaming;
+	}
+	
+	@XmlElement(name="perSr", required=true, type=PersonSensorFlexContainer.class)
+	private PersonSensorFlexContainer personSensor;
+	
+	
+	public void setPersonSensor(PersonSensorFlexContainer personSensor) {
+		this.personSensor = personSensor;
+		getFlexContainerOrContainerOrSubscription().add(personSensor);
+	}
+	
+	public PersonSensorFlexContainer getPersonSensor() {
+		this.personSensor = (PersonSensorFlexContainer) getResourceByName(PersonSensorFlexContainer.SHORT_NAME);
+		return personSensor;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceCameraFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceCameraFlexContainerAnnc.java
new file mode 100644
index 0000000..9cf4ba2
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceCameraFlexContainerAnnc.java
@@ -0,0 +1,129 @@
+/*
+Device : DeviceCameraAnnc
+
+
+
+A Camera is a device that provides video streaming feature.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceCameraFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceCameraFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceCameraFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceCameraAnnc";
+	public static final String SHORT_NAME = "devCaAnnc";
+	
+	public DeviceCameraFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceCameraFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getMotionSensor();
+		getMotionSensorAnnc();
+		getStreaming();
+		getStreamingAnnc();
+		getPersonSensor();
+		getPersonSensorAnnc();
+	}
+	
+	@XmlElement(name="motSr", required=true, type=MotionSensorFlexContainerAnnc.class)
+	private MotionSensorFlexContainer motionSensor;
+	
+	
+	public void setMotionSensor(MotionSensorFlexContainer motionSensor) {
+		this.motionSensor = motionSensor;
+		getFlexContainerOrContainerOrSubscription().add(motionSensor);
+	}
+	
+	public MotionSensorFlexContainer getMotionSensor() {
+		this.motionSensor = (MotionSensorFlexContainer) getResourceByName(MotionSensorFlexContainer.SHORT_NAME);
+		return motionSensor;
+	}
+	
+	@XmlElement(name="motSrAnnc", required=true, type=MotionSensorFlexContainerAnnc.class)
+	private MotionSensorFlexContainerAnnc motionSensorAnnc;
+	
+	
+	public void setMotionSensor(MotionSensorFlexContainerAnnc motionSensorAnnc) {
+		this.motionSensorAnnc = motionSensorAnnc;
+		getFlexContainerOrContainerOrSubscription().add(motionSensorAnnc);
+	}
+	
+	public MotionSensorFlexContainerAnnc getMotionSensorAnnc() {
+		this.motionSensorAnnc = (MotionSensorFlexContainerAnnc) getResourceByName(MotionSensorFlexContainerAnnc.SHORT_NAME);
+		return motionSensorAnnc;
+	}
+	
+	@XmlElement(name="streg", required=true, type=StreamingFlexContainerAnnc.class)
+	private StreamingFlexContainer streaming;
+	
+	
+	public void setStreaming(StreamingFlexContainer streaming) {
+		this.streaming = streaming;
+		getFlexContainerOrContainerOrSubscription().add(streaming);
+	}
+	
+	public StreamingFlexContainer getStreaming() {
+		this.streaming = (StreamingFlexContainer) getResourceByName(StreamingFlexContainer.SHORT_NAME);
+		return streaming;
+	}
+	
+	@XmlElement(name="stregAnnc", required=true, type=StreamingFlexContainerAnnc.class)
+	private StreamingFlexContainerAnnc streamingAnnc;
+	
+	
+	public void setStreaming(StreamingFlexContainerAnnc streamingAnnc) {
+		this.streamingAnnc = streamingAnnc;
+		getFlexContainerOrContainerOrSubscription().add(streamingAnnc);
+	}
+	
+	public StreamingFlexContainerAnnc getStreamingAnnc() {
+		this.streamingAnnc = (StreamingFlexContainerAnnc) getResourceByName(StreamingFlexContainerAnnc.SHORT_NAME);
+		return streamingAnnc;
+	}
+	
+	@XmlElement(name="perSr", required=true, type=PersonSensorFlexContainerAnnc.class)
+	private PersonSensorFlexContainer personSensor;
+	
+	
+	public void setPersonSensor(PersonSensorFlexContainer personSensor) {
+		this.personSensor = personSensor;
+		getFlexContainerOrContainerOrSubscription().add(personSensor);
+	}
+	
+	public PersonSensorFlexContainer getPersonSensor() {
+		this.personSensor = (PersonSensorFlexContainer) getResourceByName(PersonSensorFlexContainer.SHORT_NAME);
+		return personSensor;
+	}
+	
+	@XmlElement(name="perSrAnnc", required=true, type=PersonSensorFlexContainerAnnc.class)
+	private PersonSensorFlexContainerAnnc personSensorAnnc;
+	
+	
+	public void setPersonSensor(PersonSensorFlexContainerAnnc personSensorAnnc) {
+		this.personSensorAnnc = personSensorAnnc;
+		getFlexContainerOrContainerOrSubscription().add(personSensorAnnc);
+	}
+	
+	public PersonSensorFlexContainerAnnc getPersonSensorAnnc() {
+		this.personSensorAnnc = (PersonSensorFlexContainerAnnc) getResourceByName(PersonSensorFlexContainerAnnc.SHORT_NAME);
+		return personSensorAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceClothesWasherFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceClothesWasherFlexContainer.java
new file mode 100644
index 0000000..b06c1a7
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceClothesWasherFlexContainer.java
@@ -0,0 +1,159 @@
+/*
+Device : DeviceClothesWasher
+
+
+
+A clothes washer is a home appliance that is used to wash laundry, such as clothing and sheets. This information model provides capabilities to interact with specific functions and resources of clothes washers.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceClothesWasherFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceClothesWasherFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceClothesWasherFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceClothesWasher";
+	public static final String SHORT_NAME = "deCWr";
+	
+	public DeviceClothesWasherFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceClothesWasherFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getBinarySwitch();
+		getTimer();
+		getRunMode();
+		getTemperature();
+		getWaterLevel();
+		getRinseLevel();
+		getWaterFlow();
+		getSpinLevel();
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainer.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="timer", required=true, type=TimerFlexContainer.class)
+	private TimerFlexContainer timer;
+	
+	
+	public void setTimer(TimerFlexContainer timer) {
+		this.timer = timer;
+		getFlexContainerOrContainerOrSubscription().add(timer);
+	}
+	
+	public TimerFlexContainer getTimer() {
+		this.timer = (TimerFlexContainer) getResourceByName(TimerFlexContainer.SHORT_NAME);
+		return timer;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainer.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="tempe", required=true, type=TemperatureFlexContainer.class)
+	private TemperatureFlexContainer temperature;
+	
+	
+	public void setTemperature(TemperatureFlexContainer temperature) {
+		this.temperature = temperature;
+		getFlexContainerOrContainerOrSubscription().add(temperature);
+	}
+	
+	public TemperatureFlexContainer getTemperature() {
+		this.temperature = (TemperatureFlexContainer) getResourceByName(TemperatureFlexContainer.SHORT_NAME);
+		return temperature;
+	}
+	
+	@XmlElement(name="watLl", required=true, type=WaterLevelFlexContainer.class)
+	private WaterLevelFlexContainer waterLevel;
+	
+	
+	public void setWaterLevel(WaterLevelFlexContainer waterLevel) {
+		this.waterLevel = waterLevel;
+		getFlexContainerOrContainerOrSubscription().add(waterLevel);
+	}
+	
+	public WaterLevelFlexContainer getWaterLevel() {
+		this.waterLevel = (WaterLevelFlexContainer) getResourceByName(WaterLevelFlexContainer.SHORT_NAME);
+		return waterLevel;
+	}
+	
+	@XmlElement(name="rinLl", required=true, type=RinseLevelFlexContainer.class)
+	private RinseLevelFlexContainer rinseLevel;
+	
+	
+	public void setRinseLevel(RinseLevelFlexContainer rinseLevel) {
+		this.rinseLevel = rinseLevel;
+		getFlexContainerOrContainerOrSubscription().add(rinseLevel);
+	}
+	
+	public RinseLevelFlexContainer getRinseLevel() {
+		this.rinseLevel = (RinseLevelFlexContainer) getResourceByName(RinseLevelFlexContainer.SHORT_NAME);
+		return rinseLevel;
+	}
+	
+	@XmlElement(name="watFw", required=true, type=WaterFlowFlexContainer.class)
+	private WaterFlowFlexContainer waterFlow;
+	
+	
+	public void setWaterFlow(WaterFlowFlexContainer waterFlow) {
+		this.waterFlow = waterFlow;
+		getFlexContainerOrContainerOrSubscription().add(waterFlow);
+	}
+	
+	public WaterFlowFlexContainer getWaterFlow() {
+		this.waterFlow = (WaterFlowFlexContainer) getResourceByName(WaterFlowFlexContainer.SHORT_NAME);
+		return waterFlow;
+	}
+	
+	@XmlElement(name="spiLl", required=true, type=SpinLevelFlexContainer.class)
+	private SpinLevelFlexContainer spinLevel;
+	
+	
+	public void setSpinLevel(SpinLevelFlexContainer spinLevel) {
+		this.spinLevel = spinLevel;
+		getFlexContainerOrContainerOrSubscription().add(spinLevel);
+	}
+	
+	public SpinLevelFlexContainer getSpinLevel() {
+		this.spinLevel = (SpinLevelFlexContainer) getResourceByName(SpinLevelFlexContainer.SHORT_NAME);
+		return spinLevel;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceClothesWasherFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceClothesWasherFlexContainerAnnc.java
new file mode 100644
index 0000000..62992aa
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceClothesWasherFlexContainerAnnc.java
@@ -0,0 +1,279 @@
+/*
+Device : DeviceClothesWasherAnnc
+
+
+
+A clothes washer is a home appliance that is used to wash laundry, such as clothing and sheets. This information model provides capabilities to interact with specific functions and resources of clothes washers.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceClothesWasherFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceClothesWasherFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceClothesWasherFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceClothesWasherAnnc";
+	public static final String SHORT_NAME = "deCWrAnnc";
+	
+	public DeviceClothesWasherFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceClothesWasherFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getBinarySwitch();
+		getBinarySwitchAnnc();
+		getTimer();
+		getTimerAnnc();
+		getRunMode();
+		getRunModeAnnc();
+		getTemperature();
+		getTemperatureAnnc();
+		getWaterLevel();
+		getWaterLevelAnnc();
+		getRinseLevel();
+		getRinseLevelAnnc();
+		getWaterFlow();
+		getWaterFlowAnnc();
+		getSpinLevel();
+		getSpinLevelAnnc();
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="binShAnnc", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainerAnnc binarySwitchAnnc;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainerAnnc binarySwitchAnnc) {
+		this.binarySwitchAnnc = binarySwitchAnnc;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitchAnnc);
+	}
+	
+	public BinarySwitchFlexContainerAnnc getBinarySwitchAnnc() {
+		this.binarySwitchAnnc = (BinarySwitchFlexContainerAnnc) getResourceByName(BinarySwitchFlexContainerAnnc.SHORT_NAME);
+		return binarySwitchAnnc;
+	}
+	
+	@XmlElement(name="timer", required=true, type=TimerFlexContainerAnnc.class)
+	private TimerFlexContainer timer;
+	
+	
+	public void setTimer(TimerFlexContainer timer) {
+		this.timer = timer;
+		getFlexContainerOrContainerOrSubscription().add(timer);
+	}
+	
+	public TimerFlexContainer getTimer() {
+		this.timer = (TimerFlexContainer) getResourceByName(TimerFlexContainer.SHORT_NAME);
+		return timer;
+	}
+	
+	@XmlElement(name="timerAnnc", required=true, type=TimerFlexContainerAnnc.class)
+	private TimerFlexContainerAnnc timerAnnc;
+	
+	
+	public void setTimer(TimerFlexContainerAnnc timerAnnc) {
+		this.timerAnnc = timerAnnc;
+		getFlexContainerOrContainerOrSubscription().add(timerAnnc);
+	}
+	
+	public TimerFlexContainerAnnc getTimerAnnc() {
+		this.timerAnnc = (TimerFlexContainerAnnc) getResourceByName(TimerFlexContainerAnnc.SHORT_NAME);
+		return timerAnnc;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="runMeAnnc", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainerAnnc runModeAnnc;
+	
+	
+	public void setRunMode(RunModeFlexContainerAnnc runModeAnnc) {
+		this.runModeAnnc = runModeAnnc;
+		getFlexContainerOrContainerOrSubscription().add(runModeAnnc);
+	}
+	
+	public RunModeFlexContainerAnnc getRunModeAnnc() {
+		this.runModeAnnc = (RunModeFlexContainerAnnc) getResourceByName(RunModeFlexContainerAnnc.SHORT_NAME);
+		return runModeAnnc;
+	}
+	
+	@XmlElement(name="tempe", required=true, type=TemperatureFlexContainerAnnc.class)
+	private TemperatureFlexContainer temperature;
+	
+	
+	public void setTemperature(TemperatureFlexContainer temperature) {
+		this.temperature = temperature;
+		getFlexContainerOrContainerOrSubscription().add(temperature);
+	}
+	
+	public TemperatureFlexContainer getTemperature() {
+		this.temperature = (TemperatureFlexContainer) getResourceByName(TemperatureFlexContainer.SHORT_NAME);
+		return temperature;
+	}
+	
+	@XmlElement(name="tempeAnnc", required=true, type=TemperatureFlexContainerAnnc.class)
+	private TemperatureFlexContainerAnnc temperatureAnnc;
+	
+	
+	public void setTemperature(TemperatureFlexContainerAnnc temperatureAnnc) {
+		this.temperatureAnnc = temperatureAnnc;
+		getFlexContainerOrContainerOrSubscription().add(temperatureAnnc);
+	}
+	
+	public TemperatureFlexContainerAnnc getTemperatureAnnc() {
+		this.temperatureAnnc = (TemperatureFlexContainerAnnc) getResourceByName(TemperatureFlexContainerAnnc.SHORT_NAME);
+		return temperatureAnnc;
+	}
+	
+	@XmlElement(name="watLl", required=true, type=WaterLevelFlexContainerAnnc.class)
+	private WaterLevelFlexContainer waterLevel;
+	
+	
+	public void setWaterLevel(WaterLevelFlexContainer waterLevel) {
+		this.waterLevel = waterLevel;
+		getFlexContainerOrContainerOrSubscription().add(waterLevel);
+	}
+	
+	public WaterLevelFlexContainer getWaterLevel() {
+		this.waterLevel = (WaterLevelFlexContainer) getResourceByName(WaterLevelFlexContainer.SHORT_NAME);
+		return waterLevel;
+	}
+	
+	@XmlElement(name="watLlAnnc", required=true, type=WaterLevelFlexContainerAnnc.class)
+	private WaterLevelFlexContainerAnnc waterLevelAnnc;
+	
+	
+	public void setWaterLevel(WaterLevelFlexContainerAnnc waterLevelAnnc) {
+		this.waterLevelAnnc = waterLevelAnnc;
+		getFlexContainerOrContainerOrSubscription().add(waterLevelAnnc);
+	}
+	
+	public WaterLevelFlexContainerAnnc getWaterLevelAnnc() {
+		this.waterLevelAnnc = (WaterLevelFlexContainerAnnc) getResourceByName(WaterLevelFlexContainerAnnc.SHORT_NAME);
+		return waterLevelAnnc;
+	}
+	
+	@XmlElement(name="rinLl", required=true, type=RinseLevelFlexContainerAnnc.class)
+	private RinseLevelFlexContainer rinseLevel;
+	
+	
+	public void setRinseLevel(RinseLevelFlexContainer rinseLevel) {
+		this.rinseLevel = rinseLevel;
+		getFlexContainerOrContainerOrSubscription().add(rinseLevel);
+	}
+	
+	public RinseLevelFlexContainer getRinseLevel() {
+		this.rinseLevel = (RinseLevelFlexContainer) getResourceByName(RinseLevelFlexContainer.SHORT_NAME);
+		return rinseLevel;
+	}
+	
+	@XmlElement(name="rinLlAnnc", required=true, type=RinseLevelFlexContainerAnnc.class)
+	private RinseLevelFlexContainerAnnc rinseLevelAnnc;
+	
+	
+	public void setRinseLevel(RinseLevelFlexContainerAnnc rinseLevelAnnc) {
+		this.rinseLevelAnnc = rinseLevelAnnc;
+		getFlexContainerOrContainerOrSubscription().add(rinseLevelAnnc);
+	}
+	
+	public RinseLevelFlexContainerAnnc getRinseLevelAnnc() {
+		this.rinseLevelAnnc = (RinseLevelFlexContainerAnnc) getResourceByName(RinseLevelFlexContainerAnnc.SHORT_NAME);
+		return rinseLevelAnnc;
+	}
+	
+	@XmlElement(name="watFw", required=true, type=WaterFlowFlexContainerAnnc.class)
+	private WaterFlowFlexContainer waterFlow;
+	
+	
+	public void setWaterFlow(WaterFlowFlexContainer waterFlow) {
+		this.waterFlow = waterFlow;
+		getFlexContainerOrContainerOrSubscription().add(waterFlow);
+	}
+	
+	public WaterFlowFlexContainer getWaterFlow() {
+		this.waterFlow = (WaterFlowFlexContainer) getResourceByName(WaterFlowFlexContainer.SHORT_NAME);
+		return waterFlow;
+	}
+	
+	@XmlElement(name="watFwAnnc", required=true, type=WaterFlowFlexContainerAnnc.class)
+	private WaterFlowFlexContainerAnnc waterFlowAnnc;
+	
+	
+	public void setWaterFlow(WaterFlowFlexContainerAnnc waterFlowAnnc) {
+		this.waterFlowAnnc = waterFlowAnnc;
+		getFlexContainerOrContainerOrSubscription().add(waterFlowAnnc);
+	}
+	
+	public WaterFlowFlexContainerAnnc getWaterFlowAnnc() {
+		this.waterFlowAnnc = (WaterFlowFlexContainerAnnc) getResourceByName(WaterFlowFlexContainerAnnc.SHORT_NAME);
+		return waterFlowAnnc;
+	}
+	
+	@XmlElement(name="spiLl", required=true, type=SpinLevelFlexContainerAnnc.class)
+	private SpinLevelFlexContainer spinLevel;
+	
+	
+	public void setSpinLevel(SpinLevelFlexContainer spinLevel) {
+		this.spinLevel = spinLevel;
+		getFlexContainerOrContainerOrSubscription().add(spinLevel);
+	}
+	
+	public SpinLevelFlexContainer getSpinLevel() {
+		this.spinLevel = (SpinLevelFlexContainer) getResourceByName(SpinLevelFlexContainer.SHORT_NAME);
+		return spinLevel;
+	}
+	
+	@XmlElement(name="spiLlAnnc", required=true, type=SpinLevelFlexContainerAnnc.class)
+	private SpinLevelFlexContainerAnnc spinLevelAnnc;
+	
+	
+	public void setSpinLevel(SpinLevelFlexContainerAnnc spinLevelAnnc) {
+		this.spinLevelAnnc = spinLevelAnnc;
+		getFlexContainerOrContainerOrSubscription().add(spinLevelAnnc);
+	}
+	
+	public SpinLevelFlexContainerAnnc getSpinLevelAnnc() {
+		this.spinLevelAnnc = (SpinLevelFlexContainerAnnc) getResourceByName(SpinLevelFlexContainerAnnc.SHORT_NAME);
+		return spinLevelAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceCoffeeMachineFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceCoffeeMachineFlexContainer.java
new file mode 100644
index 0000000..bde1fe8
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceCoffeeMachineFlexContainer.java
@@ -0,0 +1,219 @@
+/*
+Device : DeviceCoffeeMachine
+
+
+
+A CoffeeMachine is a device that produces coffee.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceCoffeeMachineFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceCoffeeMachineFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceCoffeeMachineFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceCoffeeMachine";
+	public static final String SHORT_NAME = "deCMe";
+	
+	public DeviceCoffeeMachineFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceCoffeeMachineFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getFaultDetection();
+		getRunMode();
+		getClock();
+		getBrewing();
+		getWaterStatus();
+		getMilkStatus();
+		getBeansStatus();
+		getGrinder();
+		getFoamedMilk();
+		getMilkQuantity();
+		getKeepWarm();
+		getBrewingSwitch();
+	}
+	
+	@XmlElement(name="fauDn", required=true, type=FaultDetectionFlexContainer.class)
+	private FaultDetectionFlexContainer faultDetection;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainer faultDetection) {
+		this.faultDetection = faultDetection;
+		getFlexContainerOrContainerOrSubscription().add(faultDetection);
+	}
+	
+	public FaultDetectionFlexContainer getFaultDetection() {
+		this.faultDetection = (FaultDetectionFlexContainer) getResourceByName(FaultDetectionFlexContainer.SHORT_NAME);
+		return faultDetection;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainer.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="clock", required=true, type=ClockFlexContainer.class)
+	private ClockFlexContainer clock;
+	
+	
+	public void setClock(ClockFlexContainer clock) {
+		this.clock = clock;
+		getFlexContainerOrContainerOrSubscription().add(clock);
+	}
+	
+	public ClockFlexContainer getClock() {
+		this.clock = (ClockFlexContainer) getResourceByName(ClockFlexContainer.SHORT_NAME);
+		return clock;
+	}
+	
+	@XmlElement(name="brewg", required=true, type=BrewingFlexContainer.class)
+	private BrewingFlexContainer brewing;
+	
+	
+	public void setBrewing(BrewingFlexContainer brewing) {
+		this.brewing = brewing;
+		getFlexContainerOrContainerOrSubscription().add(brewing);
+	}
+	
+	public BrewingFlexContainer getBrewing() {
+		this.brewing = (BrewingFlexContainer) getResourceByName(BrewingFlexContainer.SHORT_NAME);
+		return brewing;
+	}
+	
+	@XmlElement(name="watSs", required=true, type=LiquidLevelFlexContainer.class)
+	private LiquidLevelFlexContainer waterStatus;
+	
+	
+	public void setWaterStatus(LiquidLevelFlexContainer waterStatus) {
+		this.waterStatus = waterStatus;
+		getFlexContainerOrContainerOrSubscription().add(waterStatus);
+	}
+	
+	public LiquidLevelFlexContainer getWaterStatus() {
+		this.waterStatus = (LiquidLevelFlexContainer) getResourceByName(LiquidLevelFlexContainer.SHORT_NAME);
+		return waterStatus;
+	}
+	
+	@XmlElement(name="milSs", required=true, type=LiquidLevelFlexContainer.class)
+	private LiquidLevelFlexContainer milkStatus;
+	
+	
+	public void setMilkStatus(LiquidLevelFlexContainer milkStatus) {
+		this.milkStatus = milkStatus;
+		getFlexContainerOrContainerOrSubscription().add(milkStatus);
+	}
+	
+	public LiquidLevelFlexContainer getMilkStatus() {
+		this.milkStatus = (LiquidLevelFlexContainer) getResourceByName(LiquidLevelFlexContainer.SHORT_NAME);
+		return milkStatus;
+	}
+	
+	@XmlElement(name="beaSs", required=true, type=LiquidLevelFlexContainer.class)
+	private LiquidLevelFlexContainer beansStatus;
+	
+	
+	public void setBeansStatus(LiquidLevelFlexContainer beansStatus) {
+		this.beansStatus = beansStatus;
+		getFlexContainerOrContainerOrSubscription().add(beansStatus);
+	}
+	
+	public LiquidLevelFlexContainer getBeansStatus() {
+		this.beansStatus = (LiquidLevelFlexContainer) getResourceByName(LiquidLevelFlexContainer.SHORT_NAME);
+		return beansStatus;
+	}
+	
+	@XmlElement(name="grinr", required=true, type=GrinderFlexContainer.class)
+	private GrinderFlexContainer grinder;
+	
+	
+	public void setGrinder(GrinderFlexContainer grinder) {
+		this.grinder = grinder;
+		getFlexContainerOrContainerOrSubscription().add(grinder);
+	}
+	
+	public GrinderFlexContainer getGrinder() {
+		this.grinder = (GrinderFlexContainer) getResourceByName(GrinderFlexContainer.SHORT_NAME);
+		return grinder;
+	}
+	
+	@XmlElement(name="foaMk", required=true, type=FoamingFlexContainer.class)
+	private FoamingFlexContainer foamedMilk;
+	
+	
+	public void setFoamedMilk(FoamingFlexContainer foamedMilk) {
+		this.foamedMilk = foamedMilk;
+		getFlexContainerOrContainerOrSubscription().add(foamedMilk);
+	}
+	
+	public FoamingFlexContainer getFoamedMilk() {
+		this.foamedMilk = (FoamingFlexContainer) getResourceByName(FoamingFlexContainer.SHORT_NAME);
+		return foamedMilk;
+	}
+	
+	@XmlElement(name="milQy", required=true, type=LiquidLevelFlexContainer.class)
+	private LiquidLevelFlexContainer milkQuantity;
+	
+	
+	public void setMilkQuantity(LiquidLevelFlexContainer milkQuantity) {
+		this.milkQuantity = milkQuantity;
+		getFlexContainerOrContainerOrSubscription().add(milkQuantity);
+	}
+	
+	public LiquidLevelFlexContainer getMilkQuantity() {
+		this.milkQuantity = (LiquidLevelFlexContainer) getResourceByName(LiquidLevelFlexContainer.SHORT_NAME);
+		return milkQuantity;
+	}
+	
+	@XmlElement(name="keeWm", required=true, type=KeepWarmFlexContainer.class)
+	private KeepWarmFlexContainer keepWarm;
+	
+	
+	public void setKeepWarm(KeepWarmFlexContainer keepWarm) {
+		this.keepWarm = keepWarm;
+		getFlexContainerOrContainerOrSubscription().add(keepWarm);
+	}
+	
+	public KeepWarmFlexContainer getKeepWarm() {
+		this.keepWarm = (KeepWarmFlexContainer) getResourceByName(KeepWarmFlexContainer.SHORT_NAME);
+		return keepWarm;
+	}
+	
+	@XmlElement(name="breSh", required=true, type=BinarySwitchFlexContainer.class)
+	private BinarySwitchFlexContainer brewingSwitch;
+	
+	
+	public void setBrewingSwitch(BinarySwitchFlexContainer brewingSwitch) {
+		this.brewingSwitch = brewingSwitch;
+		getFlexContainerOrContainerOrSubscription().add(brewingSwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBrewingSwitch() {
+		this.brewingSwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return brewingSwitch;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceCoffeeMachineFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceCoffeeMachineFlexContainerAnnc.java
new file mode 100644
index 0000000..7817e2d
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceCoffeeMachineFlexContainerAnnc.java
@@ -0,0 +1,399 @@
+/*
+Device : DeviceCoffeeMachineAnnc
+
+
+
+A CoffeeMachine is a device that produces coffee.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceCoffeeMachineFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceCoffeeMachineFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceCoffeeMachineFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceCoffeeMachineAnnc";
+	public static final String SHORT_NAME = "deCMeAnnc";
+	
+	public DeviceCoffeeMachineFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceCoffeeMachineFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getFaultDetection();
+		getFaultDetectionAnnc();
+		getRunMode();
+		getRunModeAnnc();
+		getClock();
+		getClockAnnc();
+		getBrewing();
+		getBrewingAnnc();
+		getWaterStatus();
+		getWaterStatusAnnc();
+		getMilkStatus();
+		getMilkStatusAnnc();
+		getBeansStatus();
+		getBeansStatusAnnc();
+		getGrinder();
+		getGrinderAnnc();
+		getFoamedMilk();
+		getFoamedMilkAnnc();
+		getMilkQuantity();
+		getMilkQuantityAnnc();
+		getKeepWarm();
+		getKeepWarmAnnc();
+		getBrewingSwitch();
+		getBrewingSwitchAnnc();
+	}
+	
+	@XmlElement(name="fauDn", required=true, type=FaultDetectionFlexContainerAnnc.class)
+	private FaultDetectionFlexContainer faultDetection;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainer faultDetection) {
+		this.faultDetection = faultDetection;
+		getFlexContainerOrContainerOrSubscription().add(faultDetection);
+	}
+	
+	public FaultDetectionFlexContainer getFaultDetection() {
+		this.faultDetection = (FaultDetectionFlexContainer) getResourceByName(FaultDetectionFlexContainer.SHORT_NAME);
+		return faultDetection;
+	}
+	
+	@XmlElement(name="fauDnAnnc", required=true, type=FaultDetectionFlexContainerAnnc.class)
+	private FaultDetectionFlexContainerAnnc faultDetectionAnnc;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainerAnnc faultDetectionAnnc) {
+		this.faultDetectionAnnc = faultDetectionAnnc;
+		getFlexContainerOrContainerOrSubscription().add(faultDetectionAnnc);
+	}
+	
+	public FaultDetectionFlexContainerAnnc getFaultDetectionAnnc() {
+		this.faultDetectionAnnc = (FaultDetectionFlexContainerAnnc) getResourceByName(FaultDetectionFlexContainerAnnc.SHORT_NAME);
+		return faultDetectionAnnc;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="runMeAnnc", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainerAnnc runModeAnnc;
+	
+	
+	public void setRunMode(RunModeFlexContainerAnnc runModeAnnc) {
+		this.runModeAnnc = runModeAnnc;
+		getFlexContainerOrContainerOrSubscription().add(runModeAnnc);
+	}
+	
+	public RunModeFlexContainerAnnc getRunModeAnnc() {
+		this.runModeAnnc = (RunModeFlexContainerAnnc) getResourceByName(RunModeFlexContainerAnnc.SHORT_NAME);
+		return runModeAnnc;
+	}
+	
+	@XmlElement(name="clock", required=true, type=ClockFlexContainerAnnc.class)
+	private ClockFlexContainer clock;
+	
+	
+	public void setClock(ClockFlexContainer clock) {
+		this.clock = clock;
+		getFlexContainerOrContainerOrSubscription().add(clock);
+	}
+	
+	public ClockFlexContainer getClock() {
+		this.clock = (ClockFlexContainer) getResourceByName(ClockFlexContainer.SHORT_NAME);
+		return clock;
+	}
+	
+	@XmlElement(name="clockAnnc", required=true, type=ClockFlexContainerAnnc.class)
+	private ClockFlexContainerAnnc clockAnnc;
+	
+	
+	public void setClock(ClockFlexContainerAnnc clockAnnc) {
+		this.clockAnnc = clockAnnc;
+		getFlexContainerOrContainerOrSubscription().add(clockAnnc);
+	}
+	
+	public ClockFlexContainerAnnc getClockAnnc() {
+		this.clockAnnc = (ClockFlexContainerAnnc) getResourceByName(ClockFlexContainerAnnc.SHORT_NAME);
+		return clockAnnc;
+	}
+	
+	@XmlElement(name="brewg", required=true, type=BrewingFlexContainerAnnc.class)
+	private BrewingFlexContainer brewing;
+	
+	
+	public void setBrewing(BrewingFlexContainer brewing) {
+		this.brewing = brewing;
+		getFlexContainerOrContainerOrSubscription().add(brewing);
+	}
+	
+	public BrewingFlexContainer getBrewing() {
+		this.brewing = (BrewingFlexContainer) getResourceByName(BrewingFlexContainer.SHORT_NAME);
+		return brewing;
+	}
+	
+	@XmlElement(name="brewgAnnc", required=true, type=BrewingFlexContainerAnnc.class)
+	private BrewingFlexContainerAnnc brewingAnnc;
+	
+	
+	public void setBrewing(BrewingFlexContainerAnnc brewingAnnc) {
+		this.brewingAnnc = brewingAnnc;
+		getFlexContainerOrContainerOrSubscription().add(brewingAnnc);
+	}
+	
+	public BrewingFlexContainerAnnc getBrewingAnnc() {
+		this.brewingAnnc = (BrewingFlexContainerAnnc) getResourceByName(BrewingFlexContainerAnnc.SHORT_NAME);
+		return brewingAnnc;
+	}
+	
+	@XmlElement(name="watSs", required=true, type=LiquidLevelFlexContainerAnnc.class)
+	private LiquidLevelFlexContainer waterStatus;
+	
+	
+	public void setWaterStatus(LiquidLevelFlexContainer waterStatus) {
+		this.waterStatus = waterStatus;
+		getFlexContainerOrContainerOrSubscription().add(waterStatus);
+	}
+	
+	public LiquidLevelFlexContainer getWaterStatus() {
+		this.waterStatus = (LiquidLevelFlexContainer) getResourceByName(LiquidLevelFlexContainer.SHORT_NAME);
+		return waterStatus;
+	}
+	
+	@XmlElement(name="watSsAnnc", required=true, type=LiquidLevelFlexContainerAnnc.class)
+	private LiquidLevelFlexContainerAnnc waterStatusAnnc;
+	
+	
+	public void setWaterStatus(LiquidLevelFlexContainerAnnc waterStatusAnnc) {
+		this.waterStatusAnnc = waterStatusAnnc;
+		getFlexContainerOrContainerOrSubscription().add(waterStatusAnnc);
+	}
+	
+	public LiquidLevelFlexContainerAnnc getWaterStatusAnnc() {
+		this.waterStatusAnnc = (LiquidLevelFlexContainerAnnc) getResourceByName(LiquidLevelFlexContainerAnnc.SHORT_NAME);
+		return waterStatusAnnc;
+	}
+	
+	@XmlElement(name="milSs", required=true, type=LiquidLevelFlexContainerAnnc.class)
+	private LiquidLevelFlexContainer milkStatus;
+	
+	
+	public void setMilkStatus(LiquidLevelFlexContainer milkStatus) {
+		this.milkStatus = milkStatus;
+		getFlexContainerOrContainerOrSubscription().add(milkStatus);
+	}
+	
+	public LiquidLevelFlexContainer getMilkStatus() {
+		this.milkStatus = (LiquidLevelFlexContainer) getResourceByName(LiquidLevelFlexContainer.SHORT_NAME);
+		return milkStatus;
+	}
+	
+	@XmlElement(name="milSsAnnc", required=true, type=LiquidLevelFlexContainerAnnc.class)
+	private LiquidLevelFlexContainerAnnc milkStatusAnnc;
+	
+	
+	public void setMilkStatus(LiquidLevelFlexContainerAnnc milkStatusAnnc) {
+		this.milkStatusAnnc = milkStatusAnnc;
+		getFlexContainerOrContainerOrSubscription().add(milkStatusAnnc);
+	}
+	
+	public LiquidLevelFlexContainerAnnc getMilkStatusAnnc() {
+		this.milkStatusAnnc = (LiquidLevelFlexContainerAnnc) getResourceByName(LiquidLevelFlexContainerAnnc.SHORT_NAME);
+		return milkStatusAnnc;
+	}
+	
+	@XmlElement(name="beaSs", required=true, type=LiquidLevelFlexContainerAnnc.class)
+	private LiquidLevelFlexContainer beansStatus;
+	
+	
+	public void setBeansStatus(LiquidLevelFlexContainer beansStatus) {
+		this.beansStatus = beansStatus;
+		getFlexContainerOrContainerOrSubscription().add(beansStatus);
+	}
+	
+	public LiquidLevelFlexContainer getBeansStatus() {
+		this.beansStatus = (LiquidLevelFlexContainer) getResourceByName(LiquidLevelFlexContainer.SHORT_NAME);
+		return beansStatus;
+	}
+	
+	@XmlElement(name="beaSsAnnc", required=true, type=LiquidLevelFlexContainerAnnc.class)
+	private LiquidLevelFlexContainerAnnc beansStatusAnnc;
+	
+	
+	public void setBeansStatus(LiquidLevelFlexContainerAnnc beansStatusAnnc) {
+		this.beansStatusAnnc = beansStatusAnnc;
+		getFlexContainerOrContainerOrSubscription().add(beansStatusAnnc);
+	}
+	
+	public LiquidLevelFlexContainerAnnc getBeansStatusAnnc() {
+		this.beansStatusAnnc = (LiquidLevelFlexContainerAnnc) getResourceByName(LiquidLevelFlexContainerAnnc.SHORT_NAME);
+		return beansStatusAnnc;
+	}
+	
+	@XmlElement(name="grinr", required=true, type=GrinderFlexContainerAnnc.class)
+	private GrinderFlexContainer grinder;
+	
+	
+	public void setGrinder(GrinderFlexContainer grinder) {
+		this.grinder = grinder;
+		getFlexContainerOrContainerOrSubscription().add(grinder);
+	}
+	
+	public GrinderFlexContainer getGrinder() {
+		this.grinder = (GrinderFlexContainer) getResourceByName(GrinderFlexContainer.SHORT_NAME);
+		return grinder;
+	}
+	
+	@XmlElement(name="grinrAnnc", required=true, type=GrinderFlexContainerAnnc.class)
+	private GrinderFlexContainerAnnc grinderAnnc;
+	
+	
+	public void setGrinder(GrinderFlexContainerAnnc grinderAnnc) {
+		this.grinderAnnc = grinderAnnc;
+		getFlexContainerOrContainerOrSubscription().add(grinderAnnc);
+	}
+	
+	public GrinderFlexContainerAnnc getGrinderAnnc() {
+		this.grinderAnnc = (GrinderFlexContainerAnnc) getResourceByName(GrinderFlexContainerAnnc.SHORT_NAME);
+		return grinderAnnc;
+	}
+	
+	@XmlElement(name="foaMk", required=true, type=FoamingFlexContainerAnnc.class)
+	private FoamingFlexContainer foamedMilk;
+	
+	
+	public void setFoamedMilk(FoamingFlexContainer foamedMilk) {
+		this.foamedMilk = foamedMilk;
+		getFlexContainerOrContainerOrSubscription().add(foamedMilk);
+	}
+	
+	public FoamingFlexContainer getFoamedMilk() {
+		this.foamedMilk = (FoamingFlexContainer) getResourceByName(FoamingFlexContainer.SHORT_NAME);
+		return foamedMilk;
+	}
+	
+	@XmlElement(name="foaMkAnnc", required=true, type=FoamingFlexContainerAnnc.class)
+	private FoamingFlexContainerAnnc foamedMilkAnnc;
+	
+	
+	public void setFoamedMilk(FoamingFlexContainerAnnc foamedMilkAnnc) {
+		this.foamedMilkAnnc = foamedMilkAnnc;
+		getFlexContainerOrContainerOrSubscription().add(foamedMilkAnnc);
+	}
+	
+	public FoamingFlexContainerAnnc getFoamedMilkAnnc() {
+		this.foamedMilkAnnc = (FoamingFlexContainerAnnc) getResourceByName(FoamingFlexContainerAnnc.SHORT_NAME);
+		return foamedMilkAnnc;
+	}
+	
+	@XmlElement(name="milQy", required=true, type=LiquidLevelFlexContainerAnnc.class)
+	private LiquidLevelFlexContainer milkQuantity;
+	
+	
+	public void setMilkQuantity(LiquidLevelFlexContainer milkQuantity) {
+		this.milkQuantity = milkQuantity;
+		getFlexContainerOrContainerOrSubscription().add(milkQuantity);
+	}
+	
+	public LiquidLevelFlexContainer getMilkQuantity() {
+		this.milkQuantity = (LiquidLevelFlexContainer) getResourceByName(LiquidLevelFlexContainer.SHORT_NAME);
+		return milkQuantity;
+	}
+	
+	@XmlElement(name="milQyAnnc", required=true, type=LiquidLevelFlexContainerAnnc.class)
+	private LiquidLevelFlexContainerAnnc milkQuantityAnnc;
+	
+	
+	public void setMilkQuantity(LiquidLevelFlexContainerAnnc milkQuantityAnnc) {
+		this.milkQuantityAnnc = milkQuantityAnnc;
+		getFlexContainerOrContainerOrSubscription().add(milkQuantityAnnc);
+	}
+	
+	public LiquidLevelFlexContainerAnnc getMilkQuantityAnnc() {
+		this.milkQuantityAnnc = (LiquidLevelFlexContainerAnnc) getResourceByName(LiquidLevelFlexContainerAnnc.SHORT_NAME);
+		return milkQuantityAnnc;
+	}
+	
+	@XmlElement(name="keeWm", required=true, type=KeepWarmFlexContainerAnnc.class)
+	private KeepWarmFlexContainer keepWarm;
+	
+	
+	public void setKeepWarm(KeepWarmFlexContainer keepWarm) {
+		this.keepWarm = keepWarm;
+		getFlexContainerOrContainerOrSubscription().add(keepWarm);
+	}
+	
+	public KeepWarmFlexContainer getKeepWarm() {
+		this.keepWarm = (KeepWarmFlexContainer) getResourceByName(KeepWarmFlexContainer.SHORT_NAME);
+		return keepWarm;
+	}
+	
+	@XmlElement(name="keeWmAnnc", required=true, type=KeepWarmFlexContainerAnnc.class)
+	private KeepWarmFlexContainerAnnc keepWarmAnnc;
+	
+	
+	public void setKeepWarm(KeepWarmFlexContainerAnnc keepWarmAnnc) {
+		this.keepWarmAnnc = keepWarmAnnc;
+		getFlexContainerOrContainerOrSubscription().add(keepWarmAnnc);
+	}
+	
+	public KeepWarmFlexContainerAnnc getKeepWarmAnnc() {
+		this.keepWarmAnnc = (KeepWarmFlexContainerAnnc) getResourceByName(KeepWarmFlexContainerAnnc.SHORT_NAME);
+		return keepWarmAnnc;
+	}
+	
+	@XmlElement(name="breSh", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainer brewingSwitch;
+	
+	
+	public void setBrewingSwitch(BinarySwitchFlexContainer brewingSwitch) {
+		this.brewingSwitch = brewingSwitch;
+		getFlexContainerOrContainerOrSubscription().add(brewingSwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBrewingSwitch() {
+		this.brewingSwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return brewingSwitch;
+	}
+	
+	@XmlElement(name="breShAnnc", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainerAnnc brewingSwitchAnnc;
+	
+	
+	public void setBrewingSwitch(BinarySwitchFlexContainerAnnc brewingSwitchAnnc) {
+		this.brewingSwitchAnnc = brewingSwitchAnnc;
+		getFlexContainerOrContainerOrSubscription().add(brewingSwitchAnnc);
+	}
+	
+	public BinarySwitchFlexContainerAnnc getBrewingSwitchAnnc() {
+		this.brewingSwitchAnnc = (BinarySwitchFlexContainerAnnc) getResourceByName(BinarySwitchFlexContainerAnnc.SHORT_NAME);
+		return brewingSwitchAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceContactDetectorFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceContactDetectorFlexContainer.java
new file mode 100644
index 0000000..61f8ca9
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceContactDetectorFlexContainer.java
@@ -0,0 +1,54 @@
+/*
+Device : DeviceContactDetector
+
+
+
+A ContactDetector is a device that trigger alarm when contact is lost.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceContactDetectorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceContactDetectorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceContactDetectorFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceContactDetector";
+	public static final String SHORT_NAME = "deCDr";
+	
+	public DeviceContactDetectorFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceContactDetectorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getContactSensor();
+	}
+	
+	@XmlElement(name="conSr", required=true, type=ContactSensorFlexContainer.class)
+	private ContactSensorFlexContainer contactSensor;
+	
+	
+	public void setContactSensor(ContactSensorFlexContainer contactSensor) {
+		this.contactSensor = contactSensor;
+		getFlexContainerOrContainerOrSubscription().add(contactSensor);
+	}
+	
+	public ContactSensorFlexContainer getContactSensor() {
+		this.contactSensor = (ContactSensorFlexContainer) getResourceByName(ContactSensorFlexContainer.SHORT_NAME);
+		return contactSensor;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceContactDetectorFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceContactDetectorFlexContainerAnnc.java
new file mode 100644
index 0000000..7fa1d5d
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceContactDetectorFlexContainerAnnc.java
@@ -0,0 +1,69 @@
+/*
+Device : DeviceContactDetectorAnnc
+
+
+
+A ContactDetector is a device that trigger alarm when contact is lost.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceContactDetectorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceContactDetectorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceContactDetectorFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceContactDetectorAnnc";
+	public static final String SHORT_NAME = "deCDrAnnc";
+	
+	public DeviceContactDetectorFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceContactDetectorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getContactSensor();
+		getContactSensorAnnc();
+	}
+	
+	@XmlElement(name="conSr", required=true, type=ContactSensorFlexContainerAnnc.class)
+	private ContactSensorFlexContainer contactSensor;
+	
+	
+	public void setContactSensor(ContactSensorFlexContainer contactSensor) {
+		this.contactSensor = contactSensor;
+		getFlexContainerOrContainerOrSubscription().add(contactSensor);
+	}
+	
+	public ContactSensorFlexContainer getContactSensor() {
+		this.contactSensor = (ContactSensorFlexContainer) getResourceByName(ContactSensorFlexContainer.SHORT_NAME);
+		return contactSensor;
+	}
+	
+	@XmlElement(name="conSrAnnc", required=true, type=ContactSensorFlexContainerAnnc.class)
+	private ContactSensorFlexContainerAnnc contactSensorAnnc;
+	
+	
+	public void setContactSensor(ContactSensorFlexContainerAnnc contactSensorAnnc) {
+		this.contactSensorAnnc = contactSensorAnnc;
+		getFlexContainerOrContainerOrSubscription().add(contactSensorAnnc);
+	}
+	
+	public ContactSensorFlexContainerAnnc getContactSensorAnnc() {
+		this.contactSensorAnnc = (ContactSensorFlexContainerAnnc) getResourceByName(ContactSensorFlexContainerAnnc.SHORT_NAME);
+		return contactSensorAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceDoorFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceDoorFlexContainer.java
new file mode 100644
index 0000000..8333c30
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceDoorFlexContainer.java
@@ -0,0 +1,84 @@
+/*
+Device : DeviceDoor
+
+
+
+A door is a door.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceDoorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceDoorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceDoorFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceDoor";
+	public static final String SHORT_NAME = "devDr";
+	
+	public DeviceDoorFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceDoorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getBattery();
+		getDoorStatus();
+		getLock();
+	}
+	
+	@XmlElement(name="batty", required=true, type=BatteryFlexContainer.class)
+	private BatteryFlexContainer battery;
+	
+	
+	public void setBattery(BatteryFlexContainer battery) {
+		this.battery = battery;
+		getFlexContainerOrContainerOrSubscription().add(battery);
+	}
+	
+	public BatteryFlexContainer getBattery() {
+		this.battery = (BatteryFlexContainer) getResourceByName(BatteryFlexContainer.SHORT_NAME);
+		return battery;
+	}
+	
+	@XmlElement(name="dooSs", required=true, type=DoorStatusFlexContainer.class)
+	private DoorStatusFlexContainer doorStatus;
+	
+	
+	public void setDoorStatus(DoorStatusFlexContainer doorStatus) {
+		this.doorStatus = doorStatus;
+		getFlexContainerOrContainerOrSubscription().add(doorStatus);
+	}
+	
+	public DoorStatusFlexContainer getDoorStatus() {
+		this.doorStatus = (DoorStatusFlexContainer) getResourceByName(DoorStatusFlexContainer.SHORT_NAME);
+		return doorStatus;
+	}
+	
+	@XmlElement(name="lock", required=true, type=LockFlexContainer.class)
+	private LockFlexContainer lock;
+	
+	
+	public void setLock(LockFlexContainer lock) {
+		this.lock = lock;
+		getFlexContainerOrContainerOrSubscription().add(lock);
+	}
+	
+	public LockFlexContainer getLock() {
+		this.lock = (LockFlexContainer) getResourceByName(LockFlexContainer.SHORT_NAME);
+		return lock;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceDoorFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceDoorFlexContainerAnnc.java
new file mode 100644
index 0000000..045ada6
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceDoorFlexContainerAnnc.java
@@ -0,0 +1,129 @@
+/*
+Device : DeviceDoorAnnc
+
+
+
+A door is a door.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceDoorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceDoorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceDoorFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceDoorAnnc";
+	public static final String SHORT_NAME = "devDrAnnc";
+	
+	public DeviceDoorFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceDoorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getBattery();
+		getBatteryAnnc();
+		getDoorStatus();
+		getDoorStatusAnnc();
+		getLock();
+		getLockAnnc();
+	}
+	
+	@XmlElement(name="batty", required=true, type=BatteryFlexContainerAnnc.class)
+	private BatteryFlexContainer battery;
+	
+	
+	public void setBattery(BatteryFlexContainer battery) {
+		this.battery = battery;
+		getFlexContainerOrContainerOrSubscription().add(battery);
+	}
+	
+	public BatteryFlexContainer getBattery() {
+		this.battery = (BatteryFlexContainer) getResourceByName(BatteryFlexContainer.SHORT_NAME);
+		return battery;
+	}
+	
+	@XmlElement(name="battyAnnc", required=true, type=BatteryFlexContainerAnnc.class)
+	private BatteryFlexContainerAnnc batteryAnnc;
+	
+	
+	public void setBattery(BatteryFlexContainerAnnc batteryAnnc) {
+		this.batteryAnnc = batteryAnnc;
+		getFlexContainerOrContainerOrSubscription().add(batteryAnnc);
+	}
+	
+	public BatteryFlexContainerAnnc getBatteryAnnc() {
+		this.batteryAnnc = (BatteryFlexContainerAnnc) getResourceByName(BatteryFlexContainerAnnc.SHORT_NAME);
+		return batteryAnnc;
+	}
+	
+	@XmlElement(name="dooSs", required=true, type=DoorStatusFlexContainerAnnc.class)
+	private DoorStatusFlexContainer doorStatus;
+	
+	
+	public void setDoorStatus(DoorStatusFlexContainer doorStatus) {
+		this.doorStatus = doorStatus;
+		getFlexContainerOrContainerOrSubscription().add(doorStatus);
+	}
+	
+	public DoorStatusFlexContainer getDoorStatus() {
+		this.doorStatus = (DoorStatusFlexContainer) getResourceByName(DoorStatusFlexContainer.SHORT_NAME);
+		return doorStatus;
+	}
+	
+	@XmlElement(name="dooSsAnnc", required=true, type=DoorStatusFlexContainerAnnc.class)
+	private DoorStatusFlexContainerAnnc doorStatusAnnc;
+	
+	
+	public void setDoorStatus(DoorStatusFlexContainerAnnc doorStatusAnnc) {
+		this.doorStatusAnnc = doorStatusAnnc;
+		getFlexContainerOrContainerOrSubscription().add(doorStatusAnnc);
+	}
+	
+	public DoorStatusFlexContainerAnnc getDoorStatusAnnc() {
+		this.doorStatusAnnc = (DoorStatusFlexContainerAnnc) getResourceByName(DoorStatusFlexContainerAnnc.SHORT_NAME);
+		return doorStatusAnnc;
+	}
+	
+	@XmlElement(name="lock", required=true, type=LockFlexContainerAnnc.class)
+	private LockFlexContainer lock;
+	
+	
+	public void setLock(LockFlexContainer lock) {
+		this.lock = lock;
+		getFlexContainerOrContainerOrSubscription().add(lock);
+	}
+	
+	public LockFlexContainer getLock() {
+		this.lock = (LockFlexContainer) getResourceByName(LockFlexContainer.SHORT_NAME);
+		return lock;
+	}
+	
+	@XmlElement(name="lockAnnc", required=true, type=LockFlexContainerAnnc.class)
+	private LockFlexContainerAnnc lockAnnc;
+	
+	
+	public void setLock(LockFlexContainerAnnc lockAnnc) {
+		this.lockAnnc = lockAnnc;
+		getFlexContainerOrContainerOrSubscription().add(lockAnnc);
+	}
+	
+	public LockFlexContainerAnnc getLockAnnc() {
+		this.lockAnnc = (LockFlexContainerAnnc) getResourceByName(LockFlexContainerAnnc.SHORT_NAME);
+		return lockAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceElectricVehicleChargerFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceElectricVehicleChargerFlexContainer.java
new file mode 100644
index 0000000..0da5231
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceElectricVehicleChargerFlexContainer.java
@@ -0,0 +1,114 @@
+/*
+Device : DeviceElectricVehicleCharger
+
+
+
+An electric vehicle charger is a device that is used for charging or discharging electric vehicles.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceElectricVehicleChargerFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceElectricVehicleChargerFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceElectricVehicleChargerFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceElectricVehicleCharger";
+	public static final String SHORT_NAME = "dEVCr";
+	
+	public DeviceElectricVehicleChargerFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceElectricVehicleChargerFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getFaultDetection();
+		getBinarySwitch();
+		getRunMode();
+		getBattery();
+		getElectricVehicleConnector();
+	}
+	
+	@XmlElement(name="fauDn", required=true, type=FaultDetectionFlexContainer.class)
+	private FaultDetectionFlexContainer faultDetection;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainer faultDetection) {
+		this.faultDetection = faultDetection;
+		getFlexContainerOrContainerOrSubscription().add(faultDetection);
+	}
+	
+	public FaultDetectionFlexContainer getFaultDetection() {
+		this.faultDetection = (FaultDetectionFlexContainer) getResourceByName(FaultDetectionFlexContainer.SHORT_NAME);
+		return faultDetection;
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainer.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainer.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="batty", required=true, type=BatteryFlexContainer.class)
+	private BatteryFlexContainer battery;
+	
+	
+	public void setBattery(BatteryFlexContainer battery) {
+		this.battery = battery;
+		getFlexContainerOrContainerOrSubscription().add(battery);
+	}
+	
+	public BatteryFlexContainer getBattery() {
+		this.battery = (BatteryFlexContainer) getResourceByName(BatteryFlexContainer.SHORT_NAME);
+		return battery;
+	}
+	
+	@XmlElement(name="elVCr", required=true, type=ElectricVehicleConnectorFlexContainer.class)
+	private ElectricVehicleConnectorFlexContainer electricVehicleConnector;
+	
+	
+	public void setElectricVehicleConnector(ElectricVehicleConnectorFlexContainer electricVehicleConnector) {
+		this.electricVehicleConnector = electricVehicleConnector;
+		getFlexContainerOrContainerOrSubscription().add(electricVehicleConnector);
+	}
+	
+	public ElectricVehicleConnectorFlexContainer getElectricVehicleConnector() {
+		this.electricVehicleConnector = (ElectricVehicleConnectorFlexContainer) getResourceByName(ElectricVehicleConnectorFlexContainer.SHORT_NAME);
+		return electricVehicleConnector;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceElectricVehicleChargerFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceElectricVehicleChargerFlexContainerAnnc.java
new file mode 100644
index 0000000..1f83edf
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceElectricVehicleChargerFlexContainerAnnc.java
@@ -0,0 +1,189 @@
+/*
+Device : DeviceElectricVehicleChargerAnnc
+
+
+
+An electric vehicle charger is a device that is used for charging or discharging electric vehicles.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceElectricVehicleChargerFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceElectricVehicleChargerFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceElectricVehicleChargerFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceElectricVehicleChargerAnnc";
+	public static final String SHORT_NAME = "dEVCrAnnc";
+	
+	public DeviceElectricVehicleChargerFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceElectricVehicleChargerFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getFaultDetection();
+		getFaultDetectionAnnc();
+		getBinarySwitch();
+		getBinarySwitchAnnc();
+		getRunMode();
+		getRunModeAnnc();
+		getBattery();
+		getBatteryAnnc();
+		getElectricVehicleConnector();
+		getElectricVehicleConnectorAnnc();
+	}
+	
+	@XmlElement(name="fauDn", required=true, type=FaultDetectionFlexContainerAnnc.class)
+	private FaultDetectionFlexContainer faultDetection;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainer faultDetection) {
+		this.faultDetection = faultDetection;
+		getFlexContainerOrContainerOrSubscription().add(faultDetection);
+	}
+	
+	public FaultDetectionFlexContainer getFaultDetection() {
+		this.faultDetection = (FaultDetectionFlexContainer) getResourceByName(FaultDetectionFlexContainer.SHORT_NAME);
+		return faultDetection;
+	}
+	
+	@XmlElement(name="fauDnAnnc", required=true, type=FaultDetectionFlexContainerAnnc.class)
+	private FaultDetectionFlexContainerAnnc faultDetectionAnnc;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainerAnnc faultDetectionAnnc) {
+		this.faultDetectionAnnc = faultDetectionAnnc;
+		getFlexContainerOrContainerOrSubscription().add(faultDetectionAnnc);
+	}
+	
+	public FaultDetectionFlexContainerAnnc getFaultDetectionAnnc() {
+		this.faultDetectionAnnc = (FaultDetectionFlexContainerAnnc) getResourceByName(FaultDetectionFlexContainerAnnc.SHORT_NAME);
+		return faultDetectionAnnc;
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="binShAnnc", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainerAnnc binarySwitchAnnc;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainerAnnc binarySwitchAnnc) {
+		this.binarySwitchAnnc = binarySwitchAnnc;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitchAnnc);
+	}
+	
+	public BinarySwitchFlexContainerAnnc getBinarySwitchAnnc() {
+		this.binarySwitchAnnc = (BinarySwitchFlexContainerAnnc) getResourceByName(BinarySwitchFlexContainerAnnc.SHORT_NAME);
+		return binarySwitchAnnc;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="runMeAnnc", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainerAnnc runModeAnnc;
+	
+	
+	public void setRunMode(RunModeFlexContainerAnnc runModeAnnc) {
+		this.runModeAnnc = runModeAnnc;
+		getFlexContainerOrContainerOrSubscription().add(runModeAnnc);
+	}
+	
+	public RunModeFlexContainerAnnc getRunModeAnnc() {
+		this.runModeAnnc = (RunModeFlexContainerAnnc) getResourceByName(RunModeFlexContainerAnnc.SHORT_NAME);
+		return runModeAnnc;
+	}
+	
+	@XmlElement(name="batty", required=true, type=BatteryFlexContainerAnnc.class)
+	private BatteryFlexContainer battery;
+	
+	
+	public void setBattery(BatteryFlexContainer battery) {
+		this.battery = battery;
+		getFlexContainerOrContainerOrSubscription().add(battery);
+	}
+	
+	public BatteryFlexContainer getBattery() {
+		this.battery = (BatteryFlexContainer) getResourceByName(BatteryFlexContainer.SHORT_NAME);
+		return battery;
+	}
+	
+	@XmlElement(name="battyAnnc", required=true, type=BatteryFlexContainerAnnc.class)
+	private BatteryFlexContainerAnnc batteryAnnc;
+	
+	
+	public void setBattery(BatteryFlexContainerAnnc batteryAnnc) {
+		this.batteryAnnc = batteryAnnc;
+		getFlexContainerOrContainerOrSubscription().add(batteryAnnc);
+	}
+	
+	public BatteryFlexContainerAnnc getBatteryAnnc() {
+		this.batteryAnnc = (BatteryFlexContainerAnnc) getResourceByName(BatteryFlexContainerAnnc.SHORT_NAME);
+		return batteryAnnc;
+	}
+	
+	@XmlElement(name="elVCr", required=true, type=ElectricVehicleConnectorFlexContainerAnnc.class)
+	private ElectricVehicleConnectorFlexContainer electricVehicleConnector;
+	
+	
+	public void setElectricVehicleConnector(ElectricVehicleConnectorFlexContainer electricVehicleConnector) {
+		this.electricVehicleConnector = electricVehicleConnector;
+		getFlexContainerOrContainerOrSubscription().add(electricVehicleConnector);
+	}
+	
+	public ElectricVehicleConnectorFlexContainer getElectricVehicleConnector() {
+		this.electricVehicleConnector = (ElectricVehicleConnectorFlexContainer) getResourceByName(ElectricVehicleConnectorFlexContainer.SHORT_NAME);
+		return electricVehicleConnector;
+	}
+	
+	@XmlElement(name="elVCrAnnc", required=true, type=ElectricVehicleConnectorFlexContainerAnnc.class)
+	private ElectricVehicleConnectorFlexContainerAnnc electricVehicleConnectorAnnc;
+	
+	
+	public void setElectricVehicleConnector(ElectricVehicleConnectorFlexContainerAnnc electricVehicleConnectorAnnc) {
+		this.electricVehicleConnectorAnnc = electricVehicleConnectorAnnc;
+		getFlexContainerOrContainerOrSubscription().add(electricVehicleConnectorAnnc);
+	}
+	
+	public ElectricVehicleConnectorFlexContainerAnnc getElectricVehicleConnectorAnnc() {
+		this.electricVehicleConnectorAnnc = (ElectricVehicleConnectorFlexContainerAnnc) getResourceByName(ElectricVehicleConnectorFlexContainerAnnc.SHORT_NAME);
+		return electricVehicleConnectorAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceFloodDetectorFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceFloodDetectorFlexContainer.java
new file mode 100644
index 0000000..4b68cd0
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceFloodDetectorFlexContainer.java
@@ -0,0 +1,54 @@
+/*
+Device : DeviceFloodDetector
+
+
+
+A door is a door.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceFloodDetectorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceFloodDetectorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceFloodDetectorFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceFloodDetector";
+	public static final String SHORT_NAME = "deFDr";
+	
+	public DeviceFloodDetectorFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceFloodDetectorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getWaterSensor();
+	}
+	
+	@XmlElement(name="watSr", required=true, type=WaterSensorFlexContainer.class)
+	private WaterSensorFlexContainer waterSensor;
+	
+	
+	public void setWaterSensor(WaterSensorFlexContainer waterSensor) {
+		this.waterSensor = waterSensor;
+		getFlexContainerOrContainerOrSubscription().add(waterSensor);
+	}
+	
+	public WaterSensorFlexContainer getWaterSensor() {
+		this.waterSensor = (WaterSensorFlexContainer) getResourceByName(WaterSensorFlexContainer.SHORT_NAME);
+		return waterSensor;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceFloodDetectorFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceFloodDetectorFlexContainerAnnc.java
new file mode 100644
index 0000000..8c956d9
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceFloodDetectorFlexContainerAnnc.java
@@ -0,0 +1,69 @@
+/*
+Device : DeviceFloodDetectorAnnc
+
+
+
+A door is a door.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceFloodDetectorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceFloodDetectorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceFloodDetectorFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceFloodDetectorAnnc";
+	public static final String SHORT_NAME = "deFDrAnnc";
+	
+	public DeviceFloodDetectorFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceFloodDetectorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getWaterSensor();
+		getWaterSensorAnnc();
+	}
+	
+	@XmlElement(name="watSr", required=true, type=WaterSensorFlexContainerAnnc.class)
+	private WaterSensorFlexContainer waterSensor;
+	
+	
+	public void setWaterSensor(WaterSensorFlexContainer waterSensor) {
+		this.waterSensor = waterSensor;
+		getFlexContainerOrContainerOrSubscription().add(waterSensor);
+	}
+	
+	public WaterSensorFlexContainer getWaterSensor() {
+		this.waterSensor = (WaterSensorFlexContainer) getResourceByName(WaterSensorFlexContainer.SHORT_NAME);
+		return waterSensor;
+	}
+	
+	@XmlElement(name="watSrAnnc", required=true, type=WaterSensorFlexContainerAnnc.class)
+	private WaterSensorFlexContainerAnnc waterSensorAnnc;
+	
+	
+	public void setWaterSensor(WaterSensorFlexContainerAnnc waterSensorAnnc) {
+		this.waterSensorAnnc = waterSensorAnnc;
+		getFlexContainerOrContainerOrSubscription().add(waterSensorAnnc);
+	}
+	
+	public WaterSensorFlexContainerAnnc getWaterSensorAnnc() {
+		this.waterSensorAnnc = (WaterSensorFlexContainerAnnc) getResourceByName(WaterSensorFlexContainerAnnc.SHORT_NAME);
+		return waterSensorAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceGasValveFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceGasValveFlexContainer.java
new file mode 100644
index 0000000..b8f7d29
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceGasValveFlexContainer.java
@@ -0,0 +1,69 @@
+/*
+Device : DeviceGasValve
+
+
+
+A gas valve is a device that is used to open/close a gas valve.
+
+Created: 2017-08-09 15:38:06
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceGasValveFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceGasValveFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceGasValveFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceGasValve";
+	public static final String SHORT_NAME = "deGVe";
+	
+	public DeviceGasValveFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceGasValveFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getFaultDetection();
+		getBinarySwitch();
+	}
+	
+	@XmlElement(name="fauDn", required=true, type=FaultDetectionFlexContainer.class)
+	private FaultDetectionFlexContainer faultDetection;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainer faultDetection) {
+		this.faultDetection = faultDetection;
+		getFlexContainerOrContainerOrSubscription().add(faultDetection);
+	}
+	
+	public FaultDetectionFlexContainer getFaultDetection() {
+		this.faultDetection = (FaultDetectionFlexContainer) getResourceByName(FaultDetectionFlexContainer.SHORT_NAME);
+		return faultDetection;
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainer.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceGasValveFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceGasValveFlexContainerAnnc.java
new file mode 100644
index 0000000..bfad69a
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceGasValveFlexContainerAnnc.java
@@ -0,0 +1,99 @@
+/*
+Device : DeviceGasValveAnnc
+
+
+
+A gas valve is a device that is used to open/close a gas valve.
+
+Created: 2017-08-09 15:38:06
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceGasValveFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceGasValveFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceGasValveFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceGasValveAnnc";
+	public static final String SHORT_NAME = "deGVeAnnc";
+	
+	public DeviceGasValveFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceGasValveFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getFaultDetection();
+		getFaultDetectionAnnc();
+		getBinarySwitch();
+		getBinarySwitchAnnc();
+	}
+	
+	@XmlElement(name="fauDn", required=true, type=FaultDetectionFlexContainerAnnc.class)
+	private FaultDetectionFlexContainer faultDetection;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainer faultDetection) {
+		this.faultDetection = faultDetection;
+		getFlexContainerOrContainerOrSubscription().add(faultDetection);
+	}
+	
+	public FaultDetectionFlexContainer getFaultDetection() {
+		this.faultDetection = (FaultDetectionFlexContainer) getResourceByName(FaultDetectionFlexContainer.SHORT_NAME);
+		return faultDetection;
+	}
+	
+	@XmlElement(name="fauDnAnnc", required=true, type=FaultDetectionFlexContainerAnnc.class)
+	private FaultDetectionFlexContainerAnnc faultDetectionAnnc;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainerAnnc faultDetectionAnnc) {
+		this.faultDetectionAnnc = faultDetectionAnnc;
+		getFlexContainerOrContainerOrSubscription().add(faultDetectionAnnc);
+	}
+	
+	public FaultDetectionFlexContainerAnnc getFaultDetectionAnnc() {
+		this.faultDetectionAnnc = (FaultDetectionFlexContainerAnnc) getResourceByName(FaultDetectionFlexContainerAnnc.SHORT_NAME);
+		return faultDetectionAnnc;
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="binShAnnc", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainerAnnc binarySwitchAnnc;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainerAnnc binarySwitchAnnc) {
+		this.binarySwitchAnnc = binarySwitchAnnc;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitchAnnc);
+	}
+	
+	public BinarySwitchFlexContainerAnnc getBinarySwitchAnnc() {
+		this.binarySwitchAnnc = (BinarySwitchFlexContainerAnnc) getResourceByName(BinarySwitchFlexContainerAnnc.SHORT_NAME);
+		return binarySwitchAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceLightFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceLightFlexContainer.java
new file mode 100644
index 0000000..5e8b15b
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceLightFlexContainer.java
@@ -0,0 +1,129 @@
+/*
+Device : DeviceLight
+
+
+
+A light is a device that is used to control the state of an illumination device.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceLightFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceLightFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceLightFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceLight";
+	public static final String SHORT_NAME = "devLt";
+	
+	public DeviceLightFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceLightFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getFaultDetection();
+		getBinarySwitch();
+		getRunMode();
+		getColour();
+		getColourSaturation();
+		getBrightness();
+	}
+	
+	@XmlElement(name="fauDn", required=true, type=FaultDetectionFlexContainer.class)
+	private FaultDetectionFlexContainer faultDetection;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainer faultDetection) {
+		this.faultDetection = faultDetection;
+		getFlexContainerOrContainerOrSubscription().add(faultDetection);
+	}
+	
+	public FaultDetectionFlexContainer getFaultDetection() {
+		this.faultDetection = (FaultDetectionFlexContainer) getResourceByName(FaultDetectionFlexContainer.SHORT_NAME);
+		return faultDetection;
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainer.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainer.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="color", required=true, type=ColourFlexContainer.class)
+	private ColourFlexContainer colour;
+	
+	
+	public void setColour(ColourFlexContainer colour) {
+		this.colour = colour;
+		getFlexContainerOrContainerOrSubscription().add(colour);
+	}
+	
+	public ColourFlexContainer getColour() {
+		this.colour = (ColourFlexContainer) getResourceByName(ColourFlexContainer.SHORT_NAME);
+		return colour;
+	}
+	
+	@XmlElement(name="colSn", required=true, type=ColourSaturationFlexContainer.class)
+	private ColourSaturationFlexContainer colourSaturation;
+	
+	
+	public void setColourSaturation(ColourSaturationFlexContainer colourSaturation) {
+		this.colourSaturation = colourSaturation;
+		getFlexContainerOrContainerOrSubscription().add(colourSaturation);
+	}
+	
+	public ColourSaturationFlexContainer getColourSaturation() {
+		this.colourSaturation = (ColourSaturationFlexContainer) getResourceByName(ColourSaturationFlexContainer.SHORT_NAME);
+		return colourSaturation;
+	}
+	
+	@XmlElement(name="brigs", required=true, type=BrightnessFlexContainer.class)
+	private BrightnessFlexContainer brightness;
+	
+	
+	public void setBrightness(BrightnessFlexContainer brightness) {
+		this.brightness = brightness;
+		getFlexContainerOrContainerOrSubscription().add(brightness);
+	}
+	
+	public BrightnessFlexContainer getBrightness() {
+		this.brightness = (BrightnessFlexContainer) getResourceByName(BrightnessFlexContainer.SHORT_NAME);
+		return brightness;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceLightFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceLightFlexContainerAnnc.java
new file mode 100644
index 0000000..39c53b2
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceLightFlexContainerAnnc.java
@@ -0,0 +1,219 @@
+/*
+Device : DeviceLightAnnc
+
+
+
+A light is a device that is used to control the state of an illumination device.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceLightFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceLightFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceLightFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceLightAnnc";
+	public static final String SHORT_NAME = "devLtAnnc";
+	
+	public DeviceLightFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceLightFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getFaultDetection();
+		getFaultDetectionAnnc();
+		getBinarySwitch();
+		getBinarySwitchAnnc();
+		getRunMode();
+		getRunModeAnnc();
+		getColour();
+		getColourAnnc();
+		getColourSaturation();
+		getColourSaturationAnnc();
+		getBrightness();
+		getBrightnessAnnc();
+	}
+	
+	@XmlElement(name="fauDn", required=true, type=FaultDetectionFlexContainerAnnc.class)
+	private FaultDetectionFlexContainer faultDetection;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainer faultDetection) {
+		this.faultDetection = faultDetection;
+		getFlexContainerOrContainerOrSubscription().add(faultDetection);
+	}
+	
+	public FaultDetectionFlexContainer getFaultDetection() {
+		this.faultDetection = (FaultDetectionFlexContainer) getResourceByName(FaultDetectionFlexContainer.SHORT_NAME);
+		return faultDetection;
+	}
+	
+	@XmlElement(name="fauDnAnnc", required=true, type=FaultDetectionFlexContainerAnnc.class)
+	private FaultDetectionFlexContainerAnnc faultDetectionAnnc;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainerAnnc faultDetectionAnnc) {
+		this.faultDetectionAnnc = faultDetectionAnnc;
+		getFlexContainerOrContainerOrSubscription().add(faultDetectionAnnc);
+	}
+	
+	public FaultDetectionFlexContainerAnnc getFaultDetectionAnnc() {
+		this.faultDetectionAnnc = (FaultDetectionFlexContainerAnnc) getResourceByName(FaultDetectionFlexContainerAnnc.SHORT_NAME);
+		return faultDetectionAnnc;
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="binShAnnc", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainerAnnc binarySwitchAnnc;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainerAnnc binarySwitchAnnc) {
+		this.binarySwitchAnnc = binarySwitchAnnc;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitchAnnc);
+	}
+	
+	public BinarySwitchFlexContainerAnnc getBinarySwitchAnnc() {
+		this.binarySwitchAnnc = (BinarySwitchFlexContainerAnnc) getResourceByName(BinarySwitchFlexContainerAnnc.SHORT_NAME);
+		return binarySwitchAnnc;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="runMeAnnc", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainerAnnc runModeAnnc;
+	
+	
+	public void setRunMode(RunModeFlexContainerAnnc runModeAnnc) {
+		this.runModeAnnc = runModeAnnc;
+		getFlexContainerOrContainerOrSubscription().add(runModeAnnc);
+	}
+	
+	public RunModeFlexContainerAnnc getRunModeAnnc() {
+		this.runModeAnnc = (RunModeFlexContainerAnnc) getResourceByName(RunModeFlexContainerAnnc.SHORT_NAME);
+		return runModeAnnc;
+	}
+	
+	@XmlElement(name="color", required=true, type=ColourFlexContainerAnnc.class)
+	private ColourFlexContainer colour;
+	
+	
+	public void setColour(ColourFlexContainer colour) {
+		this.colour = colour;
+		getFlexContainerOrContainerOrSubscription().add(colour);
+	}
+	
+	public ColourFlexContainer getColour() {
+		this.colour = (ColourFlexContainer) getResourceByName(ColourFlexContainer.SHORT_NAME);
+		return colour;
+	}
+	
+	@XmlElement(name="colorAnnc", required=true, type=ColourFlexContainerAnnc.class)
+	private ColourFlexContainerAnnc colourAnnc;
+	
+	
+	public void setColour(ColourFlexContainerAnnc colourAnnc) {
+		this.colourAnnc = colourAnnc;
+		getFlexContainerOrContainerOrSubscription().add(colourAnnc);
+	}
+	
+	public ColourFlexContainerAnnc getColourAnnc() {
+		this.colourAnnc = (ColourFlexContainerAnnc) getResourceByName(ColourFlexContainerAnnc.SHORT_NAME);
+		return colourAnnc;
+	}
+	
+	@XmlElement(name="colSn", required=true, type=ColourSaturationFlexContainerAnnc.class)
+	private ColourSaturationFlexContainer colourSaturation;
+	
+	
+	public void setColourSaturation(ColourSaturationFlexContainer colourSaturation) {
+		this.colourSaturation = colourSaturation;
+		getFlexContainerOrContainerOrSubscription().add(colourSaturation);
+	}
+	
+	public ColourSaturationFlexContainer getColourSaturation() {
+		this.colourSaturation = (ColourSaturationFlexContainer) getResourceByName(ColourSaturationFlexContainer.SHORT_NAME);
+		return colourSaturation;
+	}
+	
+	@XmlElement(name="colSnAnnc", required=true, type=ColourSaturationFlexContainerAnnc.class)
+	private ColourSaturationFlexContainerAnnc colourSaturationAnnc;
+	
+	
+	public void setColourSaturation(ColourSaturationFlexContainerAnnc colourSaturationAnnc) {
+		this.colourSaturationAnnc = colourSaturationAnnc;
+		getFlexContainerOrContainerOrSubscription().add(colourSaturationAnnc);
+	}
+	
+	public ColourSaturationFlexContainerAnnc getColourSaturationAnnc() {
+		this.colourSaturationAnnc = (ColourSaturationFlexContainerAnnc) getResourceByName(ColourSaturationFlexContainerAnnc.SHORT_NAME);
+		return colourSaturationAnnc;
+	}
+	
+	@XmlElement(name="brigs", required=true, type=BrightnessFlexContainerAnnc.class)
+	private BrightnessFlexContainer brightness;
+	
+	
+	public void setBrightness(BrightnessFlexContainer brightness) {
+		this.brightness = brightness;
+		getFlexContainerOrContainerOrSubscription().add(brightness);
+	}
+	
+	public BrightnessFlexContainer getBrightness() {
+		this.brightness = (BrightnessFlexContainer) getResourceByName(BrightnessFlexContainer.SHORT_NAME);
+		return brightness;
+	}
+	
+	@XmlElement(name="brigsAnnc", required=true, type=BrightnessFlexContainerAnnc.class)
+	private BrightnessFlexContainerAnnc brightnessAnnc;
+	
+	
+	public void setBrightness(BrightnessFlexContainerAnnc brightnessAnnc) {
+		this.brightnessAnnc = brightnessAnnc;
+		getFlexContainerOrContainerOrSubscription().add(brightnessAnnc);
+	}
+	
+	public BrightnessFlexContainerAnnc getBrightnessAnnc() {
+		this.brightnessAnnc = (BrightnessFlexContainerAnnc) getResourceByName(BrightnessFlexContainerAnnc.SHORT_NAME);
+		return brightnessAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceMicrogenerationFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceMicrogenerationFlexContainer.java
new file mode 100644
index 0000000..6ddf6e1
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceMicrogenerationFlexContainer.java
@@ -0,0 +1,99 @@
+/*
+Device : DeviceMicrogeneration
+
+
+
+A microgeneration is a Home Energy Management System (HEMS) device that is used to create energy. Examples of microgeneration devices are photovoltaics device or fuel cells.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceMicrogenerationFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceMicrogenerationFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceMicrogenerationFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceMicrogeneration";
+	public static final String SHORT_NAME = "devMn";
+	
+	public DeviceMicrogenerationFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceMicrogenerationFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getFaultDetection();
+		getBinarySwitch();
+		getRunMode();
+		getEnergyGeneration();
+	}
+	
+	@XmlElement(name="fauDn", required=true, type=FaultDetectionFlexContainer.class)
+	private FaultDetectionFlexContainer faultDetection;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainer faultDetection) {
+		this.faultDetection = faultDetection;
+		getFlexContainerOrContainerOrSubscription().add(faultDetection);
+	}
+	
+	public FaultDetectionFlexContainer getFaultDetection() {
+		this.faultDetection = (FaultDetectionFlexContainer) getResourceByName(FaultDetectionFlexContainer.SHORT_NAME);
+		return faultDetection;
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainer.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainer.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="eneGn", required=true, type=EnergyGenerationFlexContainer.class)
+	private EnergyGenerationFlexContainer energyGeneration;
+	
+	
+	public void setEnergyGeneration(EnergyGenerationFlexContainer energyGeneration) {
+		this.energyGeneration = energyGeneration;
+		getFlexContainerOrContainerOrSubscription().add(energyGeneration);
+	}
+	
+	public EnergyGenerationFlexContainer getEnergyGeneration() {
+		this.energyGeneration = (EnergyGenerationFlexContainer) getResourceByName(EnergyGenerationFlexContainer.SHORT_NAME);
+		return energyGeneration;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceMicrogenerationFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceMicrogenerationFlexContainerAnnc.java
new file mode 100644
index 0000000..8938574
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceMicrogenerationFlexContainerAnnc.java
@@ -0,0 +1,159 @@
+/*
+Device : DeviceMicrogenerationAnnc
+
+
+
+A microgeneration is a Home Energy Management System (HEMS) device that is used to create energy. Examples of microgeneration devices are photovoltaics device or fuel cells.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceMicrogenerationFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceMicrogenerationFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceMicrogenerationFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceMicrogenerationAnnc";
+	public static final String SHORT_NAME = "devMnAnnc";
+	
+	public DeviceMicrogenerationFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceMicrogenerationFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getFaultDetection();
+		getFaultDetectionAnnc();
+		getBinarySwitch();
+		getBinarySwitchAnnc();
+		getRunMode();
+		getRunModeAnnc();
+		getEnergyGeneration();
+		getEnergyGenerationAnnc();
+	}
+	
+	@XmlElement(name="fauDn", required=true, type=FaultDetectionFlexContainerAnnc.class)
+	private FaultDetectionFlexContainer faultDetection;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainer faultDetection) {
+		this.faultDetection = faultDetection;
+		getFlexContainerOrContainerOrSubscription().add(faultDetection);
+	}
+	
+	public FaultDetectionFlexContainer getFaultDetection() {
+		this.faultDetection = (FaultDetectionFlexContainer) getResourceByName(FaultDetectionFlexContainer.SHORT_NAME);
+		return faultDetection;
+	}
+	
+	@XmlElement(name="fauDnAnnc", required=true, type=FaultDetectionFlexContainerAnnc.class)
+	private FaultDetectionFlexContainerAnnc faultDetectionAnnc;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainerAnnc faultDetectionAnnc) {
+		this.faultDetectionAnnc = faultDetectionAnnc;
+		getFlexContainerOrContainerOrSubscription().add(faultDetectionAnnc);
+	}
+	
+	public FaultDetectionFlexContainerAnnc getFaultDetectionAnnc() {
+		this.faultDetectionAnnc = (FaultDetectionFlexContainerAnnc) getResourceByName(FaultDetectionFlexContainerAnnc.SHORT_NAME);
+		return faultDetectionAnnc;
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="binShAnnc", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainerAnnc binarySwitchAnnc;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainerAnnc binarySwitchAnnc) {
+		this.binarySwitchAnnc = binarySwitchAnnc;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitchAnnc);
+	}
+	
+	public BinarySwitchFlexContainerAnnc getBinarySwitchAnnc() {
+		this.binarySwitchAnnc = (BinarySwitchFlexContainerAnnc) getResourceByName(BinarySwitchFlexContainerAnnc.SHORT_NAME);
+		return binarySwitchAnnc;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="runMeAnnc", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainerAnnc runModeAnnc;
+	
+	
+	public void setRunMode(RunModeFlexContainerAnnc runModeAnnc) {
+		this.runModeAnnc = runModeAnnc;
+		getFlexContainerOrContainerOrSubscription().add(runModeAnnc);
+	}
+	
+	public RunModeFlexContainerAnnc getRunModeAnnc() {
+		this.runModeAnnc = (RunModeFlexContainerAnnc) getResourceByName(RunModeFlexContainerAnnc.SHORT_NAME);
+		return runModeAnnc;
+	}
+	
+	@XmlElement(name="eneGn", required=true, type=EnergyGenerationFlexContainerAnnc.class)
+	private EnergyGenerationFlexContainer energyGeneration;
+	
+	
+	public void setEnergyGeneration(EnergyGenerationFlexContainer energyGeneration) {
+		this.energyGeneration = energyGeneration;
+		getFlexContainerOrContainerOrSubscription().add(energyGeneration);
+	}
+	
+	public EnergyGenerationFlexContainer getEnergyGeneration() {
+		this.energyGeneration = (EnergyGenerationFlexContainer) getResourceByName(EnergyGenerationFlexContainer.SHORT_NAME);
+		return energyGeneration;
+	}
+	
+	@XmlElement(name="eneGnAnnc", required=true, type=EnergyGenerationFlexContainerAnnc.class)
+	private EnergyGenerationFlexContainerAnnc energyGenerationAnnc;
+	
+	
+	public void setEnergyGeneration(EnergyGenerationFlexContainerAnnc energyGenerationAnnc) {
+		this.energyGenerationAnnc = energyGenerationAnnc;
+		getFlexContainerOrContainerOrSubscription().add(energyGenerationAnnc);
+	}
+	
+	public EnergyGenerationFlexContainerAnnc getEnergyGenerationAnnc() {
+		this.energyGenerationAnnc = (EnergyGenerationFlexContainerAnnc) getResourceByName(EnergyGenerationFlexContainerAnnc.SHORT_NAME);
+		return energyGenerationAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceMotionDetectorFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceMotionDetectorFlexContainer.java
new file mode 100644
index 0000000..2606541
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceMotionDetectorFlexContainer.java
@@ -0,0 +1,54 @@
+/*
+Device : DeviceMotionDetector
+
+
+
+A MotionDetector is a device that triggers alarm in case of motion detection.
+
+Created: 2017-08-09 15:38:06
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceMotionDetectorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceMotionDetectorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceMotionDetectorFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceMotionDetector";
+	public static final String SHORT_NAME = "deMDr";
+	
+	public DeviceMotionDetectorFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceMotionDetectorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getMotionSensor();
+	}
+	
+	@XmlElement(name="motSr", required=true, type=MotionSensorFlexContainer.class)
+	private MotionSensorFlexContainer motionSensor;
+	
+	
+	public void setMotionSensor(MotionSensorFlexContainer motionSensor) {
+		this.motionSensor = motionSensor;
+		getFlexContainerOrContainerOrSubscription().add(motionSensor);
+	}
+	
+	public MotionSensorFlexContainer getMotionSensor() {
+		this.motionSensor = (MotionSensorFlexContainer) getResourceByName(MotionSensorFlexContainer.SHORT_NAME);
+		return motionSensor;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceMotionDetectorFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceMotionDetectorFlexContainerAnnc.java
new file mode 100644
index 0000000..0d246e3
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceMotionDetectorFlexContainerAnnc.java
@@ -0,0 +1,69 @@
+/*
+Device : DeviceMotionDetectorAnnc
+
+
+
+A MotionDetector is a device that triggers alarm in case of motion detection.
+
+Created: 2017-08-09 15:38:06
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceMotionDetectorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceMotionDetectorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceMotionDetectorFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceMotionDetectorAnnc";
+	public static final String SHORT_NAME = "deMDrAnnc";
+	
+	public DeviceMotionDetectorFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceMotionDetectorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getMotionSensor();
+		getMotionSensorAnnc();
+	}
+	
+	@XmlElement(name="motSr", required=true, type=MotionSensorFlexContainerAnnc.class)
+	private MotionSensorFlexContainer motionSensor;
+	
+	
+	public void setMotionSensor(MotionSensorFlexContainer motionSensor) {
+		this.motionSensor = motionSensor;
+		getFlexContainerOrContainerOrSubscription().add(motionSensor);
+	}
+	
+	public MotionSensorFlexContainer getMotionSensor() {
+		this.motionSensor = (MotionSensorFlexContainer) getResourceByName(MotionSensorFlexContainer.SHORT_NAME);
+		return motionSensor;
+	}
+	
+	@XmlElement(name="motSrAnnc", required=true, type=MotionSensorFlexContainerAnnc.class)
+	private MotionSensorFlexContainerAnnc motionSensorAnnc;
+	
+	
+	public void setMotionSensor(MotionSensorFlexContainerAnnc motionSensorAnnc) {
+		this.motionSensorAnnc = motionSensorAnnc;
+		getFlexContainerOrContainerOrSubscription().add(motionSensorAnnc);
+	}
+	
+	public MotionSensorFlexContainerAnnc getMotionSensorAnnc() {
+		this.motionSensorAnnc = (MotionSensorFlexContainerAnnc) getResourceByName(MotionSensorFlexContainerAnnc.SHORT_NAME);
+		return motionSensorAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceOvenFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceOvenFlexContainer.java
new file mode 100644
index 0000000..1832ec8
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceOvenFlexContainer.java
@@ -0,0 +1,99 @@
+/*
+Device : DeviceOven
+
+
+
+An oven is a home appliance used to roast and heat food in a complete stove. This information model is applicable to different types of ovens: gas ovens, electrical ovens, steam ovens, microwave ovens, etc. This information model provides capabilities to interact with specific functions and resources of ovens.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceOvenFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceOvenFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceOvenFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceOven";
+	public static final String SHORT_NAME = "devOn";
+	
+	public DeviceOvenFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceOvenFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getBinarySwitch();
+		getRunMode();
+		getTimer();
+		getTemperature();
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainer.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainer.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="timer", required=true, type=TimerFlexContainer.class)
+	private TimerFlexContainer timer;
+	
+	
+	public void setTimer(TimerFlexContainer timer) {
+		this.timer = timer;
+		getFlexContainerOrContainerOrSubscription().add(timer);
+	}
+	
+	public TimerFlexContainer getTimer() {
+		this.timer = (TimerFlexContainer) getResourceByName(TimerFlexContainer.SHORT_NAME);
+		return timer;
+	}
+	
+	@XmlElement(name="tempe", required=true, type=TemperatureFlexContainer.class)
+	private TemperatureFlexContainer temperature;
+	
+	
+	public void setTemperature(TemperatureFlexContainer temperature) {
+		this.temperature = temperature;
+		getFlexContainerOrContainerOrSubscription().add(temperature);
+	}
+	
+	public TemperatureFlexContainer getTemperature() {
+		this.temperature = (TemperatureFlexContainer) getResourceByName(TemperatureFlexContainer.SHORT_NAME);
+		return temperature;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceOvenFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceOvenFlexContainerAnnc.java
new file mode 100644
index 0000000..62b7743
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceOvenFlexContainerAnnc.java
@@ -0,0 +1,159 @@
+/*
+Device : DeviceOvenAnnc
+
+
+
+An oven is a home appliance used to roast and heat food in a complete stove. This information model is applicable to different types of ovens: gas ovens, electrical ovens, steam ovens, microwave ovens, etc. This information model provides capabilities to interact with specific functions and resources of ovens.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceOvenFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceOvenFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceOvenFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceOvenAnnc";
+	public static final String SHORT_NAME = "devOnAnnc";
+	
+	public DeviceOvenFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceOvenFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getBinarySwitch();
+		getBinarySwitchAnnc();
+		getRunMode();
+		getRunModeAnnc();
+		getTimer();
+		getTimerAnnc();
+		getTemperature();
+		getTemperatureAnnc();
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="binShAnnc", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainerAnnc binarySwitchAnnc;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainerAnnc binarySwitchAnnc) {
+		this.binarySwitchAnnc = binarySwitchAnnc;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitchAnnc);
+	}
+	
+	public BinarySwitchFlexContainerAnnc getBinarySwitchAnnc() {
+		this.binarySwitchAnnc = (BinarySwitchFlexContainerAnnc) getResourceByName(BinarySwitchFlexContainerAnnc.SHORT_NAME);
+		return binarySwitchAnnc;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="runMeAnnc", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainerAnnc runModeAnnc;
+	
+	
+	public void setRunMode(RunModeFlexContainerAnnc runModeAnnc) {
+		this.runModeAnnc = runModeAnnc;
+		getFlexContainerOrContainerOrSubscription().add(runModeAnnc);
+	}
+	
+	public RunModeFlexContainerAnnc getRunModeAnnc() {
+		this.runModeAnnc = (RunModeFlexContainerAnnc) getResourceByName(RunModeFlexContainerAnnc.SHORT_NAME);
+		return runModeAnnc;
+	}
+	
+	@XmlElement(name="timer", required=true, type=TimerFlexContainerAnnc.class)
+	private TimerFlexContainer timer;
+	
+	
+	public void setTimer(TimerFlexContainer timer) {
+		this.timer = timer;
+		getFlexContainerOrContainerOrSubscription().add(timer);
+	}
+	
+	public TimerFlexContainer getTimer() {
+		this.timer = (TimerFlexContainer) getResourceByName(TimerFlexContainer.SHORT_NAME);
+		return timer;
+	}
+	
+	@XmlElement(name="timerAnnc", required=true, type=TimerFlexContainerAnnc.class)
+	private TimerFlexContainerAnnc timerAnnc;
+	
+	
+	public void setTimer(TimerFlexContainerAnnc timerAnnc) {
+		this.timerAnnc = timerAnnc;
+		getFlexContainerOrContainerOrSubscription().add(timerAnnc);
+	}
+	
+	public TimerFlexContainerAnnc getTimerAnnc() {
+		this.timerAnnc = (TimerFlexContainerAnnc) getResourceByName(TimerFlexContainerAnnc.SHORT_NAME);
+		return timerAnnc;
+	}
+	
+	@XmlElement(name="tempe", required=true, type=TemperatureFlexContainerAnnc.class)
+	private TemperatureFlexContainer temperature;
+	
+	
+	public void setTemperature(TemperatureFlexContainer temperature) {
+		this.temperature = temperature;
+		getFlexContainerOrContainerOrSubscription().add(temperature);
+	}
+	
+	public TemperatureFlexContainer getTemperature() {
+		this.temperature = (TemperatureFlexContainer) getResourceByName(TemperatureFlexContainer.SHORT_NAME);
+		return temperature;
+	}
+	
+	@XmlElement(name="tempeAnnc", required=true, type=TemperatureFlexContainerAnnc.class)
+	private TemperatureFlexContainerAnnc temperatureAnnc;
+	
+	
+	public void setTemperature(TemperatureFlexContainerAnnc temperatureAnnc) {
+		this.temperatureAnnc = temperatureAnnc;
+		getFlexContainerOrContainerOrSubscription().add(temperatureAnnc);
+	}
+	
+	public TemperatureFlexContainerAnnc getTemperatureAnnc() {
+		this.temperatureAnnc = (TemperatureFlexContainerAnnc) getResourceByName(TemperatureFlexContainerAnnc.SHORT_NAME);
+		return temperatureAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceRefrigeratorFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceRefrigeratorFlexContainer.java
new file mode 100644
index 0000000..6b17365
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceRefrigeratorFlexContainer.java
@@ -0,0 +1,99 @@
+/*
+Device : DeviceRefrigerator
+
+
+
+A refrigerator is a home appliance used to store food at temperatures which are a few degrees above the freezing point of water. This information model provides capabilities to interact with specific functions and resource of refrigerators.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceRefrigeratorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceRefrigeratorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceRefrigeratorFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceRefrigerator";
+	public static final String SHORT_NAME = "devRr";
+	
+	public DeviceRefrigeratorFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceRefrigeratorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getBinarySwitch();
+		getPowerSave();
+		getDoorStatus();
+		getRefrigeration();
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainer.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="powSe", required=true, type=PowerSaveFlexContainer.class)
+	private PowerSaveFlexContainer powerSave;
+	
+	
+	public void setPowerSave(PowerSaveFlexContainer powerSave) {
+		this.powerSave = powerSave;
+		getFlexContainerOrContainerOrSubscription().add(powerSave);
+	}
+	
+	public PowerSaveFlexContainer getPowerSave() {
+		this.powerSave = (PowerSaveFlexContainer) getResourceByName(PowerSaveFlexContainer.SHORT_NAME);
+		return powerSave;
+	}
+	
+	@XmlElement(name="dooSs", required=true, type=DoorStatusFlexContainer.class)
+	private DoorStatusFlexContainer doorStatus;
+	
+	
+	public void setDoorStatus(DoorStatusFlexContainer doorStatus) {
+		this.doorStatus = doorStatus;
+		getFlexContainerOrContainerOrSubscription().add(doorStatus);
+	}
+	
+	public DoorStatusFlexContainer getDoorStatus() {
+		this.doorStatus = (DoorStatusFlexContainer) getResourceByName(DoorStatusFlexContainer.SHORT_NAME);
+		return doorStatus;
+	}
+	
+	@XmlElement(name="refrn", required=true, type=RefrigerationFlexContainer.class)
+	private RefrigerationFlexContainer refrigeration;
+	
+	
+	public void setRefrigeration(RefrigerationFlexContainer refrigeration) {
+		this.refrigeration = refrigeration;
+		getFlexContainerOrContainerOrSubscription().add(refrigeration);
+	}
+	
+	public RefrigerationFlexContainer getRefrigeration() {
+		this.refrigeration = (RefrigerationFlexContainer) getResourceByName(RefrigerationFlexContainer.SHORT_NAME);
+		return refrigeration;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceRefrigeratorFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceRefrigeratorFlexContainerAnnc.java
new file mode 100644
index 0000000..c7947eb
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceRefrigeratorFlexContainerAnnc.java
@@ -0,0 +1,159 @@
+/*
+Device : DeviceRefrigeratorAnnc
+
+
+
+A refrigerator is a home appliance used to store food at temperatures which are a few degrees above the freezing point of water. This information model provides capabilities to interact with specific functions and resource of refrigerators.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceRefrigeratorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceRefrigeratorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceRefrigeratorFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceRefrigeratorAnnc";
+	public static final String SHORT_NAME = "devRrAnnc";
+	
+	public DeviceRefrigeratorFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceRefrigeratorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getBinarySwitch();
+		getBinarySwitchAnnc();
+		getPowerSave();
+		getPowerSaveAnnc();
+		getDoorStatus();
+		getDoorStatusAnnc();
+		getRefrigeration();
+		getRefrigerationAnnc();
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="binShAnnc", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainerAnnc binarySwitchAnnc;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainerAnnc binarySwitchAnnc) {
+		this.binarySwitchAnnc = binarySwitchAnnc;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitchAnnc);
+	}
+	
+	public BinarySwitchFlexContainerAnnc getBinarySwitchAnnc() {
+		this.binarySwitchAnnc = (BinarySwitchFlexContainerAnnc) getResourceByName(BinarySwitchFlexContainerAnnc.SHORT_NAME);
+		return binarySwitchAnnc;
+	}
+	
+	@XmlElement(name="powSe", required=true, type=PowerSaveFlexContainerAnnc.class)
+	private PowerSaveFlexContainer powerSave;
+	
+	
+	public void setPowerSave(PowerSaveFlexContainer powerSave) {
+		this.powerSave = powerSave;
+		getFlexContainerOrContainerOrSubscription().add(powerSave);
+	}
+	
+	public PowerSaveFlexContainer getPowerSave() {
+		this.powerSave = (PowerSaveFlexContainer) getResourceByName(PowerSaveFlexContainer.SHORT_NAME);
+		return powerSave;
+	}
+	
+	@XmlElement(name="powSeAnnc", required=true, type=PowerSaveFlexContainerAnnc.class)
+	private PowerSaveFlexContainerAnnc powerSaveAnnc;
+	
+	
+	public void setPowerSave(PowerSaveFlexContainerAnnc powerSaveAnnc) {
+		this.powerSaveAnnc = powerSaveAnnc;
+		getFlexContainerOrContainerOrSubscription().add(powerSaveAnnc);
+	}
+	
+	public PowerSaveFlexContainerAnnc getPowerSaveAnnc() {
+		this.powerSaveAnnc = (PowerSaveFlexContainerAnnc) getResourceByName(PowerSaveFlexContainerAnnc.SHORT_NAME);
+		return powerSaveAnnc;
+	}
+	
+	@XmlElement(name="dooSs", required=true, type=DoorStatusFlexContainerAnnc.class)
+	private DoorStatusFlexContainer doorStatus;
+	
+	
+	public void setDoorStatus(DoorStatusFlexContainer doorStatus) {
+		this.doorStatus = doorStatus;
+		getFlexContainerOrContainerOrSubscription().add(doorStatus);
+	}
+	
+	public DoorStatusFlexContainer getDoorStatus() {
+		this.doorStatus = (DoorStatusFlexContainer) getResourceByName(DoorStatusFlexContainer.SHORT_NAME);
+		return doorStatus;
+	}
+	
+	@XmlElement(name="dooSsAnnc", required=true, type=DoorStatusFlexContainerAnnc.class)
+	private DoorStatusFlexContainerAnnc doorStatusAnnc;
+	
+	
+	public void setDoorStatus(DoorStatusFlexContainerAnnc doorStatusAnnc) {
+		this.doorStatusAnnc = doorStatusAnnc;
+		getFlexContainerOrContainerOrSubscription().add(doorStatusAnnc);
+	}
+	
+	public DoorStatusFlexContainerAnnc getDoorStatusAnnc() {
+		this.doorStatusAnnc = (DoorStatusFlexContainerAnnc) getResourceByName(DoorStatusFlexContainerAnnc.SHORT_NAME);
+		return doorStatusAnnc;
+	}
+	
+	@XmlElement(name="refrn", required=true, type=RefrigerationFlexContainerAnnc.class)
+	private RefrigerationFlexContainer refrigeration;
+	
+	
+	public void setRefrigeration(RefrigerationFlexContainer refrigeration) {
+		this.refrigeration = refrigeration;
+		getFlexContainerOrContainerOrSubscription().add(refrigeration);
+	}
+	
+	public RefrigerationFlexContainer getRefrigeration() {
+		this.refrigeration = (RefrigerationFlexContainer) getResourceByName(RefrigerationFlexContainer.SHORT_NAME);
+		return refrigeration;
+	}
+	
+	@XmlElement(name="refrnAnnc", required=true, type=RefrigerationFlexContainerAnnc.class)
+	private RefrigerationFlexContainerAnnc refrigerationAnnc;
+	
+	
+	public void setRefrigeration(RefrigerationFlexContainerAnnc refrigerationAnnc) {
+		this.refrigerationAnnc = refrigerationAnnc;
+		getFlexContainerOrContainerOrSubscription().add(refrigerationAnnc);
+	}
+	
+	public RefrigerationFlexContainerAnnc getRefrigerationAnnc() {
+		this.refrigerationAnnc = (RefrigerationFlexContainerAnnc) getResourceByName(RefrigerationFlexContainerAnnc.SHORT_NAME);
+		return refrigerationAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceRobotCleanerFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceRobotCleanerFlexContainer.java
new file mode 100644
index 0000000..579f01c
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceRobotCleanerFlexContainer.java
@@ -0,0 +1,99 @@
+/*
+Device : DeviceRobotCleaner
+
+
+
+A robot cleaner is an autonomous robotic vacuum cleaner that has intelligent programming and a limited vacuum cleaning system. This robot cleaner information model provides capabilities to control and monitor robot cleaner specific functions and resources.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceRobotCleanerFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceRobotCleanerFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceRobotCleanerFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceRobotCleaner";
+	public static final String SHORT_NAME = "deRCr";
+	
+	public DeviceRobotCleanerFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceRobotCleanerFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getBinarySwitch();
+		getRunMode();
+		getBattery();
+		getTimer();
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainer.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainer.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="batty", required=true, type=BatteryFlexContainer.class)
+	private BatteryFlexContainer battery;
+	
+	
+	public void setBattery(BatteryFlexContainer battery) {
+		this.battery = battery;
+		getFlexContainerOrContainerOrSubscription().add(battery);
+	}
+	
+	public BatteryFlexContainer getBattery() {
+		this.battery = (BatteryFlexContainer) getResourceByName(BatteryFlexContainer.SHORT_NAME);
+		return battery;
+	}
+	
+	@XmlElement(name="timer", required=true, type=TimerFlexContainer.class)
+	private TimerFlexContainer timer;
+	
+	
+	public void setTimer(TimerFlexContainer timer) {
+		this.timer = timer;
+		getFlexContainerOrContainerOrSubscription().add(timer);
+	}
+	
+	public TimerFlexContainer getTimer() {
+		this.timer = (TimerFlexContainer) getResourceByName(TimerFlexContainer.SHORT_NAME);
+		return timer;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceRobotCleanerFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceRobotCleanerFlexContainerAnnc.java
new file mode 100644
index 0000000..7ea67bb
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceRobotCleanerFlexContainerAnnc.java
@@ -0,0 +1,159 @@
+/*
+Device : DeviceRobotCleanerAnnc
+
+
+
+A robot cleaner is an autonomous robotic vacuum cleaner that has intelligent programming and a limited vacuum cleaning system. This robot cleaner information model provides capabilities to control and monitor robot cleaner specific functions and resources.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceRobotCleanerFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceRobotCleanerFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceRobotCleanerFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceRobotCleanerAnnc";
+	public static final String SHORT_NAME = "deRCrAnnc";
+	
+	public DeviceRobotCleanerFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceRobotCleanerFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getBinarySwitch();
+		getBinarySwitchAnnc();
+		getRunMode();
+		getRunModeAnnc();
+		getBattery();
+		getBatteryAnnc();
+		getTimer();
+		getTimerAnnc();
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="binShAnnc", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainerAnnc binarySwitchAnnc;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainerAnnc binarySwitchAnnc) {
+		this.binarySwitchAnnc = binarySwitchAnnc;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitchAnnc);
+	}
+	
+	public BinarySwitchFlexContainerAnnc getBinarySwitchAnnc() {
+		this.binarySwitchAnnc = (BinarySwitchFlexContainerAnnc) getResourceByName(BinarySwitchFlexContainerAnnc.SHORT_NAME);
+		return binarySwitchAnnc;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="runMeAnnc", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainerAnnc runModeAnnc;
+	
+	
+	public void setRunMode(RunModeFlexContainerAnnc runModeAnnc) {
+		this.runModeAnnc = runModeAnnc;
+		getFlexContainerOrContainerOrSubscription().add(runModeAnnc);
+	}
+	
+	public RunModeFlexContainerAnnc getRunModeAnnc() {
+		this.runModeAnnc = (RunModeFlexContainerAnnc) getResourceByName(RunModeFlexContainerAnnc.SHORT_NAME);
+		return runModeAnnc;
+	}
+	
+	@XmlElement(name="batty", required=true, type=BatteryFlexContainerAnnc.class)
+	private BatteryFlexContainer battery;
+	
+	
+	public void setBattery(BatteryFlexContainer battery) {
+		this.battery = battery;
+		getFlexContainerOrContainerOrSubscription().add(battery);
+	}
+	
+	public BatteryFlexContainer getBattery() {
+		this.battery = (BatteryFlexContainer) getResourceByName(BatteryFlexContainer.SHORT_NAME);
+		return battery;
+	}
+	
+	@XmlElement(name="battyAnnc", required=true, type=BatteryFlexContainerAnnc.class)
+	private BatteryFlexContainerAnnc batteryAnnc;
+	
+	
+	public void setBattery(BatteryFlexContainerAnnc batteryAnnc) {
+		this.batteryAnnc = batteryAnnc;
+		getFlexContainerOrContainerOrSubscription().add(batteryAnnc);
+	}
+	
+	public BatteryFlexContainerAnnc getBatteryAnnc() {
+		this.batteryAnnc = (BatteryFlexContainerAnnc) getResourceByName(BatteryFlexContainerAnnc.SHORT_NAME);
+		return batteryAnnc;
+	}
+	
+	@XmlElement(name="timer", required=true, type=TimerFlexContainerAnnc.class)
+	private TimerFlexContainer timer;
+	
+	
+	public void setTimer(TimerFlexContainer timer) {
+		this.timer = timer;
+		getFlexContainerOrContainerOrSubscription().add(timer);
+	}
+	
+	public TimerFlexContainer getTimer() {
+		this.timer = (TimerFlexContainer) getResourceByName(TimerFlexContainer.SHORT_NAME);
+		return timer;
+	}
+	
+	@XmlElement(name="timerAnnc", required=true, type=TimerFlexContainerAnnc.class)
+	private TimerFlexContainerAnnc timerAnnc;
+	
+	
+	public void setTimer(TimerFlexContainerAnnc timerAnnc) {
+		this.timerAnnc = timerAnnc;
+		getFlexContainerOrContainerOrSubscription().add(timerAnnc);
+	}
+	
+	public TimerFlexContainerAnnc getTimerAnnc() {
+		this.timerAnnc = (TimerFlexContainerAnnc) getResourceByName(TimerFlexContainerAnnc.SHORT_NAME);
+		return timerAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSmartElectricMeterFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSmartElectricMeterFlexContainer.java
new file mode 100644
index 0000000..7e45aab
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSmartElectricMeterFlexContainer.java
@@ -0,0 +1,129 @@
+/*
+Device : DeviceSmartElectricMeter
+
+
+
+A smart electric meter is a metering device that is used to measure consumption data for electrictricity.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceSmartElectricMeterFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceSmartElectricMeterFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceSmartElectricMeterFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceSmartElectricMeter";
+	public static final String SHORT_NAME = "dSEMr";
+	
+	public DeviceSmartElectricMeterFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceSmartElectricMeterFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getFaultDetection();
+		getBinarySwitch();
+		getRunMode();
+		getClock();
+		getEnergyConsumption();
+		getEnergyGeneration();
+	}
+	
+	@XmlElement(name="fauDn", required=true, type=FaultDetectionFlexContainer.class)
+	private FaultDetectionFlexContainer faultDetection;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainer faultDetection) {
+		this.faultDetection = faultDetection;
+		getFlexContainerOrContainerOrSubscription().add(faultDetection);
+	}
+	
+	public FaultDetectionFlexContainer getFaultDetection() {
+		this.faultDetection = (FaultDetectionFlexContainer) getResourceByName(FaultDetectionFlexContainer.SHORT_NAME);
+		return faultDetection;
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainer.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainer.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="clock", required=true, type=ClockFlexContainer.class)
+	private ClockFlexContainer clock;
+	
+	
+	public void setClock(ClockFlexContainer clock) {
+		this.clock = clock;
+		getFlexContainerOrContainerOrSubscription().add(clock);
+	}
+	
+	public ClockFlexContainer getClock() {
+		this.clock = (ClockFlexContainer) getResourceByName(ClockFlexContainer.SHORT_NAME);
+		return clock;
+	}
+	
+	@XmlElement(name="eneCn", required=true, type=EnergyConsumptionFlexContainer.class)
+	private EnergyConsumptionFlexContainer energyConsumption;
+	
+	
+	public void setEnergyConsumption(EnergyConsumptionFlexContainer energyConsumption) {
+		this.energyConsumption = energyConsumption;
+		getFlexContainerOrContainerOrSubscription().add(energyConsumption);
+	}
+	
+	public EnergyConsumptionFlexContainer getEnergyConsumption() {
+		this.energyConsumption = (EnergyConsumptionFlexContainer) getResourceByName(EnergyConsumptionFlexContainer.SHORT_NAME);
+		return energyConsumption;
+	}
+	
+	@XmlElement(name="eneGn", required=true, type=EnergyGenerationFlexContainer.class)
+	private EnergyGenerationFlexContainer energyGeneration;
+	
+	
+	public void setEnergyGeneration(EnergyGenerationFlexContainer energyGeneration) {
+		this.energyGeneration = energyGeneration;
+		getFlexContainerOrContainerOrSubscription().add(energyGeneration);
+	}
+	
+	public EnergyGenerationFlexContainer getEnergyGeneration() {
+		this.energyGeneration = (EnergyGenerationFlexContainer) getResourceByName(EnergyGenerationFlexContainer.SHORT_NAME);
+		return energyGeneration;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSmartElectricMeterFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSmartElectricMeterFlexContainerAnnc.java
new file mode 100644
index 0000000..801b637
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSmartElectricMeterFlexContainerAnnc.java
@@ -0,0 +1,219 @@
+/*
+Device : DeviceSmartElectricMeterAnnc
+
+
+
+A smart electric meter is a metering device that is used to measure consumption data for electrictricity.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceSmartElectricMeterFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceSmartElectricMeterFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceSmartElectricMeterFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceSmartElectricMeterAnnc";
+	public static final String SHORT_NAME = "dSEMrAnnc";
+	
+	public DeviceSmartElectricMeterFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceSmartElectricMeterFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getFaultDetection();
+		getFaultDetectionAnnc();
+		getBinarySwitch();
+		getBinarySwitchAnnc();
+		getRunMode();
+		getRunModeAnnc();
+		getClock();
+		getClockAnnc();
+		getEnergyConsumption();
+		getEnergyConsumptionAnnc();
+		getEnergyGeneration();
+		getEnergyGenerationAnnc();
+	}
+	
+	@XmlElement(name="fauDn", required=true, type=FaultDetectionFlexContainerAnnc.class)
+	private FaultDetectionFlexContainer faultDetection;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainer faultDetection) {
+		this.faultDetection = faultDetection;
+		getFlexContainerOrContainerOrSubscription().add(faultDetection);
+	}
+	
+	public FaultDetectionFlexContainer getFaultDetection() {
+		this.faultDetection = (FaultDetectionFlexContainer) getResourceByName(FaultDetectionFlexContainer.SHORT_NAME);
+		return faultDetection;
+	}
+	
+	@XmlElement(name="fauDnAnnc", required=true, type=FaultDetectionFlexContainerAnnc.class)
+	private FaultDetectionFlexContainerAnnc faultDetectionAnnc;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainerAnnc faultDetectionAnnc) {
+		this.faultDetectionAnnc = faultDetectionAnnc;
+		getFlexContainerOrContainerOrSubscription().add(faultDetectionAnnc);
+	}
+	
+	public FaultDetectionFlexContainerAnnc getFaultDetectionAnnc() {
+		this.faultDetectionAnnc = (FaultDetectionFlexContainerAnnc) getResourceByName(FaultDetectionFlexContainerAnnc.SHORT_NAME);
+		return faultDetectionAnnc;
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="binShAnnc", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainerAnnc binarySwitchAnnc;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainerAnnc binarySwitchAnnc) {
+		this.binarySwitchAnnc = binarySwitchAnnc;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitchAnnc);
+	}
+	
+	public BinarySwitchFlexContainerAnnc getBinarySwitchAnnc() {
+		this.binarySwitchAnnc = (BinarySwitchFlexContainerAnnc) getResourceByName(BinarySwitchFlexContainerAnnc.SHORT_NAME);
+		return binarySwitchAnnc;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="runMeAnnc", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainerAnnc runModeAnnc;
+	
+	
+	public void setRunMode(RunModeFlexContainerAnnc runModeAnnc) {
+		this.runModeAnnc = runModeAnnc;
+		getFlexContainerOrContainerOrSubscription().add(runModeAnnc);
+	}
+	
+	public RunModeFlexContainerAnnc getRunModeAnnc() {
+		this.runModeAnnc = (RunModeFlexContainerAnnc) getResourceByName(RunModeFlexContainerAnnc.SHORT_NAME);
+		return runModeAnnc;
+	}
+	
+	@XmlElement(name="clock", required=true, type=ClockFlexContainerAnnc.class)
+	private ClockFlexContainer clock;
+	
+	
+	public void setClock(ClockFlexContainer clock) {
+		this.clock = clock;
+		getFlexContainerOrContainerOrSubscription().add(clock);
+	}
+	
+	public ClockFlexContainer getClock() {
+		this.clock = (ClockFlexContainer) getResourceByName(ClockFlexContainer.SHORT_NAME);
+		return clock;
+	}
+	
+	@XmlElement(name="clockAnnc", required=true, type=ClockFlexContainerAnnc.class)
+	private ClockFlexContainerAnnc clockAnnc;
+	
+	
+	public void setClock(ClockFlexContainerAnnc clockAnnc) {
+		this.clockAnnc = clockAnnc;
+		getFlexContainerOrContainerOrSubscription().add(clockAnnc);
+	}
+	
+	public ClockFlexContainerAnnc getClockAnnc() {
+		this.clockAnnc = (ClockFlexContainerAnnc) getResourceByName(ClockFlexContainerAnnc.SHORT_NAME);
+		return clockAnnc;
+	}
+	
+	@XmlElement(name="eneCn", required=true, type=EnergyConsumptionFlexContainerAnnc.class)
+	private EnergyConsumptionFlexContainer energyConsumption;
+	
+	
+	public void setEnergyConsumption(EnergyConsumptionFlexContainer energyConsumption) {
+		this.energyConsumption = energyConsumption;
+		getFlexContainerOrContainerOrSubscription().add(energyConsumption);
+	}
+	
+	public EnergyConsumptionFlexContainer getEnergyConsumption() {
+		this.energyConsumption = (EnergyConsumptionFlexContainer) getResourceByName(EnergyConsumptionFlexContainer.SHORT_NAME);
+		return energyConsumption;
+	}
+	
+	@XmlElement(name="eneCnAnnc", required=true, type=EnergyConsumptionFlexContainerAnnc.class)
+	private EnergyConsumptionFlexContainerAnnc energyConsumptionAnnc;
+	
+	
+	public void setEnergyConsumption(EnergyConsumptionFlexContainerAnnc energyConsumptionAnnc) {
+		this.energyConsumptionAnnc = energyConsumptionAnnc;
+		getFlexContainerOrContainerOrSubscription().add(energyConsumptionAnnc);
+	}
+	
+	public EnergyConsumptionFlexContainerAnnc getEnergyConsumptionAnnc() {
+		this.energyConsumptionAnnc = (EnergyConsumptionFlexContainerAnnc) getResourceByName(EnergyConsumptionFlexContainerAnnc.SHORT_NAME);
+		return energyConsumptionAnnc;
+	}
+	
+	@XmlElement(name="eneGn", required=true, type=EnergyGenerationFlexContainerAnnc.class)
+	private EnergyGenerationFlexContainer energyGeneration;
+	
+	
+	public void setEnergyGeneration(EnergyGenerationFlexContainer energyGeneration) {
+		this.energyGeneration = energyGeneration;
+		getFlexContainerOrContainerOrSubscription().add(energyGeneration);
+	}
+	
+	public EnergyGenerationFlexContainer getEnergyGeneration() {
+		this.energyGeneration = (EnergyGenerationFlexContainer) getResourceByName(EnergyGenerationFlexContainer.SHORT_NAME);
+		return energyGeneration;
+	}
+	
+	@XmlElement(name="eneGnAnnc", required=true, type=EnergyGenerationFlexContainerAnnc.class)
+	private EnergyGenerationFlexContainerAnnc energyGenerationAnnc;
+	
+	
+	public void setEnergyGeneration(EnergyGenerationFlexContainerAnnc energyGenerationAnnc) {
+		this.energyGenerationAnnc = energyGenerationAnnc;
+		getFlexContainerOrContainerOrSubscription().add(energyGenerationAnnc);
+	}
+	
+	public EnergyGenerationFlexContainerAnnc getEnergyGenerationAnnc() {
+		this.energyGenerationAnnc = (EnergyGenerationFlexContainerAnnc) getResourceByName(EnergyGenerationFlexContainerAnnc.SHORT_NAME);
+		return energyGenerationAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSmokeDetectorFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSmokeDetectorFlexContainer.java
new file mode 100644
index 0000000..edd53f8
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSmokeDetectorFlexContainer.java
@@ -0,0 +1,54 @@
+/*
+Device : DeviceSmokeDetector
+
+
+
+A SmokeDetector is a device that triggers alarm in case of fire detection.
+
+Created: 2017-08-09 15:38:06
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceSmokeDetectorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceSmokeDetectorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceSmokeDetectorFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceSmokeDetector";
+	public static final String SHORT_NAME = "deSDr";
+	
+	public DeviceSmokeDetectorFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceSmokeDetectorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getSmokeSensor();
+	}
+	
+	@XmlElement(name="smoSr", required=true, type=SmokeSensorFlexContainer.class)
+	private SmokeSensorFlexContainer smokeSensor;
+	
+	
+	public void setSmokeSensor(SmokeSensorFlexContainer smokeSensor) {
+		this.smokeSensor = smokeSensor;
+		getFlexContainerOrContainerOrSubscription().add(smokeSensor);
+	}
+	
+	public SmokeSensorFlexContainer getSmokeSensor() {
+		this.smokeSensor = (SmokeSensorFlexContainer) getResourceByName(SmokeSensorFlexContainer.SHORT_NAME);
+		return smokeSensor;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSmokeDetectorFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSmokeDetectorFlexContainerAnnc.java
new file mode 100644
index 0000000..69d4363
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSmokeDetectorFlexContainerAnnc.java
@@ -0,0 +1,69 @@
+/*
+Device : DeviceSmokeDetectorAnnc
+
+
+
+A SmokeDetector is a device that triggers alarm in case of fire detection.
+
+Created: 2017-08-09 15:38:06
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceSmokeDetectorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceSmokeDetectorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceSmokeDetectorFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceSmokeDetectorAnnc";
+	public static final String SHORT_NAME = "deSDrAnnc";
+	
+	public DeviceSmokeDetectorFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceSmokeDetectorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getSmokeSensor();
+		getSmokeSensorAnnc();
+	}
+	
+	@XmlElement(name="smoSr", required=true, type=SmokeSensorFlexContainerAnnc.class)
+	private SmokeSensorFlexContainer smokeSensor;
+	
+	
+	public void setSmokeSensor(SmokeSensorFlexContainer smokeSensor) {
+		this.smokeSensor = smokeSensor;
+		getFlexContainerOrContainerOrSubscription().add(smokeSensor);
+	}
+	
+	public SmokeSensorFlexContainer getSmokeSensor() {
+		this.smokeSensor = (SmokeSensorFlexContainer) getResourceByName(SmokeSensorFlexContainer.SHORT_NAME);
+		return smokeSensor;
+	}
+	
+	@XmlElement(name="smoSrAnnc", required=true, type=SmokeSensorFlexContainerAnnc.class)
+	private SmokeSensorFlexContainerAnnc smokeSensorAnnc;
+	
+	
+	public void setSmokeSensor(SmokeSensorFlexContainerAnnc smokeSensorAnnc) {
+		this.smokeSensorAnnc = smokeSensorAnnc;
+		getFlexContainerOrContainerOrSubscription().add(smokeSensorAnnc);
+	}
+	
+	public SmokeSensorFlexContainerAnnc getSmokeSensorAnnc() {
+		this.smokeSensorAnnc = (SmokeSensorFlexContainerAnnc) getResourceByName(SmokeSensorFlexContainerAnnc.SHORT_NAME);
+		return smokeSensorAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSmokeExtractorFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSmokeExtractorFlexContainer.java
new file mode 100644
index 0000000..755e849
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSmokeExtractorFlexContainer.java
@@ -0,0 +1,69 @@
+/*
+Device : DeviceSmokeExtractor
+
+
+
+A SmokeExtractor is a device that is able to extract fire.
+
+Created: 2017-08-09 15:38:06
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceSmokeExtractorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceSmokeExtractorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceSmokeExtractorFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceSmokeExtractor";
+	public static final String SHORT_NAME = "deSEr";
+	
+	public DeviceSmokeExtractorFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceSmokeExtractorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getFaultDetection();
+		getBinarySwitch();
+	}
+	
+	@XmlElement(name="fauDn", required=true, type=FaultDetectionFlexContainer.class)
+	private FaultDetectionFlexContainer faultDetection;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainer faultDetection) {
+		this.faultDetection = faultDetection;
+		getFlexContainerOrContainerOrSubscription().add(faultDetection);
+	}
+	
+	public FaultDetectionFlexContainer getFaultDetection() {
+		this.faultDetection = (FaultDetectionFlexContainer) getResourceByName(FaultDetectionFlexContainer.SHORT_NAME);
+		return faultDetection;
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainer.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSmokeExtractorFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSmokeExtractorFlexContainerAnnc.java
new file mode 100644
index 0000000..1b25bf8
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSmokeExtractorFlexContainerAnnc.java
@@ -0,0 +1,99 @@
+/*
+Device : DeviceSmokeExtractorAnnc
+
+
+
+A SmokeExtractor is a device that is able to extract fire.
+
+Created: 2017-08-09 15:38:06
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceSmokeExtractorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceSmokeExtractorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceSmokeExtractorFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceSmokeExtractorAnnc";
+	public static final String SHORT_NAME = "deSErAnnc";
+	
+	public DeviceSmokeExtractorFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceSmokeExtractorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getFaultDetection();
+		getFaultDetectionAnnc();
+		getBinarySwitch();
+		getBinarySwitchAnnc();
+	}
+	
+	@XmlElement(name="fauDn", required=true, type=FaultDetectionFlexContainerAnnc.class)
+	private FaultDetectionFlexContainer faultDetection;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainer faultDetection) {
+		this.faultDetection = faultDetection;
+		getFlexContainerOrContainerOrSubscription().add(faultDetection);
+	}
+	
+	public FaultDetectionFlexContainer getFaultDetection() {
+		this.faultDetection = (FaultDetectionFlexContainer) getResourceByName(FaultDetectionFlexContainer.SHORT_NAME);
+		return faultDetection;
+	}
+	
+	@XmlElement(name="fauDnAnnc", required=true, type=FaultDetectionFlexContainerAnnc.class)
+	private FaultDetectionFlexContainerAnnc faultDetectionAnnc;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainerAnnc faultDetectionAnnc) {
+		this.faultDetectionAnnc = faultDetectionAnnc;
+		getFlexContainerOrContainerOrSubscription().add(faultDetectionAnnc);
+	}
+	
+	public FaultDetectionFlexContainerAnnc getFaultDetectionAnnc() {
+		this.faultDetectionAnnc = (FaultDetectionFlexContainerAnnc) getResourceByName(FaultDetectionFlexContainerAnnc.SHORT_NAME);
+		return faultDetectionAnnc;
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="binShAnnc", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainerAnnc binarySwitchAnnc;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainerAnnc binarySwitchAnnc) {
+		this.binarySwitchAnnc = binarySwitchAnnc;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitchAnnc);
+	}
+	
+	public BinarySwitchFlexContainerAnnc getBinarySwitchAnnc() {
+		this.binarySwitchAnnc = (BinarySwitchFlexContainerAnnc) getResourceByName(BinarySwitchFlexContainerAnnc.SHORT_NAME);
+		return binarySwitchAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceStorageBatteryFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceStorageBatteryFlexContainer.java
new file mode 100644
index 0000000..851d3f1
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceStorageBatteryFlexContainer.java
@@ -0,0 +1,99 @@
+/*
+Device : DeviceStorageBattery
+
+
+
+A storage battery is a HEMS device that is used to provide the home with electrical energy.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceStorageBatteryFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceStorageBatteryFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceStorageBatteryFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceStorageBattery";
+	public static final String SHORT_NAME = "deSBy";
+	
+	public DeviceStorageBatteryFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceStorageBatteryFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getFaultDetection();
+		getBinarySwitch();
+		getRunMode();
+		getBattery();
+	}
+	
+	@XmlElement(name="fauDn", required=true, type=FaultDetectionFlexContainer.class)
+	private FaultDetectionFlexContainer faultDetection;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainer faultDetection) {
+		this.faultDetection = faultDetection;
+		getFlexContainerOrContainerOrSubscription().add(faultDetection);
+	}
+	
+	public FaultDetectionFlexContainer getFaultDetection() {
+		this.faultDetection = (FaultDetectionFlexContainer) getResourceByName(FaultDetectionFlexContainer.SHORT_NAME);
+		return faultDetection;
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainer.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainer.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="batty", required=true, type=BatteryFlexContainer.class)
+	private BatteryFlexContainer battery;
+	
+	
+	public void setBattery(BatteryFlexContainer battery) {
+		this.battery = battery;
+		getFlexContainerOrContainerOrSubscription().add(battery);
+	}
+	
+	public BatteryFlexContainer getBattery() {
+		this.battery = (BatteryFlexContainer) getResourceByName(BatteryFlexContainer.SHORT_NAME);
+		return battery;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceStorageBatteryFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceStorageBatteryFlexContainerAnnc.java
new file mode 100644
index 0000000..a3a2bb8
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceStorageBatteryFlexContainerAnnc.java
@@ -0,0 +1,159 @@
+/*
+Device : DeviceStorageBatteryAnnc
+
+
+
+A storage battery is a HEMS device that is used to provide the home with electrical energy.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceStorageBatteryFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceStorageBatteryFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceStorageBatteryFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceStorageBatteryAnnc";
+	public static final String SHORT_NAME = "deSByAnnc";
+	
+	public DeviceStorageBatteryFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceStorageBatteryFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getFaultDetection();
+		getFaultDetectionAnnc();
+		getBinarySwitch();
+		getBinarySwitchAnnc();
+		getRunMode();
+		getRunModeAnnc();
+		getBattery();
+		getBatteryAnnc();
+	}
+	
+	@XmlElement(name="fauDn", required=true, type=FaultDetectionFlexContainerAnnc.class)
+	private FaultDetectionFlexContainer faultDetection;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainer faultDetection) {
+		this.faultDetection = faultDetection;
+		getFlexContainerOrContainerOrSubscription().add(faultDetection);
+	}
+	
+	public FaultDetectionFlexContainer getFaultDetection() {
+		this.faultDetection = (FaultDetectionFlexContainer) getResourceByName(FaultDetectionFlexContainer.SHORT_NAME);
+		return faultDetection;
+	}
+	
+	@XmlElement(name="fauDnAnnc", required=true, type=FaultDetectionFlexContainerAnnc.class)
+	private FaultDetectionFlexContainerAnnc faultDetectionAnnc;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainerAnnc faultDetectionAnnc) {
+		this.faultDetectionAnnc = faultDetectionAnnc;
+		getFlexContainerOrContainerOrSubscription().add(faultDetectionAnnc);
+	}
+	
+	public FaultDetectionFlexContainerAnnc getFaultDetectionAnnc() {
+		this.faultDetectionAnnc = (FaultDetectionFlexContainerAnnc) getResourceByName(FaultDetectionFlexContainerAnnc.SHORT_NAME);
+		return faultDetectionAnnc;
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="binShAnnc", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainerAnnc binarySwitchAnnc;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainerAnnc binarySwitchAnnc) {
+		this.binarySwitchAnnc = binarySwitchAnnc;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitchAnnc);
+	}
+	
+	public BinarySwitchFlexContainerAnnc getBinarySwitchAnnc() {
+		this.binarySwitchAnnc = (BinarySwitchFlexContainerAnnc) getResourceByName(BinarySwitchFlexContainerAnnc.SHORT_NAME);
+		return binarySwitchAnnc;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="runMeAnnc", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainerAnnc runModeAnnc;
+	
+	
+	public void setRunMode(RunModeFlexContainerAnnc runModeAnnc) {
+		this.runModeAnnc = runModeAnnc;
+		getFlexContainerOrContainerOrSubscription().add(runModeAnnc);
+	}
+	
+	public RunModeFlexContainerAnnc getRunModeAnnc() {
+		this.runModeAnnc = (RunModeFlexContainerAnnc) getResourceByName(RunModeFlexContainerAnnc.SHORT_NAME);
+		return runModeAnnc;
+	}
+	
+	@XmlElement(name="batty", required=true, type=BatteryFlexContainerAnnc.class)
+	private BatteryFlexContainer battery;
+	
+	
+	public void setBattery(BatteryFlexContainer battery) {
+		this.battery = battery;
+		getFlexContainerOrContainerOrSubscription().add(battery);
+	}
+	
+	public BatteryFlexContainer getBattery() {
+		this.battery = (BatteryFlexContainer) getResourceByName(BatteryFlexContainer.SHORT_NAME);
+		return battery;
+	}
+	
+	@XmlElement(name="battyAnnc", required=true, type=BatteryFlexContainerAnnc.class)
+	private BatteryFlexContainerAnnc batteryAnnc;
+	
+	
+	public void setBattery(BatteryFlexContainerAnnc batteryAnnc) {
+		this.batteryAnnc = batteryAnnc;
+		getFlexContainerOrContainerOrSubscription().add(batteryAnnc);
+	}
+	
+	public BatteryFlexContainerAnnc getBatteryAnnc() {
+		this.batteryAnnc = (BatteryFlexContainerAnnc) getResourceByName(BatteryFlexContainerAnnc.SHORT_NAME);
+		return batteryAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSwitchButtonFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSwitchButtonFlexContainer.java
new file mode 100644
index 0000000..8de2294
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSwitchButtonFlexContainer.java
@@ -0,0 +1,54 @@
+/*
+Device : DeviceSwitchButton
+
+
+
+A SwitchButton is a device that provides button.
+
+Created: 2017-08-09 15:38:06
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceSwitchButtonFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceSwitchButtonFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceSwitchButtonFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceSwitchButton";
+	public static final String SHORT_NAME = "deSBn";
+	
+	public DeviceSwitchButtonFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceSwitchButtonFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getButtonSwitch();
+	}
+	
+	@XmlElement(name="butSh", required=true, type=PushButtonFlexContainer.class)
+	private PushButtonFlexContainer buttonSwitch;
+	
+	
+	public void setButtonSwitch(PushButtonFlexContainer buttonSwitch) {
+		this.buttonSwitch = buttonSwitch;
+		getFlexContainerOrContainerOrSubscription().add(buttonSwitch);
+	}
+	
+	public PushButtonFlexContainer getButtonSwitch() {
+		this.buttonSwitch = (PushButtonFlexContainer) getResourceByName(PushButtonFlexContainer.SHORT_NAME);
+		return buttonSwitch;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSwitchButtonFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSwitchButtonFlexContainerAnnc.java
new file mode 100644
index 0000000..34c8b95
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceSwitchButtonFlexContainerAnnc.java
@@ -0,0 +1,69 @@
+/*
+Device : DeviceSwitchButtonAnnc
+
+
+
+A SwitchButton is a device that provides button.
+
+Created: 2017-08-09 15:38:06
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceSwitchButtonFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceSwitchButtonFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceSwitchButtonFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceSwitchButtonAnnc";
+	public static final String SHORT_NAME = "deSBnAnnc";
+	
+	public DeviceSwitchButtonFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceSwitchButtonFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getButtonSwitch();
+		getButtonSwitchAnnc();
+	}
+	
+	@XmlElement(name="butSh", required=true, type=PushButtonFlexContainerAnnc.class)
+	private PushButtonFlexContainer buttonSwitch;
+	
+	
+	public void setButtonSwitch(PushButtonFlexContainer buttonSwitch) {
+		this.buttonSwitch = buttonSwitch;
+		getFlexContainerOrContainerOrSubscription().add(buttonSwitch);
+	}
+	
+	public PushButtonFlexContainer getButtonSwitch() {
+		this.buttonSwitch = (PushButtonFlexContainer) getResourceByName(PushButtonFlexContainer.SHORT_NAME);
+		return buttonSwitch;
+	}
+	
+	@XmlElement(name="butShAnnc", required=true, type=PushButtonFlexContainerAnnc.class)
+	private PushButtonFlexContainerAnnc buttonSwitchAnnc;
+	
+	
+	public void setButtonSwitch(PushButtonFlexContainerAnnc buttonSwitchAnnc) {
+		this.buttonSwitchAnnc = buttonSwitchAnnc;
+		getFlexContainerOrContainerOrSubscription().add(buttonSwitchAnnc);
+	}
+	
+	public PushButtonFlexContainerAnnc getButtonSwitchAnnc() {
+		this.buttonSwitchAnnc = (PushButtonFlexContainerAnnc) getResourceByName(PushButtonFlexContainerAnnc.SHORT_NAME);
+		return buttonSwitchAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceTelevisionFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceTelevisionFlexContainer.java
new file mode 100644
index 0000000..fac4fe6
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceTelevisionFlexContainer.java
@@ -0,0 +1,99 @@
+/*
+Device : DeviceTelevision
+
+
+
+A stelevision (TV) is a home appliance used to show audio and visual content such as broadcasting programs and network streaming. This TV information model provides capabilities to control and monitor TV specific resources.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceTelevisionFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceTelevisionFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceTelevisionFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceTelevision";
+	public static final String SHORT_NAME = "devTn";
+	
+	public DeviceTelevisionFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceTelevisionFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getBinarySwitch();
+		getAudioVolume();
+		getTelevisionChannel();
+		getAudioVideoInput();
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainer.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="audVe", required=true, type=AudioVolumeFlexContainer.class)
+	private AudioVolumeFlexContainer audioVolume;
+	
+	
+	public void setAudioVolume(AudioVolumeFlexContainer audioVolume) {
+		this.audioVolume = audioVolume;
+		getFlexContainerOrContainerOrSubscription().add(audioVolume);
+	}
+	
+	public AudioVolumeFlexContainer getAudioVolume() {
+		this.audioVolume = (AudioVolumeFlexContainer) getResourceByName(AudioVolumeFlexContainer.SHORT_NAME);
+		return audioVolume;
+	}
+	
+	@XmlElement(name="telCl", required=true, type=TelevisionChannelFlexContainer.class)
+	private TelevisionChannelFlexContainer televisionChannel;
+	
+	
+	public void setTelevisionChannel(TelevisionChannelFlexContainer televisionChannel) {
+		this.televisionChannel = televisionChannel;
+		getFlexContainerOrContainerOrSubscription().add(televisionChannel);
+	}
+	
+	public TelevisionChannelFlexContainer getTelevisionChannel() {
+		this.televisionChannel = (TelevisionChannelFlexContainer) getResourceByName(TelevisionChannelFlexContainer.SHORT_NAME);
+		return televisionChannel;
+	}
+	
+	@XmlElement(name="auVIt", required=true, type=AudioVideoInputFlexContainer.class)
+	private AudioVideoInputFlexContainer audioVideoInput;
+	
+	
+	public void setAudioVideoInput(AudioVideoInputFlexContainer audioVideoInput) {
+		this.audioVideoInput = audioVideoInput;
+		getFlexContainerOrContainerOrSubscription().add(audioVideoInput);
+	}
+	
+	public AudioVideoInputFlexContainer getAudioVideoInput() {
+		this.audioVideoInput = (AudioVideoInputFlexContainer) getResourceByName(AudioVideoInputFlexContainer.SHORT_NAME);
+		return audioVideoInput;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceTelevisionFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceTelevisionFlexContainerAnnc.java
new file mode 100644
index 0000000..7d68a69
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceTelevisionFlexContainerAnnc.java
@@ -0,0 +1,159 @@
+/*
+Device : DeviceTelevisionAnnc
+
+
+
+A stelevision (TV) is a home appliance used to show audio and visual content such as broadcasting programs and network streaming. This TV information model provides capabilities to control and monitor TV specific resources.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceTelevisionFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceTelevisionFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceTelevisionFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceTelevisionAnnc";
+	public static final String SHORT_NAME = "devTnAnnc";
+	
+	public DeviceTelevisionFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceTelevisionFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getBinarySwitch();
+		getBinarySwitchAnnc();
+		getAudioVolume();
+		getAudioVolumeAnnc();
+		getTelevisionChannel();
+		getTelevisionChannelAnnc();
+		getAudioVideoInput();
+		getAudioVideoInputAnnc();
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="binShAnnc", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainerAnnc binarySwitchAnnc;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainerAnnc binarySwitchAnnc) {
+		this.binarySwitchAnnc = binarySwitchAnnc;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitchAnnc);
+	}
+	
+	public BinarySwitchFlexContainerAnnc getBinarySwitchAnnc() {
+		this.binarySwitchAnnc = (BinarySwitchFlexContainerAnnc) getResourceByName(BinarySwitchFlexContainerAnnc.SHORT_NAME);
+		return binarySwitchAnnc;
+	}
+	
+	@XmlElement(name="audVe", required=true, type=AudioVolumeFlexContainerAnnc.class)
+	private AudioVolumeFlexContainer audioVolume;
+	
+	
+	public void setAudioVolume(AudioVolumeFlexContainer audioVolume) {
+		this.audioVolume = audioVolume;
+		getFlexContainerOrContainerOrSubscription().add(audioVolume);
+	}
+	
+	public AudioVolumeFlexContainer getAudioVolume() {
+		this.audioVolume = (AudioVolumeFlexContainer) getResourceByName(AudioVolumeFlexContainer.SHORT_NAME);
+		return audioVolume;
+	}
+	
+	@XmlElement(name="audVeAnnc", required=true, type=AudioVolumeFlexContainerAnnc.class)
+	private AudioVolumeFlexContainerAnnc audioVolumeAnnc;
+	
+	
+	public void setAudioVolume(AudioVolumeFlexContainerAnnc audioVolumeAnnc) {
+		this.audioVolumeAnnc = audioVolumeAnnc;
+		getFlexContainerOrContainerOrSubscription().add(audioVolumeAnnc);
+	}
+	
+	public AudioVolumeFlexContainerAnnc getAudioVolumeAnnc() {
+		this.audioVolumeAnnc = (AudioVolumeFlexContainerAnnc) getResourceByName(AudioVolumeFlexContainerAnnc.SHORT_NAME);
+		return audioVolumeAnnc;
+	}
+	
+	@XmlElement(name="telCl", required=true, type=TelevisionChannelFlexContainerAnnc.class)
+	private TelevisionChannelFlexContainer televisionChannel;
+	
+	
+	public void setTelevisionChannel(TelevisionChannelFlexContainer televisionChannel) {
+		this.televisionChannel = televisionChannel;
+		getFlexContainerOrContainerOrSubscription().add(televisionChannel);
+	}
+	
+	public TelevisionChannelFlexContainer getTelevisionChannel() {
+		this.televisionChannel = (TelevisionChannelFlexContainer) getResourceByName(TelevisionChannelFlexContainer.SHORT_NAME);
+		return televisionChannel;
+	}
+	
+	@XmlElement(name="telClAnnc", required=true, type=TelevisionChannelFlexContainerAnnc.class)
+	private TelevisionChannelFlexContainerAnnc televisionChannelAnnc;
+	
+	
+	public void setTelevisionChannel(TelevisionChannelFlexContainerAnnc televisionChannelAnnc) {
+		this.televisionChannelAnnc = televisionChannelAnnc;
+		getFlexContainerOrContainerOrSubscription().add(televisionChannelAnnc);
+	}
+	
+	public TelevisionChannelFlexContainerAnnc getTelevisionChannelAnnc() {
+		this.televisionChannelAnnc = (TelevisionChannelFlexContainerAnnc) getResourceByName(TelevisionChannelFlexContainerAnnc.SHORT_NAME);
+		return televisionChannelAnnc;
+	}
+	
+	@XmlElement(name="auVIt", required=true, type=AudioVideoInputFlexContainerAnnc.class)
+	private AudioVideoInputFlexContainer audioVideoInput;
+	
+	
+	public void setAudioVideoInput(AudioVideoInputFlexContainer audioVideoInput) {
+		this.audioVideoInput = audioVideoInput;
+		getFlexContainerOrContainerOrSubscription().add(audioVideoInput);
+	}
+	
+	public AudioVideoInputFlexContainer getAudioVideoInput() {
+		this.audioVideoInput = (AudioVideoInputFlexContainer) getResourceByName(AudioVideoInputFlexContainer.SHORT_NAME);
+		return audioVideoInput;
+	}
+	
+	@XmlElement(name="auVItAnnc", required=true, type=AudioVideoInputFlexContainerAnnc.class)
+	private AudioVideoInputFlexContainerAnnc audioVideoInputAnnc;
+	
+	
+	public void setAudioVideoInput(AudioVideoInputFlexContainerAnnc audioVideoInputAnnc) {
+		this.audioVideoInputAnnc = audioVideoInputAnnc;
+		getFlexContainerOrContainerOrSubscription().add(audioVideoInputAnnc);
+	}
+	
+	public AudioVideoInputFlexContainerAnnc getAudioVideoInputAnnc() {
+		this.audioVideoInputAnnc = (AudioVideoInputFlexContainerAnnc) getResourceByName(AudioVideoInputFlexContainerAnnc.SHORT_NAME);
+		return audioVideoInputAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceTemperatureDetectorFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceTemperatureDetectorFlexContainer.java
new file mode 100644
index 0000000..1b31d1f
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceTemperatureDetectorFlexContainer.java
@@ -0,0 +1,69 @@
+/*
+Device : DeviceTemperatureDetector
+
+
+
+A SwitchButton is a device that provides button.
+
+Created: 2017-08-09 15:38:06
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceTemperatureDetectorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceTemperatureDetectorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceTemperatureDetectorFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceTemperatureDetector";
+	public static final String SHORT_NAME = "deTDr";
+	
+	public DeviceTemperatureDetectorFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceTemperatureDetectorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getAlarmSensor();
+		getTemperature();
+	}
+	
+	@XmlElement(name="alSer", required=true, type=AlarmSensorFlexContainer.class)
+	private AlarmSensorFlexContainer alarmSensor;
+	
+	
+	public void setAlarmSensor(AlarmSensorFlexContainer alarmSensor) {
+		this.alarmSensor = alarmSensor;
+		getFlexContainerOrContainerOrSubscription().add(alarmSensor);
+	}
+	
+	public AlarmSensorFlexContainer getAlarmSensor() {
+		this.alarmSensor = (AlarmSensorFlexContainer) getResourceByName(AlarmSensorFlexContainer.SHORT_NAME);
+		return alarmSensor;
+	}
+	
+	@XmlElement(name="tempe", required=true, type=TemperatureFlexContainer.class)
+	private TemperatureFlexContainer temperature;
+	
+	
+	public void setTemperature(TemperatureFlexContainer temperature) {
+		this.temperature = temperature;
+		getFlexContainerOrContainerOrSubscription().add(temperature);
+	}
+	
+	public TemperatureFlexContainer getTemperature() {
+		this.temperature = (TemperatureFlexContainer) getResourceByName(TemperatureFlexContainer.SHORT_NAME);
+		return temperature;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceTemperatureDetectorFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceTemperatureDetectorFlexContainerAnnc.java
new file mode 100644
index 0000000..04fce16
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceTemperatureDetectorFlexContainerAnnc.java
@@ -0,0 +1,99 @@
+/*
+Device : DeviceTemperatureDetectorAnnc
+
+
+
+A SwitchButton is a device that provides button.
+
+Created: 2017-08-09 15:38:06
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceTemperatureDetectorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceTemperatureDetectorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceTemperatureDetectorFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceTemperatureDetectorAnnc";
+	public static final String SHORT_NAME = "deTDrAnnc";
+	
+	public DeviceTemperatureDetectorFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceTemperatureDetectorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getAlarmSensor();
+		getAlarmSensorAnnc();
+		getTemperature();
+		getTemperatureAnnc();
+	}
+	
+	@XmlElement(name="alSer", required=true, type=AlarmSensorFlexContainerAnnc.class)
+	private AlarmSensorFlexContainer alarmSensor;
+	
+	
+	public void setAlarmSensor(AlarmSensorFlexContainer alarmSensor) {
+		this.alarmSensor = alarmSensor;
+		getFlexContainerOrContainerOrSubscription().add(alarmSensor);
+	}
+	
+	public AlarmSensorFlexContainer getAlarmSensor() {
+		this.alarmSensor = (AlarmSensorFlexContainer) getResourceByName(AlarmSensorFlexContainer.SHORT_NAME);
+		return alarmSensor;
+	}
+	
+	@XmlElement(name="alSerAnnc", required=true, type=AlarmSensorFlexContainerAnnc.class)
+	private AlarmSensorFlexContainerAnnc alarmSensorAnnc;
+	
+	
+	public void setAlarmSensor(AlarmSensorFlexContainerAnnc alarmSensorAnnc) {
+		this.alarmSensorAnnc = alarmSensorAnnc;
+		getFlexContainerOrContainerOrSubscription().add(alarmSensorAnnc);
+	}
+	
+	public AlarmSensorFlexContainerAnnc getAlarmSensorAnnc() {
+		this.alarmSensorAnnc = (AlarmSensorFlexContainerAnnc) getResourceByName(AlarmSensorFlexContainerAnnc.SHORT_NAME);
+		return alarmSensorAnnc;
+	}
+	
+	@XmlElement(name="tempe", required=true, type=TemperatureFlexContainerAnnc.class)
+	private TemperatureFlexContainer temperature;
+	
+	
+	public void setTemperature(TemperatureFlexContainer temperature) {
+		this.temperature = temperature;
+		getFlexContainerOrContainerOrSubscription().add(temperature);
+	}
+	
+	public TemperatureFlexContainer getTemperature() {
+		this.temperature = (TemperatureFlexContainer) getResourceByName(TemperatureFlexContainer.SHORT_NAME);
+		return temperature;
+	}
+	
+	@XmlElement(name="tempeAnnc", required=true, type=TemperatureFlexContainerAnnc.class)
+	private TemperatureFlexContainerAnnc temperatureAnnc;
+	
+	
+	public void setTemperature(TemperatureFlexContainerAnnc temperatureAnnc) {
+		this.temperatureAnnc = temperatureAnnc;
+		getFlexContainerOrContainerOrSubscription().add(temperatureAnnc);
+	}
+	
+	public TemperatureFlexContainerAnnc getTemperatureAnnc() {
+		this.temperatureAnnc = (TemperatureFlexContainerAnnc) getResourceByName(TemperatureFlexContainerAnnc.SHORT_NAME);
+		return temperatureAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceThermostatFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceThermostatFlexContainer.java
new file mode 100644
index 0000000..8ae7b1f
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceThermostatFlexContainer.java
@@ -0,0 +1,84 @@
+/*
+Device : DeviceThermostat
+
+
+
+A thermostat is used to control the ambient temperature of rooms within for example a house. This information model provides capabilities to interact with specific functions of thermostats.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceThermostatFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceThermostatFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceThermostatFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceThermostat";
+	public static final String SHORT_NAME = "devTt";
+	
+	public DeviceThermostatFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceThermostatFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getRunMode();
+		getTimer();
+		getTemperature();
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainer.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="timer", required=true, type=TimerFlexContainer.class)
+	private TimerFlexContainer timer;
+	
+	
+	public void setTimer(TimerFlexContainer timer) {
+		this.timer = timer;
+		getFlexContainerOrContainerOrSubscription().add(timer);
+	}
+	
+	public TimerFlexContainer getTimer() {
+		this.timer = (TimerFlexContainer) getResourceByName(TimerFlexContainer.SHORT_NAME);
+		return timer;
+	}
+	
+	@XmlElement(name="tempe", required=true, type=TemperatureFlexContainer.class)
+	private TemperatureFlexContainer temperature;
+	
+	
+	public void setTemperature(TemperatureFlexContainer temperature) {
+		this.temperature = temperature;
+		getFlexContainerOrContainerOrSubscription().add(temperature);
+	}
+	
+	public TemperatureFlexContainer getTemperature() {
+		this.temperature = (TemperatureFlexContainer) getResourceByName(TemperatureFlexContainer.SHORT_NAME);
+		return temperature;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceThermostatFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceThermostatFlexContainerAnnc.java
new file mode 100644
index 0000000..58f0199
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceThermostatFlexContainerAnnc.java
@@ -0,0 +1,129 @@
+/*
+Device : DeviceThermostatAnnc
+
+
+
+A thermostat is used to control the ambient temperature of rooms within for example a house. This information model provides capabilities to interact with specific functions of thermostats.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceThermostatFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceThermostatFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceThermostatFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceThermostatAnnc";
+	public static final String SHORT_NAME = "devTtAnnc";
+	
+	public DeviceThermostatFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceThermostatFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getRunMode();
+		getRunModeAnnc();
+		getTimer();
+		getTimerAnnc();
+		getTemperature();
+		getTemperatureAnnc();
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="runMeAnnc", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainerAnnc runModeAnnc;
+	
+	
+	public void setRunMode(RunModeFlexContainerAnnc runModeAnnc) {
+		this.runModeAnnc = runModeAnnc;
+		getFlexContainerOrContainerOrSubscription().add(runModeAnnc);
+	}
+	
+	public RunModeFlexContainerAnnc getRunModeAnnc() {
+		this.runModeAnnc = (RunModeFlexContainerAnnc) getResourceByName(RunModeFlexContainerAnnc.SHORT_NAME);
+		return runModeAnnc;
+	}
+	
+	@XmlElement(name="timer", required=true, type=TimerFlexContainerAnnc.class)
+	private TimerFlexContainer timer;
+	
+	
+	public void setTimer(TimerFlexContainer timer) {
+		this.timer = timer;
+		getFlexContainerOrContainerOrSubscription().add(timer);
+	}
+	
+	public TimerFlexContainer getTimer() {
+		this.timer = (TimerFlexContainer) getResourceByName(TimerFlexContainer.SHORT_NAME);
+		return timer;
+	}
+	
+	@XmlElement(name="timerAnnc", required=true, type=TimerFlexContainerAnnc.class)
+	private TimerFlexContainerAnnc timerAnnc;
+	
+	
+	public void setTimer(TimerFlexContainerAnnc timerAnnc) {
+		this.timerAnnc = timerAnnc;
+		getFlexContainerOrContainerOrSubscription().add(timerAnnc);
+	}
+	
+	public TimerFlexContainerAnnc getTimerAnnc() {
+		this.timerAnnc = (TimerFlexContainerAnnc) getResourceByName(TimerFlexContainerAnnc.SHORT_NAME);
+		return timerAnnc;
+	}
+	
+	@XmlElement(name="tempe", required=true, type=TemperatureFlexContainerAnnc.class)
+	private TemperatureFlexContainer temperature;
+	
+	
+	public void setTemperature(TemperatureFlexContainer temperature) {
+		this.temperature = temperature;
+		getFlexContainerOrContainerOrSubscription().add(temperature);
+	}
+	
+	public TemperatureFlexContainer getTemperature() {
+		this.temperature = (TemperatureFlexContainer) getResourceByName(TemperatureFlexContainer.SHORT_NAME);
+		return temperature;
+	}
+	
+	@XmlElement(name="tempeAnnc", required=true, type=TemperatureFlexContainerAnnc.class)
+	private TemperatureFlexContainerAnnc temperatureAnnc;
+	
+	
+	public void setTemperature(TemperatureFlexContainerAnnc temperatureAnnc) {
+		this.temperatureAnnc = temperatureAnnc;
+		getFlexContainerOrContainerOrSubscription().add(temperatureAnnc);
+	}
+	
+	public TemperatureFlexContainerAnnc getTemperatureAnnc() {
+		this.temperatureAnnc = (TemperatureFlexContainerAnnc) getResourceByName(TemperatureFlexContainerAnnc.SHORT_NAME);
+		return temperatureAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWarningDeviceFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWarningDeviceFlexContainer.java
new file mode 100644
index 0000000..f022d35
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWarningDeviceFlexContainer.java
@@ -0,0 +1,69 @@
+/*
+Device : DeviceWarningDevice
+
+
+
+A WarningDevice is a device that prevents users about an alarm (ie a siren).
+
+Created: 2017-08-09 15:38:06
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceWarningDeviceFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceWarningDeviceFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceWarningDeviceFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceWarningDevice";
+	public static final String SHORT_NAME = "deWDe";
+	
+	public DeviceWarningDeviceFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceWarningDeviceFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getAlarmSpeaker();
+		getFaultDetection();
+	}
+	
+	@XmlElement(name="alaSr", required=true, type=AlarmSpeakerFlexContainer.class)
+	private AlarmSpeakerFlexContainer alarmSpeaker;
+	
+	
+	public void setAlarmSpeaker(AlarmSpeakerFlexContainer alarmSpeaker) {
+		this.alarmSpeaker = alarmSpeaker;
+		getFlexContainerOrContainerOrSubscription().add(alarmSpeaker);
+	}
+	
+	public AlarmSpeakerFlexContainer getAlarmSpeaker() {
+		this.alarmSpeaker = (AlarmSpeakerFlexContainer) getResourceByName(AlarmSpeakerFlexContainer.SHORT_NAME);
+		return alarmSpeaker;
+	}
+	
+	@XmlElement(name="fauDn", required=true, type=FaultDetectionFlexContainer.class)
+	private FaultDetectionFlexContainer faultDetection;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainer faultDetection) {
+		this.faultDetection = faultDetection;
+		getFlexContainerOrContainerOrSubscription().add(faultDetection);
+	}
+	
+	public FaultDetectionFlexContainer getFaultDetection() {
+		this.faultDetection = (FaultDetectionFlexContainer) getResourceByName(FaultDetectionFlexContainer.SHORT_NAME);
+		return faultDetection;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWarningDeviceFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWarningDeviceFlexContainerAnnc.java
new file mode 100644
index 0000000..2d36aa7
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWarningDeviceFlexContainerAnnc.java
@@ -0,0 +1,99 @@
+/*
+Device : DeviceWarningDeviceAnnc
+
+
+
+A WarningDevice is a device that prevents users about an alarm (ie a siren).
+
+Created: 2017-08-09 15:38:06
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceWarningDeviceFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceWarningDeviceFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceWarningDeviceFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceWarningDeviceAnnc";
+	public static final String SHORT_NAME = "deWDeAnnc";
+	
+	public DeviceWarningDeviceFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceWarningDeviceFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getAlarmSpeaker();
+		getAlarmSpeakerAnnc();
+		getFaultDetection();
+		getFaultDetectionAnnc();
+	}
+	
+	@XmlElement(name="alaSr", required=true, type=AlarmSpeakerFlexContainerAnnc.class)
+	private AlarmSpeakerFlexContainer alarmSpeaker;
+	
+	
+	public void setAlarmSpeaker(AlarmSpeakerFlexContainer alarmSpeaker) {
+		this.alarmSpeaker = alarmSpeaker;
+		getFlexContainerOrContainerOrSubscription().add(alarmSpeaker);
+	}
+	
+	public AlarmSpeakerFlexContainer getAlarmSpeaker() {
+		this.alarmSpeaker = (AlarmSpeakerFlexContainer) getResourceByName(AlarmSpeakerFlexContainer.SHORT_NAME);
+		return alarmSpeaker;
+	}
+	
+	@XmlElement(name="alaSrAnnc", required=true, type=AlarmSpeakerFlexContainerAnnc.class)
+	private AlarmSpeakerFlexContainerAnnc alarmSpeakerAnnc;
+	
+	
+	public void setAlarmSpeaker(AlarmSpeakerFlexContainerAnnc alarmSpeakerAnnc) {
+		this.alarmSpeakerAnnc = alarmSpeakerAnnc;
+		getFlexContainerOrContainerOrSubscription().add(alarmSpeakerAnnc);
+	}
+	
+	public AlarmSpeakerFlexContainerAnnc getAlarmSpeakerAnnc() {
+		this.alarmSpeakerAnnc = (AlarmSpeakerFlexContainerAnnc) getResourceByName(AlarmSpeakerFlexContainerAnnc.SHORT_NAME);
+		return alarmSpeakerAnnc;
+	}
+	
+	@XmlElement(name="fauDn", required=true, type=FaultDetectionFlexContainerAnnc.class)
+	private FaultDetectionFlexContainer faultDetection;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainer faultDetection) {
+		this.faultDetection = faultDetection;
+		getFlexContainerOrContainerOrSubscription().add(faultDetection);
+	}
+	
+	public FaultDetectionFlexContainer getFaultDetection() {
+		this.faultDetection = (FaultDetectionFlexContainer) getResourceByName(FaultDetectionFlexContainer.SHORT_NAME);
+		return faultDetection;
+	}
+	
+	@XmlElement(name="fauDnAnnc", required=true, type=FaultDetectionFlexContainerAnnc.class)
+	private FaultDetectionFlexContainerAnnc faultDetectionAnnc;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainerAnnc faultDetectionAnnc) {
+		this.faultDetectionAnnc = faultDetectionAnnc;
+		getFlexContainerOrContainerOrSubscription().add(faultDetectionAnnc);
+	}
+	
+	public FaultDetectionFlexContainerAnnc getFaultDetectionAnnc() {
+		this.faultDetectionAnnc = (FaultDetectionFlexContainerAnnc) getResourceByName(FaultDetectionFlexContainerAnnc.SHORT_NAME);
+		return faultDetectionAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWaterHeaterFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWaterHeaterFlexContainer.java
new file mode 100644
index 0000000..9d321a8
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWaterHeaterFlexContainer.java
@@ -0,0 +1,129 @@
+/*
+Device : DeviceWaterHeater
+
+
+
+A water heater is a device that is used to provide hot water through home facilities.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceWaterHeaterFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceWaterHeaterFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceWaterHeaterFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceWaterHeater";
+	public static final String SHORT_NAME = "deWHr";
+	
+	public DeviceWaterHeaterFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceWaterHeaterFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getFaultDetection();
+		getBinarySwitch();
+		getRunMode();
+		getClock();
+		getBoiler();
+		getHotWaterSupply();
+	}
+	
+	@XmlElement(name="fauDn", required=true, type=FaultDetectionFlexContainer.class)
+	private FaultDetectionFlexContainer faultDetection;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainer faultDetection) {
+		this.faultDetection = faultDetection;
+		getFlexContainerOrContainerOrSubscription().add(faultDetection);
+	}
+	
+	public FaultDetectionFlexContainer getFaultDetection() {
+		this.faultDetection = (FaultDetectionFlexContainer) getResourceByName(FaultDetectionFlexContainer.SHORT_NAME);
+		return faultDetection;
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainer.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainer.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="clock", required=true, type=ClockFlexContainer.class)
+	private ClockFlexContainer clock;
+	
+	
+	public void setClock(ClockFlexContainer clock) {
+		this.clock = clock;
+		getFlexContainerOrContainerOrSubscription().add(clock);
+	}
+	
+	public ClockFlexContainer getClock() {
+		this.clock = (ClockFlexContainer) getResourceByName(ClockFlexContainer.SHORT_NAME);
+		return clock;
+	}
+	
+	@XmlElement(name="boilr", required=true, type=BoilerFlexContainer.class)
+	private BoilerFlexContainer boiler;
+	
+	
+	public void setBoiler(BoilerFlexContainer boiler) {
+		this.boiler = boiler;
+		getFlexContainerOrContainerOrSubscription().add(boiler);
+	}
+	
+	public BoilerFlexContainer getBoiler() {
+		this.boiler = (BoilerFlexContainer) getResourceByName(BoilerFlexContainer.SHORT_NAME);
+		return boiler;
+	}
+	
+	@XmlElement(name="hoWSy", required=true, type=HotWaterSupplyFlexContainer.class)
+	private HotWaterSupplyFlexContainer hotWaterSupply;
+	
+	
+	public void setHotWaterSupply(HotWaterSupplyFlexContainer hotWaterSupply) {
+		this.hotWaterSupply = hotWaterSupply;
+		getFlexContainerOrContainerOrSubscription().add(hotWaterSupply);
+	}
+	
+	public HotWaterSupplyFlexContainer getHotWaterSupply() {
+		this.hotWaterSupply = (HotWaterSupplyFlexContainer) getResourceByName(HotWaterSupplyFlexContainer.SHORT_NAME);
+		return hotWaterSupply;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWaterHeaterFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWaterHeaterFlexContainerAnnc.java
new file mode 100644
index 0000000..bd1047f
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWaterHeaterFlexContainerAnnc.java
@@ -0,0 +1,219 @@
+/*
+Device : DeviceWaterHeaterAnnc
+
+
+
+A water heater is a device that is used to provide hot water through home facilities.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceWaterHeaterFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceWaterHeaterFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceWaterHeaterFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceWaterHeaterAnnc";
+	public static final String SHORT_NAME = "deWHrAnnc";
+	
+	public DeviceWaterHeaterFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceWaterHeaterFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getFaultDetection();
+		getFaultDetectionAnnc();
+		getBinarySwitch();
+		getBinarySwitchAnnc();
+		getRunMode();
+		getRunModeAnnc();
+		getClock();
+		getClockAnnc();
+		getBoiler();
+		getBoilerAnnc();
+		getHotWaterSupply();
+		getHotWaterSupplyAnnc();
+	}
+	
+	@XmlElement(name="fauDn", required=true, type=FaultDetectionFlexContainerAnnc.class)
+	private FaultDetectionFlexContainer faultDetection;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainer faultDetection) {
+		this.faultDetection = faultDetection;
+		getFlexContainerOrContainerOrSubscription().add(faultDetection);
+	}
+	
+	public FaultDetectionFlexContainer getFaultDetection() {
+		this.faultDetection = (FaultDetectionFlexContainer) getResourceByName(FaultDetectionFlexContainer.SHORT_NAME);
+		return faultDetection;
+	}
+	
+	@XmlElement(name="fauDnAnnc", required=true, type=FaultDetectionFlexContainerAnnc.class)
+	private FaultDetectionFlexContainerAnnc faultDetectionAnnc;
+	
+	
+	public void setFaultDetection(FaultDetectionFlexContainerAnnc faultDetectionAnnc) {
+		this.faultDetectionAnnc = faultDetectionAnnc;
+		getFlexContainerOrContainerOrSubscription().add(faultDetectionAnnc);
+	}
+	
+	public FaultDetectionFlexContainerAnnc getFaultDetectionAnnc() {
+		this.faultDetectionAnnc = (FaultDetectionFlexContainerAnnc) getResourceByName(FaultDetectionFlexContainerAnnc.SHORT_NAME);
+		return faultDetectionAnnc;
+	}
+	
+	@XmlElement(name="binSh", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainer binarySwitch;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainer binarySwitch) {
+		this.binarySwitch = binarySwitch;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitch);
+	}
+	
+	public BinarySwitchFlexContainer getBinarySwitch() {
+		this.binarySwitch = (BinarySwitchFlexContainer) getResourceByName(BinarySwitchFlexContainer.SHORT_NAME);
+		return binarySwitch;
+	}
+	
+	@XmlElement(name="binShAnnc", required=true, type=BinarySwitchFlexContainerAnnc.class)
+	private BinarySwitchFlexContainerAnnc binarySwitchAnnc;
+	
+	
+	public void setBinarySwitch(BinarySwitchFlexContainerAnnc binarySwitchAnnc) {
+		this.binarySwitchAnnc = binarySwitchAnnc;
+		getFlexContainerOrContainerOrSubscription().add(binarySwitchAnnc);
+	}
+	
+	public BinarySwitchFlexContainerAnnc getBinarySwitchAnnc() {
+		this.binarySwitchAnnc = (BinarySwitchFlexContainerAnnc) getResourceByName(BinarySwitchFlexContainerAnnc.SHORT_NAME);
+		return binarySwitchAnnc;
+	}
+	
+	@XmlElement(name="runMe", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainer runMode;
+	
+	
+	public void setRunMode(RunModeFlexContainer runMode) {
+		this.runMode = runMode;
+		getFlexContainerOrContainerOrSubscription().add(runMode);
+	}
+	
+	public RunModeFlexContainer getRunMode() {
+		this.runMode = (RunModeFlexContainer) getResourceByName(RunModeFlexContainer.SHORT_NAME);
+		return runMode;
+	}
+	
+	@XmlElement(name="runMeAnnc", required=true, type=RunModeFlexContainerAnnc.class)
+	private RunModeFlexContainerAnnc runModeAnnc;
+	
+	
+	public void setRunMode(RunModeFlexContainerAnnc runModeAnnc) {
+		this.runModeAnnc = runModeAnnc;
+		getFlexContainerOrContainerOrSubscription().add(runModeAnnc);
+	}
+	
+	public RunModeFlexContainerAnnc getRunModeAnnc() {
+		this.runModeAnnc = (RunModeFlexContainerAnnc) getResourceByName(RunModeFlexContainerAnnc.SHORT_NAME);
+		return runModeAnnc;
+	}
+	
+	@XmlElement(name="clock", required=true, type=ClockFlexContainerAnnc.class)
+	private ClockFlexContainer clock;
+	
+	
+	public void setClock(ClockFlexContainer clock) {
+		this.clock = clock;
+		getFlexContainerOrContainerOrSubscription().add(clock);
+	}
+	
+	public ClockFlexContainer getClock() {
+		this.clock = (ClockFlexContainer) getResourceByName(ClockFlexContainer.SHORT_NAME);
+		return clock;
+	}
+	
+	@XmlElement(name="clockAnnc", required=true, type=ClockFlexContainerAnnc.class)
+	private ClockFlexContainerAnnc clockAnnc;
+	
+	
+	public void setClock(ClockFlexContainerAnnc clockAnnc) {
+		this.clockAnnc = clockAnnc;
+		getFlexContainerOrContainerOrSubscription().add(clockAnnc);
+	}
+	
+	public ClockFlexContainerAnnc getClockAnnc() {
+		this.clockAnnc = (ClockFlexContainerAnnc) getResourceByName(ClockFlexContainerAnnc.SHORT_NAME);
+		return clockAnnc;
+	}
+	
+	@XmlElement(name="boilr", required=true, type=BoilerFlexContainerAnnc.class)
+	private BoilerFlexContainer boiler;
+	
+	
+	public void setBoiler(BoilerFlexContainer boiler) {
+		this.boiler = boiler;
+		getFlexContainerOrContainerOrSubscription().add(boiler);
+	}
+	
+	public BoilerFlexContainer getBoiler() {
+		this.boiler = (BoilerFlexContainer) getResourceByName(BoilerFlexContainer.SHORT_NAME);
+		return boiler;
+	}
+	
+	@XmlElement(name="boilrAnnc", required=true, type=BoilerFlexContainerAnnc.class)
+	private BoilerFlexContainerAnnc boilerAnnc;
+	
+	
+	public void setBoiler(BoilerFlexContainerAnnc boilerAnnc) {
+		this.boilerAnnc = boilerAnnc;
+		getFlexContainerOrContainerOrSubscription().add(boilerAnnc);
+	}
+	
+	public BoilerFlexContainerAnnc getBoilerAnnc() {
+		this.boilerAnnc = (BoilerFlexContainerAnnc) getResourceByName(BoilerFlexContainerAnnc.SHORT_NAME);
+		return boilerAnnc;
+	}
+	
+	@XmlElement(name="hoWSy", required=true, type=HotWaterSupplyFlexContainerAnnc.class)
+	private HotWaterSupplyFlexContainer hotWaterSupply;
+	
+	
+	public void setHotWaterSupply(HotWaterSupplyFlexContainer hotWaterSupply) {
+		this.hotWaterSupply = hotWaterSupply;
+		getFlexContainerOrContainerOrSubscription().add(hotWaterSupply);
+	}
+	
+	public HotWaterSupplyFlexContainer getHotWaterSupply() {
+		this.hotWaterSupply = (HotWaterSupplyFlexContainer) getResourceByName(HotWaterSupplyFlexContainer.SHORT_NAME);
+		return hotWaterSupply;
+	}
+	
+	@XmlElement(name="hoWSyAnnc", required=true, type=HotWaterSupplyFlexContainerAnnc.class)
+	private HotWaterSupplyFlexContainerAnnc hotWaterSupplyAnnc;
+	
+	
+	public void setHotWaterSupply(HotWaterSupplyFlexContainerAnnc hotWaterSupplyAnnc) {
+		this.hotWaterSupplyAnnc = hotWaterSupplyAnnc;
+		getFlexContainerOrContainerOrSubscription().add(hotWaterSupplyAnnc);
+	}
+	
+	public HotWaterSupplyFlexContainerAnnc getHotWaterSupplyAnnc() {
+		this.hotWaterSupplyAnnc = (HotWaterSupplyFlexContainerAnnc) getResourceByName(HotWaterSupplyFlexContainerAnnc.SHORT_NAME);
+		return hotWaterSupplyAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWaterValveFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWaterValveFlexContainer.java
new file mode 100644
index 0000000..1e4b5fb
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWaterValveFlexContainer.java
@@ -0,0 +1,54 @@
+/*
+Device : DeviceWaterValve
+
+
+
+A WaterValve is a device that controls liquid flux.
+
+Created: 2017-08-09 15:38:06
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceWaterValveFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceWaterValveFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceWaterValveFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceWaterValve";
+	public static final String SHORT_NAME = "deWVe";
+	
+	public DeviceWaterValveFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceWaterValveFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getWaterLevel();
+	}
+	
+	@XmlElement(name="watLl", required=true, type=LiquidLevelFlexContainer.class)
+	private LiquidLevelFlexContainer waterLevel;
+	
+	
+	public void setWaterLevel(LiquidLevelFlexContainer waterLevel) {
+		this.waterLevel = waterLevel;
+		getFlexContainerOrContainerOrSubscription().add(waterLevel);
+	}
+	
+	public LiquidLevelFlexContainer getWaterLevel() {
+		this.waterLevel = (LiquidLevelFlexContainer) getResourceByName(LiquidLevelFlexContainer.SHORT_NAME);
+		return waterLevel;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWaterValveFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWaterValveFlexContainerAnnc.java
new file mode 100644
index 0000000..469ac51
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWaterValveFlexContainerAnnc.java
@@ -0,0 +1,69 @@
+/*
+Device : DeviceWaterValveAnnc
+
+
+
+A WaterValve is a device that controls liquid flux.
+
+Created: 2017-08-09 15:38:06
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceWaterValveFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceWaterValveFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceWaterValveFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceWaterValveAnnc";
+	public static final String SHORT_NAME = "deWVeAnnc";
+	
+	public DeviceWaterValveFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceWaterValveFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getWaterLevel();
+		getWaterLevelAnnc();
+	}
+	
+	@XmlElement(name="watLl", required=true, type=LiquidLevelFlexContainerAnnc.class)
+	private LiquidLevelFlexContainer waterLevel;
+	
+	
+	public void setWaterLevel(LiquidLevelFlexContainer waterLevel) {
+		this.waterLevel = waterLevel;
+		getFlexContainerOrContainerOrSubscription().add(waterLevel);
+	}
+	
+	public LiquidLevelFlexContainer getWaterLevel() {
+		this.waterLevel = (LiquidLevelFlexContainer) getResourceByName(LiquidLevelFlexContainer.SHORT_NAME);
+		return waterLevel;
+	}
+	
+	@XmlElement(name="watLlAnnc", required=true, type=LiquidLevelFlexContainerAnnc.class)
+	private LiquidLevelFlexContainerAnnc waterLevelAnnc;
+	
+	
+	public void setWaterLevel(LiquidLevelFlexContainerAnnc waterLevelAnnc) {
+		this.waterLevelAnnc = waterLevelAnnc;
+		getFlexContainerOrContainerOrSubscription().add(waterLevelAnnc);
+	}
+	
+	public LiquidLevelFlexContainerAnnc getWaterLevelAnnc() {
+		this.waterLevelAnnc = (LiquidLevelFlexContainerAnnc) getResourceByName(LiquidLevelFlexContainerAnnc.SHORT_NAME);
+		return waterLevelAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWeatherStationFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWeatherStationFlexContainer.java
new file mode 100644
index 0000000..0261f04
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWeatherStationFlexContainer.java
@@ -0,0 +1,114 @@
+/*
+Device : DeviceWeatherStation
+
+
+
+A WeatherStation is a device that provides weather information.
+
+Created: 2017-08-09 15:38:06
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceWeatherStationFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceWeatherStationFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceWeatherStationFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "deviceWeatherStation";
+	public static final String SHORT_NAME = "deWSn";
+	
+	public DeviceWeatherStationFlexContainer () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceWeatherStationFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getTemperature();
+		getRelativeHumidity();
+		getAtmosphericPressureSensor();
+		getNoise();
+		getExtendedCarbonDioxideSensor();
+	}
+	
+	@XmlElement(name="tempe", required=true, type=TemperatureFlexContainer.class)
+	private TemperatureFlexContainer temperature;
+	
+	
+	public void setTemperature(TemperatureFlexContainer temperature) {
+		this.temperature = temperature;
+		getFlexContainerOrContainerOrSubscription().add(temperature);
+	}
+	
+	public TemperatureFlexContainer getTemperature() {
+		this.temperature = (TemperatureFlexContainer) getResourceByName(TemperatureFlexContainer.SHORT_NAME);
+		return temperature;
+	}
+	
+	@XmlElement(name="relHy", required=true, type=RelativeHumidityFlexContainer.class)
+	private RelativeHumidityFlexContainer relativeHumidity;
+	
+	
+	public void setRelativeHumidity(RelativeHumidityFlexContainer relativeHumidity) {
+		this.relativeHumidity = relativeHumidity;
+		getFlexContainerOrContainerOrSubscription().add(relativeHumidity);
+	}
+	
+	public RelativeHumidityFlexContainer getRelativeHumidity() {
+		this.relativeHumidity = (RelativeHumidityFlexContainer) getResourceByName(RelativeHumidityFlexContainer.SHORT_NAME);
+		return relativeHumidity;
+	}
+	
+	@XmlElement(name="atPSr", required=true, type=AtmosphericPressureSensorFlexContainer.class)
+	private AtmosphericPressureSensorFlexContainer atmosphericPressureSensor;
+	
+	
+	public void setAtmosphericPressureSensor(AtmosphericPressureSensorFlexContainer atmosphericPressureSensor) {
+		this.atmosphericPressureSensor = atmosphericPressureSensor;
+		getFlexContainerOrContainerOrSubscription().add(atmosphericPressureSensor);
+	}
+	
+	public AtmosphericPressureSensorFlexContainer getAtmosphericPressureSensor() {
+		this.atmosphericPressureSensor = (AtmosphericPressureSensorFlexContainer) getResourceByName(AtmosphericPressureSensorFlexContainer.SHORT_NAME);
+		return atmosphericPressureSensor;
+	}
+	
+	@XmlElement(name="noise", required=true, type=NoiseFlexContainer.class)
+	private NoiseFlexContainer noise;
+	
+	
+	public void setNoise(NoiseFlexContainer noise) {
+		this.noise = noise;
+		getFlexContainerOrContainerOrSubscription().add(noise);
+	}
+	
+	public NoiseFlexContainer getNoise() {
+		this.noise = (NoiseFlexContainer) getResourceByName(NoiseFlexContainer.SHORT_NAME);
+		return noise;
+	}
+	
+	@XmlElement(name="eCDSr", required=true, type=ExtendedCarbonDioxideSensorFlexContainer.class)
+	private ExtendedCarbonDioxideSensorFlexContainer extendedCarbonDioxideSensor;
+	
+	
+	public void setExtendedCarbonDioxideSensor(ExtendedCarbonDioxideSensorFlexContainer extendedCarbonDioxideSensor) {
+		this.extendedCarbonDioxideSensor = extendedCarbonDioxideSensor;
+		getFlexContainerOrContainerOrSubscription().add(extendedCarbonDioxideSensor);
+	}
+	
+	public ExtendedCarbonDioxideSensorFlexContainer getExtendedCarbonDioxideSensor() {
+		this.extendedCarbonDioxideSensor = (ExtendedCarbonDioxideSensorFlexContainer) getResourceByName(ExtendedCarbonDioxideSensorFlexContainer.SHORT_NAME);
+		return extendedCarbonDioxideSensor;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWeatherStationFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWeatherStationFlexContainerAnnc.java
new file mode 100644
index 0000000..8d632ca
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DeviceWeatherStationFlexContainerAnnc.java
@@ -0,0 +1,189 @@
+/*
+Device : DeviceWeatherStationAnnc
+
+
+
+A WeatherStation is a device that provides weather information.
+
+Created: 2017-08-09 15:38:06
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DeviceWeatherStationFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DeviceWeatherStationFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DeviceWeatherStationFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "deviceWeatherStationAnnc";
+	public static final String SHORT_NAME = "deWSnAnnc";
+	
+	public DeviceWeatherStationFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.device." + DeviceWeatherStationFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getTemperature();
+		getTemperatureAnnc();
+		getRelativeHumidity();
+		getRelativeHumidityAnnc();
+		getAtmosphericPressureSensor();
+		getAtmosphericPressureSensorAnnc();
+		getNoise();
+		getNoiseAnnc();
+		getExtendedCarbonDioxideSensor();
+		getExtendedCarbonDioxideSensorAnnc();
+	}
+	
+	@XmlElement(name="tempe", required=true, type=TemperatureFlexContainerAnnc.class)
+	private TemperatureFlexContainer temperature;
+	
+	
+	public void setTemperature(TemperatureFlexContainer temperature) {
+		this.temperature = temperature;
+		getFlexContainerOrContainerOrSubscription().add(temperature);
+	}
+	
+	public TemperatureFlexContainer getTemperature() {
+		this.temperature = (TemperatureFlexContainer) getResourceByName(TemperatureFlexContainer.SHORT_NAME);
+		return temperature;
+	}
+	
+	@XmlElement(name="tempeAnnc", required=true, type=TemperatureFlexContainerAnnc.class)
+	private TemperatureFlexContainerAnnc temperatureAnnc;
+	
+	
+	public void setTemperature(TemperatureFlexContainerAnnc temperatureAnnc) {
+		this.temperatureAnnc = temperatureAnnc;
+		getFlexContainerOrContainerOrSubscription().add(temperatureAnnc);
+	}
+	
+	public TemperatureFlexContainerAnnc getTemperatureAnnc() {
+		this.temperatureAnnc = (TemperatureFlexContainerAnnc) getResourceByName(TemperatureFlexContainerAnnc.SHORT_NAME);
+		return temperatureAnnc;
+	}
+	
+	@XmlElement(name="relHy", required=true, type=RelativeHumidityFlexContainerAnnc.class)
+	private RelativeHumidityFlexContainer relativeHumidity;
+	
+	
+	public void setRelativeHumidity(RelativeHumidityFlexContainer relativeHumidity) {
+		this.relativeHumidity = relativeHumidity;
+		getFlexContainerOrContainerOrSubscription().add(relativeHumidity);
+	}
+	
+	public RelativeHumidityFlexContainer getRelativeHumidity() {
+		this.relativeHumidity = (RelativeHumidityFlexContainer) getResourceByName(RelativeHumidityFlexContainer.SHORT_NAME);
+		return relativeHumidity;
+	}
+	
+	@XmlElement(name="relHyAnnc", required=true, type=RelativeHumidityFlexContainerAnnc.class)
+	private RelativeHumidityFlexContainerAnnc relativeHumidityAnnc;
+	
+	
+	public void setRelativeHumidity(RelativeHumidityFlexContainerAnnc relativeHumidityAnnc) {
+		this.relativeHumidityAnnc = relativeHumidityAnnc;
+		getFlexContainerOrContainerOrSubscription().add(relativeHumidityAnnc);
+	}
+	
+	public RelativeHumidityFlexContainerAnnc getRelativeHumidityAnnc() {
+		this.relativeHumidityAnnc = (RelativeHumidityFlexContainerAnnc) getResourceByName(RelativeHumidityFlexContainerAnnc.SHORT_NAME);
+		return relativeHumidityAnnc;
+	}
+	
+	@XmlElement(name="atPSr", required=true, type=AtmosphericPressureSensorFlexContainerAnnc.class)
+	private AtmosphericPressureSensorFlexContainer atmosphericPressureSensor;
+	
+	
+	public void setAtmosphericPressureSensor(AtmosphericPressureSensorFlexContainer atmosphericPressureSensor) {
+		this.atmosphericPressureSensor = atmosphericPressureSensor;
+		getFlexContainerOrContainerOrSubscription().add(atmosphericPressureSensor);
+	}
+	
+	public AtmosphericPressureSensorFlexContainer getAtmosphericPressureSensor() {
+		this.atmosphericPressureSensor = (AtmosphericPressureSensorFlexContainer) getResourceByName(AtmosphericPressureSensorFlexContainer.SHORT_NAME);
+		return atmosphericPressureSensor;
+	}
+	
+	@XmlElement(name="atPSrAnnc", required=true, type=AtmosphericPressureSensorFlexContainerAnnc.class)
+	private AtmosphericPressureSensorFlexContainerAnnc atmosphericPressureSensorAnnc;
+	
+	
+	public void setAtmosphericPressureSensor(AtmosphericPressureSensorFlexContainerAnnc atmosphericPressureSensorAnnc) {
+		this.atmosphericPressureSensorAnnc = atmosphericPressureSensorAnnc;
+		getFlexContainerOrContainerOrSubscription().add(atmosphericPressureSensorAnnc);
+	}
+	
+	public AtmosphericPressureSensorFlexContainerAnnc getAtmosphericPressureSensorAnnc() {
+		this.atmosphericPressureSensorAnnc = (AtmosphericPressureSensorFlexContainerAnnc) getResourceByName(AtmosphericPressureSensorFlexContainerAnnc.SHORT_NAME);
+		return atmosphericPressureSensorAnnc;
+	}
+	
+	@XmlElement(name="noise", required=true, type=NoiseFlexContainerAnnc.class)
+	private NoiseFlexContainer noise;
+	
+	
+	public void setNoise(NoiseFlexContainer noise) {
+		this.noise = noise;
+		getFlexContainerOrContainerOrSubscription().add(noise);
+	}
+	
+	public NoiseFlexContainer getNoise() {
+		this.noise = (NoiseFlexContainer) getResourceByName(NoiseFlexContainer.SHORT_NAME);
+		return noise;
+	}
+	
+	@XmlElement(name="noiseAnnc", required=true, type=NoiseFlexContainerAnnc.class)
+	private NoiseFlexContainerAnnc noiseAnnc;
+	
+	
+	public void setNoise(NoiseFlexContainerAnnc noiseAnnc) {
+		this.noiseAnnc = noiseAnnc;
+		getFlexContainerOrContainerOrSubscription().add(noiseAnnc);
+	}
+	
+	public NoiseFlexContainerAnnc getNoiseAnnc() {
+		this.noiseAnnc = (NoiseFlexContainerAnnc) getResourceByName(NoiseFlexContainerAnnc.SHORT_NAME);
+		return noiseAnnc;
+	}
+	
+	@XmlElement(name="eCDSr", required=true, type=ExtendedCarbonDioxideSensorFlexContainerAnnc.class)
+	private ExtendedCarbonDioxideSensorFlexContainer extendedCarbonDioxideSensor;
+	
+	
+	public void setExtendedCarbonDioxideSensor(ExtendedCarbonDioxideSensorFlexContainer extendedCarbonDioxideSensor) {
+		this.extendedCarbonDioxideSensor = extendedCarbonDioxideSensor;
+		getFlexContainerOrContainerOrSubscription().add(extendedCarbonDioxideSensor);
+	}
+	
+	public ExtendedCarbonDioxideSensorFlexContainer getExtendedCarbonDioxideSensor() {
+		this.extendedCarbonDioxideSensor = (ExtendedCarbonDioxideSensorFlexContainer) getResourceByName(ExtendedCarbonDioxideSensorFlexContainer.SHORT_NAME);
+		return extendedCarbonDioxideSensor;
+	}
+	
+	@XmlElement(name="eCDSrAnnc", required=true, type=ExtendedCarbonDioxideSensorFlexContainerAnnc.class)
+	private ExtendedCarbonDioxideSensorFlexContainerAnnc extendedCarbonDioxideSensorAnnc;
+	
+	
+	public void setExtendedCarbonDioxideSensor(ExtendedCarbonDioxideSensorFlexContainerAnnc extendedCarbonDioxideSensorAnnc) {
+		this.extendedCarbonDioxideSensorAnnc = extendedCarbonDioxideSensorAnnc;
+		getFlexContainerOrContainerOrSubscription().add(extendedCarbonDioxideSensorAnnc);
+	}
+	
+	public ExtendedCarbonDioxideSensorFlexContainerAnnc getExtendedCarbonDioxideSensorAnnc() {
+		this.extendedCarbonDioxideSensorAnnc = (ExtendedCarbonDioxideSensorFlexContainerAnnc) getResourceByName(ExtendedCarbonDioxideSensorFlexContainerAnnc.SHORT_NAME);
+		return extendedCarbonDioxideSensorAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DoorStatusFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DoorStatusFlexContainer.java
new file mode 100644
index 0000000..c51f4cd
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DoorStatusFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : DoorStatus
+
+
+
+This ModuleClass provides the status of a door. It is intended  to be part of a larger object such as a refrigerator and an oven  that might have multiple doors.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DoorStatusFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DoorStatusFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DoorStatusFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "doorStatus";
+	public static final String SHORT_NAME = "dooSs";
+	
+	public DoorStatusFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + DoorStatusFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DoorStatusFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DoorStatusFlexContainerAnnc.java
new file mode 100644
index 0000000..fe39f01
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DoorStatusFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : DoorStatusAnnc
+
+
+
+This ModuleClass provides the status of a door. It is intended  to be part of a larger object such as a refrigerator and an oven  that might have multiple doors.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DoorStatusFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DoorStatusFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DoorStatusFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "doorStatusAnnc";
+	public static final String SHORT_NAME = "dooSsAnnc";
+	
+	public DoorStatusFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + DoorStatusFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DownChannelFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DownChannelFlexContainer.java
new file mode 100644
index 0000000..e62e1b2
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DownChannelFlexContainer.java
@@ -0,0 +1,36 @@
+/*
+Action : downChannel
+
+
+
+Change the current channel to the previous channel in the  stored list of available channels. If the current channel is the  first one in the list, the new set channel may be the last one in  the list.
+
+Created: 2017-08-09 14:07:04
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DownChannelFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DownChannelFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DownChannelFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "downChannel";
+	public static final String SHORT_NAME = "dowCl";
+	
+	public DownChannelFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass.televisionchannel." + DownChannelFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DownChannelFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DownChannelFlexContainerAnnc.java
new file mode 100644
index 0000000..642cb70
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DownChannelFlexContainerAnnc.java
@@ -0,0 +1,36 @@
+/*
+Action : downChannel
+
+
+
+Change the current channel to the previous channel in the  stored list of available channels. If the current channel is the  first one in the list, the new set channel may be the last one in  the list.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DownChannelFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DownChannelFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DownChannelFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "downChannelAnnc";
+	public static final String SHORT_NAME = "dowClAnnc";
+	
+	public DownChannelFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass.televisionchannel." + DownChannelFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DownVolumeFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DownVolumeFlexContainer.java
new file mode 100644
index 0000000..bc117b6
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DownVolumeFlexContainer.java
@@ -0,0 +1,36 @@
+/*
+Action : downVolume
+
+
+
+Decrease volume by the amount of the stepValue down to 0.
+
+Created: 2017-08-09 14:07:04
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DownVolumeFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DownVolumeFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DownVolumeFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "downVolume";
+	public static final String SHORT_NAME = "dowVe";
+	
+	public DownVolumeFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass.audiovolume." + DownVolumeFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DownVolumeFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DownVolumeFlexContainerAnnc.java
new file mode 100644
index 0000000..31e5322
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/DownVolumeFlexContainerAnnc.java
@@ -0,0 +1,36 @@
+/*
+Action : downVolume
+
+
+
+Decrease volume by the amount of the stepValue down to 0.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = DownVolumeFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = DownVolumeFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class DownVolumeFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "downVolumeAnnc";
+	public static final String SHORT_NAME = "dowVeAnnc";
+	
+	public DownVolumeFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass.audiovolume." + DownVolumeFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ElectricVehicleConnectorFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ElectricVehicleConnectorFlexContainer.java
new file mode 100644
index 0000000..4505aae
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ElectricVehicleConnectorFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : ElectricVehicleConnector
+
+
+
+This ModuleClass provides the information about  charging/discharging devices for electric vehicles.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = ElectricVehicleConnectorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = ElectricVehicleConnectorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class ElectricVehicleConnectorFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "electricVehicleConnector";
+	public static final String SHORT_NAME = "elVCr";
+	
+	public ElectricVehicleConnectorFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + ElectricVehicleConnectorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ElectricVehicleConnectorFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ElectricVehicleConnectorFlexContainerAnnc.java
new file mode 100644
index 0000000..b43e8ed
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ElectricVehicleConnectorFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : ElectricVehicleConnectorAnnc
+
+
+
+This ModuleClass provides the information about  charging/discharging devices for electric vehicles.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = ElectricVehicleConnectorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = ElectricVehicleConnectorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class ElectricVehicleConnectorFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "electricVehicleConnectorAnnc";
+	public static final String SHORT_NAME = "elVCrAnnc";
+	
+	public ElectricVehicleConnectorFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + ElectricVehicleConnectorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/EnergyConsumptionFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/EnergyConsumptionFlexContainer.java
new file mode 100644
index 0000000..cd9d971
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/EnergyConsumptionFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : EnergyConsumption
+
+
+
+This ModuleClass describes the energy consumed by the device  since power up. One particular use case for energyConsumption  ModuleClass is smart meter.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = EnergyConsumptionFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = EnergyConsumptionFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class EnergyConsumptionFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "energyConsumption";
+	public static final String SHORT_NAME = "eneCn";
+	
+	public EnergyConsumptionFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + EnergyConsumptionFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/EnergyConsumptionFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/EnergyConsumptionFlexContainerAnnc.java
new file mode 100644
index 0000000..a0e07e6
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/EnergyConsumptionFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : EnergyConsumptionAnnc
+
+
+
+This ModuleClass describes the energy consumed by the device  since power up. One particular use case for energyConsumption  ModuleClass is smart meter.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = EnergyConsumptionFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = EnergyConsumptionFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class EnergyConsumptionFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "energyConsumptionAnnc";
+	public static final String SHORT_NAME = "eneCnAnnc";
+	
+	public EnergyConsumptionFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + EnergyConsumptionFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/EnergyGenerationFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/EnergyGenerationFlexContainer.java
new file mode 100644
index 0000000..d146084
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/EnergyGenerationFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : EnergyGeneration
+
+
+
+This ModuleClass provides the information about generation data  on electric generator devices such as a photo voltaic power system,  fuel cells, or microgeneration.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = EnergyGenerationFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = EnergyGenerationFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class EnergyGenerationFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "energyGeneration";
+	public static final String SHORT_NAME = "eneGn";
+	
+	public EnergyGenerationFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + EnergyGenerationFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/EnergyGenerationFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/EnergyGenerationFlexContainerAnnc.java
new file mode 100644
index 0000000..941ac44
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/EnergyGenerationFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : EnergyGenerationAnnc
+
+
+
+This ModuleClass provides the information about generation data  on electric generator devices such as a photo voltaic power system,  fuel cells, or microgeneration.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = EnergyGenerationFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = EnergyGenerationFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class EnergyGenerationFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "energyGenerationAnnc";
+	public static final String SHORT_NAME = "eneGnAnnc";
+	
+	public EnergyGenerationFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + EnergyGenerationFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ExtendedCarbonDioxideSensorFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ExtendedCarbonDioxideSensorFlexContainer.java
new file mode 100644
index 0000000..9f0ead3
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ExtendedCarbonDioxideSensorFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : ExtendedCarbonDioxideSensor
+
+
+
+This ModuleClass provides carbon dioxide data.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = ExtendedCarbonDioxideSensorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = ExtendedCarbonDioxideSensorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class ExtendedCarbonDioxideSensorFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "extendedCarbonDioxideSensor";
+	public static final String SHORT_NAME = "eCDSr";
+	
+	public ExtendedCarbonDioxideSensorFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + ExtendedCarbonDioxideSensorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ExtendedCarbonDioxideSensorFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ExtendedCarbonDioxideSensorFlexContainerAnnc.java
new file mode 100644
index 0000000..7b0a1e2
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ExtendedCarbonDioxideSensorFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : ExtendedCarbonDioxideSensorAnnc
+
+
+
+This ModuleClass provides carbon dioxide data.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = ExtendedCarbonDioxideSensorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = ExtendedCarbonDioxideSensorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class ExtendedCarbonDioxideSensorFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "extendedCarbonDioxideSensorAnnc";
+	public static final String SHORT_NAME = "eCDSrAnnc";
+	
+	public ExtendedCarbonDioxideSensorFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + ExtendedCarbonDioxideSensorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/FaultDetectionFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/FaultDetectionFlexContainer.java
new file mode 100644
index 0000000..68622cd
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/FaultDetectionFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : FaultDetection
+
+
+
+This ModuleClass provides the information about whether a fault  has occurred in the actual device.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = FaultDetectionFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = FaultDetectionFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class FaultDetectionFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "faultDetection";
+	public static final String SHORT_NAME = "fauDn";
+	
+	public FaultDetectionFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + FaultDetectionFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/FaultDetectionFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/FaultDetectionFlexContainerAnnc.java
new file mode 100644
index 0000000..041011f
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/FaultDetectionFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : FaultDetectionAnnc
+
+
+
+This ModuleClass provides the information about whether a fault  has occurred in the actual device.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = FaultDetectionFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = FaultDetectionFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class FaultDetectionFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "faultDetectionAnnc";
+	public static final String SHORT_NAME = "fauDnAnnc";
+	
+	public FaultDetectionFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + FaultDetectionFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/FlexContainerFactory.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/FlexContainerFactory.java
new file mode 100644
index 0000000..f7fc9f8
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/FlexContainerFactory.java
@@ -0,0 +1,383 @@
+/*
+FlexContainerFactory : FlexContainerFactory
+
+
+
+
+
+Created: 2017-08-09 15:38:06
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import org.eclipse.om2m.commons.resource.FlexContainer;
+import org.eclipse.om2m.commons.resource.FlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+public class FlexContainerFactory {
+	
+	public static AbstractFlexContainer getSpecializationFlexContainer(String shortName) {
+		switch(shortName) {
+		case AlarmSpeakerFlexContainer.SHORT_NAME:
+			return new AlarmSpeakerFlexContainer();
+		case AudioVideoInputFlexContainer.SHORT_NAME:
+			return new AudioVideoInputFlexContainer();
+		case AudioVolumeFlexContainer.SHORT_NAME:
+			return new AudioVolumeFlexContainer();
+		case UpVolumeFlexContainer.SHORT_NAME:
+			return new UpVolumeFlexContainer();
+		case DownVolumeFlexContainer.SHORT_NAME:
+			return new DownVolumeFlexContainer();
+		case BatteryFlexContainer.SHORT_NAME:
+			return new BatteryFlexContainer();
+		case BinarySwitchFlexContainer.SHORT_NAME:
+			return new BinarySwitchFlexContainer();
+		case ToggleFlexContainer.SHORT_NAME:
+			return new ToggleFlexContainer();
+		case BioElectricalImpedanceAnalysisFlexContainer.SHORT_NAME:
+			return new BioElectricalImpedanceAnalysisFlexContainer();
+		case BoilerFlexContainer.SHORT_NAME:
+			return new BoilerFlexContainer();
+		case BrightnessFlexContainer.SHORT_NAME:
+			return new BrightnessFlexContainer();
+		case ClockFlexContainer.SHORT_NAME:
+			return new ClockFlexContainer();
+		case ColourFlexContainer.SHORT_NAME:
+			return new ColourFlexContainer();
+		case ColourSaturationFlexContainer.SHORT_NAME:
+			return new ColourSaturationFlexContainer();
+		case DoorStatusFlexContainer.SHORT_NAME:
+			return new DoorStatusFlexContainer();
+		case ElectricVehicleConnectorFlexContainer.SHORT_NAME:
+			return new ElectricVehicleConnectorFlexContainer();
+		case EnergyConsumptionFlexContainer.SHORT_NAME:
+			return new EnergyConsumptionFlexContainer();
+		case EnergyGenerationFlexContainer.SHORT_NAME:
+			return new EnergyGenerationFlexContainer();
+		case FaultDetectionFlexContainer.SHORT_NAME:
+			return new FaultDetectionFlexContainer();
+		case HeightFlexContainer.SHORT_NAME:
+			return new HeightFlexContainer();
+		case HotWaterSupplyFlexContainer.SHORT_NAME:
+			return new HotWaterSupplyFlexContainer();
+		case KeypadFlexContainer.SHORT_NAME:
+			return new KeypadFlexContainer();
+		case MotionSensorFlexContainer.SHORT_NAME:
+			return new MotionSensorFlexContainer();
+		case OximeterFlexContainer.SHORT_NAME:
+			return new OximeterFlexContainer();
+		case PowerSaveFlexContainer.SHORT_NAME:
+			return new PowerSaveFlexContainer();
+		case PushButtonFlexContainer.SHORT_NAME:
+			return new PushButtonFlexContainer();
+		case RecorderFlexContainer.SHORT_NAME:
+			return new RecorderFlexContainer();
+		case RefrigerationFlexContainer.SHORT_NAME:
+			return new RefrigerationFlexContainer();
+		case RelativeHumidityFlexContainer.SHORT_NAME:
+			return new RelativeHumidityFlexContainer();
+		case RinseLevelFlexContainer.SHORT_NAME:
+			return new RinseLevelFlexContainer();
+		case RunModeFlexContainer.SHORT_NAME:
+			return new RunModeFlexContainer();
+		case SignalStrengthFlexContainer.SHORT_NAME:
+			return new SignalStrengthFlexContainer();
+		case SmokeSensorFlexContainer.SHORT_NAME:
+			return new SmokeSensorFlexContainer();
+		case SpinLevelFlexContainer.SHORT_NAME:
+			return new SpinLevelFlexContainer();
+		case TelevisionChannelFlexContainer.SHORT_NAME:
+			return new TelevisionChannelFlexContainer();
+		case UpChannelFlexContainer.SHORT_NAME:
+			return new UpChannelFlexContainer();
+		case DownChannelFlexContainer.SHORT_NAME:
+			return new DownChannelFlexContainer();
+		case TemperatureFlexContainer.SHORT_NAME:
+			return new TemperatureFlexContainer();
+		case TemperatureAlarmFlexContainer.SHORT_NAME:
+			return new TemperatureAlarmFlexContainer();
+		case TimerFlexContainer.SHORT_NAME:
+			return new TimerFlexContainer();
+		case ActivateClockTimerFlexContainer.SHORT_NAME:
+			return new ActivateClockTimerFlexContainer();
+		case DeactivateClockTimerFlexContainer.SHORT_NAME:
+			return new DeactivateClockTimerFlexContainer();
+		case TurboFlexContainer.SHORT_NAME:
+			return new TurboFlexContainer();
+		case WaterFlowFlexContainer.SHORT_NAME:
+			return new WaterFlowFlexContainer();
+		case WaterLevelFlexContainer.SHORT_NAME:
+			return new WaterLevelFlexContainer();
+		case WaterSensorFlexContainer.SHORT_NAME:
+			return new WaterSensorFlexContainer();
+		case WeightFlexContainer.SHORT_NAME:
+			return new WeightFlexContainer();
+		case WindFlexContainer.SHORT_NAME:
+			return new WindFlexContainer();
+		case StreamingFlexContainer.SHORT_NAME:
+			return new StreamingFlexContainer();
+		case PersonSensorFlexContainer.SHORT_NAME:
+			return new PersonSensorFlexContainer();
+		case BrewingFlexContainer.SHORT_NAME:
+			return new BrewingFlexContainer();
+		case LiquidLevelFlexContainer.SHORT_NAME:
+			return new LiquidLevelFlexContainer();
+		case GrinderFlexContainer.SHORT_NAME:
+			return new GrinderFlexContainer();
+		case FoamingFlexContainer.SHORT_NAME:
+			return new FoamingFlexContainer();
+		case KeepWarmFlexContainer.SHORT_NAME:
+			return new KeepWarmFlexContainer();
+		case ContactSensorFlexContainer.SHORT_NAME:
+			return new ContactSensorFlexContainer();
+		case AlarmSensorFlexContainer.SHORT_NAME:
+			return new AlarmSensorFlexContainer();
+		case LockFlexContainer.SHORT_NAME:
+			return new LockFlexContainer();
+		case AtmosphericPressureSensorFlexContainer.SHORT_NAME:
+			return new AtmosphericPressureSensorFlexContainer();
+		case NoiseFlexContainer.SHORT_NAME:
+			return new NoiseFlexContainer();
+		case ExtendedCarbonDioxideSensorFlexContainer.SHORT_NAME:
+			return new ExtendedCarbonDioxideSensorFlexContainer();
+		case DeviceAirConditionerFlexContainer.SHORT_NAME:
+			return new DeviceAirConditionerFlexContainer();
+		case DeviceClothesWasherFlexContainer.SHORT_NAME:
+			return new DeviceClothesWasherFlexContainer();
+		case DeviceElectricVehicleChargerFlexContainer.SHORT_NAME:
+			return new DeviceElectricVehicleChargerFlexContainer();
+		case DeviceLightFlexContainer.SHORT_NAME:
+			return new DeviceLightFlexContainer();
+		case DeviceMicrogenerationFlexContainer.SHORT_NAME:
+			return new DeviceMicrogenerationFlexContainer();
+		case DeviceOvenFlexContainer.SHORT_NAME:
+			return new DeviceOvenFlexContainer();
+		case DeviceRefrigeratorFlexContainer.SHORT_NAME:
+			return new DeviceRefrigeratorFlexContainer();
+		case DeviceRobotCleanerFlexContainer.SHORT_NAME:
+			return new DeviceRobotCleanerFlexContainer();
+		case DeviceSmartElectricMeterFlexContainer.SHORT_NAME:
+			return new DeviceSmartElectricMeterFlexContainer();
+		case DeviceStorageBatteryFlexContainer.SHORT_NAME:
+			return new DeviceStorageBatteryFlexContainer();
+		case DeviceTelevisionFlexContainer.SHORT_NAME:
+			return new DeviceTelevisionFlexContainer();
+		case DeviceThermostatFlexContainer.SHORT_NAME:
+			return new DeviceThermostatFlexContainer();
+		case DeviceWaterHeaterFlexContainer.SHORT_NAME:
+			return new DeviceWaterHeaterFlexContainer();
+		case DeviceCameraFlexContainer.SHORT_NAME:
+			return new DeviceCameraFlexContainer();
+		case DeviceCoffeeMachineFlexContainer.SHORT_NAME:
+			return new DeviceCoffeeMachineFlexContainer();
+		case DeviceContactDetectorFlexContainer.SHORT_NAME:
+			return new DeviceContactDetectorFlexContainer();
+		case DeviceDoorFlexContainer.SHORT_NAME:
+			return new DeviceDoorFlexContainer();
+		case DeviceFloodDetectorFlexContainer.SHORT_NAME:
+			return new DeviceFloodDetectorFlexContainer();
+		case DeviceGasValveFlexContainer.SHORT_NAME:
+			return new DeviceGasValveFlexContainer();
+		case DeviceMotionDetectorFlexContainer.SHORT_NAME:
+			return new DeviceMotionDetectorFlexContainer();
+		case DeviceSmokeDetectorFlexContainer.SHORT_NAME:
+			return new DeviceSmokeDetectorFlexContainer();
+		case DeviceSmokeExtractorFlexContainer.SHORT_NAME:
+			return new DeviceSmokeExtractorFlexContainer();
+		case DeviceSwitchButtonFlexContainer.SHORT_NAME:
+			return new DeviceSwitchButtonFlexContainer();
+		case DeviceTemperatureDetectorFlexContainer.SHORT_NAME:
+			return new DeviceTemperatureDetectorFlexContainer();
+		case DeviceWarningDeviceFlexContainer.SHORT_NAME:
+			return new DeviceWarningDeviceFlexContainer();
+		case DeviceWaterValveFlexContainer.SHORT_NAME:
+			return new DeviceWaterValveFlexContainer();
+		case DeviceWeatherStationFlexContainer.SHORT_NAME:
+			return new DeviceWeatherStationFlexContainer();
+		}
+		return new FlexContainer();
+	}
+	
+	public static AbstractFlexContainerAnnc getSpecializationFlexContainerAnnc(String shortName) {
+		switch(shortName) {
+		case AlarmSpeakerFlexContainerAnnc.SHORT_NAME:
+			return new AlarmSpeakerFlexContainerAnnc();
+		case AudioVideoInputFlexContainerAnnc.SHORT_NAME:
+			return new AudioVideoInputFlexContainerAnnc();
+		case AudioVolumeFlexContainerAnnc.SHORT_NAME:
+			return new AudioVolumeFlexContainerAnnc();
+		case UpVolumeFlexContainerAnnc.SHORT_NAME:
+			return new UpVolumeFlexContainerAnnc();
+		case DownVolumeFlexContainerAnnc.SHORT_NAME:
+			return new DownVolumeFlexContainerAnnc();
+		case BatteryFlexContainerAnnc.SHORT_NAME:
+			return new BatteryFlexContainerAnnc();
+		case BinarySwitchFlexContainerAnnc.SHORT_NAME:
+			return new BinarySwitchFlexContainerAnnc();
+		case ToggleFlexContainerAnnc.SHORT_NAME:
+			return new ToggleFlexContainerAnnc();
+		case BioElectricalImpedanceAnalysisFlexContainerAnnc.SHORT_NAME:
+			return new BioElectricalImpedanceAnalysisFlexContainerAnnc();
+		case BoilerFlexContainerAnnc.SHORT_NAME:
+			return new BoilerFlexContainerAnnc();
+		case BrightnessFlexContainerAnnc.SHORT_NAME:
+			return new BrightnessFlexContainerAnnc();
+		case ClockFlexContainerAnnc.SHORT_NAME:
+			return new ClockFlexContainerAnnc();
+		case ColourFlexContainerAnnc.SHORT_NAME:
+			return new ColourFlexContainerAnnc();
+		case ColourSaturationFlexContainerAnnc.SHORT_NAME:
+			return new ColourSaturationFlexContainerAnnc();
+		case DoorStatusFlexContainerAnnc.SHORT_NAME:
+			return new DoorStatusFlexContainerAnnc();
+		case ElectricVehicleConnectorFlexContainerAnnc.SHORT_NAME:
+			return new ElectricVehicleConnectorFlexContainerAnnc();
+		case EnergyConsumptionFlexContainerAnnc.SHORT_NAME:
+			return new EnergyConsumptionFlexContainerAnnc();
+		case EnergyGenerationFlexContainerAnnc.SHORT_NAME:
+			return new EnergyGenerationFlexContainerAnnc();
+		case FaultDetectionFlexContainerAnnc.SHORT_NAME:
+			return new FaultDetectionFlexContainerAnnc();
+		case HeightFlexContainerAnnc.SHORT_NAME:
+			return new HeightFlexContainerAnnc();
+		case HotWaterSupplyFlexContainerAnnc.SHORT_NAME:
+			return new HotWaterSupplyFlexContainerAnnc();
+		case KeypadFlexContainerAnnc.SHORT_NAME:
+			return new KeypadFlexContainerAnnc();
+		case MotionSensorFlexContainerAnnc.SHORT_NAME:
+			return new MotionSensorFlexContainerAnnc();
+		case OximeterFlexContainerAnnc.SHORT_NAME:
+			return new OximeterFlexContainerAnnc();
+		case PowerSaveFlexContainerAnnc.SHORT_NAME:
+			return new PowerSaveFlexContainerAnnc();
+		case PushButtonFlexContainerAnnc.SHORT_NAME:
+			return new PushButtonFlexContainerAnnc();
+		case RecorderFlexContainerAnnc.SHORT_NAME:
+			return new RecorderFlexContainerAnnc();
+		case RefrigerationFlexContainerAnnc.SHORT_NAME:
+			return new RefrigerationFlexContainerAnnc();
+		case RelativeHumidityFlexContainerAnnc.SHORT_NAME:
+			return new RelativeHumidityFlexContainerAnnc();
+		case RinseLevelFlexContainerAnnc.SHORT_NAME:
+			return new RinseLevelFlexContainerAnnc();
+		case RunModeFlexContainerAnnc.SHORT_NAME:
+			return new RunModeFlexContainerAnnc();
+		case SignalStrengthFlexContainerAnnc.SHORT_NAME:
+			return new SignalStrengthFlexContainerAnnc();
+		case SmokeSensorFlexContainerAnnc.SHORT_NAME:
+			return new SmokeSensorFlexContainerAnnc();
+		case SpinLevelFlexContainerAnnc.SHORT_NAME:
+			return new SpinLevelFlexContainerAnnc();
+		case TelevisionChannelFlexContainerAnnc.SHORT_NAME:
+			return new TelevisionChannelFlexContainerAnnc();
+		case UpChannelFlexContainerAnnc.SHORT_NAME:
+			return new UpChannelFlexContainerAnnc();
+		case DownChannelFlexContainerAnnc.SHORT_NAME:
+			return new DownChannelFlexContainerAnnc();
+		case TemperatureFlexContainerAnnc.SHORT_NAME:
+			return new TemperatureFlexContainerAnnc();
+		case TemperatureAlarmFlexContainerAnnc.SHORT_NAME:
+			return new TemperatureAlarmFlexContainerAnnc();
+		case TimerFlexContainerAnnc.SHORT_NAME:
+			return new TimerFlexContainerAnnc();
+		case ActivateClockTimerFlexContainerAnnc.SHORT_NAME:
+			return new ActivateClockTimerFlexContainerAnnc();
+		case DeactivateClockTimerFlexContainerAnnc.SHORT_NAME:
+			return new DeactivateClockTimerFlexContainerAnnc();
+		case TurboFlexContainerAnnc.SHORT_NAME:
+			return new TurboFlexContainerAnnc();
+		case WaterFlowFlexContainerAnnc.SHORT_NAME:
+			return new WaterFlowFlexContainerAnnc();
+		case WaterLevelFlexContainerAnnc.SHORT_NAME:
+			return new WaterLevelFlexContainerAnnc();
+		case WaterSensorFlexContainerAnnc.SHORT_NAME:
+			return new WaterSensorFlexContainerAnnc();
+		case WeightFlexContainerAnnc.SHORT_NAME:
+			return new WeightFlexContainerAnnc();
+		case WindFlexContainerAnnc.SHORT_NAME:
+			return new WindFlexContainerAnnc();
+		case StreamingFlexContainerAnnc.SHORT_NAME:
+			return new StreamingFlexContainerAnnc();
+		case PersonSensorFlexContainerAnnc.SHORT_NAME:
+			return new PersonSensorFlexContainerAnnc();
+		case BrewingFlexContainerAnnc.SHORT_NAME:
+			return new BrewingFlexContainerAnnc();
+		case LiquidLevelFlexContainerAnnc.SHORT_NAME:
+			return new LiquidLevelFlexContainerAnnc();
+		case GrinderFlexContainerAnnc.SHORT_NAME:
+			return new GrinderFlexContainerAnnc();
+		case FoamingFlexContainerAnnc.SHORT_NAME:
+			return new FoamingFlexContainerAnnc();
+		case KeepWarmFlexContainerAnnc.SHORT_NAME:
+			return new KeepWarmFlexContainerAnnc();
+		case ContactSensorFlexContainerAnnc.SHORT_NAME:
+			return new ContactSensorFlexContainerAnnc();
+		case AlarmSensorFlexContainerAnnc.SHORT_NAME:
+			return new AlarmSensorFlexContainerAnnc();
+		case LockFlexContainerAnnc.SHORT_NAME:
+			return new LockFlexContainerAnnc();
+		case AtmosphericPressureSensorFlexContainerAnnc.SHORT_NAME:
+			return new AtmosphericPressureSensorFlexContainerAnnc();
+		case NoiseFlexContainerAnnc.SHORT_NAME:
+			return new NoiseFlexContainerAnnc();
+		case ExtendedCarbonDioxideSensorFlexContainerAnnc.SHORT_NAME:
+			return new ExtendedCarbonDioxideSensorFlexContainerAnnc();
+		case DeviceAirConditionerFlexContainerAnnc.SHORT_NAME:
+			return new DeviceAirConditionerFlexContainerAnnc();
+		case DeviceClothesWasherFlexContainerAnnc.SHORT_NAME:
+			return new DeviceClothesWasherFlexContainerAnnc();
+		case DeviceElectricVehicleChargerFlexContainerAnnc.SHORT_NAME:
+			return new DeviceElectricVehicleChargerFlexContainerAnnc();
+		case DeviceLightFlexContainerAnnc.SHORT_NAME:
+			return new DeviceLightFlexContainerAnnc();
+		case DeviceMicrogenerationFlexContainerAnnc.SHORT_NAME:
+			return new DeviceMicrogenerationFlexContainerAnnc();
+		case DeviceOvenFlexContainerAnnc.SHORT_NAME:
+			return new DeviceOvenFlexContainerAnnc();
+		case DeviceRefrigeratorFlexContainerAnnc.SHORT_NAME:
+			return new DeviceRefrigeratorFlexContainerAnnc();
+		case DeviceRobotCleanerFlexContainerAnnc.SHORT_NAME:
+			return new DeviceRobotCleanerFlexContainerAnnc();
+		case DeviceSmartElectricMeterFlexContainerAnnc.SHORT_NAME:
+			return new DeviceSmartElectricMeterFlexContainerAnnc();
+		case DeviceStorageBatteryFlexContainerAnnc.SHORT_NAME:
+			return new DeviceStorageBatteryFlexContainerAnnc();
+		case DeviceTelevisionFlexContainerAnnc.SHORT_NAME:
+			return new DeviceTelevisionFlexContainerAnnc();
+		case DeviceThermostatFlexContainerAnnc.SHORT_NAME:
+			return new DeviceThermostatFlexContainerAnnc();
+		case DeviceWaterHeaterFlexContainerAnnc.SHORT_NAME:
+			return new DeviceWaterHeaterFlexContainerAnnc();
+		case DeviceCameraFlexContainerAnnc.SHORT_NAME:
+			return new DeviceCameraFlexContainerAnnc();
+		case DeviceCoffeeMachineFlexContainerAnnc.SHORT_NAME:
+			return new DeviceCoffeeMachineFlexContainerAnnc();
+		case DeviceContactDetectorFlexContainerAnnc.SHORT_NAME:
+			return new DeviceContactDetectorFlexContainerAnnc();
+		case DeviceDoorFlexContainerAnnc.SHORT_NAME:
+			return new DeviceDoorFlexContainerAnnc();
+		case DeviceFloodDetectorFlexContainerAnnc.SHORT_NAME:
+			return new DeviceFloodDetectorFlexContainerAnnc();
+		case DeviceGasValveFlexContainerAnnc.SHORT_NAME:
+			return new DeviceGasValveFlexContainerAnnc();
+		case DeviceMotionDetectorFlexContainerAnnc.SHORT_NAME:
+			return new DeviceMotionDetectorFlexContainerAnnc();
+		case DeviceSmokeDetectorFlexContainerAnnc.SHORT_NAME:
+			return new DeviceSmokeDetectorFlexContainerAnnc();
+		case DeviceSmokeExtractorFlexContainerAnnc.SHORT_NAME:
+			return new DeviceSmokeExtractorFlexContainerAnnc();
+		case DeviceSwitchButtonFlexContainerAnnc.SHORT_NAME:
+			return new DeviceSwitchButtonFlexContainerAnnc();
+		case DeviceTemperatureDetectorFlexContainerAnnc.SHORT_NAME:
+			return new DeviceTemperatureDetectorFlexContainerAnnc();
+		case DeviceWarningDeviceFlexContainerAnnc.SHORT_NAME:
+			return new DeviceWarningDeviceFlexContainerAnnc();
+		case DeviceWaterValveFlexContainerAnnc.SHORT_NAME:
+			return new DeviceWaterValveFlexContainerAnnc();
+		case DeviceWeatherStationFlexContainerAnnc.SHORT_NAME:
+			return new DeviceWeatherStationFlexContainerAnnc();
+		}
+		return new FlexContainerAnnc();
+	}
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/FoamingFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/FoamingFlexContainer.java
new file mode 100644
index 0000000..69fa66f
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/FoamingFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : Foaming
+
+
+
+This ModuleClass manages foaming feature.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = FoamingFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = FoamingFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class FoamingFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "foaming";
+	public static final String SHORT_NAME = "foamg";
+	
+	public FoamingFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + FoamingFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/FoamingFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/FoamingFlexContainerAnnc.java
new file mode 100644
index 0000000..58d6e3b
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/FoamingFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : FoamingAnnc
+
+
+
+This ModuleClass manages foaming feature.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = FoamingFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = FoamingFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class FoamingFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "foamingAnnc";
+	public static final String SHORT_NAME = "foamgAnnc";
+	
+	public FoamingFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + FoamingFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/GrinderFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/GrinderFlexContainer.java
new file mode 100644
index 0000000..095be62
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/GrinderFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : Grinder
+
+
+
+This ModuleClass manages grinder feature.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = GrinderFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = GrinderFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class GrinderFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "grinder";
+	public static final String SHORT_NAME = "grinr";
+	
+	public GrinderFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + GrinderFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/GrinderFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/GrinderFlexContainerAnnc.java
new file mode 100644
index 0000000..47abe53
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/GrinderFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : GrinderAnnc
+
+
+
+This ModuleClass manages grinder feature.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = GrinderFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = GrinderFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class GrinderFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "grinderAnnc";
+	public static final String SHORT_NAME = "grinrAnnc";
+	
+	public GrinderFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + GrinderFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/HeightFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/HeightFlexContainer.java
new file mode 100644
index 0000000..44cc6bc
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/HeightFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : Height
+
+
+
+This ModuleClass provides the capability to report the  measurement of height.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = HeightFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = HeightFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class HeightFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "height";
+	public static final String SHORT_NAME = "heigt";
+	
+	public HeightFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + HeightFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/HeightFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/HeightFlexContainerAnnc.java
new file mode 100644
index 0000000..44af18b
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/HeightFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : HeightAnnc
+
+
+
+This ModuleClass provides the capability to report the  measurement of height.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = HeightFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = HeightFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class HeightFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "heightAnnc";
+	public static final String SHORT_NAME = "heigtAnnc";
+	
+	public HeightFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + HeightFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/HotWaterSupplyFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/HotWaterSupplyFlexContainer.java
new file mode 100644
index 0000000..c419ef3
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/HotWaterSupplyFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : HotWaterSupply
+
+
+
+This ModuleClass provides the information about the status of  supplying hot water into tanks or bath tubes.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = HotWaterSupplyFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = HotWaterSupplyFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class HotWaterSupplyFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "hotWaterSupply";
+	public static final String SHORT_NAME = "hoWSy";
+	
+	public HotWaterSupplyFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + HotWaterSupplyFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/HotWaterSupplyFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/HotWaterSupplyFlexContainerAnnc.java
new file mode 100644
index 0000000..e0d73a4
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/HotWaterSupplyFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : HotWaterSupplyAnnc
+
+
+
+This ModuleClass provides the information about the status of  supplying hot water into tanks or bath tubes.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = HotWaterSupplyFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = HotWaterSupplyFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class HotWaterSupplyFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "hotWaterSupplyAnnc";
+	public static final String SHORT_NAME = "hoWSyAnnc";
+	
+	public HotWaterSupplyFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + HotWaterSupplyFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/KeepWarmFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/KeepWarmFlexContainer.java
new file mode 100644
index 0000000..64ccac7
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/KeepWarmFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : KeepWarm
+
+
+
+This ModuleClass manages keepWarm feature.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = KeepWarmFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = KeepWarmFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class KeepWarmFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "keepWarm";
+	public static final String SHORT_NAME = "keeWm";
+	
+	public KeepWarmFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + KeepWarmFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/KeepWarmFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/KeepWarmFlexContainerAnnc.java
new file mode 100644
index 0000000..9c24254
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/KeepWarmFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : KeepWarmAnnc
+
+
+
+This ModuleClass manages keepWarm feature.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = KeepWarmFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = KeepWarmFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class KeepWarmFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "keepWarmAnnc";
+	public static final String SHORT_NAME = "keeWmAnnc";
+	
+	public KeepWarmFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + KeepWarmFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/KeypadFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/KeypadFlexContainer.java
new file mode 100644
index 0000000..80cfad0
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/KeypadFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : Keypad
+
+
+
+This ModuleClass provides the capability to require a user  defined service through the key-in number. For example, a user can  define key 1 as "require a takeout from restaurant XXX with combo  meal 1". The IoT service provider or user can define the services.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = KeypadFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = KeypadFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class KeypadFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "keypad";
+	public static final String SHORT_NAME = "keypd";
+	
+	public KeypadFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + KeypadFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/KeypadFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/KeypadFlexContainerAnnc.java
new file mode 100644
index 0000000..48f4d2a
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/KeypadFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : KeypadAnnc
+
+
+
+This ModuleClass provides the capability to require a user  defined service through the key-in number. For example, a user can  define key 1 as "require a takeout from restaurant XXX with combo  meal 1". The IoT service provider or user can define the services.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = KeypadFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = KeypadFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class KeypadFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "keypadAnnc";
+	public static final String SHORT_NAME = "keypdAnnc";
+	
+	public KeypadFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + KeypadFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/LiquidLevelFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/LiquidLevelFlexContainer.java
new file mode 100644
index 0000000..17982c3
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/LiquidLevelFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : LiquidLevel
+
+
+
+This ModuleClass manages a level of liquid.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = LiquidLevelFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = LiquidLevelFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class LiquidLevelFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "liquidLevel";
+	public static final String SHORT_NAME = "liqLl";
+	
+	public LiquidLevelFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + LiquidLevelFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/LiquidLevelFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/LiquidLevelFlexContainerAnnc.java
new file mode 100644
index 0000000..79e21ab
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/LiquidLevelFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : LiquidLevelAnnc
+
+
+
+This ModuleClass manages a level of liquid.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = LiquidLevelFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = LiquidLevelFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class LiquidLevelFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "liquidLevelAnnc";
+	public static final String SHORT_NAME = "liqLlAnnc";
+	
+	public LiquidLevelFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + LiquidLevelFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/LockFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/LockFlexContainer.java
new file mode 100644
index 0000000..57258af
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/LockFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : Lock
+
+
+
+This ModuleClass manages lock feature.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = LockFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = LockFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class LockFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "lock";
+	public static final String SHORT_NAME = "lock";
+	
+	public LockFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + LockFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/LockFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/LockFlexContainerAnnc.java
new file mode 100644
index 0000000..0eed68e
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/LockFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : LockAnnc
+
+
+
+This ModuleClass manages lock feature.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = LockFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = LockFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class LockFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "lockAnnc";
+	public static final String SHORT_NAME = "lockAnnc";
+	
+	public LockFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + LockFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/MotionSensorFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/MotionSensorFlexContainer.java
new file mode 100644
index 0000000..2a5422c
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/MotionSensorFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : MotionSensor
+
+
+
+This ModuleClass provides the capabilities to indicates the  occurrence of a motion and raises an alarm if the triggering  criterion is met.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = MotionSensorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = MotionSensorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class MotionSensorFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "motionSensor";
+	public static final String SHORT_NAME = "motSr";
+	
+	public MotionSensorFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + MotionSensorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/MotionSensorFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/MotionSensorFlexContainerAnnc.java
new file mode 100644
index 0000000..cbdf1b2
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/MotionSensorFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : MotionSensorAnnc
+
+
+
+This ModuleClass provides the capabilities to indicates the  occurrence of a motion and raises an alarm if the triggering  criterion is met.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = MotionSensorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = MotionSensorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class MotionSensorFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "motionSensorAnnc";
+	public static final String SHORT_NAME = "motSrAnnc";
+	
+	public MotionSensorFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + MotionSensorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/NoiseFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/NoiseFlexContainer.java
new file mode 100644
index 0000000..5aa4200
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/NoiseFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : Noise
+
+
+
+This ModuleClass provides data noise.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = NoiseFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = NoiseFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class NoiseFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "noise";
+	public static final String SHORT_NAME = "noise";
+	
+	public NoiseFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + NoiseFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/NoiseFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/NoiseFlexContainerAnnc.java
new file mode 100644
index 0000000..abd8334
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/NoiseFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : NoiseAnnc
+
+
+
+This ModuleClass provides data noise.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = NoiseFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = NoiseFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class NoiseFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "noiseAnnc";
+	public static final String SHORT_NAME = "noiseAnnc";
+	
+	public NoiseFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + NoiseFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ObjectFactory.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ObjectFactory.java
new file mode 100644
index 0000000..23c7294
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ObjectFactory.java
@@ -0,0 +1,724 @@
+/*
+ObjectFactory : ObjectFactory
+
+
+
+
+
+Created: 2017-08-09 15:38:06
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlRegistry;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+@XmlRegistry
+public class ObjectFactory {
+	
+	public AbstractFlexContainer createalaSr() {
+		return new AlarmSpeakerFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createalaSrAnnc() {
+		return new AlarmSpeakerFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createAuVIt() {
+		return new AudioVideoInputFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createAuVItAnnc() {
+		return new AudioVideoInputFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createAudVe() {
+		return new AudioVolumeFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createAudVeAnnc() {
+		return new AudioVolumeFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createUpoVe() {
+		return new UpVolumeFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createUpoVeAnnc() {
+		return new UpVolumeFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDowVe() {
+		return new DownVolumeFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDowVeAnnc() {
+		return new DownVolumeFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createBatty() {
+		return new BatteryFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createBattyAnnc() {
+		return new BatteryFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createBinSh() {
+		return new BinarySwitchFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createBinShAnnc() {
+		return new BinarySwitchFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createTogge() {
+		return new ToggleFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createToggeAnnc() {
+		return new ToggleFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createBEIAs() {
+		return new BioElectricalImpedanceAnalysisFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createBEIAsAnnc() {
+		return new BioElectricalImpedanceAnalysisFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createBoilr() {
+		return new BoilerFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createBoilrAnnc() {
+		return new BoilerFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createBrigs() {
+		return new BrightnessFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createBrigsAnnc() {
+		return new BrightnessFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createClock() {
+		return new ClockFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createClockAnnc() {
+		return new ClockFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createColor() {
+		return new ColourFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createColorAnnc() {
+		return new ColourFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createColSn() {
+		return new ColourSaturationFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createColSnAnnc() {
+		return new ColourSaturationFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDooSs() {
+		return new DoorStatusFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDooSsAnnc() {
+		return new DoorStatusFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createElVCr() {
+		return new ElectricVehicleConnectorFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createElVCrAnnc() {
+		return new ElectricVehicleConnectorFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createEneCn() {
+		return new EnergyConsumptionFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createEneCnAnnc() {
+		return new EnergyConsumptionFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createEneGn() {
+		return new EnergyGenerationFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createEneGnAnnc() {
+		return new EnergyGenerationFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createFauDn() {
+		return new FaultDetectionFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createFauDnAnnc() {
+		return new FaultDetectionFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createHeigt() {
+		return new HeightFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createHeigtAnnc() {
+		return new HeightFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createHoWSy() {
+		return new HotWaterSupplyFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createHoWSyAnnc() {
+		return new HotWaterSupplyFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createKeypd() {
+		return new KeypadFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createKeypdAnnc() {
+		return new KeypadFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createMotSr() {
+		return new MotionSensorFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createMotSrAnnc() {
+		return new MotionSensorFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createOximr() {
+		return new OximeterFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createOximrAnnc() {
+		return new OximeterFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createPowSe() {
+		return new PowerSaveFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createPowSeAnnc() {
+		return new PowerSaveFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createPusBn() {
+		return new PushButtonFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createPusBnAnnc() {
+		return new PushButtonFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createRecor() {
+		return new RecorderFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createRecorAnnc() {
+		return new RecorderFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createRefrn() {
+		return new RefrigerationFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createRefrnAnnc() {
+		return new RefrigerationFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createRelHy() {
+		return new RelativeHumidityFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createRelHyAnnc() {
+		return new RelativeHumidityFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createRinLl() {
+		return new RinseLevelFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createRinLlAnnc() {
+		return new RinseLevelFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createRunMe() {
+		return new RunModeFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createRunMeAnnc() {
+		return new RunModeFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createSigSh() {
+		return new SignalStrengthFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createSigShAnnc() {
+		return new SignalStrengthFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createSmoSr() {
+		return new SmokeSensorFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createSmoSrAnnc() {
+		return new SmokeSensorFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createSpiLl() {
+		return new SpinLevelFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createSpiLlAnnc() {
+		return new SpinLevelFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createTelCl() {
+		return new TelevisionChannelFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createTelClAnnc() {
+		return new TelevisionChannelFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createUphCl() {
+		return new UpChannelFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createUphClAnnc() {
+		return new UpChannelFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDowCl() {
+		return new DownChannelFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDowClAnnc() {
+		return new DownChannelFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createTempe() {
+		return new TemperatureFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createTempeAnnc() {
+		return new TemperatureFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createTemAm() {
+		return new TemperatureAlarmFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createTemAmAnnc() {
+		return new TemperatureAlarmFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createTimer() {
+		return new TimerFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createTimerAnnc() {
+		return new TimerFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createAcCTr() {
+		return new ActivateClockTimerFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createAcCTrAnnc() {
+		return new ActivateClockTimerFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDeCTr() {
+		return new DeactivateClockTimerFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDeCTrAnnc() {
+		return new DeactivateClockTimerFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createTurbo() {
+		return new TurboFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createTurboAnnc() {
+		return new TurboFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createWatFw() {
+		return new WaterFlowFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createWatFwAnnc() {
+		return new WaterFlowFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createWatLl() {
+		return new WaterLevelFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createWatLlAnnc() {
+		return new WaterLevelFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createWatSr() {
+		return new WaterSensorFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createWatSrAnnc() {
+		return new WaterSensorFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createWeigt() {
+		return new WeightFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createWeigtAnnc() {
+		return new WeightFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createWind() {
+		return new WindFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createWindAnnc() {
+		return new WindFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createStreg() {
+		return new StreamingFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createStregAnnc() {
+		return new StreamingFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createPerSr() {
+		return new PersonSensorFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createPerSrAnnc() {
+		return new PersonSensorFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createBrewg() {
+		return new BrewingFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createBrewgAnnc() {
+		return new BrewingFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createLiqLl() {
+		return new LiquidLevelFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createLiqLlAnnc() {
+		return new LiquidLevelFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createGrinr() {
+		return new GrinderFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createGrinrAnnc() {
+		return new GrinderFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createFoamg() {
+		return new FoamingFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createFoamgAnnc() {
+		return new FoamingFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createKeeWm() {
+		return new KeepWarmFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createKeeWmAnnc() {
+		return new KeepWarmFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createConSr() {
+		return new ContactSensorFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createConSrAnnc() {
+		return new ContactSensorFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createalSer() {
+		return new AlarmSensorFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createalSerAnnc() {
+		return new AlarmSensorFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createLock() {
+		return new LockFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createLockAnnc() {
+		return new LockFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createAtPSr() {
+		return new AtmosphericPressureSensorFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createAtPSrAnnc() {
+		return new AtmosphericPressureSensorFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createNoise() {
+		return new NoiseFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createNoiseAnnc() {
+		return new NoiseFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createECDSr() {
+		return new ExtendedCarbonDioxideSensorFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createECDSrAnnc() {
+		return new ExtendedCarbonDioxideSensorFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDeACr() {
+		return new DeviceAirConditionerFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDeACrAnnc() {
+		return new DeviceAirConditionerFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDeCWr() {
+		return new DeviceClothesWasherFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDeCWrAnnc() {
+		return new DeviceClothesWasherFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDEVCr() {
+		return new DeviceElectricVehicleChargerFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDEVCrAnnc() {
+		return new DeviceElectricVehicleChargerFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDevLt() {
+		return new DeviceLightFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDevLtAnnc() {
+		return new DeviceLightFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDevMn() {
+		return new DeviceMicrogenerationFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDevMnAnnc() {
+		return new DeviceMicrogenerationFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDevOn() {
+		return new DeviceOvenFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDevOnAnnc() {
+		return new DeviceOvenFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDevRr() {
+		return new DeviceRefrigeratorFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDevRrAnnc() {
+		return new DeviceRefrigeratorFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDeRCr() {
+		return new DeviceRobotCleanerFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDeRCrAnnc() {
+		return new DeviceRobotCleanerFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDSEMr() {
+		return new DeviceSmartElectricMeterFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDSEMrAnnc() {
+		return new DeviceSmartElectricMeterFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDeSBy() {
+		return new DeviceStorageBatteryFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDeSByAnnc() {
+		return new DeviceStorageBatteryFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDevTn() {
+		return new DeviceTelevisionFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDevTnAnnc() {
+		return new DeviceTelevisionFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDevTt() {
+		return new DeviceThermostatFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDevTtAnnc() {
+		return new DeviceThermostatFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDeWHr() {
+		return new DeviceWaterHeaterFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDeWHrAnnc() {
+		return new DeviceWaterHeaterFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDevCa() {
+		return new DeviceCameraFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDevCaAnnc() {
+		return new DeviceCameraFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDeCMe() {
+		return new DeviceCoffeeMachineFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDeCMeAnnc() {
+		return new DeviceCoffeeMachineFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDeCDr() {
+		return new DeviceContactDetectorFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDeCDrAnnc() {
+		return new DeviceContactDetectorFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDevDr() {
+		return new DeviceDoorFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDevDrAnnc() {
+		return new DeviceDoorFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDeFDr() {
+		return new DeviceFloodDetectorFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDeFDrAnnc() {
+		return new DeviceFloodDetectorFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDeGVe() {
+		return new DeviceGasValveFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDeGVeAnnc() {
+		return new DeviceGasValveFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDeMDr() {
+		return new DeviceMotionDetectorFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDeMDrAnnc() {
+		return new DeviceMotionDetectorFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDeSDr() {
+		return new DeviceSmokeDetectorFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDeSDrAnnc() {
+		return new DeviceSmokeDetectorFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDeSEr() {
+		return new DeviceSmokeExtractorFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDeSErAnnc() {
+		return new DeviceSmokeExtractorFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDeSBn() {
+		return new DeviceSwitchButtonFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDeSBnAnnc() {
+		return new DeviceSwitchButtonFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDeTDr() {
+		return new DeviceTemperatureDetectorFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDeTDrAnnc() {
+		return new DeviceTemperatureDetectorFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDeWDe() {
+		return new DeviceWarningDeviceFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDeWDeAnnc() {
+		return new DeviceWarningDeviceFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDeWVe() {
+		return new DeviceWaterValveFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDeWVeAnnc() {
+		return new DeviceWaterValveFlexContainerAnnc();
+	}
+	
+	public AbstractFlexContainer createDeWSn() {
+		return new DeviceWeatherStationFlexContainer();
+	}
+	
+	public AbstractFlexContainerAnnc createDeWSnAnnc() {
+		return new DeviceWeatherStationFlexContainerAnnc();
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/OximeterFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/OximeterFlexContainer.java
new file mode 100644
index 0000000..ed8e0f9
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/OximeterFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : Oximeter
+
+
+
+This ModuleClass provides the capability to report the  measurement of blood characteristics.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = OximeterFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = OximeterFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class OximeterFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "oximeter";
+	public static final String SHORT_NAME = "oximr";
+	
+	public OximeterFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + OximeterFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/OximeterFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/OximeterFlexContainerAnnc.java
new file mode 100644
index 0000000..b26927f
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/OximeterFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : OximeterAnnc
+
+
+
+This ModuleClass provides the capability to report the  measurement of blood characteristics.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = OximeterFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = OximeterFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class OximeterFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "oximeterAnnc";
+	public static final String SHORT_NAME = "oximrAnnc";
+	
+	public OximeterFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + OximeterFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/PersonSensorFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/PersonSensorFlexContainer.java
new file mode 100644
index 0000000..d604db0
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/PersonSensorFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : PersonSensor
+
+
+
+This ModuleClass indicates if a known people has been detected  by a camera.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = PersonSensorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = PersonSensorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class PersonSensorFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "personSensor";
+	public static final String SHORT_NAME = "perSr";
+	
+	public PersonSensorFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + PersonSensorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/PersonSensorFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/PersonSensorFlexContainerAnnc.java
new file mode 100644
index 0000000..eb40a73
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/PersonSensorFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : PersonSensorAnnc
+
+
+
+This ModuleClass indicates if a known people has been detected  by a camera.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = PersonSensorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = PersonSensorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class PersonSensorFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "personSensorAnnc";
+	public static final String SHORT_NAME = "perSrAnnc";
+	
+	public PersonSensorFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + PersonSensorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/PowerSaveFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/PowerSaveFlexContainer.java
new file mode 100644
index 0000000..bdf3428
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/PowerSaveFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : PowerSave
+
+
+
+This ModuleClass provides capabilities to enable power saving  mode and monitor the current status.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = PowerSaveFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = PowerSaveFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class PowerSaveFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "powerSave";
+	public static final String SHORT_NAME = "powSe";
+	
+	public PowerSaveFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + PowerSaveFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/PowerSaveFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/PowerSaveFlexContainerAnnc.java
new file mode 100644
index 0000000..9ab632c
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/PowerSaveFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : PowerSaveAnnc
+
+
+
+This ModuleClass provides capabilities to enable power saving  mode and monitor the current status.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = PowerSaveFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = PowerSaveFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class PowerSaveFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "powerSaveAnnc";
+	public static final String SHORT_NAME = "powSeAnnc";
+	
+	public PowerSaveFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + PowerSaveFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/PushButtonFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/PushButtonFlexContainer.java
new file mode 100644
index 0000000..2c42be3
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/PushButtonFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : PushButton
+
+
+
+This ModuleClass provides the capability to indicate the  operation of a button style switch. A typical application can be an  SOS button.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = PushButtonFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = PushButtonFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class PushButtonFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "pushButton";
+	public static final String SHORT_NAME = "pusBn";
+	
+	public PushButtonFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + PushButtonFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/PushButtonFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/PushButtonFlexContainerAnnc.java
new file mode 100644
index 0000000..46ed523
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/PushButtonFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : PushButtonAnnc
+
+
+
+This ModuleClass provides the capability to indicate the  operation of a button style switch. A typical application can be an  SOS button.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = PushButtonFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = PushButtonFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class PushButtonFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "pushButtonAnnc";
+	public static final String SHORT_NAME = "pusBnAnnc";
+	
+	public PushButtonFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + PushButtonFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RecorderFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RecorderFlexContainer.java
new file mode 100644
index 0000000..8519e78
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RecorderFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : Recorder
+
+
+
+This ModuleClass provides the capability to record the  video/audio for a defined duration.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = RecorderFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = RecorderFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class RecorderFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "recorder";
+	public static final String SHORT_NAME = "recor";
+	
+	public RecorderFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + RecorderFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RecorderFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RecorderFlexContainerAnnc.java
new file mode 100644
index 0000000..9dc8789
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RecorderFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : RecorderAnnc
+
+
+
+This ModuleClass provides the capability to record the  video/audio for a defined duration.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = RecorderFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = RecorderFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class RecorderFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "recorderAnnc";
+	public static final String SHORT_NAME = "recorAnnc";
+	
+	public RecorderFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + RecorderFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RefrigerationFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RefrigerationFlexContainer.java
new file mode 100644
index 0000000..867f66c
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RefrigerationFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : Refrigeration
+
+
+
+This ModuleClass describes a refrigeration function. This is not  a Refrigerator device. The filter state is a read-only value  providing the percentage life time remaining for the water filter.  RapidFreeze is a boolean that controls the rapid freeze capability  if present. RapidCool is a boolean that controls the rapid cool  capability if present. Defrost is a boolean that controls the  defrost cycle if present.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = RefrigerationFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = RefrigerationFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class RefrigerationFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "refrigeration";
+	public static final String SHORT_NAME = "refrn";
+	
+	public RefrigerationFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + RefrigerationFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RefrigerationFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RefrigerationFlexContainerAnnc.java
new file mode 100644
index 0000000..ce69a7d
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RefrigerationFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : RefrigerationAnnc
+
+
+
+This ModuleClass describes a refrigeration function. This is not  a Refrigerator device. The filter state is a read-only value  providing the percentage life time remaining for the water filter.  RapidFreeze is a boolean that controls the rapid freeze capability  if present. RapidCool is a boolean that controls the rapid cool  capability if present. Defrost is a boolean that controls the  defrost cycle if present.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = RefrigerationFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = RefrigerationFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class RefrigerationFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "refrigerationAnnc";
+	public static final String SHORT_NAME = "refrnAnnc";
+	
+	public RefrigerationFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + RefrigerationFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RelativeHumidityFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RelativeHumidityFlexContainer.java
new file mode 100644
index 0000000..96a9002
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RelativeHumidityFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : RelativeHumidity
+
+
+
+This ModuleClass provides the capability for the device to  report the humidity based on a specified rule that is vendor  discretionary.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = RelativeHumidityFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = RelativeHumidityFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class RelativeHumidityFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "relativeHumidity";
+	public static final String SHORT_NAME = "relHy";
+	
+	public RelativeHumidityFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + RelativeHumidityFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RelativeHumidityFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RelativeHumidityFlexContainerAnnc.java
new file mode 100644
index 0000000..c7c70f7
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RelativeHumidityFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : RelativeHumidityAnnc
+
+
+
+This ModuleClass provides the capability for the device to  report the humidity based on a specified rule that is vendor  discretionary.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = RelativeHumidityFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = RelativeHumidityFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class RelativeHumidityFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "relativeHumidityAnnc";
+	public static final String SHORT_NAME = "relHyAnnc";
+	
+	public RelativeHumidityFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + RelativeHumidityFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RinseLevelFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RinseLevelFlexContainer.java
new file mode 100644
index 0000000..199fb68
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RinseLevelFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : RinseLevel
+
+
+
+This ModuleClass provides capabilities to control and monitor  the level of rinse. It is intended to be part of object which uses  rinse such as a washing machine.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = RinseLevelFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = RinseLevelFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class RinseLevelFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "rinseLevel";
+	public static final String SHORT_NAME = "rinLl";
+	
+	public RinseLevelFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + RinseLevelFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RinseLevelFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RinseLevelFlexContainerAnnc.java
new file mode 100644
index 0000000..dd00fbd
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RinseLevelFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : RinseLevelAnnc
+
+
+
+This ModuleClass provides capabilities to control and monitor  the level of rinse. It is intended to be part of object which uses  rinse such as a washing machine.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = RinseLevelFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = RinseLevelFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class RinseLevelFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "rinseLevelAnnc";
+	public static final String SHORT_NAME = "rinLlAnnc";
+	
+	public RinseLevelFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + RinseLevelFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RunModeFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RunModeFlexContainer.java
new file mode 100644
index 0000000..b1fd344
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RunModeFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : RunMode
+
+
+
+This ModuleClasses provides capabilities to control and monitor  the operational modes of appliances.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = RunModeFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = RunModeFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class RunModeFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "runMode";
+	public static final String SHORT_NAME = "runMe";
+	
+	public RunModeFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + RunModeFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RunModeFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RunModeFlexContainerAnnc.java
new file mode 100644
index 0000000..bee942f
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/RunModeFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : RunModeAnnc
+
+
+
+This ModuleClasses provides capabilities to control and monitor  the operational modes of appliances.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = RunModeFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = RunModeFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class RunModeFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "runModeAnnc";
+	public static final String SHORT_NAME = "runMeAnnc";
+	
+	public RunModeFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + RunModeFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/SignalStrengthFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/SignalStrengthFlexContainer.java
new file mode 100644
index 0000000..749ecae
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/SignalStrengthFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : SignalStrength
+
+
+
+This ModuleClass provides the capability to monitor the strength  of the signal.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = SignalStrengthFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = SignalStrengthFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class SignalStrengthFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "signalStrength";
+	public static final String SHORT_NAME = "sigSh";
+	
+	public SignalStrengthFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + SignalStrengthFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/SignalStrengthFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/SignalStrengthFlexContainerAnnc.java
new file mode 100644
index 0000000..29bc2e5
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/SignalStrengthFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : SignalStrengthAnnc
+
+
+
+This ModuleClass provides the capability to monitor the strength  of the signal.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = SignalStrengthFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = SignalStrengthFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class SignalStrengthFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "signalStrengthAnnc";
+	public static final String SHORT_NAME = "sigShAnnc";
+	
+	public SignalStrengthFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + SignalStrengthFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/SmokeSensorFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/SmokeSensorFlexContainer.java
new file mode 100644
index 0000000..5ef3013
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/SmokeSensorFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : SmokeSensor
+
+
+
+This ModuleClass provides the capabilities to indicate the  detection of smoke and raises an alarm if triggering criterion is  met.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = SmokeSensorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = SmokeSensorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class SmokeSensorFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "smokeSensor";
+	public static final String SHORT_NAME = "smoSr";
+	
+	public SmokeSensorFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + SmokeSensorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/SmokeSensorFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/SmokeSensorFlexContainerAnnc.java
new file mode 100644
index 0000000..2780239
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/SmokeSensorFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : SmokeSensorAnnc
+
+
+
+This ModuleClass provides the capabilities to indicate the  detection of smoke and raises an alarm if triggering criterion is  met.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = SmokeSensorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = SmokeSensorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class SmokeSensorFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "smokeSensorAnnc";
+	public static final String SHORT_NAME = "smoSrAnnc";
+	
+	public SmokeSensorFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + SmokeSensorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/SpinLevelFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/SpinLevelFlexContainer.java
new file mode 100644
index 0000000..2df71e0
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/SpinLevelFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : SpinLevel
+
+
+
+This ModuleClass provides capabilities to control and monitor  the level of spin. It is intended to be part of objects which use  spinning function such as a washing machine and a dryer.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = SpinLevelFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = SpinLevelFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class SpinLevelFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "spinLevel";
+	public static final String SHORT_NAME = "spiLl";
+	
+	public SpinLevelFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + SpinLevelFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/SpinLevelFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/SpinLevelFlexContainerAnnc.java
new file mode 100644
index 0000000..305b9ba
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/SpinLevelFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : SpinLevelAnnc
+
+
+
+This ModuleClass provides capabilities to control and monitor  the level of spin. It is intended to be part of objects which use  spinning function such as a washing machine and a dryer.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = SpinLevelFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = SpinLevelFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class SpinLevelFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "spinLevelAnnc";
+	public static final String SHORT_NAME = "spiLlAnnc";
+	
+	public SpinLevelFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + SpinLevelFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/StreamingFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/StreamingFlexContainer.java
new file mode 100644
index 0000000..c5f6eb5
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/StreamingFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : Streaming
+
+
+
+This ModuleClass provides the capabilities to retrieve usefull  data about a streaming (url, credentials..).
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = StreamingFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = StreamingFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class StreamingFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "streaming";
+	public static final String SHORT_NAME = "streg";
+	
+	public StreamingFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + StreamingFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/StreamingFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/StreamingFlexContainerAnnc.java
new file mode 100644
index 0000000..489e24f
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/StreamingFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : StreamingAnnc
+
+
+
+This ModuleClass provides the capabilities to retrieve usefull  data about a streaming (url, credentials..).
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = StreamingFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = StreamingFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class StreamingFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "streamingAnnc";
+	public static final String SHORT_NAME = "stregAnnc";
+	
+	public StreamingFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + StreamingFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TelevisionChannelFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TelevisionChannelFlexContainer.java
new file mode 100644
index 0000000..b340420
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TelevisionChannelFlexContainer.java
@@ -0,0 +1,69 @@
+/*
+ModuleClass : TelevisionChannel
+
+
+
+This ModuleClass provides capabilities to set and get channels  of a device that has a channel list.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = TelevisionChannelFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = TelevisionChannelFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class TelevisionChannelFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "televisionChannel";
+	public static final String SHORT_NAME = "telCl";
+	
+	public TelevisionChannelFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + TelevisionChannelFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getUpChannel();
+		getDownChannel();
+	}
+	
+	@XmlElement(name=UpChannelFlexContainer.SHORT_NAME, required=true, type=UpChannelFlexContainer.class)
+	private UpChannelFlexContainer upChannel;
+	
+	
+	public void setUpChannel(UpChannelFlexContainer upChannel) {
+		this.upChannel = upChannel;
+		getFlexContainerOrContainerOrSubscription().add(upChannel);
+	}
+	
+	public UpChannelFlexContainer getUpChannel() {
+		this.upChannel = (UpChannelFlexContainer) getResourceByName(UpChannelFlexContainer.SHORT_NAME);
+		return upChannel;
+	}
+	
+	@XmlElement(name=DownChannelFlexContainer.SHORT_NAME, required=true, type=DownChannelFlexContainer.class)
+	private DownChannelFlexContainer downChannel;
+	
+	
+	public void setDownChannel(DownChannelFlexContainer downChannel) {
+		this.downChannel = downChannel;
+		getFlexContainerOrContainerOrSubscription().add(downChannel);
+	}
+	
+	public DownChannelFlexContainer getDownChannel() {
+		this.downChannel = (DownChannelFlexContainer) getResourceByName(DownChannelFlexContainer.SHORT_NAME);
+		return downChannel;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TelevisionChannelFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TelevisionChannelFlexContainerAnnc.java
new file mode 100644
index 0000000..7aef28b
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TelevisionChannelFlexContainerAnnc.java
@@ -0,0 +1,69 @@
+/*
+ModuleClass : TelevisionChannelAnnc
+
+
+
+This ModuleClass provides capabilities to set and get channels  of a device that has a channel list.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = TelevisionChannelFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = TelevisionChannelFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class TelevisionChannelFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "televisionChannelAnnc";
+	public static final String SHORT_NAME = "telClAnnc";
+	
+	public TelevisionChannelFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + TelevisionChannelFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getUpChannelAnnc();
+		getDownChannelAnnc();
+	}
+	
+	@XmlElement(name=UpChannelFlexContainerAnnc.SHORT_NAME, required=true, type=UpChannelFlexContainerAnnc.class)
+	private UpChannelFlexContainerAnnc upChannelAnnc;
+	
+	
+	public void setUpChannel(UpChannelFlexContainerAnnc upChannelAnnc) {
+		this.upChannelAnnc = upChannelAnnc;
+		getFlexContainerOrContainerOrSubscription().add(upChannelAnnc);
+	}
+	
+	public UpChannelFlexContainerAnnc getUpChannelAnnc() {
+		this.upChannelAnnc = (UpChannelFlexContainerAnnc) getResourceByName(UpChannelFlexContainerAnnc.SHORT_NAME);
+		return upChannelAnnc;
+	}
+	
+	@XmlElement(name=DownChannelFlexContainerAnnc.SHORT_NAME, required=true, type=DownChannelFlexContainerAnnc.class)
+	private DownChannelFlexContainerAnnc downChannelAnnc;
+	
+	
+	public void setDownChannel(DownChannelFlexContainerAnnc downChannelAnnc) {
+		this.downChannelAnnc = downChannelAnnc;
+		getFlexContainerOrContainerOrSubscription().add(downChannelAnnc);
+	}
+	
+	public DownChannelFlexContainerAnnc getDownChannelAnnc() {
+		this.downChannelAnnc = (DownChannelFlexContainerAnnc) getResourceByName(DownChannelFlexContainerAnnc.SHORT_NAME);
+		return downChannelAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TemperatureAlarmFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TemperatureAlarmFlexContainer.java
new file mode 100644
index 0000000..9afc576
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TemperatureAlarmFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : TemperatureAlarm
+
+
+
+This ModuleClass provides the capabilities to indicates the  detection of abnormal temperatures and raies an alarm if the  triggering criterion is met.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = TemperatureAlarmFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = TemperatureAlarmFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class TemperatureAlarmFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "temperatureAlarm";
+	public static final String SHORT_NAME = "temAm";
+	
+	public TemperatureAlarmFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + TemperatureAlarmFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TemperatureAlarmFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TemperatureAlarmFlexContainerAnnc.java
new file mode 100644
index 0000000..e45e611
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TemperatureAlarmFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : TemperatureAlarmAnnc
+
+
+
+This ModuleClass provides the capabilities to indicates the  detection of abnormal temperatures and raies an alarm if the  triggering criterion is met.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = TemperatureAlarmFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = TemperatureAlarmFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class TemperatureAlarmFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "temperatureAlarmAnnc";
+	public static final String SHORT_NAME = "temAmAnnc";
+	
+	public TemperatureAlarmFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + TemperatureAlarmFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TemperatureFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TemperatureFlexContainer.java
new file mode 100644
index 0000000..1ff2e6a
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TemperatureFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : Temperature
+
+
+
+This ModuleClass provides capabilities to represent the current  temperature and target temperature of devices such as an air  conditioner, refrigerator, oven and etc.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = TemperatureFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = TemperatureFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class TemperatureFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "temperature";
+	public static final String SHORT_NAME = "tempe";
+	
+	public TemperatureFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + TemperatureFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TemperatureFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TemperatureFlexContainerAnnc.java
new file mode 100644
index 0000000..fde694f
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TemperatureFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : TemperatureAnnc
+
+
+
+This ModuleClass provides capabilities to represent the current  temperature and target temperature of devices such as an air  conditioner, refrigerator, oven and etc.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = TemperatureFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = TemperatureFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class TemperatureFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "temperatureAnnc";
+	public static final String SHORT_NAME = "tempeAnnc";
+	
+	public TemperatureFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + TemperatureFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TimerFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TimerFlexContainer.java
new file mode 100644
index 0000000..fbfc5e1
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TimerFlexContainer.java
@@ -0,0 +1,69 @@
+/*
+ModuleClass : Timer
+
+
+
+This ModuleClass provides capabilities to monitor and control  the times when the appliance executes its operations (i.e. when it  starts, when it ends).
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = TimerFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = TimerFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class TimerFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "timer";
+	public static final String SHORT_NAME = "timer";
+	
+	public TimerFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + TimerFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getActivateClockTimer();
+		getDeactivateClockTimer();
+	}
+	
+	@XmlElement(name=ActivateClockTimerFlexContainer.SHORT_NAME, required=true, type=ActivateClockTimerFlexContainer.class)
+	private ActivateClockTimerFlexContainer activateClockTimer;
+	
+	
+	public void setActivateClockTimer(ActivateClockTimerFlexContainer activateClockTimer) {
+		this.activateClockTimer = activateClockTimer;
+		getFlexContainerOrContainerOrSubscription().add(activateClockTimer);
+	}
+	
+	public ActivateClockTimerFlexContainer getActivateClockTimer() {
+		this.activateClockTimer = (ActivateClockTimerFlexContainer) getResourceByName(ActivateClockTimerFlexContainer.SHORT_NAME);
+		return activateClockTimer;
+	}
+	
+	@XmlElement(name=DeactivateClockTimerFlexContainer.SHORT_NAME, required=true, type=DeactivateClockTimerFlexContainer.class)
+	private DeactivateClockTimerFlexContainer deactivateClockTimer;
+	
+	
+	public void setDeactivateClockTimer(DeactivateClockTimerFlexContainer deactivateClockTimer) {
+		this.deactivateClockTimer = deactivateClockTimer;
+		getFlexContainerOrContainerOrSubscription().add(deactivateClockTimer);
+	}
+	
+	public DeactivateClockTimerFlexContainer getDeactivateClockTimer() {
+		this.deactivateClockTimer = (DeactivateClockTimerFlexContainer) getResourceByName(DeactivateClockTimerFlexContainer.SHORT_NAME);
+		return deactivateClockTimer;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TimerFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TimerFlexContainerAnnc.java
new file mode 100644
index 0000000..15afcf5
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TimerFlexContainerAnnc.java
@@ -0,0 +1,69 @@
+/*
+ModuleClass : TimerAnnc
+
+
+
+This ModuleClass provides capabilities to monitor and control  the times when the appliance executes its operations (i.e. when it  starts, when it ends).
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = TimerFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = TimerFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class TimerFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "timerAnnc";
+	public static final String SHORT_NAME = "timerAnnc";
+	
+	public TimerFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + TimerFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+		getActivateClockTimerAnnc();
+		getDeactivateClockTimerAnnc();
+	}
+	
+	@XmlElement(name=ActivateClockTimerFlexContainerAnnc.SHORT_NAME, required=true, type=ActivateClockTimerFlexContainerAnnc.class)
+	private ActivateClockTimerFlexContainerAnnc activateClockTimerAnnc;
+	
+	
+	public void setActivateClockTimer(ActivateClockTimerFlexContainerAnnc activateClockTimerAnnc) {
+		this.activateClockTimerAnnc = activateClockTimerAnnc;
+		getFlexContainerOrContainerOrSubscription().add(activateClockTimerAnnc);
+	}
+	
+	public ActivateClockTimerFlexContainerAnnc getActivateClockTimerAnnc() {
+		this.activateClockTimerAnnc = (ActivateClockTimerFlexContainerAnnc) getResourceByName(ActivateClockTimerFlexContainerAnnc.SHORT_NAME);
+		return activateClockTimerAnnc;
+	}
+	
+	@XmlElement(name=DeactivateClockTimerFlexContainerAnnc.SHORT_NAME, required=true, type=DeactivateClockTimerFlexContainerAnnc.class)
+	private DeactivateClockTimerFlexContainerAnnc deactivateClockTimerAnnc;
+	
+	
+	public void setDeactivateClockTimer(DeactivateClockTimerFlexContainerAnnc deactivateClockTimerAnnc) {
+		this.deactivateClockTimerAnnc = deactivateClockTimerAnnc;
+		getFlexContainerOrContainerOrSubscription().add(deactivateClockTimerAnnc);
+	}
+	
+	public DeactivateClockTimerFlexContainerAnnc getDeactivateClockTimerAnnc() {
+		this.deactivateClockTimerAnnc = (DeactivateClockTimerFlexContainerAnnc) getResourceByName(DeactivateClockTimerFlexContainerAnnc.SHORT_NAME);
+		return deactivateClockTimerAnnc;
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ToggleFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ToggleFlexContainer.java
new file mode 100644
index 0000000..7d517e5
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ToggleFlexContainer.java
@@ -0,0 +1,36 @@
+/*
+Action : toggle
+
+
+
+Toggle the switch.
+
+Created: 2017-08-09 14:07:04
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = ToggleFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = ToggleFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class ToggleFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "toggle";
+	public static final String SHORT_NAME = "togge";
+	
+	public ToggleFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass.binaryswitch." + ToggleFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ToggleFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ToggleFlexContainerAnnc.java
new file mode 100644
index 0000000..3662c28
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/ToggleFlexContainerAnnc.java
@@ -0,0 +1,36 @@
+/*
+Action : toggle
+
+
+
+Toggle the switch.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = ToggleFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = ToggleFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class ToggleFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "toggleAnnc";
+	public static final String SHORT_NAME = "toggeAnnc";
+	
+	public ToggleFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass.binaryswitch." + ToggleFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TurboFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TurboFlexContainer.java
new file mode 100644
index 0000000..79929b4
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TurboFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : Turbo
+
+
+
+This ModuleClass provides capabilities to enalbe turbo mode and  monitor the current status of the turbo function. It is intended to  be part of objects which use turbo function such as an air  conditioner, a washing machine etc.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = TurboFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = TurboFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class TurboFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "turbo";
+	public static final String SHORT_NAME = "turbo";
+	
+	public TurboFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + TurboFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TurboFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TurboFlexContainerAnnc.java
new file mode 100644
index 0000000..b2a865c
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/TurboFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : TurboAnnc
+
+
+
+This ModuleClass provides capabilities to enalbe turbo mode and  monitor the current status of the turbo function. It is intended to  be part of objects which use turbo function such as an air  conditioner, a washing machine etc.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = TurboFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = TurboFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class TurboFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "turboAnnc";
+	public static final String SHORT_NAME = "turboAnnc";
+	
+	public TurboFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + TurboFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/UpChannelFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/UpChannelFlexContainer.java
new file mode 100644
index 0000000..d6002db
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/UpChannelFlexContainer.java
@@ -0,0 +1,36 @@
+/*
+Action : upChannel
+
+
+
+Change the current channel to the next channel in the stored  list of available channels. If the current channel is the last one  in the list, the new set channel may be the first one in the list.
+
+Created: 2017-08-09 14:07:04
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = UpChannelFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = UpChannelFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class UpChannelFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "upChannel";
+	public static final String SHORT_NAME = "uphCl";
+	
+	public UpChannelFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass.televisionchannel." + UpChannelFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/UpChannelFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/UpChannelFlexContainerAnnc.java
new file mode 100644
index 0000000..27fff2c
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/UpChannelFlexContainerAnnc.java
@@ -0,0 +1,36 @@
+/*
+Action : upChannel
+
+
+
+Change the current channel to the next channel in the stored  list of available channels. If the current channel is the last one  in the list, the new set channel may be the first one in the list.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = UpChannelFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = UpChannelFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class UpChannelFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "upChannelAnnc";
+	public static final String SHORT_NAME = "uphClAnnc";
+	
+	public UpChannelFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass.televisionchannel." + UpChannelFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/UpVolumeFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/UpVolumeFlexContainer.java
new file mode 100644
index 0000000..0842160
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/UpVolumeFlexContainer.java
@@ -0,0 +1,36 @@
+/*
+Action : upVolume
+
+
+
+Increase volume by the amount of the stepValue up to the  maxValue.
+
+Created: 2017-08-09 14:07:04
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = UpVolumeFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = UpVolumeFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class UpVolumeFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "upVolume";
+	public static final String SHORT_NAME = "upoVe";
+	
+	public UpVolumeFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass.audiovolume." + UpVolumeFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/UpVolumeFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/UpVolumeFlexContainerAnnc.java
new file mode 100644
index 0000000..bcf4682
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/UpVolumeFlexContainerAnnc.java
@@ -0,0 +1,36 @@
+/*
+Action : upVolume
+
+
+
+Increase volume by the amount of the stepValue up to the  maxValue.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = UpVolumeFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = UpVolumeFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class UpVolumeFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "upVolumeAnnc";
+	public static final String SHORT_NAME = "upoVeAnnc";
+	
+	public UpVolumeFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass.audiovolume." + UpVolumeFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WaterFlowFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WaterFlowFlexContainer.java
new file mode 100644
index 0000000..c047b83
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WaterFlowFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : WaterFlow
+
+
+
+This ModuleClass is for controlling water strength of a device.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = WaterFlowFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = WaterFlowFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class WaterFlowFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "waterFlow";
+	public static final String SHORT_NAME = "watFw";
+	
+	public WaterFlowFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + WaterFlowFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WaterFlowFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WaterFlowFlexContainerAnnc.java
new file mode 100644
index 0000000..787c5e3
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WaterFlowFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : WaterFlowAnnc
+
+
+
+This ModuleClass is for controlling water strength of a device.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = WaterFlowFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = WaterFlowFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class WaterFlowFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "waterFlowAnnc";
+	public static final String SHORT_NAME = "watFwAnnc";
+	
+	public WaterFlowFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + WaterFlowFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WaterLevelFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WaterLevelFlexContainer.java
new file mode 100644
index 0000000..2553fdc
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WaterLevelFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : WaterLevel
+
+
+
+This ModuleClass provides the level and supply source of water  for an appliance. Examples of appliances which may include this  ModuleClass are air purifier, humidifier and ice maker.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = WaterLevelFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = WaterLevelFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class WaterLevelFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "waterLevel";
+	public static final String SHORT_NAME = "watLl";
+	
+	public WaterLevelFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + WaterLevelFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WaterLevelFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WaterLevelFlexContainerAnnc.java
new file mode 100644
index 0000000..9074341
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WaterLevelFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : WaterLevelAnnc
+
+
+
+This ModuleClass provides the level and supply source of water  for an appliance. Examples of appliances which may include this  ModuleClass are air purifier, humidifier and ice maker.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = WaterLevelFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = WaterLevelFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class WaterLevelFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "waterLevelAnnc";
+	public static final String SHORT_NAME = "watLlAnnc";
+	
+	public WaterLevelFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + WaterLevelFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WaterSensorFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WaterSensorFlexContainer.java
new file mode 100644
index 0000000..9dc153a
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WaterSensorFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : WaterSensor
+
+
+
+This ModuleClass provides the capabilities to indicates whether  water has been sensed or not and raises an alarm if the triggering  criterion is met.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = WaterSensorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = WaterSensorFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class WaterSensorFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "waterSensor";
+	public static final String SHORT_NAME = "watSr";
+	
+	public WaterSensorFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + WaterSensorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WaterSensorFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WaterSensorFlexContainerAnnc.java
new file mode 100644
index 0000000..1a12e59
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WaterSensorFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : WaterSensorAnnc
+
+
+
+This ModuleClass provides the capabilities to indicates whether  water has been sensed or not and raises an alarm if the triggering  criterion is met.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = WaterSensorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = WaterSensorFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class WaterSensorFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "waterSensorAnnc";
+	public static final String SHORT_NAME = "watSrAnnc";
+	
+	public WaterSensorFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + WaterSensorFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WeightFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WeightFlexContainer.java
new file mode 100644
index 0000000..c7f6f10
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WeightFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : Weight
+
+
+
+This ModuleClass provides the capability to report the  measurement of weight.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = WeightFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = WeightFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class WeightFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "weight";
+	public static final String SHORT_NAME = "weigt";
+	
+	public WeightFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + WeightFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WeightFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WeightFlexContainerAnnc.java
new file mode 100644
index 0000000..1e736b5
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WeightFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : WeightAnnc
+
+
+
+This ModuleClass provides the capability to report the  measurement of weight.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = WeightFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = WeightFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class WeightFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "weightAnnc";
+	public static final String SHORT_NAME = "weigtAnnc";
+	
+	public WeightFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + WeightFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WindFlexContainer.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WindFlexContainer.java
new file mode 100644
index 0000000..8e70c6c
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WindFlexContainer.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : Wind
+
+
+
+This ModuleClass is for controlling wind strength and direction  of a device.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = WindFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = WindFlexContainer.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class WindFlexContainer extends AbstractFlexContainer {
+	
+	public static final String LONG_NAME = "wind";
+	public static final String SHORT_NAME = "wind";
+	
+	public WindFlexContainer () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + WindFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WindFlexContainerAnnc.java b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WindFlexContainerAnnc.java
new file mode 100644
index 0000000..c8a69ce
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/WindFlexContainerAnnc.java
@@ -0,0 +1,39 @@
+/*
+ModuleClass : WindAnnc
+
+
+
+This ModuleClass is for controlling wind strength and direction  of a device.
+
+Created: 2017-08-09 15:38:05
+*/
+
+package org.eclipse.om2m.commons.resource.flexcontainerspec;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlRootElement;
+import javax.xml.bind.annotation.XmlType;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+
+
+@XmlRootElement(name = WindFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = WindFlexContainerAnnc.SHORT_NAME, namespace = "http://www.onem2m.org/xml/protocols/homedomain")
+public class WindFlexContainerAnnc extends AbstractFlexContainerAnnc {
+	
+	public static final String LONG_NAME = "windAnnc";
+	public static final String SHORT_NAME = "windAnnc";
+	
+	public WindFlexContainerAnnc () {
+		setContainerDefinition("org.onem2m.home.moduleclass." + WindFlexContainer.LONG_NAME);
+		setLongName(LONG_NAME);
+		setShortName(SHORT_NAME);
+	}
+	
+	public void finalizeSerialization() {
+	}
+	
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/jaxb.properties b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/jaxb.properties
new file mode 100644
index 0000000..1ca28d9
--- /dev/null
+++ b/org.eclipse.om2m.commons/src/main/java/org/eclipse/om2m/commons/resource/flexcontainerspec/jaxb.properties
@@ -0,0 +1,20 @@
+###############################################################################
+# Copyright (c) 2013-2016 LAAS-CNRS (www.laas.fr)
+# 7 Colonel Roche 31077 Toulouse - France
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Initial Contributors:
+#     Thierry Monteil : Project manager, technical co-manager
+#     Mahdi Ben Alaya : Technical co-manager
+#     Samir Medjiah : Technical co-manager
+#     Khalil Drira : Strategy expert
+#     Guillaume Garzone : Developer
+#     François Aïssaoui : Developer
+#
+# New contributors :
+###############################################################################
+javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory
\ No newline at end of file
diff --git a/org.eclipse.om2m.core.service/src/main/java/org/eclipse/om2m/core/service/RemoteCseService.java b/org.eclipse.om2m.core.service/src/main/java/org/eclipse/om2m/core/service/RemoteCseService.java
index 9da6933..b379d71 100644
--- a/org.eclipse.om2m.core.service/src/main/java/org/eclipse/om2m/core/service/RemoteCseService.java
+++ b/org.eclipse.om2m.core.service/src/main/java/org/eclipse/om2m/core/service/RemoteCseService.java
@@ -16,6 +16,7 @@
 	public static final String REMOTE_CSE_TOPIC = "org/eclipse/om2m/remoteCse";

 	public static final String REMOTE_CSE_ID_PROPERTY = "remoteCseId";

 	public static final String REMOTE_CSE_NAME_PROPERTY = "remoteCseName";

+	public static final String REMOTE_CSE_POA = "remoteCsePoa";

 	public static final String OPERATION_PROPERTY = "operation";

 	public static final String ADD_OPERATION_VALUE = "add";

 	public static final String REMOVE_OPERATION_VALUE = "remove";

diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/CSEInitializer.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/CSEInitializer.java
index 339cd06..24c47a3 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/CSEInitializer.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/CSEInitializer.java
@@ -126,9 +126,7 @@
 		DBService db = PersistenceService.getInstance().getDbService();
 		DBTransaction transaction = db.getDbTransaction();
 		transaction.open();
-		String acpUri = UriMapper.getNonHierarchicalUri(
-				"/" + Constants.CSE_ID + "/" + Constants.CSE_NAME + "/" + Constants.ADMIN_PROFILE_ID);
-		AccessControlPolicyEntity acpEntity = db.getDAOFactory().getAccessControlPolicyDAO().find(transaction, acpUri);
+		AccessControlPolicyEntity acpEntity = db.getDAOFactory().getAccessControlPolicyDAO().find(transaction, acpAdminId);
 		cseBaseEntity.getAccessControlPolicies().add(acpEntity);
 		cseBaseEntity.getChildAccessControlPolicies().add(acpEntity);
 		cseBaseEntity.setCreationTime(DateUtil.now());
@@ -143,7 +141,7 @@
 		int[] supportedResources = { ResourceType.ACCESS_CONTROL_POLICY, ResourceType.AE, ResourceType.CONTAINER,
 				ResourceType.CONTENT_INSTANCE, ResourceType.CSE_BASE, ResourceType.GROUP, ResourceType.NODE,
 				ResourceType.POLLING_CHANNEL, ResourceType.REMOTE_CSE, ResourceType.REQUEST,
-				ResourceType.SUBSCRIPTION };
+				ResourceType.SUBSCRIPTION, ResourceType.FLEXCONTAINER };
 
 		for (int rt : supportedResources) {
 			cseBaseEntity.getSupportedResourceType().add(BigInteger.valueOf(rt));
@@ -158,7 +156,13 @@
 		} else {
 			db.getDAOFactory().getCSEBaseDAO().update(transaction, cseBaseEntity);
 		}
+		
+		// update acp admin entity's parent
+		CSEBaseEntity dbCseBaseEntity = db.getDAOFactory().getCSEBaseDAO().find(transaction, cseBaseEntity.getResourceID());
+		acpEntity.setParentCse(dbCseBaseEntity);
+		
 		transaction.commit();
+		transaction.close();
 	}
 
 	/**
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/announcer/Announcer.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/announcer/Announcer.java
index 3c4cf31..7cb479e 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/announcer/Announcer.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/announcer/Announcer.java
@@ -36,10 +36,11 @@
 import org.eclipse.om2m.commons.resource.AEAnnc;

 import org.eclipse.om2m.commons.resource.AnnounceableResource;

 import org.eclipse.om2m.commons.resource.AnnouncedResource;

-import org.eclipse.om2m.commons.resource.FlexContainer;

-import org.eclipse.om2m.commons.resource.FlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;

+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;

 import org.eclipse.om2m.commons.resource.RequestPrimitive;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.FlexContainerFactory;

 import org.eclipse.om2m.core.persistence.PersistenceService;

 import org.eclipse.om2m.core.redirector.Redirector;

 import org.eclipse.om2m.persistence.service.DBService;

@@ -81,11 +82,13 @@
 			announcedResource = aeAnnc;

 			break;

 		case ResourceType.FLEXCONTAINER:

-			FlexContainerAnnc flexContainerAnnc = new FlexContainerAnnc();

-			flexContainerAnnc.setContainerDefinition(((FlexContainer) toBeAnnounced).getContainerDefinition());

+			AbstractFlexContainer afc = (AbstractFlexContainer) toBeAnnounced;

+			AbstractFlexContainerAnnc flexContainerAnnc = FlexContainerFactory.getSpecializationFlexContainerAnnc(afc.getShortName() + "Annc");

 			announcedResource = flexContainerAnnc;

 		default:

 		}

+		

+		announcedResource.setName(toBeAnnounced.getName() + "_Annc");

 

 		// get the database service

 		DBService dbs = PersistenceService.getInstance().getDbService();

@@ -133,7 +136,6 @@
 			request.setRequestContentType(MimeMediaType.OBJ);

 			request.setReturnContentType(MimeMediaType.OBJ);

 			request.setFrom(requestingEntity);

-			request.setName(toBeAnnounced.getName() + "_Annc");

 

 			ResponsePrimitive response = Redirector.retarget(request);

 			if (response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AEAnncController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AEAnncController.java
index b2ae5d1..27eee91 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AEAnncController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AEAnncController.java
@@ -277,11 +277,6 @@
 				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);

 			}

 			aeAnncEntity.setName(aeAnnc.getName());

-		} else if (request.getName() != null) {

-			if (!Patterns.checkResourceName(request.getName())) {

-				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);

-			}

-			aeAnncEntity.setName(request.getName());

 		} else {

 			aeAnncEntity.setName(ShortName.AE_ANNC + "_" + generatedId);

 		}

@@ -344,7 +339,7 @@
 			originalResourceRequest.setOperation(Operation.RETRIEVE);

 			originalResourceRequest.setFrom(Constants.ADMIN_REQUESTING_ENTITY);

 			originalResourceRequest.setTargetId(aeAnncEntity.getLink());

-			originalResourceRequest.setReturnContentType(MimeMediaType.OBJ);

+			originalResourceRequest.setReturnContentType(request.getReturnContentType());

 			return Redirector.retarget(originalResourceRequest );

 		} else {

 			// Create the object used to create the representation of the resource

diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AEController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AEController.java
index c5712c5..3b9e7a0 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AEController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AEController.java
@@ -309,15 +309,9 @@
 				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);
 			}
 			aeEntity.setName(ae.getName());
-		} else
-			if (request.getName() != null){
-				if (!Patterns.checkResourceName(request.getName())){
-					throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);
-				}
-				aeEntity.setName(request.getName());
-			} else {
+		} else {
 				aeEntity.setName(ShortName.AE + "_" + generatedId);
-			}
+		}
 		aeEntity.setHierarchicalURI(parentEntity.getHierarchicalURI() + "/" + aeEntity.getName());
 		if (!UriMapper.addNewUri(aeEntity.getHierarchicalURI(), aeEntity.getResourceID(), ResourceType.AE)){
 			throw new ConflictException("Name already present in the parent collection.");
@@ -344,7 +338,7 @@
 		transaction.commit();
 		
 		if ((ae.getAnnounceTo() != null) && (!ae.getAnnounceTo().isEmpty())) {
-			ae.setName(request.getName());
+			ae.setName(aeDB.getName());
 			ae.setResourceID(aeDB.getResourceID());
 			ae.setResourceType(ResourceType.AE);
 			Announcer.announce(ae.getAnnounceTo(), ae.getAnnouncedAttribute(), ae, request.getFrom(), "");
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AccessControlPolicyController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AccessControlPolicyController.java
index 551749c..7bc349b 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AccessControlPolicyController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/AccessControlPolicyController.java
@@ -178,12 +178,6 @@
 				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);
 			}
 			acpEntity.setName(acp.getName());
-		} else 
-		if (request.getName() != null){
-			if (!Patterns.checkResourceName(request.getName())){
-				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);
-			}
-			acpEntity.setName(request.getName());			
 		} else {
 			acpEntity.setName(ShortName.ACP + "_" + generatedId);			
 		}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/ContainerController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/ContainerController.java
index 0d4b614..72aa2ad 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/ContainerController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/ContainerController.java
@@ -201,12 +201,6 @@
 				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);
 			}
 			containerEntity.setName(container.getName());
-		} else 
-		if (request.getName() != null) {
-			if(!Patterns.checkResourceName(request.getName())){
-				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);
-			}
-			containerEntity.setName(request.getName());
 		} else {
 			containerEntity.setName(ShortName.CNT + "_" + generatedId);
 		}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/ContentInstanceController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/ContentInstanceController.java
index 45fb3bf..a8e5505 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/ContentInstanceController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/ContentInstanceController.java
@@ -177,12 +177,6 @@
 				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);
 			}
 			cinEntity.setName(cin.getName());
-		} else 
-		if (request.getName() != null){
-			if (!Patterns.checkResourceName(request.getName())){
-				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);
-			}
-			cinEntity.setName(request.getName());
 		} else {
 			cinEntity.setName(ShortName.CIN + "_" + generatedId);
 		}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/Controller.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/Controller.java
index 2f07800..d7bb602 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/Controller.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/Controller.java
@@ -74,7 +74,6 @@
 		ResponsePrimitive response = new ResponsePrimitive(request);
 		dbs = PersistenceService.getInstance().getDbService();
 		transaction = dbs.getDbTransaction();
-		System.out.println("create transaction " + transaction.toString() + ", targetId " + request.getTargetId() + ", operation =" + request.getOperation());
 		try{
 			transaction.open();
 			if(request.getOperation().equals(Operation.CREATE)){
@@ -356,7 +355,7 @@
 			}
 			if(request.getResultContent().equals(ResultContent.HIERARCHICAL_AND_ATTRIBUTES)
 					|| request.getResultContent().equals(ResultContent.ATTRIBUTES)){
-				Resource res = mapper.mapEntityToResource(entity, ResultContent.ATTRIBUTES);
+				Resource res = mapper.mapEntityToResource(entity, ResultContent.ATTRIBUTES, 0, 0);
 				if(request.getReturnContentType().equals(MimeMediaType.OBJ)){
 					response.setContent(res);
 				} else {
@@ -366,7 +365,7 @@
 				}
 			}
 		} else {
-			response.setContent(mapper.mapEntityToResource(entity, ResultContent.ATTRIBUTES));
+			response.setContent(mapper.mapEntityToResource(entity, ResultContent.ATTRIBUTES, 0, 0));
 			response.setLocation(entity.getResourceID());			
 		}
 	}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/DiscoveryController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/DiscoveryController.java
index 3f908bc..eb465c3 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/DiscoveryController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/DiscoveryController.java
@@ -161,6 +161,8 @@
 		}
 		
 		URIList uriList = new URIList();
+		// need to call getListofUri in order to create at least an empty list
+		uriList.getListOfUri();
 		for(UriMapperEntity uriEntity : childUris){
 			if(filter.getLimit() != null && uriList.getListOfUri().size() == filter.getLimit().intValue()){
 				break;
@@ -172,7 +174,8 @@
 			if (currentResourceEntity != null) {
 				List<AccessControlPolicyEntity> acps = getAcpsFromEntity(currentResourceEntity);
 				try {
-					checkACP(acps, request.getFrom(), Operation.DISCOVERY);
+					checkPermissions(request, currentResourceEntity, acps);
+//					checkACP(acps, request.getFrom(), Operation.DISCOVERY);
 					if(request.getDiscoveryResultType().equals(DiscoveryResultType.HIERARCHICAL)){
 						if(!uriList.getListOfUri().contains(uriEntity.getHierarchicalUri())){
 							uriList.getListOfUri().add(uriEntity.getHierarchicalUri());
@@ -291,6 +294,9 @@
 				result.addAll(labelEntity.getLinkedAni());
 				result.addAll(labelEntity.getLinkedAndi());
 				break;
+			case(ResourceType.SUBSCRIPTION):
+				result.addAll(labelEntity.getLinkedSub());
+				break;
 			default:
 				break;
 			}
@@ -308,6 +314,7 @@
 			result.addAll(labelEntity.getLinkedNodes());
 			result.addAll(labelEntity.getLinkedAni());
 			result.addAll(labelEntity.getLinkedAndi());
+			result.addAll(labelEntity.getLinkedSub());
 		}
 		return result;
 	}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/DynamicAuthorizationConsultationController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/DynamicAuthorizationConsultationController.java
index eb5dda9..cec1bb9 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/DynamicAuthorizationConsultationController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/DynamicAuthorizationConsultationController.java
@@ -154,11 +154,11 @@
 		// name

 		String generatedId = generateId("", "");

 		// set name if present and without any conflict

-		if (request.getName() != null) {

-			if (!Patterns.checkResourceName(request.getName())) {

+		if (dac.getName() != null) {

+			if (!Patterns.checkResourceName(dac.getName())) {

 				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);

 			}

-			dacEntity.setName(request.getName());

+			dacEntity.setName(dac.getName());

 		} else {

 			dacEntity.setName(ShortName.DAC + "_" + generatedId);

 		}

diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/FlexContainerAnncController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/FlexContainerAnncController.java
index ed06bca..4b1f8ef 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/FlexContainerAnncController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/FlexContainerAnncController.java
@@ -28,8 +28,8 @@
 import org.eclipse.om2m.commons.exceptions.Om2mException;

 import org.eclipse.om2m.commons.exceptions.ResourceNotFoundException;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

-import org.eclipse.om2m.commons.resource.FlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;

+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;

 import org.eclipse.om2m.commons.resource.RequestPrimitive;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

 import org.eclipse.om2m.commons.utils.Util.DateUtil;

@@ -115,12 +115,12 @@
 			throw new BadRequestException("A content is requiered for FlexContainer creation");

 		}

 		// get the object from the representation

-		FlexContainerAnnc flexContainerAnnc = null;

+		AbstractFlexContainerAnnc flexContainerAnnc = null;

 		try {

 			if (request.getRequestContentType().equals(MimeMediaType.OBJ)) {

-				flexContainerAnnc = (FlexContainerAnnc) request.getContent();

+				flexContainerAnnc = (AbstractFlexContainerAnnc) request.getContent();

 			} else {

-				flexContainerAnnc = (FlexContainerAnnc) DataMapperSelector.getDataMapperList()

+				flexContainerAnnc = (AbstractFlexContainerAnnc) DataMapperSelector.getDataMapperList()

 						.get(request.getRequestContentType()).stringToObj((String) request.getContent());

 			}

 

@@ -178,14 +178,16 @@
 

 		String generatedId = generateId("", "");

 		// set name if present and without any conflict

-		if (request.getName() != null) {

-			if (!Patterns.checkResourceName(request.getName())) {

+		if (flexContainerAnnc.getName() != null) {

+			if (!Patterns.checkResourceName(flexContainerAnnc.getName())) {

 				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);

 			}

-			flexContainerAnncEntity.setName(request.getName());

+			flexContainerAnncEntity.setName(flexContainerAnnc.getName());

 		} else {

 			flexContainerAnncEntity.setName(ShortName.FCNTA + "_" + generatedId);

 		}

+		flexContainerAnncEntity.setLongName(flexContainerAnnc.getLongName());

+		flexContainerAnncEntity.setShortName(flexContainerAnnc.getShortName());

 		flexContainerAnncEntity.setResourceID(

 				"/" + Constants.CSE_ID + "/" + ShortName.FCNTA + Constants.PREFIX_SEPERATOR + generatedId);

 		flexContainerAnncEntity

@@ -288,11 +290,11 @@
 			originalResourceRequest.setOperation(Operation.RETRIEVE);

 			originalResourceRequest.setFrom(Constants.ADMIN_REQUESTING_ENTITY);

 			originalResourceRequest.setTargetId(flexContainerAnncEntity.getLink());

-			originalResourceRequest.setReturnContentType(MimeMediaType.OBJ);

+			originalResourceRequest.setReturnContentType(request.getReturnContentType());

 			return Redirector.retarget(originalResourceRequest);

 		} else {

 			// Mapping the entity with the exchange resource

-			FlexContainerAnnc flexContainerAnncResource = EntityMapperFactory.getFlexContainerAnncMapper()

+			AbstractFlexContainerAnnc flexContainerAnncResource = EntityMapperFactory.getFlexContainerAnncMapper()

 					.mapEntityToResource(flexContainerAnncEntity, request);

 			response.setContent(flexContainerAnncResource);

 		}

@@ -330,24 +332,24 @@
 			originalResourceRequest.setFrom(Constants.ADMIN_REQUESTING_ENTITY);

 			originalResourceRequest.setTargetId(flexContainerAnncEntity.getLink());

 			originalResourceRequest.setRequestContentType(request.getRequestContentType());

-			originalResourceRequest.setReturnContentType(MimeMediaType.OBJ);

+			originalResourceRequest.setReturnContentType(request.getReturnContentType());

 			originalResourceRequest.setContent(request.getContent());

 			return Redirector.retarget(originalResourceRequest);

 		} else {

 			// create the response base

 			ResponsePrimitive response = new ResponsePrimitive(request);

 

-			FlexContainerAnnc modifiedAttributes = new FlexContainerAnnc();

+			AbstractFlexContainerAnnc modifiedAttributes = new AbstractFlexContainerAnnc();

 			// check if content is present

 			if (request.getContent() != null) {

 				// create the java object from the resource representation

 				// get the object from the representation

-				FlexContainerAnnc flexContainerAnnc = null;

+				AbstractFlexContainerAnnc flexContainerAnnc = null;

 				try {

 					if (request.getRequestContentType().equals(MimeMediaType.OBJ)) {

-						flexContainerAnnc = (FlexContainerAnnc) request.getContent();

+						flexContainerAnnc = (AbstractFlexContainerAnnc) request.getContent();

 					} else {

-						flexContainerAnnc = (FlexContainerAnnc) DataMapperSelector.getDataMapperList()

+						flexContainerAnnc = (AbstractFlexContainerAnnc) DataMapperSelector.getDataMapperList()

 								.get(request.getRequestContentType()).stringToObj((String) request.getContent());

 					}

 

diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/FlexContainerController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/FlexContainerController.java
index c0592df..2a21a93 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/FlexContainerController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/FlexContainerController.java
@@ -7,14 +7,12 @@
  *******************************************************************************/
 package org.eclipse.om2m.core.controller;
 
-import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.eclipse.om2m.commons.constants.Constants;
 import org.eclipse.om2m.commons.constants.MimeMediaType;
-import org.eclipse.om2m.commons.constants.Operation;
 import org.eclipse.om2m.commons.constants.ResourceStatus;
 import org.eclipse.om2m.commons.constants.ResourceType;
 import org.eclipse.om2m.commons.constants.ResponseStatusCode;
@@ -34,9 +32,10 @@
 import org.eclipse.om2m.commons.exceptions.Om2mException;
 import org.eclipse.om2m.commons.exceptions.ResourceNotFoundException;
 import org.eclipse.om2m.commons.resource.CustomAttribute;
-import org.eclipse.om2m.commons.resource.FlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
 import org.eclipse.om2m.commons.resource.RequestPrimitive;
 import org.eclipse.om2m.commons.resource.ResponsePrimitive;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.FlexContainerFactory;
 import org.eclipse.om2m.commons.utils.Util.DateUtil;
 import org.eclipse.om2m.core.announcer.Announcer;
 import org.eclipse.om2m.core.datamapper.DataMapperSelector;
@@ -151,18 +150,18 @@
 			throw new BadRequestException("A content is requiered for FlexContainer creation");
 		}
 		// get the object from the representation
-		FlexContainer flexContainer = null;
+		AbstractFlexContainer flexContainer = null;
 		try {
 
 			String xmlPayload = null;
 			if (request.getRequestContentType().equals(MimeMediaType.OBJ)) {
-				flexContainer = (FlexContainer) request.getContent();
+				flexContainer = (AbstractFlexContainer) request.getContent();
 
 				// need to create the XML payload in order to validate it
 				xmlPayload = DataMapperSelector.getDataMapperList().get(MimeMediaType.XML).objToString(flexContainer);
 
 			} else {
-				flexContainer = (FlexContainer) DataMapperSelector.getDataMapperList()
+				flexContainer = (AbstractFlexContainer) DataMapperSelector.getDataMapperList()
 						.get(request.getRequestContentType()).stringToObj((String) request.getContent());
 
 				if (request.getRequestContentType().equals(MimeMediaType.XML)) {
@@ -201,6 +200,9 @@
 		// announcedAttribute O
 
 		ControllerUtil.CreateUtil.fillEntityFromAnnounceableResource(flexContainer, flexContainerEntity);
+		
+		flexContainerEntity.setLongName(flexContainer.getLongName());
+		flexContainerEntity.setShortName(flexContainer.getShortName());
 
 		// creator O
 		if (flexContainer.getCreator() != null) {
@@ -220,11 +222,11 @@
 
 		String generatedId = generateId("", "");
 		// set name if present and without any conflict
-		if (request.getName() != null) {
-			if (!Patterns.checkResourceName(request.getName())) {
+		if (flexContainer.getName() != null) {
+			if (!Patterns.checkResourceName(flexContainer.getName())) {
 				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);
 			}
-			flexContainerEntity.setName(request.getName());
+			flexContainerEntity.setName(flexContainer.getName());
 		} else {
 			flexContainerEntity.setName(ShortName.FCNT + "_" + generatedId);
 		}
@@ -267,11 +269,9 @@
 		}
 
 		// custom attributes
-		LOGGER.debug("nb of customAttributes: "
-				+ (flexContainer.getCustomAttributes() != null ? flexContainer.getCustomAttributes().size() : "0"));
 		for (CustomAttribute ca : flexContainer.getCustomAttributes()) {
 
-			flexContainerEntity.createOrUpdateCustomAttribute(ca.getCustomAttributeName(), ca.getCustomAttributeType(),
+			flexContainerEntity.createOrUpdateCustomAttribute(ca.getCustomAttributeName(),
 					ca.getCustomAttributeValue());
 		}
 
@@ -296,7 +296,7 @@
 		transaction.commit();
 
 		if ((flexContainer.getAnnounceTo() != null) && (!flexContainer.getAnnounceTo().isEmpty())) {
-			flexContainer.setName(request.getName());
+			flexContainer.setName(flexContainerFromDB.getName());
 			flexContainer.setResourceID(flexContainerFromDB.getResourceID());
 			flexContainer.setResourceType(ResourceType.FLEXCONTAINER);
 			flexContainer.setParentID(flexContainerFromDB.getParentID());
@@ -342,21 +342,9 @@
 		checkPermissions(request, flexContainerEntity, flexContainerEntity.getAccessControlPolicies());
 
 		// Mapping the entity with the exchange resource
-		FlexContainer flexContainerResource = EntityMapperFactory.getFlexContainerMapper()
+		AbstractFlexContainer flexContainerResource = EntityMapperFactory.getFlexContainerMapper()
 				.mapEntityToResource(flexContainerEntity, request);
 
-		if (!request.getQueryStrings().containsKey("#")) {
-			// ACK
-			// check if a FlexContainer service exist
-			FlexContainerService fcs = FlexContainerSelector
-					.getFlexContainerService(flexContainerResource.getResourceID());
-			if (fcs != null) {
-				// retrieve the last values of custom attribute
-				for (CustomAttribute ca : flexContainerResource.getCustomAttributes()) {
-					ca.setCustomAttributeValue(fcs.getCustomAttributeValue(ca.getCustomAttributeName()));
-				}
-			}
-		}
 
 		response.setContent(flexContainerResource);
 
@@ -412,24 +400,26 @@
 		}
 		// check ACP
 //		checkACP(flexContainerEntity.getAccessControlPolicies(), request.getFrom(), Operation.UPDATE);
-		checkPermissions(request, flexContainerEntity, flexContainerEntity.getAccessControlPolicies());
+		if (!isInternalNotify) {
+			checkPermissions(request, flexContainerEntity, flexContainerEntity.getAccessControlPolicies());
+		}
 
-		FlexContainer modifiedAttributes = new FlexContainer();
+		AbstractFlexContainer modifiedAttributes = /*new FlexContainer()*/ FlexContainerFactory.getSpecializationFlexContainer(flexContainerEntity.getShortName());
 		// check if content is present
 		if (request.getContent() != null) {
 			// create the java object from the resource representation
 			// get the object from the representation
-			FlexContainer flexContainer = null;
+			AbstractFlexContainer flexContainer = null;
 			try {
 				String xmlPayload = null;
 				if (request.getRequestContentType().equals(MimeMediaType.OBJ)) {
-					flexContainer = (FlexContainer) request.getContent();
+					flexContainer = (AbstractFlexContainer) request.getContent();
 					// need to create the XML payload in order to validate it
 					xmlPayload = DataMapperSelector.getDataMapperList().get(MimeMediaType.XML)
 							.objToString(flexContainer);
 
 				} else {
-					flexContainer = (FlexContainer) DataMapperSelector.getDataMapperList()
+					flexContainer = (AbstractFlexContainer) DataMapperSelector.getDataMapperList()
 							.get(request.getRequestContentType()).stringToObj((String) request.getContent());
 
 					if (request.getRequestContentType().equals(MimeMediaType.XML)) {
@@ -524,7 +514,7 @@
 			if (!flexContainer.getCustomAttributes().isEmpty()) {
 				for (CustomAttribute ca : flexContainer.getCustomAttributes()) {
 					flexContainerEntity.createOrUpdateCustomAttribute(ca.getCustomAttributeName(),
-							ca.getCustomAttributeType(), ca.getCustomAttributeValue());
+							ca.getCustomAttributeValue());
 				}
 				modifiedAttributes.setCustomAttributes(flexContainer.getCustomAttributes());
 			}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/GroupController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/GroupController.java
index d20ec6c..6331561 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/GroupController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/GroupController.java
@@ -252,12 +252,6 @@
 				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);
 			}
 			groupEntity.setName(group.getName());
-		} else 
-		if(request.getName() != null){
-			if (!Patterns.checkResourceName(request.getName())){
-				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);
-			}
-			groupEntity.setName(request.getName());
 		} else {
 			groupEntity.setName(ShortName.GROUP + "_" + generatedId);
 		}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/NodeController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/NodeController.java
index 8b21332..142112a 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/NodeController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/NodeController.java
@@ -165,12 +165,6 @@
 				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);
 			}
 			nodeEntity.setName(node.getName());
-		} else 		
-		if(request.getName() != null){
-			if (!Patterns.checkResourceName(request.getName())){
-				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);
-			}
-			nodeEntity.setName(request.getName());
 		} else {
 			nodeEntity.setName(ShortName.NODE + "_" + generatedId);
 		}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/PollingChannelController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/PollingChannelController.java
index f90ec52..0713f80 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/PollingChannelController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/PollingChannelController.java
@@ -153,12 +153,6 @@
 				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);
 			}
 			pollingChannelEntity.setName(pollingChannel.getName());
-		} else 
-		if(request.getName() != null){
-			if(!Patterns.checkResourceName(request.getName())){
-				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);
-			}
-			pollingChannelEntity.setName(request.getName());
 		} else {
 			pollingChannelEntity.setName(ShortName.PCH + "_" + generatedId);
 		}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/RemoteCSEController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/RemoteCSEController.java
index e099e68..3a25c91 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/RemoteCSEController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/RemoteCSEController.java
@@ -250,12 +250,6 @@
 				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);
 			}
 			remoteCseEntity.setName(remoteCse.getName());
-		} else 
-		if (request.getName() != null){
-			if (!Patterns.checkResourceName(request.getName())){
-				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);
-			}
-			remoteCseEntity.setName(request.getName());
 		} else {
 			remoteCseEntity.setName(ShortName.REMOTE_CSE + "_" + generatedId);
 		}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/SubscriptionController.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/SubscriptionController.java
index 13a4ac8..399aae7 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/SubscriptionController.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/controller/SubscriptionController.java
@@ -264,18 +264,14 @@
 		subscriptionEntity.setLastModifiedTime(DateUtil.now());
 		subscriptionEntity.setParentID(parentEntity.getResourceID());
 		subscriptionEntity.setResourceType(ResourceType.SUBSCRIPTION);
+		subscriptionEntity.setNotificationPayloadContentType(request.getReturnContentType());
+		subscriptionEntity.setNbOfFailedNotifications(new Integer(0));
 
 		if (subscription.getName() != null){
 			if (!Patterns.checkResourceName(subscription.getName())){
 				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);
 			}
 			subscriptionEntity.setName(subscription.getName());
-		} else 
-		if(request.getName() != null){
-			if(!Patterns.checkResourceName(request.getName())){
-				throw new BadRequestException("Name provided is incorrect. Must be:" + Patterns.ID_STRING);
-			}
-			subscriptionEntity.setName(request.getName());
 		} else {
 			subscriptionEntity.setName(ShortName.SUB + "_" + generatedId);
 		}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AcpMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AcpMapper.java
index 1bee0f0..b0ec424 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AcpMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AcpMapper.java
@@ -19,6 +19,10 @@
  *******************************************************************************/
 package org.eclipse.om2m.core.entitymapper;
 
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
+
 import org.eclipse.om2m.commons.constants.ResourceType;
 import org.eclipse.om2m.commons.constants.ResultContent;
 import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
@@ -35,9 +39,13 @@
 
 	@Override
 	protected void mapAttributes(AccessControlPolicyEntity entity,
-			AccessControlPolicy resource) {
+			AccessControlPolicy resource, int level, int offset) {
+		if (level < 0) {
+			return;
+		}
+		
 		// announceableSubordinateResource attribute
-		EntityMapperFactory.getAnnounceableSubordinateMapper().mapAttributes(entity, resource);
+		EntityMapperFactory.getAnnounceableSubordinateMapper().mapAttributes(entity, resource, level, offset);
 		
 		resource.setPrivileges(AcpUtils.getSetOfArcsFromACRE(entity
 				.getPrivileges()));
@@ -46,24 +54,45 @@
 	}
 
 	@Override
-	protected void mapChildResourceRef(AccessControlPolicyEntity entity,
-			AccessControlPolicy resource) {
-		// add sub child resource
+	protected List<ChildResourceRef> getChildResourceRef(AccessControlPolicyEntity entity, int level, int offset) {
+		
+		List<ChildResourceRef> childRefs = new ArrayList<>();
+		
+		if (level == 0) {
+			return childRefs;
+		}
+		
 		for(SubscriptionEntity sub : entity.getChildSubscriptions()){
 			ChildResourceRef child = new ChildResourceRef();
 			child.setValue(sub.getResourceID());
 			child.setType(ResourceType.SUBSCRIPTION);
 			child.setResourceName(sub.getName());
-			resource.getChildResource().add(child);
+			childRefs.add(child);
+
+			childRefs.addAll(new SubscriptionMapper().getChildResourceRef(sub, level-1, offset-1));
 		}
+		
+		return childRefs;
+	}
+	
+	@Override
+	protected void mapChildResourceRef(AccessControlPolicyEntity entity,
+			AccessControlPolicy resource, int level, int offset) {
+		resource.getChildResource().addAll(getChildResourceRef(entity, level, offset));
 	}
 
 	@Override
 	protected void mapChildResources(AccessControlPolicyEntity entity,
-			AccessControlPolicy resource) {
+			AccessControlPolicy resource, int level, int offset) {
+		
+		if (level == 0) {
+			// reach limit
+			return;
+		}
+		
 		// add sub child resource
 		for(SubscriptionEntity sub : entity.getChildSubscriptions()){
-			Subscription subRes = new SubscriptionMapper().mapEntityToResource(sub, ResultContent.ATTRIBUTES);
+			Subscription subRes = new SubscriptionMapper().mapEntityToResource(sub, ResultContent.ATTRIBUTES, level-1, offset-1);
 			resource.getSubscription().add(subRes);
 		}
 	}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AeAnncMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AeAnncMapper.java
index 14993f7..67b9f3a 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AeAnncMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AeAnncMapper.java
@@ -1,6 +1,8 @@
 package org.eclipse.om2m.core.entitymapper;

 

 import java.math.BigInteger;

+import java.util.ArrayList;

+import java.util.List;

 

 import org.eclipse.om2m.commons.constants.ResourceType;

 import org.eclipse.om2m.commons.constants.ResultContent;

@@ -14,16 +16,20 @@
 import org.eclipse.om2m.commons.resource.AccessControlPolicy;

 import org.eclipse.om2m.commons.resource.ChildResourceRef;

 import org.eclipse.om2m.commons.resource.Container;

-import org.eclipse.om2m.commons.resource.FlexContainer;

-import org.eclipse.om2m.commons.resource.FlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;

+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;

 import org.eclipse.om2m.commons.resource.Subscription;

 

 public class AeAnncMapper extends EntityMapper<AeAnncEntity, AEAnnc> {

 

 	@Override

-	protected void mapAttributes(AeAnncEntity entity, AEAnnc resource) {

+	protected void mapAttributes(AeAnncEntity entity, AEAnnc resource, int level, int offset) {

+		if (level < 0) {

+			return;

+		}

+		

 		// announcedResource attributes

-		EntityMapperFactory.getAnnouncedResourceMapper().mapAttributes(entity, resource);

+		EntityMapperFactory.getAnnouncedResourceMapper().mapAttributes(entity, resource, level, offset);

 		

 		resource.setAEID(entity.getAeid());

 		resource.setAppID(entity.getAppID());

@@ -37,14 +43,29 @@
 	}

 

 	@Override

-	protected void mapChildResourceRef(AeAnncEntity entity, AEAnnc resource) {

-		// ChildResourceRef FlexContainerAnnc

+	protected void mapChildResourceRef(AeAnncEntity entity, AEAnnc resource, int level, int offset) {

+		resource.getChildResource().addAll(getChildResourceRef(entity, level, offset));

+	}

+	

+	@Override

+	protected List<ChildResourceRef> getChildResourceRef(AeAnncEntity entity, int level, int offset) {

+		

+		

+		List<ChildResourceRef> childRefs = new ArrayList<>();

+		

+		if (level == 0) {

+			return childRefs;

+		}

+		

 		for (FlexContainerAnncEntity flexContainerEntity : entity.getFlexContainerAnncs()) {

 			ChildResourceRef child = new ChildResourceRef();

 			child.setResourceName(flexContainerEntity.getName());

 			child.setType(flexContainerEntity.getResourceType());

 			child.setValue(flexContainerEntity.getResourceID());

-			resource.getChildResource().add(child);

+			child.setSpid(flexContainerEntity.getContainerDefinition());

+			childRefs.add(child);

+			

+			childRefs.addAll(new FlexContainerAnncMapper().getChildResourceRef(flexContainerEntity, level - 1, offset - 1));

 		}

 

 		// ChildResourceRef Subscription

@@ -53,24 +74,30 @@
 			child.setResourceName(sub.getName());

 			child.setType(BigInteger.valueOf(ResourceType.SUBSCRIPTION));

 			child.setValue(sub.getResourceID());

-			resource.getChildResource().add(child);

+			childRefs.add(child);

+			

+			childRefs.addAll(new SubscriptionMapper().getChildResourceRef(sub, level - 1, offset - 1));

 		}

-

-

+		

+		return childRefs;

 	}

 

 	@Override

-	protected void mapChildResources(AeAnncEntity entity, AEAnnc resource) {

+	protected void mapChildResources(AeAnncEntity entity, AEAnnc resource, int level, int offset) {

 

+		if (level == 0) {

+			return;

+		}

+		

 		// ChildResourceRef FlexContainerAnnc

 		for (FlexContainerAnncEntity flexContainerEntity : entity.getFlexContainerAnncs()) {

-			FlexContainerAnnc fcnt = new FlexContainerAnncMapper().mapEntityToResource(flexContainerEntity,

-					ResultContent.ATTRIBUTES);

+			AbstractFlexContainerAnnc fcnt = new FlexContainerAnncMapper().mapEntityToResource(flexContainerEntity,

+					ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);

 			resource.getContainerOrContainerAnncOrGroup().add(fcnt);

 		}

 		// ChildResourceRef Subscription

 		for (SubscriptionEntity sub : entity.getSubscriptions()) {

-			Subscription subRes = new SubscriptionMapper().mapEntityToResource(sub, ResultContent.ATTRIBUTES);

+			Subscription subRes = new SubscriptionMapper().mapEntityToResource(sub, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);

 			resource.getContainerOrContainerAnncOrGroup().add(subRes);

 		}

 	}

diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AeMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AeMapper.java
index bb58f4e..60992bf 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AeMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AeMapper.java
@@ -20,6 +20,8 @@
 package org.eclipse.om2m.core.entitymapper;
 
 import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.eclipse.om2m.commons.constants.ResourceType;
 import org.eclipse.om2m.commons.constants.ResultContent;
@@ -36,7 +38,7 @@
 import org.eclipse.om2m.commons.resource.ChildResourceRef;
 import org.eclipse.om2m.commons.resource.Container;
 import org.eclipse.om2m.commons.resource.DynamicAuthorizationConsultation;
-import org.eclipse.om2m.commons.resource.FlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
 import org.eclipse.om2m.commons.resource.Group;
 import org.eclipse.om2m.commons.resource.PollingChannel;
 import org.eclipse.om2m.commons.resource.Subscription;
@@ -49,9 +51,14 @@
 	}
 
 	@Override
-	protected void mapAttributes(AeEntity entity, AE resource) {
+	protected void mapAttributes(AeEntity entity, AE resource, int level, int offset) {
+		
+		if (level < 0) {
+			return;
+		}
+		
 		// AnnounceableResource attributes
-		EntityMapperFactory.getAnnounceableSubordonateEntity_AnnounceableResourceMapper().mapAttributes(entity, resource);
+		EntityMapperFactory.getAnnounceableSubordonateEntity_AnnounceableResourceMapper().mapAttributes(entity, resource, level, offset);
 		
 		// Ae attributes
 		resource.setAEID(entity.getAeid());
@@ -64,17 +71,24 @@
 		}
 		resource.setRequestReachability(entity.isRequestReachability());
 	}
-
+	
 	@Override
-	protected void mapChildResourceRef(AeEntity entity, AE resource) {
-
+	protected List<ChildResourceRef> getChildResourceRef(AeEntity entity, int level, int offset) {
+		List<ChildResourceRef> childRefs = new ArrayList<>();
+		
+		if (level == 0) {
+			return childRefs;
+		}
+		
 		// ChildResourceRef ACP
 		for (AccessControlPolicyEntity acpEntity : entity.getChildAccessControlPolicies()) {
 			ChildResourceRef child = new ChildResourceRef();
 			child.setResourceName(acpEntity.getName());
 			child.setType(BigInteger.valueOf(ResourceType.ACCESS_CONTROL_POLICY));
 			child.setValue(acpEntity.getResourceID());
-			resource.getChildResource().add(child);
+			childRefs.add(child);
+			
+			childRefs.addAll(new AcpMapper().getChildResourceRef(acpEntity, level - 1, offset - 1));
 		}
 		// ChildResourceRef Container
 		for (ContainerEntity containerEntity : entity.getChildContainers()) {
@@ -82,7 +96,9 @@
 			child.setResourceName(containerEntity.getName());
 			child.setType(BigInteger.valueOf(ResourceType.CONTAINER));
 			child.setValue(containerEntity.getResourceID());
-			resource.getChildResource().add(child);
+			childRefs.add(child);
+			
+			childRefs.addAll(new ContainerMapper().getChildResourceRef(containerEntity, level - 1, offset - 1));
 		}
 		// ChildResourceRef FlexContainer
 		for (FlexContainerEntity flexContainerEntity : entity.getChildFlexContainers()) {
@@ -90,7 +106,10 @@
 			child.setResourceName(flexContainerEntity.getName());
 			child.setType(flexContainerEntity.getResourceType());
 			child.setValue(flexContainerEntity.getResourceID());
-			resource.getChildResource().add(child);
+			child.setSpid(flexContainerEntity.getContainerDefinition());
+			childRefs.add(child);
+			
+			childRefs.addAll(new FlexContainerMapper().getChildResourceRef(flexContainerEntity, level - 1, offset - 1));
 		}
 		// ChildResourceRef Subscription
 		for (SubscriptionEntity sub : entity.getSubscriptions()) {
@@ -98,7 +117,9 @@
 			child.setResourceName(sub.getName());
 			child.setType(BigInteger.valueOf(ResourceType.SUBSCRIPTION));
 			child.setValue(sub.getResourceID());
-			resource.getChildResource().add(child);
+			childRefs.add(child);
+			
+			childRefs.addAll(new SubscriptionMapper().getChildResourceRef(sub, level - 1, offset - 1));
 		}
 		// ChildResourceRef Group
 		for (GroupEntity group : entity.getChildGroups()) {
@@ -106,7 +127,9 @@
 			child.setResourceName(group.getName());
 			child.setType(BigInteger.valueOf(ResourceType.GROUP));
 			child.setValue(group.getResourceID());
-			resource.getChildResource().add(child);
+			childRefs.add(child);
+			
+			childRefs.addAll(new GroupMapper().getChildResourceRef(group, level - 1, offset - 1));
 		}
 		// ChildResourceRef PollingChannel
 		for (PollingChannelEntity pollEntity : entity.getPollingChannels()) {
@@ -114,7 +137,9 @@
 			child.setResourceName(pollEntity.getName());
 			child.setValue(pollEntity.getResourceID());
 			child.setType(ResourceType.POLLING_CHANNEL);
-			resource.getChildResource().add(child);
+			childRefs.add(child);
+			
+			childRefs.addAll(new PollingChannelMapper().getChildResourceRef(pollEntity, level - 1, offset - 1));
 		}
 
 		// adding DynamicAuthorizationConsultation refs
@@ -123,48 +148,62 @@
 			ch.setResourceName(dace.getName());
 			ch.setType(ResourceType.DYNAMIC_AUTHORIZATION_CONSULTATION);
 			ch.setValue(dace.getResourceID());
-			resource.getChildResource().add(ch);
+			childRefs.add(ch);
+			
+			childRefs.addAll(new DynamicAuthorizationConsultationMapper().getChildResourceRef(dace, level - 1, offset - 1));
 		}
+		
+		return childRefs;
 	}
 
 	@Override
-	protected void mapChildResources(AeEntity entity, AE resource) {
+	protected void mapChildResourceRef(AeEntity entity, AE resource, int level, int offset) {
+		resource.getChildResource().addAll(getChildResourceRef(entity, level, offset));
+		
+	}
+
+	@Override
+	protected void mapChildResources(AeEntity entity, AE resource, int level, int offset) {
+		if (level == 0) {
+			return;
+		}
+		
 		// ChildResourceRef ACP
 		for (AccessControlPolicyEntity acpEntity : entity.getChildAccessControlPolicies()) {
-			AccessControlPolicy acpRes = new AcpMapper().mapEntityToResource(acpEntity, ResultContent.ATTRIBUTES);
+			AccessControlPolicy acpRes = new AcpMapper().mapEntityToResource(acpEntity, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			resource.getContainerOrGroupOrAccessControlPolicy().add(acpRes);
 		}
 		// ChildResourceRef Container
 		for (ContainerEntity containerEntity : entity.getChildContainers()) {
-			Container cnt = new ContainerMapper().mapEntityToResource(containerEntity, ResultContent.ATTRIBUTES);
+			Container cnt = new ContainerMapper().mapEntityToResource(containerEntity, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			resource.getContainerOrGroupOrAccessControlPolicy().add(cnt);
 		}
 		// ChildResourceRef FlexContainer
 		for (FlexContainerEntity flexContainerEntity : entity.getChildFlexContainers()) {
-			FlexContainer fcnt = new FlexContainerMapper().mapEntityToResource(flexContainerEntity,
-					ResultContent.ATTRIBUTES);
+			AbstractFlexContainer fcnt = new FlexContainerMapper().mapEntityToResource(flexContainerEntity,
+					ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			resource.getContainerOrGroupOrAccessControlPolicy().add(fcnt);
 		}
 		// ChildResourceRef Subscription
 		for (SubscriptionEntity sub : entity.getSubscriptions()) {
-			Subscription subRes = new SubscriptionMapper().mapEntityToResource(sub, ResultContent.ATTRIBUTES);
+			Subscription subRes = new SubscriptionMapper().mapEntityToResource(sub, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			resource.getContainerOrGroupOrAccessControlPolicy().add(subRes);
 		}
 		// ChildResourceRef Group
 		for (GroupEntity group : entity.getChildGroups()) {
-			Group grp = new GroupMapper().mapEntityToResource(group, ResultContent.ATTRIBUTES);
+			Group grp = new GroupMapper().mapEntityToResource(group, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			resource.getContainerOrGroupOrAccessControlPolicy().add(grp);
 		}
 		// ChildResourceRef PollingChannel
 		for (PollingChannelEntity pollEntity : entity.getPollingChannels()) {
-			PollingChannel poll = new PollingChannelMapper().mapEntityToResource(pollEntity, ResultContent.ATTRIBUTES);
+			PollingChannel poll = new PollingChannelMapper().mapEntityToResource(pollEntity, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			resource.getContainerOrGroupOrAccessControlPolicy().add(poll);
 		}
 
 		// adding DynamicAuthorizationConsultation resource
 		for (DynamicAuthorizationConsultationEntity daceEntity : entity.getChildDynamicAuthorizationConsultations()) {
 			DynamicAuthorizationConsultation dace = new DynamicAuthorizationConsultationMapper()
-					.mapEntityToResource(daceEntity, ResultContent.ATTRIBUTES);
+					.mapEntityToResource(daceEntity, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			resource.getContainerOrGroupOrAccessControlPolicy().add(dace);
 		}
 	}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AnnounceableSubordinateMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AnnounceableSubordinateMapper.java
index d5efb7b..7298568 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AnnounceableSubordinateMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AnnounceableSubordinateMapper.java
@@ -3,8 +3,12 @@
  */

 package org.eclipse.om2m.core.entitymapper;

 

+import java.util.ArrayList;

+import java.util.List;

+

 import org.eclipse.om2m.commons.entities.AnnounceableSubordinateEntity;

 import org.eclipse.om2m.commons.resource.AnnounceableSubordinateResource;

+import org.eclipse.om2m.commons.resource.ChildResourceRef;

 

 /**

  * @author MPCY8647

@@ -13,7 +17,11 @@
 public class AnnounceableSubordinateMapper extends EntityMapper<AnnounceableSubordinateEntity, AnnounceableSubordinateResource> {

 

 	@Override

-	protected void mapAttributes(AnnounceableSubordinateEntity entity, AnnounceableSubordinateResource resource) {

+	protected void mapAttributes(AnnounceableSubordinateEntity entity, AnnounceableSubordinateResource resource, int level, int offset) {

+		if (level < 0) {

+			return;

+		}

+		

 		// announceTo

 		resource.getAnnounceTo().addAll(entity.getAnnounceTo());

 		

@@ -25,12 +33,17 @@
 	}

 

 	@Override

-	protected void mapChildResourceRef(AnnounceableSubordinateEntity entity, AnnounceableSubordinateResource resource) {

+	protected List<ChildResourceRef> getChildResourceRef(AnnounceableSubordinateEntity entity, int level, int offset) {

+		return new ArrayList<ChildResourceRef>();

+	}

+	

+	@Override

+	protected void mapChildResourceRef(AnnounceableSubordinateEntity entity, AnnounceableSubordinateResource resource, int level, int offset) {

 		

 	}

 

 	@Override

-	protected void mapChildResources(AnnounceableSubordinateEntity entity, AnnounceableSubordinateResource resource) {

+	protected void mapChildResources(AnnounceableSubordinateEntity entity, AnnounceableSubordinateResource resource, int level, int offset) {

 		

 	}

 

diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AnnounceableSubordonateEntity_AnnounceableResourceMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AnnounceableSubordonateEntity_AnnounceableResourceMapper.java
index 62d2f2c..898aa5b 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AnnounceableSubordonateEntity_AnnounceableResourceMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AnnounceableSubordonateEntity_AnnounceableResourceMapper.java
@@ -3,12 +3,14 @@
  */

 package org.eclipse.om2m.core.entitymapper;

 

+import java.util.ArrayList;

 import java.util.List;

 

 import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;

 import org.eclipse.om2m.commons.entities.AnnounceableSubordinateEntity;

 import org.eclipse.om2m.commons.entities.DynamicAuthorizationConsultationEntity;

 import org.eclipse.om2m.commons.resource.AnnounceableResource;

+import org.eclipse.om2m.commons.resource.ChildResourceRef;

 

 /**

  * @author MPCY8647

@@ -18,7 +20,11 @@
 		extends EntityMapper<AnnounceableSubordinateEntity, AnnounceableResource> {

 

 	@Override

-	protected void mapAttributes(AnnounceableSubordinateEntity entity, AnnounceableResource resource) {

+	protected void mapAttributes(AnnounceableSubordinateEntity entity, AnnounceableResource resource, int level, int offset) {

+		if (level < 0) {

+			return;

+		}

+		

 		// expiration time

 		resource.setExpirationTime(entity.getExpirationTime());

 

@@ -39,13 +45,18 @@
 		// announcedAttribute

 		resource.getAnnouncedAttribute().addAll(entity.getAnnouncedAttribute());

 	}

-

+	

 	@Override

-	protected void mapChildResourceRef(AnnounceableSubordinateEntity entity, AnnounceableResource resource) {

+	protected List<ChildResourceRef> getChildResourceRef(AnnounceableSubordinateEntity entity, int level, int offset) {

+		return new ArrayList<>();

 	}

 

 	@Override

-	protected void mapChildResources(AnnounceableSubordinateEntity entity, AnnounceableResource resource) {

+	protected void mapChildResourceRef(AnnounceableSubordinateEntity entity, AnnounceableResource resource, int level, int offset) {

+	}

+

+	@Override

+	protected void mapChildResources(AnnounceableSubordinateEntity entity, AnnounceableResource resource, int level, int offset) {

 	}

 

 	@Override

diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AnnouncedResourceMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AnnouncedResourceMapper.java
index f4f3166..4c29970 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AnnouncedResourceMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AnnouncedResourceMapper.java
@@ -3,12 +3,14 @@
  */

 package org.eclipse.om2m.core.entitymapper;

 

+import java.util.ArrayList;

 import java.util.List;

 

 import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;

 import org.eclipse.om2m.commons.entities.AnnouncedResourceEntity;

 import org.eclipse.om2m.commons.entities.DynamicAuthorizationConsultationEntity;

 import org.eclipse.om2m.commons.resource.AnnouncedResource;

+import org.eclipse.om2m.commons.resource.ChildResourceRef;

 

 /**

  * @author MPCY8647

@@ -17,7 +19,11 @@
 public class AnnouncedResourceMapper extends EntityMapper<AnnouncedResourceEntity, AnnouncedResource> {

 

 	@Override

-	protected void mapAttributes(AnnouncedResourceEntity entity, AnnouncedResource resource) {

+	protected void mapAttributes(AnnouncedResourceEntity entity, AnnouncedResource resource, int level, int offset) {

+		if (level < 0) {

+			return;

+		}

+		

 		// expiration time

 		resource.setExpirationTime(entity.getExpirationTime());

 		

@@ -36,13 +42,18 @@
 		}

 		

 	}

-

+	

 	@Override

-	protected void mapChildResourceRef(AnnouncedResourceEntity entity, AnnouncedResource resource) {

+	protected List<ChildResourceRef> getChildResourceRef(AnnouncedResourceEntity entity, int level, int offset) {

+		return new ArrayList<>();

 	}

 

 	@Override

-	protected void mapChildResources(AnnouncedResourceEntity entity, AnnouncedResource resource) {

+	protected void mapChildResourceRef(AnnouncedResourceEntity entity, AnnouncedResource resource, int level, int offset) {

+	}

+

+	@Override

+	protected void mapChildResources(AnnouncedResourceEntity entity, AnnouncedResource resource, int level, int offset) {

 	}

 

 	@Override

diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AreaNwkDeviceInfoMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AreaNwkDeviceInfoMapper.java
index b3941b3..465eaac 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AreaNwkDeviceInfoMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AreaNwkDeviceInfoMapper.java
@@ -19,8 +19,12 @@
  *******************************************************************************/
 package org.eclipse.om2m.core.entitymapper;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.eclipse.om2m.commons.entities.AreaNwkDeviceInfoEntity;
 import org.eclipse.om2m.commons.resource.AreaNwkDeviceInfo;
+import org.eclipse.om2m.commons.resource.ChildResourceRef;
 
 /**
  * Mapper for AreaNwkDeviceInfo
@@ -30,9 +34,13 @@
 
 	@Override
 	protected void mapAttributes(AreaNwkDeviceInfoEntity entity,
-			AreaNwkDeviceInfo resource) {
+			AreaNwkDeviceInfo resource, int level, int offset) {
+		if (level < 0) {
+			return;
+		}
+		
 		// Announceable resource attributes
-		EntityMapperFactory.getAnnounceableSubordonateEntity_AnnounceableResourceMapper().mapAttributes(entity, resource);
+		EntityMapperFactory.getAnnounceableSubordonateEntity_AnnounceableResourceMapper().mapAttributes(entity, resource, level, offset);
 		
 		// AreaNwkDeviceInfo attributes
 		resource.setAreaNwkId(entity.getAreaNwkId());
@@ -44,17 +52,22 @@
 		resource.setSleepInterval(entity.getSleepInterval());
 		resource.setStatus(entity.getStatus());
 	}
+	
+	@Override
+	protected List<ChildResourceRef> getChildResourceRef(AreaNwkDeviceInfoEntity entity, int level, int offset) {
+		return new ArrayList<>();
+	}
 
 	@Override
 	protected void mapChildResourceRef(AreaNwkDeviceInfoEntity entity,
-			AreaNwkDeviceInfo resource) {
+			AreaNwkDeviceInfo resource, int level, int offset) {
 		// TODO Auto-generated method stub
 
 	}
 
 	@Override
 	protected void mapChildResources(AreaNwkDeviceInfoEntity entity,
-			AreaNwkDeviceInfo resource) {
+			AreaNwkDeviceInfo resource, int level, int offset) {
 		// TODO Auto-generated method stub
 
 	}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AreaNwkInfoMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AreaNwkInfoMapper.java
index 97212cb..53dd9b7 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AreaNwkInfoMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/AreaNwkInfoMapper.java
@@ -19,16 +19,24 @@
  *******************************************************************************/
 package org.eclipse.om2m.core.entitymapper;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.eclipse.om2m.commons.entities.AreaNwkInfoEntity;
 import org.eclipse.om2m.commons.resource.AreaNwkInfo;
+import org.eclipse.om2m.commons.resource.ChildResourceRef;
 
 public class AreaNwkInfoMapper extends EntityMapper<AreaNwkInfoEntity, AreaNwkInfo> {
 
 	@Override
-	protected void mapAttributes(AreaNwkInfoEntity entity, AreaNwkInfo resource) {
+	protected void mapAttributes(AreaNwkInfoEntity entity, AreaNwkInfo resource, int level, int offset) {
+		if (level < 0) {
+			return;
+		}
+		
 		// Announceable resource attributes
 		EntityMapperFactory.getAnnounceableSubordonateEntity_AnnounceableResourceMapper().mapAttributes(entity,
-				resource);
+				resource, level, offset);
 
 		resource.setAreaNwkType(entity.getAreaNwkType());
 		resource.setCreationTime(entity.getCreationTime());
@@ -44,16 +52,19 @@
 			resource.getListOfDevices().addAll(entity.getListOfDevices());
 		}
 	}
+	
+	@Override
+	protected List<ChildResourceRef> getChildResourceRef(AreaNwkInfoEntity entity, int level, int offset) {
+		return new ArrayList<>();
+	}
 
 	@Override
-	protected void mapChildResourceRef(AreaNwkInfoEntity entity, AreaNwkInfo resource) {
-		// TODO Auto-generated method stub
+	protected void mapChildResourceRef(AreaNwkInfoEntity entity, AreaNwkInfo resource, int level, int offset) {
 
 	}
 
 	@Override
-	protected void mapChildResources(AreaNwkInfoEntity entity, AreaNwkInfo resource) {
-		// TODO Auto-generated method stub
+	protected void mapChildResources(AreaNwkInfoEntity entity, AreaNwkInfo resource, int level, int offset) {
 
 	}
 
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/ContainerMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/ContainerMapper.java
index 2c30bed..824bf19 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/ContainerMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/ContainerMapper.java
@@ -20,6 +20,8 @@
 package org.eclipse.om2m.core.entitymapper;
 
 import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.eclipse.om2m.commons.constants.ResourceType;
 import org.eclipse.om2m.commons.constants.ResultContent;
@@ -32,7 +34,7 @@
 import org.eclipse.om2m.commons.resource.ChildResourceRef;
 import org.eclipse.om2m.commons.resource.Container;
 import org.eclipse.om2m.commons.resource.ContentInstance;
-import org.eclipse.om2m.commons.resource.FlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
 import org.eclipse.om2m.commons.resource.Subscription;
 
 public class ContainerMapper extends EntityMapper<ContainerEntity, Container>{
@@ -43,9 +45,13 @@
 	}
 
 	@Override
-	protected void mapAttributes(ContainerEntity entity, Container resource) {
+	protected void mapAttributes(ContainerEntity entity, Container resource, int level, int offset) {
+		if (level < 0) {
+			return;
+		}
+		
 		// announceable resource mapper
-		EntityMapperFactory.getAnnounceableSubordonateEntity_AnnounceableResourceMapper().mapAttributes(entity, resource);
+		EntityMapperFactory.getAnnounceableSubordonateEntity_AnnounceableResourceMapper().mapAttributes(entity, resource, level, offset);
 		
 		// Container attributes
 		resource.setCreator(entity.getCreator());
@@ -60,18 +66,24 @@
 		resource.setOldest(entity.getHierarchicalURI() + "/" + ShortName.OLDEST);
 		resource.setLatest(entity.getHierarchicalURI() + "/" + ShortName.LATEST);
 	}
-
+	
 	@Override
-	protected void mapChildResourceRef(ContainerEntity entity,
-			Container resource) {
-
+	protected List<ChildResourceRef> getChildResourceRef(ContainerEntity entity, int level, int offset) {
+		List<ChildResourceRef> childRefs = new ArrayList<>();
+		
+		if (level == 0) {
+			return childRefs;
+		}
+		
 		// add child ref contentInstance
 		for (ContentInstanceEntity cin : entity.getChildContentInstances()) {
 			ChildResourceRef child = new ChildResourceRef();
 			child.setResourceName(cin.getName());
 			child.setType(ResourceType.CONTENT_INSTANCE);
 			child.setValue(cin.getResourceID());
-			resource.getChildResource().add(child);	
+			childRefs.add(child);
+			
+			childRefs.addAll(new ContentInstanceMapper().getChildResourceRef(cin, level - 1, offset - 1));
 		}
 
 		// add child ref subscription
@@ -80,7 +92,9 @@
 			child.setResourceName(sub.getName());
 			child.setType(ResourceType.SUBSCRIPTION);
 			child.setValue(sub.getResourceID());
-			resource.getChildResource().add(child);
+			childRefs.add(child);
+			
+			childRefs.addAll(new SubscriptionMapper().getChildResourceRef(sub, level - 1, offset - 1));
 		}
 		
 		
@@ -90,7 +104,9 @@
 			child.setResourceName(childCont.getName());
 			child.setType(ResourceType.CONTAINER);
 			child.setValue(childCont.getResourceID());
-			resource.getChildResource().add(child);
+			childRefs.add(child);
+			
+			childRefs.addAll(new ContainerMapper().getChildResourceRef(childCont, level - 1, offset - 1));
 		}
 		
 		// add child ref FlexContainers
@@ -99,35 +115,44 @@
 			child.setResourceName(childFlexCont.getName());
 			child.setType(ResourceType.FLEXCONTAINER);
 			child.setValue(childFlexCont.getResourceID());
-			resource.getChildResource().add(child);
+			childRefs.add(child);
+			
+			childRefs.addAll(new FlexContainerMapper().getChildResourceRef(childFlexCont, level - 1, offset - 1));
 		}
 		
+		return childRefs;
 	}
 
 	@Override
-	protected void mapChildResources(ContainerEntity entity, Container resource) {
+	protected void mapChildResourceRef(ContainerEntity entity,
+			Container resource, int level, int offset) {
+		resource.getChildResource().addAll(getChildResourceRef(entity, level, offset));
+	}
+
+	@Override
+	protected void mapChildResources(ContainerEntity entity, Container resource, int level, int offset) {
 		// add child ref contentInstance
 		for (ContentInstanceEntity cin : entity.getChildContentInstances()) {
-			ContentInstance cinRes = new ContentInstanceMapper().mapEntityToResource(cin, ResultContent.ATTRIBUTES);
+			ContentInstance cinRes = new ContentInstanceMapper().mapEntityToResource(cin, ResultContent.ATTRIBUTES, level - 1, offset - 1);
 			resource.getContentInstanceOrContainerOrSubscription().add(cinRes);
 		}
 
 		// add child ref subscription
 		for (SubscriptionEntity sub : entity.getSubscriptions()){
-			Subscription subRes = new SubscriptionMapper().mapEntityToResource(sub, ResultContent.ATTRIBUTES);
+			Subscription subRes = new SubscriptionMapper().mapEntityToResource(sub, ResultContent.ATTRIBUTES, level - 1, offset - 1);
 			resource.getContentInstanceOrContainerOrSubscription().add(subRes);
 		}
 		
 		
 		// add child ref with containers
 		for (ContainerEntity childCont : entity.getChildContainers()) {
-			Container cnt = new ContainerMapper().mapEntityToResource(childCont, ResultContent.ATTRIBUTES);
+			Container cnt = new ContainerMapper().mapEntityToResource(childCont, ResultContent.ATTRIBUTES, level - 1, offset - 1);
 			resource.getContentInstanceOrContainerOrSubscription().add(cnt);
 		}
 		
 		// add child ref flexContainers
 		for(FlexContainerEntity childFlexCont : entity.getChildFlexContainers()) {
-			FlexContainer fcnt = new FlexContainerMapper().mapEntityToResource(childFlexCont, ResultContent.ATTRIBUTES);
+			AbstractFlexContainer fcnt = new FlexContainerMapper().mapEntityToResource(childFlexCont, ResultContent.ATTRIBUTES, level - 1, offset - 1);
 			resource.getContentInstanceOrContainerOrSubscription().add(fcnt);
 		}
 	}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/ContentInstanceMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/ContentInstanceMapper.java
index b8af6b9..94f16a5 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/ContentInstanceMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/ContentInstanceMapper.java
@@ -20,8 +20,11 @@
 package org.eclipse.om2m.core.entitymapper;
 
 import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.eclipse.om2m.commons.entities.ContentInstanceEntity;
+import org.eclipse.om2m.commons.resource.ChildResourceRef;
 import org.eclipse.om2m.commons.resource.ContentInstance;
 
 public class ContentInstanceMapper extends
@@ -34,9 +37,13 @@
 
 	@Override
 	protected void mapAttributes(ContentInstanceEntity entity,
-			ContentInstance resource) {
+			ContentInstance resource, int level, int offset) {
+		if (level < 0) {
+			return;
+		}
+		
 		// announceableSubordonate attribute
-		EntityMapperFactory.getAnnounceableSubordinateMapper().mapAttributes(entity, resource);
+		EntityMapperFactory.getAnnounceableSubordinateMapper().mapAttributes(entity, resource, level, offset);
 		
 		// ContentInstance attributes
 		resource.setContent(entity.getContent());
@@ -46,15 +53,20 @@
 		resource.setOntologyRef(entity.getOntologyRef());
 		resource.setStateTag(entity.getStateTag());
 	}
+	
+	@Override
+	protected List<ChildResourceRef> getChildResourceRef(ContentInstanceEntity entity, int level, int offset) {
+		return new ArrayList<>();
+	}
 
 	@Override
 	protected void mapChildResourceRef(ContentInstanceEntity entity,
-			ContentInstance resource) {
+			ContentInstance resource, int level, int offset) {
 	}
 
 	@Override
 	protected void mapChildResources(ContentInstanceEntity entity,
-			ContentInstance resource) {
+			ContentInstance resource, int level, int offset) {
 	}
 
 }
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/CseBaseMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/CseBaseMapper.java
index 57122cd..9e5933b 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/CseBaseMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/CseBaseMapper.java
@@ -20,6 +20,7 @@
 package org.eclipse.om2m.core.entitymapper;
 
 import java.math.BigInteger;
+import java.util.ArrayList;
 import java.util.List;
 
 import org.eclipse.om2m.commons.constants.ResourceType;
@@ -42,7 +43,7 @@
 import org.eclipse.om2m.commons.resource.ChildResourceRef;
 import org.eclipse.om2m.commons.resource.Container;
 import org.eclipse.om2m.commons.resource.DynamicAuthorizationConsultation;
-import org.eclipse.om2m.commons.resource.FlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
 import org.eclipse.om2m.commons.resource.Group;
 import org.eclipse.om2m.commons.resource.RemoteCSE;
 import org.eclipse.om2m.commons.resource.Request;
@@ -56,7 +57,11 @@
 	}
 
 	@Override
-	protected void mapAttributes(CSEBaseEntity cseBaseEntity, CSEBase cseBaseResource) {
+	protected void mapAttributes(CSEBaseEntity cseBaseEntity, CSEBase cseBaseResource, int level, int offset) {
+		if (level < 0) {
+			return;
+		}
+		
 		cseBaseResource.setNodeLink(cseBaseEntity.getNodeLink());
 		cseBaseResource.setCSEID(cseBaseEntity.getCseid());
 		cseBaseResource.setCseType(cseBaseEntity.getCseType());
@@ -86,17 +91,22 @@
 			cseBaseResource.getPointOfAccess().addAll(cseBaseEntity.getPointOfAccess());
 		}
 	}
-
+	
 	@Override
-	protected void mapChildResourceRef(CSEBaseEntity cseBaseEntity, CSEBase cseBaseResource) {
-		// setting child resources refs
-		// setting acps refs
+	protected List<ChildResourceRef> getChildResourceRef(CSEBaseEntity cseBaseEntity, int level, int offset) {
+		List<ChildResourceRef> childRefs = new ArrayList<>();
+		if (level == 0) {
+			return childRefs;
+		}
+		
 		for (AccessControlPolicyEntity acp : cseBaseEntity.getChildAccessControlPolicies()) {
 			ChildResourceRef child = new ChildResourceRef();
 			child.setResourceName(acp.getName());
 			child.setType(ResourceType.ACCESS_CONTROL_POLICY);
 			child.setValue(acp.getResourceID());
-			cseBaseResource.getChildResource().add(child);
+			childRefs.add(child);
+			
+			childRefs.addAll(new AcpMapper().getChildResourceRef(acp, level - 1, offset - 1));
 		}
 		// adding aes refs
 		for (AeEntity ae : cseBaseEntity.getAes()) {
@@ -104,7 +114,9 @@
 			child.setResourceName(ae.getName());
 			child.setType(ResourceType.AE);
 			child.setValue(ae.getResourceID());
-			cseBaseResource.getChildResource().add(child);
+			childRefs.add(child);
+			
+			childRefs.addAll(new AeMapper().getChildResourceRef(ae, level - 1, offset - 1));
 		}
 		// adding container refs
 		for (ContainerEntity cnt : cseBaseEntity.getChildContainers()) {
@@ -112,7 +124,9 @@
 			child.setResourceName(cnt.getName());
 			child.setType(ResourceType.CONTAINER);
 			child.setValue(cnt.getResourceID());
-			cseBaseResource.getChildResource().add(child);
+			childRefs.add(child);
+			
+			childRefs.addAll(new ContainerMapper().getChildResourceRef(cnt, level - 1, offset - 1));
 		}
 		// adding flexcontainer refs
 		for (FlexContainerEntity fcnt : cseBaseEntity.getChildFlexContainers()) {
@@ -120,7 +134,9 @@
 			child.setResourceName(fcnt.getName());
 			child.setType(ResourceType.FLEXCONTAINER);
 			child.setValue(fcnt.getResourceID());
-			cseBaseResource.getChildResource().add(child);
+			childRefs.add(child);
+			
+			childRefs.addAll(new FlexContainerMapper().getChildResourceRef(fcnt, level - 1, offset - 1));
 		}
 
 		// adding remoteCSE refs
@@ -129,7 +145,9 @@
 			child.setResourceName(csr.getName());
 			child.setType(ResourceType.REMOTE_CSE);
 			child.setValue(csr.getResourceID());
-			cseBaseResource.getChildResource().add(child);
+			childRefs.add(child);
+			
+			childRefs.addAll(new RemoteCSEMapper().getChildResourceRef(csr, level - 1, offset - 1));
 		}
 		// adding group refs
 		for (GroupEntity group : cseBaseEntity.getGroups()) {
@@ -137,7 +155,9 @@
 			child.setResourceName(group.getName());
 			child.setType(ResourceType.GROUP);
 			child.setValue(group.getResourceID());
-			cseBaseResource.getChildResource().add(child);
+			childRefs.add(child);
+			
+			childRefs.addAll(new GroupMapper().getChildResourceRef(group, level - 1, offset - 1));
 		}
 		// adding subscription refs
 		for (SubscriptionEntity sub : cseBaseEntity.getSubscriptions()) {
@@ -145,7 +165,9 @@
 			child.setResourceName(sub.getName());
 			child.setType(ResourceType.SUBSCRIPTION);
 			child.setValue(sub.getResourceID());
-			cseBaseResource.getChildResource().add(child);
+			childRefs.add(child);
+			
+			childRefs.addAll(new SubscriptionMapper().getChildResourceRef(sub, level - 1, offset - 1));
 		}
 		// adding request refs
 		for (RequestEntity req : cseBaseEntity.getChildReq()) {
@@ -153,7 +175,9 @@
 			child.setResourceName(req.getName());
 			child.setType(ResourceType.REQUEST);
 			child.setValue(req.getResourceID());
-			cseBaseResource.getChildResource().add(child);
+			childRefs.add(child);
+			
+			childRefs.addAll(new RequestMapper().getChildResourceRef(req, level - 1, offset - 1));
 		}
 		// adding node refs
 		for (NodeEntity nod : cseBaseEntity.getChildNodes()) {
@@ -161,7 +185,9 @@
 			ch.setResourceName(nod.getName());
 			ch.setType(ResourceType.NODE);
 			ch.setValue(nod.getResourceID());
-			cseBaseResource.getChildResource().add(ch);
+			childRefs.add(ch);
+			
+			childRefs.addAll(new NodeMapper().getChildResourceRef(nod, level - 1, offset - 1));
 		}
 
 		// adding DynamicAuthorizationConsultation refs
@@ -170,56 +196,70 @@
 			ch.setResourceName(dace.getName());
 			ch.setType(ResourceType.DYNAMIC_AUTHORIZATION_CONSULTATION);
 			ch.setValue(dace.getResourceID());
-			cseBaseResource.getChildResource().add(ch);
+			childRefs.add(ch);
+			
+			childRefs.addAll(new DynamicAuthorizationConsultationMapper().getChildResourceRef(dace, level - 1, offset - 1));
 		}
+		
+		return childRefs;
 	}
 
 	@Override
-	protected void mapChildResources(CSEBaseEntity entity, CSEBase resource) {
+	protected void mapChildResourceRef(CSEBaseEntity cseBaseEntity, CSEBase cseBaseResource, int level, int offset) {
+		// setting child resources refs
+		cseBaseResource.getChildResource().addAll(getChildResourceRef(cseBaseEntity, level, offset));
+	}
+
+	@Override
+	protected void mapChildResources(CSEBaseEntity entity, CSEBase resource, int level, int offset) {
+		if (level == 0) {
+			return;
+		}
+		
 		for (AccessControlPolicyEntity acp : entity.getChildAccessControlPolicies()) {
-			AccessControlPolicy acpRes = new AcpMapper().mapEntityToResource(acp, ResultContent.ATTRIBUTES);
+			AccessControlPolicy acpRes = new AcpMapper().mapEntityToResource(acp, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			resource.getRemoteCSEOrNodeOrAE().add(acpRes);
 		}
 		// adding aes refs
 		for (AeEntity ae : entity.getAes()) {
-			AE aeRes = new AeMapper().mapEntityToResource(ae, ResultContent.ATTRIBUTES);
+			AE aeRes = new AeMapper().mapEntityToResource(ae, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			resource.getRemoteCSEOrNodeOrAE().add(aeRes);
 		}
 		// adding container refs
 		for (ContainerEntity cnt : entity.getChildContainers()) {
-			Container cntRes = new ContainerMapper().mapEntityToResource(cnt, ResultContent.ATTRIBUTES);
+			Container cntRes = new ContainerMapper().mapEntityToResource(cnt, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			resource.getRemoteCSEOrNodeOrAE().add(cntRes);
 		}
 		// adding flexcontainer refs
 		for (FlexContainerEntity fcnt : entity.getChildFlexContainers()) {
-			FlexContainer fcntRes = new FlexContainerMapper().mapEntityToResource(fcnt, ResultContent.ATTRIBUTES);
+			AbstractFlexContainer fcntRes = new FlexContainerMapper().mapEntityToResource(fcnt, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			resource.getRemoteCSEOrNodeOrAE().add(fcntRes);
 		}
 		// adding remoteCSE refs
 		for (RemoteCSEEntity csr : entity.getRemoteCses()) {
-			RemoteCSE csrRes = new RemoteCSEMapper().mapEntityToResource(csr, ResultContent.ATTRIBUTES);
+			RemoteCSE csrRes = new RemoteCSEMapper().mapEntityToResource(csr, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			resource.getRemoteCSEOrNodeOrAE().add(csrRes);
 		}
 		// adding group refs
 		for (GroupEntity group : entity.getGroups()) {
-			Group grp = new GroupMapper().mapEntityToResource(group, ResultContent.ATTRIBUTES);
+			Group grp = new GroupMapper().mapEntityToResource(group, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			resource.getRemoteCSEOrNodeOrAE().add(grp);
 		}
 		// adding subscription refs
 		for (SubscriptionEntity sub : entity.getSubscriptions()) {
-			Subscription subRes = new SubscriptionMapper().mapEntityToResource(sub, ResultContent.ATTRIBUTES);
+			Subscription subRes = new SubscriptionMapper().mapEntityToResource(sub, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			resource.getRemoteCSEOrNodeOrAE().add(subRes);
 		}
 		// adding request refs
 		for (RequestEntity req : entity.getChildReq()) {
-			Request reqResource = new RequestMapper().mapEntityToResource(req, ResultContent.ATTRIBUTES);
+			Request reqResource = new RequestMapper().mapEntityToResource(req, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			resource.getRemoteCSEOrNodeOrAE().add(reqResource);
 		}
 
 		// adding DynamicAuthorizationConsultation resource
 		for (DynamicAuthorizationConsultationEntity daceEntity : entity.getChildDynamicAuthorizationConsultation()) {
 			DynamicAuthorizationConsultation dace = new DynamicAuthorizationConsultationMapper()
-					.mapEntityToResource(daceEntity, ResultContent.ATTRIBUTES);
+					.mapEntityToResource(daceEntity, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			resource.getRemoteCSEOrNodeOrAE().add(dace);
 		}
 	}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/DynamicAuthorizationConsultationMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/DynamicAuthorizationConsultationMapper.java
index c550feb..d1d5014 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/DynamicAuthorizationConsultationMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/DynamicAuthorizationConsultationMapper.java
@@ -1,15 +1,23 @@
 package org.eclipse.om2m.core.entitymapper;

 

+import java.util.ArrayList;

+import java.util.List;

+

 import org.eclipse.om2m.commons.entities.DynamicAuthorizationConsultationEntity;

+import org.eclipse.om2m.commons.resource.ChildResourceRef;

 import org.eclipse.om2m.commons.resource.DynamicAuthorizationConsultation;

 

 public class DynamicAuthorizationConsultationMapper extends EntityMapper<DynamicAuthorizationConsultationEntity, DynamicAuthorizationConsultation> {

 

 	@Override

 	protected void mapAttributes(DynamicAuthorizationConsultationEntity entity,

-			DynamicAuthorizationConsultation resource) {

+			DynamicAuthorizationConsultation resource, int level, int offset) {

+		if (level < 0) {

+			return;

+		}

+		

 		// regularResource mapper

-		EntityMapperFactory.getRegularResourceMapper().mapAttributes(entity, resource);

+		EntityMapperFactory.getRegularResourceMapper().mapAttributes(entity, resource, level, offset);

 		

 		

 		// dynamicAuthorizationEnabled

@@ -23,14 +31,18 @@
 	}

 

 	@Override

+	protected List<ChildResourceRef> getChildResourceRef(DynamicAuthorizationConsultationEntity entity, int level, int offset) {

+		return new ArrayList<>();

+	}

+	

+	@Override

 	protected void mapChildResourceRef(DynamicAuthorizationConsultationEntity entity,

-			DynamicAuthorizationConsultation resource) {

-		

+			DynamicAuthorizationConsultation resource, int level, int offset) {

 	}

 

 	@Override

 	protected void mapChildResources(DynamicAuthorizationConsultationEntity entity,

-			DynamicAuthorizationConsultation resource) {

+			DynamicAuthorizationConsultation resource, int level, int offset) {

 	}

 

 	@Override

diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/EntityMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/EntityMapper.java
index 36ff84e..2b290fd 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/EntityMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/EntityMapper.java
@@ -34,6 +34,7 @@
 import org.eclipse.om2m.commons.resource.AnnounceableResource;
 import org.eclipse.om2m.commons.resource.AnnounceableSubordinateResource;
 import org.eclipse.om2m.commons.resource.AnnouncedResource;
+import org.eclipse.om2m.commons.resource.ChildResourceRef;
 import org.eclipse.om2m.commons.resource.RegularResource;
 import org.eclipse.om2m.commons.resource.RequestPrimitive;
 import org.eclipse.om2m.commons.resource.Resource;
@@ -54,7 +55,10 @@
 	 * @param entity
 	 * @param resource
 	 */
-	private void mapGenericAttributes(E entity, R resource) {
+	private void mapGenericAttributes(E entity, R resource, int level, int offset) {
+		if (level < 0) {
+			return;
+		}
 		resource.setCreationTime(entity.getCreationTime());
 		resource.setLastModifiedTime(entity.getLastModifiedTime());
 		resource.setName(entity.getName());
@@ -77,6 +81,22 @@
 	 */
 	public R mapEntityToResource(E entity, RequestPrimitive request) {
 		BigInteger resultContent = request.getResultContent();
+		BigInteger level = null;
+		BigInteger offset = null;
+		if (request.getFilterCriteria() != null) {
+			level = request.getFilterCriteria().getLevel();
+			offset = request.getFilterCriteria().getOffset();
+		}
+		// default value for level = 1000 => all possible levels
+		int levelInt = 1000;
+		int offsetInt = 0;
+		if (level != null) {
+			levelInt = level.intValue();
+		}
+		if (offset != null) {
+			offsetInt = offset.intValue();
+		}
+		
 		if (resultContent == null) {
 			resultContent = ResultContent.ATTRIBUTES;
 		} else {
@@ -84,7 +104,7 @@
 				resultContent = ResultContent.ATTRIBUTES;
 			}
 		}
-		return mapEntityToResource(entity, resultContent);
+		return mapEntityToResource(entity, resultContent, levelInt, offsetInt);
 	}
 
 	/**
@@ -96,23 +116,23 @@
 	 *            to use
 	 * @return the mapped serializable resource
 	 */
-	public R mapEntityToResource(E entity, BigInteger resultContent) {
-		R result = createResource();
+	public R mapEntityToResource(E entity, BigInteger resultContent, int level, int offset) {
+		R result = createResource(entity);
 		if (resultContent.equals(ResultContent.ATTRIBUTES)
 				|| resultContent.equals(ResultContent.ATTRIBUTES_AND_CHILD_REF)
 				|| resultContent.equals(ResultContent.ATTRIBUTES_AND_CHILD_RES)
 				|| resultContent.equals(ResultContent.HIERARCHICAL_ADRESS)
 				|| resultContent.equals(ResultContent.HIERARCHICAL_AND_ATTRIBUTES)
 				|| resultContent.equals(ResultContent.ORIGINAL_RES)) {
-			mapGenericAttributes(entity, result);
-			mapAttributes(entity, result);
+			mapGenericAttributes(entity, result, level, offset);
+			mapAttributes(entity, result, level, offset);
 		}
 		if (resultContent.equals(ResultContent.ATTRIBUTES_AND_CHILD_REF)
 				|| resultContent.equals(ResultContent.CHILD_REF)) {
-			mapChildResourceRef(entity, result);
+			mapChildResourceRef(entity, result, level, offset);
 		}
 		if (resultContent.equals(ResultContent.ATTRIBUTES_AND_CHILD_RES)) {
-			mapChildResources(entity, result);
+			mapChildResources(entity, result, level, offset);
 		}
 		return result;
 	}
@@ -125,7 +145,7 @@
 	 * @param resource
 	 *            result
 	 */
-	protected abstract void mapAttributes(E entity, R resource);
+	protected abstract void mapAttributes(E entity, R resource, int level, int offset);
 
 	/**
 	 * Map child resource references of the resource
@@ -135,7 +155,14 @@
 	 * @param resource
 	 *            resource
 	 */
-	protected abstract void mapChildResourceRef(E entity, R resource);
+	protected abstract void mapChildResourceRef(E entity, R resource, int level, int offset);
+	
+	/**
+	 * 
+	 * @param entity
+	 * @return
+	 */
+	protected abstract List<ChildResourceRef> getChildResourceRef(E entity, int level, int offset);
 
 	/**
 	 * Map child reosurces using their attributes
@@ -144,12 +171,21 @@
 	 *            to map
 	 * @param resource
 	 */
-	protected abstract void mapChildResources(E entity, R resource);
+	protected abstract void mapChildResources(E entity, R resource, int level, int offset);
 
 	/**
 	 * Method use to create the object to return corresponding to the R type.
 	 * 
 	 * @return the created empty resource
 	 */
+	protected R createResource(E entity) {
+		return createResource();
+	}
+	
+	/**
+	 * Method use to create the object to return corresponding to the R type.
+	 * 
+	 * @return the created empty resource
+	 */
 	protected abstract R createResource();
 }
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/EntityMapperFactory.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/EntityMapperFactory.java
index c6cff2e..5467ed0 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/EntityMapperFactory.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/EntityMapperFactory.java
@@ -53,8 +53,8 @@
 import org.eclipse.om2m.commons.resource.Container;
 import org.eclipse.om2m.commons.resource.ContentInstance;
 import org.eclipse.om2m.commons.resource.DynamicAuthorizationConsultation;
-import org.eclipse.om2m.commons.resource.FlexContainer;
-import org.eclipse.om2m.commons.resource.FlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
 import org.eclipse.om2m.commons.resource.Group;
 import org.eclipse.om2m.commons.resource.Node;
 import org.eclipse.om2m.commons.resource.PollingChannel;
@@ -96,11 +96,11 @@
 	}
 	
 	/** Get the FlexContainer mapper */
-	public static EntityMapper<FlexContainerEntity, FlexContainer> getFlexContainerMapper(){
+	public static EntityMapper<FlexContainerEntity, AbstractFlexContainer> getFlexContainerMapper(){
 		return new FlexContainerMapper();
 	}
 	/** Get the FlexContainerAnnc mapper */
-	public static EntityMapper<FlexContainerAnncEntity, FlexContainerAnnc> getFlexContainerAnncMapper(){
+	public static EntityMapper<FlexContainerAnncEntity, AbstractFlexContainerAnnc> getFlexContainerAnncMapper(){
 		return new FlexContainerAnncMapper();
 	}
 	
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/FlexContainerAnncMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/FlexContainerAnncMapper.java
index 7323821..90f001b 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/FlexContainerAnncMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/FlexContainerAnncMapper.java
@@ -7,26 +7,38 @@
  *******************************************************************************/
 package org.eclipse.om2m.core.entitymapper;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.eclipse.om2m.commons.constants.ResourceType;
 import org.eclipse.om2m.commons.constants.ResultContent;
 import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
 import org.eclipse.om2m.commons.entities.FlexContainerAnncEntity;
 import org.eclipse.om2m.commons.entities.SubscriptionEntity;
 import org.eclipse.om2m.commons.resource.ChildResourceRef;
-import org.eclipse.om2m.commons.resource.FlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
 import org.eclipse.om2m.commons.resource.Subscription;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.FlexContainerFactory;
 
-public class FlexContainerAnncMapper extends EntityMapper<FlexContainerAnncEntity, FlexContainerAnnc>{
+public class FlexContainerAnncMapper extends EntityMapper<FlexContainerAnncEntity, AbstractFlexContainerAnnc>{
 
 	@Override
-	protected FlexContainerAnnc createResource() {
-		return new FlexContainerAnnc();
+	protected AbstractFlexContainerAnnc createResource() {
+		return new AbstractFlexContainerAnnc();
+	}
+	
+	@Override
+	protected AbstractFlexContainerAnnc createResource(FlexContainerAnncEntity flexContainerAnncEntity) {
+		return FlexContainerFactory.getSpecializationFlexContainerAnnc(flexContainerAnncEntity.getShortName());
 	}
 
 	@Override
-	protected void mapAttributes(FlexContainerAnncEntity entity, FlexContainerAnnc resource) {
+	protected void mapAttributes(FlexContainerAnncEntity entity, AbstractFlexContainerAnnc resource, int level, int offset) {
+		if (level < 0) {
+			return;
+		}
 		// announcedResource attribute
-		EntityMapperFactory.getAnnouncedResourceMapper().mapAttributes(entity, resource);
+		EntityMapperFactory.getAnnouncedResourceMapper().mapAttributes(entity, resource, level, offset);
 		
 		// flexContainerAnnc attribute
 		resource.setCreator(entity.getCreator());
@@ -35,18 +47,24 @@
 		resource.setContainerDefinition(entity.getContainerDefinition());
 		
 	}
-
+	
 	@Override
-	protected void mapChildResourceRef(FlexContainerAnncEntity entity,
-			FlexContainerAnnc resource) {
-
+	protected List<ChildResourceRef> getChildResourceRef(FlexContainerAnncEntity entity, int level, int offset) {
+		List<ChildResourceRef> childRefs = new ArrayList<>();
+		if (level == 0) {
+			return childRefs;
+		}
+		
 		// add child ref FlexContainer
 		for (FlexContainerAnncEntity fcntAnnc : entity.getChildFlexContainerAnncs()) {
 			ChildResourceRef child = new ChildResourceRef();
 			child.setResourceName(fcntAnnc.getName());
 			child.setType(ResourceType.FLEXCONTAINER_ANNC);
 			child.setValue(fcntAnnc.getResourceID());
-			resource.getChildResource().add(child);	
+			child.setSpid(fcntAnnc.getContainerDefinition());
+			childRefs.add(child);
+			
+			childRefs.addAll(new FlexContainerAnncMapper().getChildResourceRef(fcntAnnc, level - 1, offset - 1));
 		}
 
 		// add child ref subscription
@@ -55,29 +73,42 @@
 			child.setResourceName(sub.getName());
 			child.setType(ResourceType.SUBSCRIPTION);
 			child.setValue(sub.getResourceID());
-			resource.getChildResource().add(child);
+			childRefs.add(child);
+			
+			childRefs.addAll(new SubscriptionMapper().getChildResourceRef(sub, level - 1, offset - 1));
 		}
 		
-		
-		// add child ref with containers
+		return childRefs;
 	}
 
 	@Override
-	protected void mapChildResources(FlexContainerAnncEntity entity, FlexContainerAnnc resource) {
+	protected void mapChildResourceRef(FlexContainerAnncEntity entity,
+			AbstractFlexContainerAnnc resource, int level, int offset) {
+		resource.getChildResource().addAll(getChildResourceRef(entity, level, offset));
+	}
+
+	@Override
+	protected void mapChildResources(FlexContainerAnncEntity entity, AbstractFlexContainerAnnc resource, int level, int offset) {
+		if (level == 0) {
+			return;
+		}
+		
 		// add child ref flexContainer
 		for (FlexContainerAnncEntity flexContainerAnncEntity : entity.getChildFlexContainerAnncs()) {
-			FlexContainerAnnc flexContainerAnncRes = new FlexContainerAnncMapper().mapEntityToResource(flexContainerAnncEntity, ResultContent.ATTRIBUTES);
+			AbstractFlexContainerAnnc flexContainerAnncRes = new FlexContainerAnncMapper().mapEntityToResource(flexContainerAnncEntity, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			resource.getFlexContainerOrContainerOrSubscription().add(flexContainerAnncRes);
 		}
 
 		// add child ref subscription
 		for (SubscriptionEntity sub : entity.getSubscriptions()){
-			Subscription subRes = new SubscriptionMapper().mapEntityToResource(sub, ResultContent.ATTRIBUTES);
+			Subscription subRes = new SubscriptionMapper().mapEntityToResource(sub, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			resource.getFlexContainerOrContainerOrSubscription().add(subRes);
 		}
 		
 		
 		// add child ref with containers
+		
+		resource.finalizeSerialization();
 	}
 
 	
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/FlexContainerMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/FlexContainerMapper.java
index a959657..25766e0 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/FlexContainerMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/FlexContainerMapper.java
@@ -7,6 +7,10 @@
  *******************************************************************************/
 package org.eclipse.om2m.core.entitymapper;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
 import org.eclipse.om2m.commons.constants.ResourceType;
 import org.eclipse.om2m.commons.constants.ResultContent;
 import org.eclipse.om2m.commons.entities.ContainerEntity;
@@ -17,20 +21,33 @@
 import org.eclipse.om2m.commons.resource.Container;
 import org.eclipse.om2m.commons.resource.CustomAttribute;
 import org.eclipse.om2m.commons.resource.FlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
 import org.eclipse.om2m.commons.resource.Subscription;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.FlexContainerFactory;
+import org.eclipse.om2m.core.flexcontainer.FlexContainerSelector;
+import org.eclipse.om2m.flexcontainer.service.FlexContainerService;
 
-public class FlexContainerMapper extends EntityMapper<FlexContainerEntity, FlexContainer>{
+public class FlexContainerMapper extends EntityMapper<FlexContainerEntity, AbstractFlexContainer>{
 
 	@Override
-	protected FlexContainer createResource() {
+	protected AbstractFlexContainer createResource() {
 		return new FlexContainer();
 	}
+	
+	@Override
+	protected AbstractFlexContainer createResource(FlexContainerEntity entity) {
+		return FlexContainerFactory.getSpecializationFlexContainer(entity.getShortName());
+	}
 
 	@Override
-	protected void mapAttributes(FlexContainerEntity entity, FlexContainer resource) {
+	protected void mapAttributes(FlexContainerEntity entity, AbstractFlexContainer resource, int level, int offset) {
+		
+		if (level < 0) {
+			return;
+		}
 		
 		// announceableResource attributes
-		EntityMapperFactory.getAnnounceableSubordonateEntity_AnnounceableResourceMapper().mapAttributes(entity, resource);
+		EntityMapperFactory.getAnnounceableSubordonateEntity_AnnounceableResourceMapper().mapAttributes(entity, resource, level, offset);
 		
 		// flexContainer attributes
 		resource.setCreator(entity.getCreator());
@@ -38,26 +55,50 @@
 		resource.setStateTag(entity.getStateTag());
 		resource.setContainerDefinition(entity.getContainerDefinition());
 		
-		for(CustomAttributeEntity cae : entity.getCustomAttributes()) {
-			CustomAttribute ca = new CustomAttribute();
-			ca.setCustomAttributeName(cae.getCustomAttributeName());
-			ca.setCustomAttributeType(cae.getCustomAttributeType());
-			ca.setCustomAttributeValue(cae.getCustomAttributeValue());
-			resource.getCustomAttributes().add(ca);
+		resource.setLongName(entity.getLongName());
+		resource.setShortName(entity.getShortName());
+		
+		FlexContainerService fcs = FlexContainerSelector
+				.getFlexContainerService(entity.getResourceID());
+		
+		if (fcs == null) {
+			for (CustomAttributeEntity cae : entity.getCustomAttributes()) {
+				CustomAttribute ca = new CustomAttribute();
+				ca.setCustomAttributeName(cae.getCustomAttributeName());
+				ca.setCustomAttributeValue(cae.getCustomAttributeValue());
+				resource.getCustomAttributes().add(ca);
+			}
+		} else {
+			List<String> customAttributeNames = new ArrayList<String>();
+			for (CustomAttributeEntity cae : entity.getCustomAttributes()) {
+				customAttributeNames.add(cae.getCustomAttributeName());
+			}
+			for (Map.Entry<String, String> entry : fcs.getCustomAttributeValues(customAttributeNames).entrySet()) {
+				CustomAttribute ca = new CustomAttribute();
+				ca.setCustomAttributeName(entry.getKey());
+				ca.setCustomAttributeValue(entry.getValue());
+				resource.getCustomAttributes().add(ca);
+			}
 		}
 	}
-
+	
 	@Override
-	protected void mapChildResourceRef(FlexContainerEntity entity,
-			FlexContainer resource) {
-
+	protected List<ChildResourceRef> getChildResourceRef(FlexContainerEntity entity, int level, int offset) {
+		List<ChildResourceRef> childRefs = new ArrayList<>();
+		
+		if (level == 0) {
+			return childRefs;
+		}
+		
 		// add child ref FlexContainer
 		for (FlexContainerEntity fcnt : entity.getChildFlexContainers()) {
 			ChildResourceRef child = new ChildResourceRef();
 			child.setResourceName(fcnt.getName());
 			child.setType(ResourceType.FLEXCONTAINER);
 			child.setValue(fcnt.getResourceID());
-			resource.getChildResource().add(child);	
+			child.setSpid(fcnt.getContainerDefinition());
+			childRefs.add(child);
+			childRefs.addAll(new FlexContainerMapper().getChildResourceRef(fcnt, level - 1, offset - 1));
 		}
 
 		// add child ref subscription
@@ -66,7 +107,8 @@
 			child.setResourceName(sub.getName());
 			child.setType(ResourceType.SUBSCRIPTION);
 			child.setValue(sub.getResourceID());
-			resource.getChildResource().add(child);
+			childRefs.add(child);
+			childRefs.addAll(new SubscriptionMapper().getChildResourceRef(sub, level - 1, offset - 1));
 		}
 		
 		
@@ -76,30 +118,45 @@
 			child.setResourceName(childCont.getName());
 			child.setType(ResourceType.CONTAINER);
 			child.setValue(childCont.getResourceID());
-			resource.getChildResource().add(child);
+			childRefs.add(child);
+			childRefs.addAll(new ContainerMapper().getChildResourceRef(childCont, level - 1, offset - 1));
 		}
+		
+		return childRefs;
 	}
 
 	@Override
-	protected void mapChildResources(FlexContainerEntity entity, FlexContainer resource) {
+	protected void mapChildResourceRef(FlexContainerEntity entity,
+			AbstractFlexContainer resource, int level, int offset) {
+		resource.getChildResource().addAll(getChildResourceRef(entity, level, offset));
+	}
+
+	@Override
+	protected void mapChildResources(FlexContainerEntity entity, AbstractFlexContainer resource, int level, int offset) {
+		
+		if (level == 0) {
+			return;
+		}
 		// add child ref flexContainer
 		for (FlexContainerEntity cin : entity.getChildFlexContainers()) {
-			FlexContainer flexContainerRes = new FlexContainerMapper().mapEntityToResource(cin, ResultContent.ATTRIBUTES);
+			AbstractFlexContainer flexContainerRes = new FlexContainerMapper().mapEntityToResource(cin, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			resource.getFlexContainerOrContainerOrSubscription().add(flexContainerRes);
 		}
 
 		// add child ref subscription
 		for (SubscriptionEntity sub : entity.getSubscriptions()){
-			Subscription subRes = new SubscriptionMapper().mapEntityToResource(sub, ResultContent.ATTRIBUTES);
+			Subscription subRes = new SubscriptionMapper().mapEntityToResource(sub, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			resource.getFlexContainerOrContainerOrSubscription().add(subRes);
 		}
 		
 		
 		// add child ref with containers
 		for (ContainerEntity childCont : entity.getChildContainers()) {
-			Container cnt = new ContainerMapper().mapEntityToResource(childCont, ResultContent.ATTRIBUTES);
+			Container cnt = new ContainerMapper().mapEntityToResource(childCont, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			resource.getFlexContainerOrContainerOrSubscription().add(cnt);
 		}
+		
+		resource.finalizeSerialization();
 	}
 
 	
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/GroupMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/GroupMapper.java
index 7fbf77e..9bc66a2 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/GroupMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/GroupMapper.java
@@ -20,6 +20,8 @@
 package org.eclipse.om2m.core.entitymapper;
 
 import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.eclipse.om2m.commons.constants.ResultContent;
 import org.eclipse.om2m.commons.constants.ShortName;
@@ -38,9 +40,13 @@
 	}
 
 	@Override
-	protected void mapAttributes(GroupEntity entity, Group resource) {
+	protected void mapAttributes(GroupEntity entity, Group resource, int level, int offset) {
+		if (level < 0) {
+			return;
+		}
+		
 		// announceable resource attributes
-		EntityMapperFactory.getAnnounceableSubordonateEntity_AnnounceableResourceMapper().mapAttributes(entity, resource);
+		EntityMapperFactory.getAnnounceableSubordonateEntity_AnnounceableResourceMapper().mapAttributes(entity, resource, level, offset);
 		
 		// group attributes
 		resource.setConsistencyStrategy(entity.getConsistencyStrategy());
@@ -58,23 +64,40 @@
 			resource.getMembersAccessControlPolicyIDs().addAll(entity.getMemberAcpIds());
 		}
 	}
-
+	
 	@Override
-	protected void mapChildResourceRef(GroupEntity entity, Group resource) {
+	protected List<ChildResourceRef> getChildResourceRef(GroupEntity entity, int level, int offset) {
+		List<ChildResourceRef> childRefs = new ArrayList<>();
+		
+		if (level == 0) {
+			return childRefs;
+		}
+		
 		// ChildResourceRef Subscription
 		for(SubscriptionEntity sub : entity.getSubscriptions()){
 			ChildResourceRef ref = new ChildResourceRef();
 			ref.setResourceName(sub.getName());
 			ref.setType(sub.getResourceType());
 			ref.setValue(sub.getResourceID());
-			resource.getChildResource().add(ref);
+			childRefs.add(ref);
+			childRefs.addAll(new SubscriptionMapper().getChildResourceRef(sub, level - 1, offset - 1));
 		}
+		
+		return childRefs;
 	}
 
 	@Override
-	protected void mapChildResources(GroupEntity entity, Group resource) {
+	protected void mapChildResourceRef(GroupEntity entity, Group resource, int level, int offset) {
+		resource.getChildResource().addAll(getChildResourceRef(entity, level, offset));
+	}
+
+	@Override
+	protected void mapChildResources(GroupEntity entity, Group resource, int level, int offset) {
+		if (level == 0) {
+			return;
+		}
 		for(SubscriptionEntity sub : entity.getSubscriptions()){
-			Subscription subRes = new SubscriptionMapper().mapEntityToResource(sub, ResultContent.ATTRIBUTES);
+			Subscription subRes = new SubscriptionMapper().mapEntityToResource(sub, ResultContent.ATTRIBUTES, level - 1, offset - 1);
 			resource.getSubscription().add(subRes);
 		}
 	}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/NodeMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/NodeMapper.java
index e20917c..618eaf0 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/NodeMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/NodeMapper.java
@@ -19,6 +19,9 @@
  *******************************************************************************/
 package org.eclipse.om2m.core.entitymapper;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.eclipse.om2m.commons.constants.ResourceType;
 import org.eclipse.om2m.commons.constants.ResultContent;
 import org.eclipse.om2m.commons.entities.AreaNwkDeviceInfoEntity;
@@ -36,24 +39,36 @@
 public class NodeMapper extends EntityMapper<NodeEntity, Node> {
 
 	@Override
-	protected void mapAttributes(NodeEntity entity, Node resource) {
+	protected void mapAttributes(NodeEntity entity, Node resource, int level, int offset) {
+		
+		if (level < 0) {
+			return;
+		}
+		
 		// announceableResource attributes
-		EntityMapperFactory.getAnnounceableSubordonateEntity_AnnounceableResourceMapper().mapAttributes(entity, resource);
+		EntityMapperFactory.getAnnounceableSubordonateEntity_AnnounceableResourceMapper().mapAttributes(entity, resource, level, offset);
 		
 		// node attribute
 		resource.setNodeID(entity.getNodeID());
 		resource.setHostedCSELink(entity.getHostedCSELink());
 	}
-
+	
 	@Override
-	protected void mapChildResourceRef(NodeEntity entity, Node resource) {
+	protected List<ChildResourceRef> getChildResourceRef(NodeEntity entity, int level, int offset) {
+		List<ChildResourceRef> childRefs = new ArrayList<>();
+		
+		if (level == 0) {
+			return childRefs;
+		}
+		
 		// add child area nwk info entities
 		for (AreaNwkInfoEntity aniEntity : entity.getChildAreaNwkInfoEntities()) {
 			ChildResourceRef chref = new ChildResourceRef();
 			chref.setResourceName(aniEntity.getName());
 			chref.setType(ResourceType.MGMT_OBJ);
 			chref.setValue(aniEntity.getResourceID());
-			resource.getChildResource().add(chref);
+			childRefs.add(chref);
+			childRefs.addAll(new AreaNwkInfoMapper().getChildResourceRef(aniEntity, level - 1, offset - 1));
 		}
 		// add child area nwk device info entities
 		for (AreaNwkDeviceInfoEntity andiEntity : entity.getChildAreaNwkDeviceInfoEntities()) {
@@ -61,20 +76,28 @@
 			chref.setResourceName(andiEntity.getName());
 			chref.setType(ResourceType.MGMT_OBJ);
 			chref.setValue(andiEntity.getResourceID());
-			resource.getChildResource().add(chref);
+			childRefs.add(chref);
+			childRefs.addAll(new AreaNwkDeviceInfoMapper().getChildResourceRef(andiEntity, level - 1, offset - 1));
 		}
+		
+		return childRefs;
 	}
 
 	@Override
-	protected void mapChildResources(NodeEntity entity, Node resource) {
+	protected void mapChildResourceRef(NodeEntity entity, Node resource, int level, int offset) {
+		resource.getChildResource().addAll(getChildResourceRef(entity, level, offset));
+	}
+
+	@Override
+	protected void mapChildResources(NodeEntity entity, Node resource, int level, int offset) {
 		// add child area nwk info entities
 		for (AreaNwkInfoEntity aniEntity : entity.getChildAreaNwkInfoEntities()) {
-			AreaNwkInfo aniRes = new AreaNwkInfoMapper().mapEntityToResource(aniEntity, ResultContent.ATTRIBUTES);
+			AreaNwkInfo aniRes = new AreaNwkInfoMapper().mapEntityToResource(aniEntity, ResultContent.ATTRIBUTES, level - 1, offset - 1);
 			resource.getMemoryOrBatteryOrAreaNwkInfo().add(aniRes);
 		}
 		// add child area nwk device info entities
 		for (AreaNwkDeviceInfoEntity andiEntity : entity.getChildAreaNwkDeviceInfoEntities()) {
-			AreaNwkDeviceInfo andiRes = new AreaNwkDeviceInfoMapper().mapEntityToResource(andiEntity, ResultContent.ATTRIBUTES);
+			AreaNwkDeviceInfo andiRes = new AreaNwkDeviceInfoMapper().mapEntityToResource(andiEntity, ResultContent.ATTRIBUTES, level - 1, offset - 1);
 			resource.getMemoryOrBatteryOrAreaNwkInfo().add(andiRes);
 		}
 	}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/PollingChannelMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/PollingChannelMapper.java
index abc334d..be1e6e4 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/PollingChannelMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/PollingChannelMapper.java
@@ -19,7 +19,11 @@
  *******************************************************************************/
 package org.eclipse.om2m.core.entitymapper;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.eclipse.om2m.commons.entities.PollingChannelEntity;
+import org.eclipse.om2m.commons.resource.ChildResourceRef;
 import org.eclipse.om2m.commons.resource.PollingChannel;
 
 public class PollingChannelMapper extends
@@ -32,7 +36,12 @@
 
 	@Override
 	protected void mapAttributes(PollingChannelEntity entity,
-			PollingChannel resource) {
+			PollingChannel resource, int level, int offset) {
+		
+		if (level < 0) {
+			return;
+		}
+		
 		// regular resource attributes
 		// expiration time
 		resource.setExpirationTime(entity.getExpirationTime());
@@ -42,15 +51,20 @@
 			resource.setPollingChannelURI(entity.getPollingChannelUri());
 		}
 	}
+	
+	@Override
+	protected List<ChildResourceRef> getChildResourceRef(PollingChannelEntity entity, int level, int offset) {
+		return new ArrayList<>();
+	}
 
 	@Override
 	protected void mapChildResourceRef(PollingChannelEntity entity,
-			PollingChannel resource) {
+			PollingChannel resource, int level, int offset) {
 	}
 
 	@Override
 	protected void mapChildResources(PollingChannelEntity entity,
-			PollingChannel resource) {
+			PollingChannel resource, int level, int offset) {
 	}
 
 }
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/RegularResourceMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/RegularResourceMapper.java
index 0921261..35141c0 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/RegularResourceMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/RegularResourceMapper.java
@@ -3,11 +3,13 @@
  */

 package org.eclipse.om2m.core.entitymapper;

 

+import java.util.ArrayList;

 import java.util.List;

 

 import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;

 import org.eclipse.om2m.commons.entities.DynamicAuthorizationConsultationEntity;

 import org.eclipse.om2m.commons.entities.RegularResourceEntity;

+import org.eclipse.om2m.commons.resource.ChildResourceRef;

 import org.eclipse.om2m.commons.resource.RegularResource;

 

 /**

@@ -17,7 +19,12 @@
 public class RegularResourceMapper extends EntityMapper<RegularResourceEntity, RegularResource> {

 

 	@Override

-	protected void mapAttributes(RegularResourceEntity entity, RegularResource resource) {

+	protected void mapAttributes(RegularResourceEntity entity, RegularResource resource, int level, int offset) {

+		

+		if (level < 0) {

+			return;

+		}

+		

 		// expiration time

 		resource.setExpirationTime(entity.getExpirationTime());

 

@@ -32,14 +39,19 @@
 			dacis.add(dace.getResourceID());

 		}

 	}

+	

+	@Override

+	protected List<ChildResourceRef> getChildResourceRef(RegularResourceEntity entity, int level, int offset) {

+		return new ArrayList<>();

+	}

 

 	@Override

-	protected void mapChildResourceRef(RegularResourceEntity entity, RegularResource resource) {

+	protected void mapChildResourceRef(RegularResourceEntity entity, RegularResource resource, int level, int offset) {

 

 	}

 

 	@Override

-	protected void mapChildResources(RegularResourceEntity entity, RegularResource resource) {

+	protected void mapChildResources(RegularResourceEntity entity, RegularResource resource, int level, int offset) {

 

 	}

 

diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/RemoteCSEMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/RemoteCSEMapper.java
index fca778e..a761c27 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/RemoteCSEMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/RemoteCSEMapper.java
@@ -19,6 +19,9 @@
  *******************************************************************************/
 package org.eclipse.om2m.core.entitymapper;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.eclipse.om2m.commons.constants.ResourceType;
 import org.eclipse.om2m.commons.constants.ResultContent;
 import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
@@ -38,7 +41,7 @@
 import org.eclipse.om2m.commons.resource.ChildResourceRef;
 import org.eclipse.om2m.commons.resource.Container;
 import org.eclipse.om2m.commons.resource.DynamicAuthorizationConsultation;
-import org.eclipse.om2m.commons.resource.FlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
 import org.eclipse.om2m.commons.resource.Group;
 import org.eclipse.om2m.commons.resource.PollingChannel;
 import org.eclipse.om2m.commons.resource.RemoteCSE;
@@ -52,9 +55,14 @@
 	}
 
 	@Override
-	protected void mapAttributes(RemoteCSEEntity csrEntity, RemoteCSE csr) {
+	protected void mapAttributes(RemoteCSEEntity csrEntity, RemoteCSE csr, int level, int offset) {
+		
+		if (level < 0) {
+			return;
+		}
+		
 		// announceableResource attributes
-		EntityMapperFactory.getAnnounceableSubordonateEntity_AnnounceableResourceMapper().mapAttributes(csrEntity, csr);
+		EntityMapperFactory.getAnnounceableSubordonateEntity_AnnounceableResourceMapper().mapAttributes(csrEntity, csr, level, offset);
 			
 		// remoteCse attributes
 		csr.setCSEBase(csrEntity.getRemoteCseUri());
@@ -70,16 +78,23 @@
 		}
 
 	}
-
+	
 	@Override
-	protected void mapChildResourceRef(RemoteCSEEntity csrEntity, RemoteCSE csr) {
+	protected List<ChildResourceRef> getChildResourceRef(RemoteCSEEntity csrEntity, int level, int offset) {
+		List<ChildResourceRef> childRefs = new ArrayList<>();
+		
+		if (level == 0) {
+			return childRefs;
+		}
+		
 		// adding subscription refs
 		for (SubscriptionEntity sub : csrEntity.getSubscriptions()) {
 			ChildResourceRef child = new ChildResourceRef();
 			child.setResourceName(sub.getName());
 			child.setType(ResourceType.SUBSCRIPTION);
 			child.setValue(sub.getResourceID());
-			csr.getChildResource().add(child);
+			childRefs.add(child);
+			childRefs.addAll(new SubscriptionMapper().getChildResourceRef(sub, level - 1, offset - 1));
 		}
 		// adding ae ref
 		for (AeEntity ae : csrEntity.getChildAes()) {
@@ -87,7 +102,8 @@
 			child.setResourceName(ae.getName());
 			child.setType(ResourceType.AE);
 			child.setValue(ae.getResourceID());
-			csr.getChildResource().add(child);
+			childRefs.add(child);
+			childRefs.addAll(new AeMapper().getChildResourceRef(ae, level - 1, offset - 1));
 		}
 		// adding aeA ref
 		for (AeAnncEntity aeAnnc : csrEntity.getChildAeAnncs()) {
@@ -95,7 +111,8 @@
 			child.setResourceName(aeAnnc.getName());
 			child.setType(ResourceType.AE_ANNC);
 			child.setValue(aeAnnc.getResourceID());
-			csr.getChildResource().add(child);
+			childRefs.add(child);
+			childRefs.addAll(new AeAnncMapper().getChildResourceRef(aeAnnc, level - 1, offset - 1));
 		}
 		// adding acp ref
 		for (AccessControlPolicyEntity acp : csrEntity.getChildAcps()) {
@@ -103,7 +120,8 @@
 			child.setResourceName(acp.getName());
 			child.setType(ResourceType.ACCESS_CONTROL_POLICY);
 			child.setValue(acp.getResourceID());
-			csr.getChildResource().add(child);
+			childRefs.add(child);
+			childRefs.addAll(new AcpMapper().getChildResourceRef(acp, level - 1, offset - 1));
 		}
 		// adding cnt ref
 		for (ContainerEntity container : csrEntity.getChildCnt()) {
@@ -111,7 +129,8 @@
 			child.setResourceName(container.getName());
 			child.setType(ResourceType.CONTAINER);
 			child.setValue(container.getResourceID());
-			csr.getChildResource().add(child);
+			childRefs.add(child);
+			childRefs.addAll(new ContainerMapper().getChildResourceRef(container, level - 1, offset - 1));
 		}
 		// adding fcnt ref
 		for (FlexContainerEntity flexContainer : csrEntity.getChildFcnt()) {
@@ -119,7 +138,9 @@
 			child.setResourceName(flexContainer.getName());
 			child.setType(ResourceType.FLEXCONTAINER);
 			child.setValue(flexContainer.getResourceID());
-			csr.getChildResource().add(child);
+			child.setSpid(flexContainer.getContainerDefinition());
+			childRefs.add(child);
+			childRefs.addAll(new FlexContainerMapper().getChildResourceRef(flexContainer, level - 1, offset - 1));
 		}
 		// adding group ref
 		for (GroupEntity group : csrEntity.getChildGrps()) {
@@ -127,7 +148,8 @@
 			child.setResourceName(group.getName());
 			child.setType(ResourceType.GROUP);
 			child.setValue(group.getResourceID());
-			csr.getChildResource().add(child);
+			childRefs.add(child);
+			childRefs.addAll(new GroupMapper().getChildResourceRef(group, level - 1, offset - 1));
 		}
 		// adding polling channel child
 		for (PollingChannelEntity pollEntity : csrEntity.getPollingChannels()) {
@@ -135,7 +157,8 @@
 			child.setResourceName(pollEntity.getName());
 			child.setValue(pollEntity.getResourceID());
 			child.setType(ResourceType.POLLING_CHANNEL);
-			csr.getChildResource().add(child);
+			childRefs.add(child);
+			childRefs.addAll(new PollingChannelMapper().getChildResourceRef(pollEntity, level - 1, offset - 1));
 		}
 		// adding schedule child
 		ScheduleEntity sch = csrEntity.getLinkedSchedule();
@@ -144,7 +167,7 @@
 			child.setResourceName(sch.getName());
 			child.setValue(sch.getResourceID());
 			child.setType(ResourceType.SCHEDULE);
-			csr.getChildResource().add(child);
+			childRefs.add(child);
 		}
 		// TODO add NODE ref
 
@@ -154,52 +177,64 @@
 			ch.setResourceName(dace.getName());
 			ch.setType(ResourceType.DYNAMIC_AUTHORIZATION_CONSULTATION);
 			ch.setValue(dace.getResourceID());
-			csr.getChildResource().add(ch);
+			childRefs.add(ch);
+			childRefs.addAll(new DynamicAuthorizationConsultationMapper().getChildResourceRef(dace, level - 1, offset - 1));
 		}
+		
+		return childRefs;
 	}
 
 	@Override
-	protected void mapChildResources(RemoteCSEEntity csrEntity, RemoteCSE csr) {
+	protected void mapChildResourceRef(RemoteCSEEntity csrEntity, RemoteCSE csr, int level, int offset) {
+		csr.getChildResource().addAll(getChildResourceRef(csrEntity, level, offset));
+	}
+
+	@Override
+	protected void mapChildResources(RemoteCSEEntity csrEntity, RemoteCSE csr, int level, int offset) {
+		if (level == 0) {
+			return;
+		}
+		
 		// adding subscription refs
 		for (SubscriptionEntity sub : csrEntity.getSubscriptions()) {
-			Subscription chSub = new SubscriptionMapper().mapEntityToResource(sub, ResultContent.ATTRIBUTES);
+			Subscription chSub = new SubscriptionMapper().mapEntityToResource(sub, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			csr.getAEOrContainerOrGroup().add(chSub);
 		}
 		// adding ae ref
 		for (AeEntity ae : csrEntity.getChildAes()) {
-			AE chAe = new AeMapper().mapEntityToResource(ae, ResultContent.ATTRIBUTES);
+			AE chAe = new AeMapper().mapEntityToResource(ae, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			csr.getAEOrContainerOrGroup().add(chAe);
 		}
 		// adding aeAnnc ref
 		for (AeAnncEntity aeAnnc : csrEntity.getChildAeAnncs()) {
-			AEAnnc chAeAnnc = new AeAnncMapper().mapEntityToResource(aeAnnc, ResultContent.ATTRIBUTES);
+			AEAnnc chAeAnnc = new AeAnncMapper().mapEntityToResource(aeAnnc, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			csr.getAEOrContainerOrGroup().add(chAeAnnc);
 		}
 
 		// adding acp ref
 		for (AccessControlPolicyEntity acp : csrEntity.getChildAcps()) {
-			AccessControlPolicy chAcp = new AcpMapper().mapEntityToResource(acp, ResultContent.ATTRIBUTES);
+			AccessControlPolicy chAcp = new AcpMapper().mapEntityToResource(acp, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			csr.getAEOrContainerOrGroup().add(chAcp);
 		}
 		// adding cnt ref
 		for (ContainerEntity container : csrEntity.getChildCnt()) {
-			Container chCnt = new ContainerMapper().mapEntityToResource(container, ResultContent.ATTRIBUTES);
+			Container chCnt = new ContainerMapper().mapEntityToResource(container, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			csr.getAEOrContainerOrGroup().add(chCnt);
 		}
 		// adding fcnt ref
 		for (FlexContainerEntity flexContainer : csrEntity.getChildFcnt()) {
-			FlexContainer chFcnt = new FlexContainerMapper().mapEntityToResource(flexContainer,
-					ResultContent.ATTRIBUTES);
+			AbstractFlexContainer chFcnt = new FlexContainerMapper().mapEntityToResource(flexContainer,
+					ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			csr.getAEOrContainerOrGroup().add(chFcnt);
 		}
 		// adding group ref
 		for (GroupEntity grp : csrEntity.getChildGrps()) {
-			Group chGrp = new GroupMapper().mapEntityToResource(grp, ResultContent.ATTRIBUTES);
+			Group chGrp = new GroupMapper().mapEntityToResource(grp, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			csr.getAEOrContainerOrGroup().add(chGrp);
 		}
 		// adding polling channel child
 		for (PollingChannelEntity pollEntity : csrEntity.getPollingChannels()) {
-			PollingChannel chPch = new PollingChannelMapper().mapEntityToResource(pollEntity, ResultContent.ATTRIBUTES);
+			PollingChannel chPch = new PollingChannelMapper().mapEntityToResource(pollEntity, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			csr.getAEOrContainerOrGroup().add(chPch);
 		}
 		// adding schedule child
@@ -211,7 +246,7 @@
 		// adding DynamicAuthorizationConsultation resource
 		for (DynamicAuthorizationConsultationEntity daceEntity : csrEntity.getChildDynamicAuthorizationConsultation()) {
 			DynamicAuthorizationConsultation dace = new DynamicAuthorizationConsultationMapper()
-					.mapEntityToResource(daceEntity, ResultContent.ATTRIBUTES);
+					.mapEntityToResource(daceEntity, ResultContent.ATTRIBUTES_AND_CHILD_RES, level - 1, offset - 1);
 			csr.getAEOrContainerOrGroup().add(dace);
 		}
 	}
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/RequestMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/RequestMapper.java
index f1dfb86..7e7a679 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/RequestMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/RequestMapper.java
@@ -19,6 +19,7 @@
  *******************************************************************************/
 package org.eclipse.om2m.core.entitymapper;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.commons.logging.Log;
@@ -27,6 +28,7 @@
 import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
 import org.eclipse.om2m.commons.entities.DynamicAuthorizationConsultationEntity;
 import org.eclipse.om2m.commons.entities.RequestEntity;
+import org.eclipse.om2m.commons.resource.ChildResourceRef;
 import org.eclipse.om2m.commons.resource.MetaInformation;
 import org.eclipse.om2m.commons.resource.OperationResult;
 import org.eclipse.om2m.commons.resource.PrimitiveContent;
@@ -43,8 +45,12 @@
 	private static Log LOGGER = LogFactory.getLog(RequestMapper.class);
 
 	@Override
-	protected void mapAttributes(RequestEntity entity, Request resource) {
+	protected void mapAttributes(RequestEntity entity, Request resource, int level, int offset) {
 
+		if (level < 0) {
+			return;
+		}
+		
 		// requestEntity attributes
 		if (entity.getContent() != null) {
 			PrimitiveContent pc = new PrimitiveContent();
@@ -61,14 +67,19 @@
 		resource.setStateTag(entity.getStateTag());
 		resource.setTarget(entity.getTarget());
 	}
+	
+	@Override
+	protected List<ChildResourceRef> getChildResourceRef(RequestEntity entity, int level, int offset) {
+		return new ArrayList<>();
+	}
 
 	@Override
-	protected void mapChildResourceRef(RequestEntity entity, Request resource) {
+	protected void mapChildResourceRef(RequestEntity entity, Request resource, int level, int offset) {
 		// TODO subscriptions childs
 	}
 
 	@Override
-	protected void mapChildResources(RequestEntity entity, Request resource) {
+	protected void mapChildResources(RequestEntity entity, Request resource, int level, int offset) {
 		// TODO subscription childs
 	}
 
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/SubscriptionMapper.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/SubscriptionMapper.java
index 58e970c..784b52b 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/SubscriptionMapper.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/entitymapper/SubscriptionMapper.java
@@ -19,6 +19,9 @@
  *******************************************************************************/
 package org.eclipse.om2m.core.entitymapper;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import org.eclipse.om2m.commons.entities.ScheduleEntity;
 import org.eclipse.om2m.commons.entities.SubscriptionEntity;
 import org.eclipse.om2m.commons.resource.ChildResourceRef;
@@ -32,9 +35,13 @@
 	}
 
 	@Override
-	protected void mapAttributes(SubscriptionEntity subscriptionEntity, Subscription subscription) {
+	protected void mapAttributes(SubscriptionEntity subscriptionEntity, Subscription subscription, int level, int offset) {
+		if (level < 0) {
+			return;
+		}
+		
 		// regular resources
-		EntityMapperFactory.getRegularResourceMapper().mapAttributes(subscriptionEntity, subscription);
+		EntityMapperFactory.getRegularResourceMapper().mapAttributes(subscriptionEntity, subscription, level, offset);
 
 		// subscription.setBatchNotify(value); // TODO
 		subscription.setCreator(subscriptionEntity.getCreator());
@@ -56,21 +63,36 @@
 		subscription.getNotificationURI().addAll(subscriptionEntity.getNotificationURI());
 
 	}
-
+	
 	@Override
-	protected void mapChildResourceRef(SubscriptionEntity entity, Subscription resource) {
+	protected List<ChildResourceRef> getChildResourceRef(SubscriptionEntity entity, int level, int offset) {
+		List<ChildResourceRef> childRefs = new ArrayList<>();
+		if (level == 0) {
+			return childRefs;
+		}
+		
 		ScheduleEntity schE = entity.getChildSchedule();
 		if (schE != null) {
 			ChildResourceRef ch = new ChildResourceRef();
 			ch.setResourceName(schE.getName());
 			ch.setType(schE.getResourceType());
 			ch.setValue(schE.getResourceID());
-			resource.setChildResource(ch);
+			childRefs.add(ch);
+		}
+		
+		return childRefs;
+	}
+
+	@Override
+	protected void mapChildResourceRef(SubscriptionEntity entity, Subscription resource, int level, int offset) {
+		List<ChildResourceRef> childRefs = getChildResourceRef(entity, level, offset);
+		if (!childRefs.isEmpty()) {
+			resource.setChildResource(childRefs.get(0));
 		}
 	}
 
 	@Override
-	protected void mapChildResources(SubscriptionEntity entity, Subscription resource) {
+	protected void mapChildResources(SubscriptionEntity entity, Subscription resource, int level, int offset) {
 		ScheduleEntity schE = entity.getChildSchedule();
 		if (schE != null) {
 			// TODO add schedule child resource
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/nblocking/NonBlockingHandler.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/nblocking/NonBlockingHandler.java
index da1fa8a..83d533c 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/nblocking/NonBlockingHandler.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/nblocking/NonBlockingHandler.java
@@ -100,7 +100,6 @@
 		metaInf.setDiscoveryResultType(request.getDiscoveryResultType());
 		// TODO EventCat nblock handler
 		metaInf.setGroupRequestIdentifier(request.getGroupRequestIdentifier());
-		metaInf.setName(request.getName());
 		metaInf.setOperationalExecutionTime(request.getOperationExecutionTime());
 		metaInf.setOriginatingTimestamp(request.getOriginatingTimestamp());
 		metaInf.setRequestExpirationTimestamp(request.getResultExpirationTimestamp());
@@ -131,7 +130,7 @@
 		dbs.getDAOFactory().getCSEBaseDAO().update(transaction, cseBaseEntity);
 		transaction.commit();
 		
-		Request requestResource = EntityMapperFactory.getRequestMapper().mapEntityToResource(requestEntity, ResultContent.ATTRIBUTES);
+		Request requestResource = EntityMapperFactory.getRequestMapper().mapEntityToResource(requestEntity, ResultContent.ATTRIBUTES, 0, 0);
 		response.setContent(requestResource.getResourceID());
 		response.setContentType(MimeMediaType.TEXT_PLAIN);
 		
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/nblocking/NonBlockingWorker.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/nblocking/NonBlockingWorker.java
index 5473266..c95104c 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/nblocking/NonBlockingWorker.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/nblocking/NonBlockingWorker.java
@@ -122,7 +122,7 @@
 					getDataMapperList().get(request.getReturnContentType()).
 					objToString(
 							EntityMapperFactory.getRequestMapper().
-							mapEntityToResource(managedRequest, ResultContent.ATTRIBUTES)
+							mapEntityToResource(managedRequest, ResultContent.ATTRIBUTES, 0, 0)
 					);
 			for(String uriNotif : request.getResponseTypeInfo().getNotificationURI()){
 				RequestPrimitive notifRequest = new RequestPrimitive();
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/notifier/Notifier.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/notifier/Notifier.java
index 5b352df..4a909c2 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/notifier/Notifier.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/notifier/Notifier.java
@@ -71,6 +71,8 @@
 public class Notifier {
 	/** Logger */
 	private static Log LOGGER = LogFactory.getLog(Notifier.class);
+	
+	private static final Integer NB_OF_FAILED_NOTIFS_BEFORE_DELETION = Integer.valueOf(System.getProperty("org.eclipse.om2m.subscriptions.nbOfFailedNotificationsBeforeDeletion", "5"));
 
 	/**
 	 * Finds all resource subscribers and notifies them.
@@ -78,6 +80,7 @@
 	 * @param resource - Notification resource
 	 */
 	public static void notify(List<SubscriptionEntity> listSubscription, ResourceEntity resource, int resourceStatus) {
+
 		notify(listSubscription, resource, null, resourceStatus);
 	}
 	
@@ -115,6 +118,7 @@
 
 	public static void performVerificationRequest(RequestPrimitive request,
 			SubscriptionEntity subscriptionEntity) {
+		String notificationPayloadContentType = subscriptionEntity.getNotificationPayloadContentType();
 		for(String uri : subscriptionEntity.getNotificationURI()){
 			if(!uri.equals(request.getFrom())){
 				Notification notification = new Notification();
@@ -123,13 +127,16 @@
 				notification.setSubscriptionReference(subscriptionEntity.getHierarchicalURI());
 				notification.setSubscriptionDeletion(false);
 				RequestPrimitive notifRequest = new RequestPrimitive();
-				notifRequest.setContent(DataMapperSelector.getDataMapperList().get(Constants.NOTIFICATION_MMT).objToString(notification));
+				if (!MimeMediaType.OBJ.equals(notificationPayloadContentType)) {
+					notifRequest.setContent(DataMapperSelector.getDataMapperList().get(notificationPayloadContentType).objToString(notification));
+				} else {
+					notifRequest.setContent(notification);
+				}
 				notifRequest.setFrom("/" + Constants.CSE_ID);
 				notifRequest.setTo(uri);
 				notifRequest.setOperation(Operation.NOTIFY);
-				notifRequest.setRequestContentType(Constants.NOTIFICATION_MMT);
-				notifRequest.setReturnContentType(Constants.NOTIFICATION_MMT);
-				
+				notifRequest.setRequestContentType(notificationPayloadContentType);
+				notifRequest.setReturnContentType(notificationPayloadContentType);
 				ResponsePrimitive resp = notify(notifRequest, uri);
 				if(resp.getResponseStatusCode().equals(ResponseStatusCode.TARGET_NOT_REACHABLE)){
 					throw new Om2mException("Error during the verification request", 
@@ -148,30 +155,11 @@
 		LOGGER.info("Sending notify request to: " + contact);
 		if(contact.matches(".*://.*")){ 
 			// Contact = protocol-dependent -> direct notification using the rest client.
-			// In case of MQTT, the URI of the broker and the Topic has to be handled separatly
-			if(contact.startsWith("mqtt://")){
-				Pattern mqttUriPattern = Pattern.compile("(mqtt://[^:/]*(:[0-9]{1,5})?)(/.*)");
-				Matcher matcher = mqttUriPattern.matcher(contact);
-				if(matcher.matches()){
-					String uri = matcher.group(1);
-					String topic = matcher.group(3) == null ? "" : matcher.group(3).substring(1);
-					request.setMqttTopic(topic);
-					request.setMqttUri(uri);
-					// We do not want to wait for a response on AE topic
-					request.setMqttResponseExpected(false);
-				} else {
-					ResponsePrimitive resp = new ResponsePrimitive(request);
-					resp.setResponseStatusCode(ResponseStatusCode.BAD_REQUEST);
-					resp.setContent("Error in mqtt URI");
-					resp.setContentType(MimeMediaType.TEXT_PLAIN);
-					return resp;
-				}
-			}
 			request.setTo(contact);
 			return RestClient.sendRequest(request);
 		}else{
-			request.setTo(contact);
 			request.setTargetId(contact);
+			request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
 			LOGGER.info("Sending notify request...");
 			return new Router().doRequest(request);
 		}
@@ -268,8 +256,7 @@
 
 			// Set request parameters
 			request.setOperation(Operation.NOTIFY);
-			//request.setFrom("/" + Constants.CSE_ID);
-			request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
+			request.setFrom("/" + Constants.CSE_ID);
 
 			if(resourceStatus == ResourceStatus.DELETED){
 				notification.setSubscriptionDeletion(true);
@@ -277,7 +264,7 @@
 				notification.setSubscriptionDeletion(false);
 			}
 
-			notification.setSubscriptionReference(sub.getHierarchicalURI());
+			notification.setSubscriptionReference(sub.getResourceID());
 
 			// Get the representation of the content
 			Resource serializableResource;
@@ -290,7 +277,6 @@
 							getMapperFromResourceType(resource.getResourceType().intValue());
 				}
 				if(sub.getNotificationContentType().equals(NotificationContentType.MODIFIED_ATTRIBUTES)){
-
 					Representation representation = new Representation();
 					if (modifiedOnlyResource != null) {
 						// Gregory BONNARDEL - 26 Avril 2016
@@ -301,33 +287,70 @@
 						// for non modified controllers, send the ResourceEntity 
 						// but it is not compliant with the specs
 						serializableResource  = (Resource) mapper
-								.mapEntityToResource(resource, ResultContent.ATTRIBUTES);
+								.mapEntityToResource(resource, ResultContent.ATTRIBUTES, 0, 0);
 						representation.setResource(serializableResource);
 					}
 					notification.getNotificationEvent().setRepresentation(representation);
-					request.setRequestContentType(MimeMediaType.XML);
-
+					request.setRequestContentType(sub.getNotificationPayloadContentType());
 				} else if(sub.getNotificationContentType().equals(NotificationContentType.WHOLE_RESOURCE)){
-					serializableResource = (Resource) mapper.mapEntityToResource(resource, ResultContent.ATTRIBUTES);
-
+					serializableResource = (Resource) mapper.mapEntityToResource(resource, ResultContent.ATTRIBUTES, 0, 0);
 					Representation representation = new Representation();
 					representation.setResource(serializableResource);
 					notification.getNotificationEvent().setRepresentation(representation);
-					request.setRequestContentType(MimeMediaType.XML);
-
+					request.setRequestContentType(sub.getNotificationPayloadContentType());
 				} 
 			} 
 			// Set the content
-			request.setContent(DataMapperSelector.getDataMapperList().get(Constants.NOTIFICATION_MMT).objToString(notification));
+			request.setContent(DataMapperSelector.getDataMapperList().get(sub.getNotificationPayloadContentType()).objToString(notification));
 			// For each notification URI: send the notify request
 			for(final String uri : sub.getNotificationURI()){
 				CoreExecutor.postThread(new Runnable(){
 					public void run() {
-						Notifier.notify(request, uri);			
+						ResponsePrimitive response = Notifier.notify(request, uri);  
+						if (ResponseStatusCode.OK.equals(response.getResponseStatusCode())) {
+							// notify ok
+							updateSubscription(sub.getResourceID(), 0);
+							LOGGER.debug("notify OK for subscription " + sub.getResourceID());
+						} else {
+							// notify KO
+							Integer nbOfFailed = sub.getNbOfFailedNotifications();
+							if (nbOfFailed == null) {
+								nbOfFailed = 0;
+							}
+							if (nbOfFailed > NB_OF_FAILED_NOTIFS_BEFORE_DELETION) {
+								// delete notification
+								deleteSubscription(sub.getResourceID());
+								LOGGER.error("Reach the limit of failed notifs --> delete subscription " + sub.getResourceID());
+							} else {
+								updateSubscription(sub.getResourceID(), nbOfFailed+1);
+								LOGGER.warn("unable to notify, increase failed notifs(" + nbOfFailed +") for subscription " + sub.getResourceID());
+							}
+						}
 					};
 				});
 			}
 		}
 	}
+	
+	private static void deleteSubscription(String resourceId) {
+		DBService dbs = PersistenceService.getInstance().getDbService();
+		DBTransaction dbTransaction = dbs.getDbTransaction();
+		dbTransaction.open();
+		SubscriptionEntity subscriptionEntityToBeDeleted = dbs.getDAOFactory().getSubsciptionDAO().find(dbTransaction, resourceId);
+		dbs.getDAOFactory().getSubsciptionDAO().delete(dbTransaction, subscriptionEntityToBeDeleted);
+		dbTransaction.commit();
+		dbTransaction.close();
+	}
+	
+	private static void updateSubscription(String resourceId, Integer nbOfFailedNotification) {
+		DBService dbs = PersistenceService.getInstance().getDbService();
+		DBTransaction dbTransaction = dbs.getDbTransaction();
+		dbTransaction.open();
+		SubscriptionEntity subscriptionEntityToBeUpdated = dbs.getDAOFactory().getSubsciptionDAO().find(dbTransaction, resourceId);
+		subscriptionEntityToBeUpdated.setNbOfFailedNotifications(nbOfFailedNotification);
+		dbs.getDAOFactory().getSubsciptionDAO().update(dbTransaction, subscriptionEntityToBeUpdated);
+		dbTransaction.commit();
+		dbTransaction.close();
+	}
 
 }
diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/redirector/Redirector.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/redirector/Redirector.java
index c05dbcd..e469550 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/redirector/Redirector.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/redirector/Redirector.java
@@ -157,9 +157,8 @@
 				String initialRequestContentType = request.getRequestContentType();

 				String initialReturnContentType = request.getReturnContentType();

 				if ((MimeMediaType.OBJ.equals(initialRequestContentType))) {

-

+					// forward payload using XML

 					request.setRequestContentType(MimeMediaType.XML);

-					request.setReturnContentType(MimeMediaType.XML);

 

 					if ((Operation.CREATE.equals(request.getOperation()))

 							|| (Operation.UPDATE.equals(request.getOperation()))) {

@@ -170,6 +169,11 @@
 					}

 

 				}

+				

+				// if returnType=OBJ, change it to XML

+				if ((MimeMediaType.OBJ.equals(initialReturnContentType))) {

+					request.setReturnContentType(MimeMediaType.XML);

+				}

 

 				ResponsePrimitive response = RestClient.sendRequest(request);

 				if (!(response.getResponseStatusCode().equals(ResponseStatusCode.TARGET_NOT_REACHABLE))) {

diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/remotecse/RemoteCseService.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/remotecse/RemoteCseService.java
index 3259b02..ae2e4f0 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/remotecse/RemoteCseService.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/remotecse/RemoteCseService.java
@@ -47,16 +47,21 @@
 		if (eventAdmin != null) {

 

 			// create a new Event

-			Map<String, String> properties = new Hashtable<>();

-			properties.put(REMOTE_CSE_ID_PROPERTY, toBeAdded.getResourceID());

+			Map<String, Object> properties = new Hashtable<>();

+			String cseId = toBeAdded.getRemoteCseId();

+			if (cseId.startsWith("/")) {

+				cseId = cseId.substring(1);

+			}

+			properties.put(REMOTE_CSE_ID_PROPERTY, cseId);

 			properties.put(REMOTE_CSE_NAME_PROPERTY, toBeAdded.getName());

 			properties.put(OPERATION_PROPERTY, ADD_OPERATION_VALUE);

+			properties.put(REMOTE_CSE_POA, toBeAdded.getPointOfAccess());

 			Event event = new Event(REMOTE_CSE_TOPIC, properties);

 

 			// send it through EventAdmin (asynchronously)

 			eventAdmin.postEvent(event);

 			

-			LOGGER.info("post Event to inform about RemoteCSE creation (cseId=" + toBeAdded.getRemoteCseId()

+			LOGGER.info("post Event to inform about RemoteCSE creation (cseId=" + cseId

 			+ ", cseName=" + toBeAdded.getName() + ")");

 

 		}

diff --git a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/router/Router.java b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/router/Router.java
index 1701083..9fcc97d 100644
--- a/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/router/Router.java
+++ b/org.eclipse.om2m.core/src/main/java/org/eclipse/om2m/core/router/Router.java
@@ -214,7 +214,8 @@
 			}
 
 			// Discovery case
-			if (request.getFilterCriteria() != null){
+			if ((request.getFilterCriteria() != null) && (request.getFilterCriteria().getFilterUsage() != null)
+					&& (request.getFilterCriteria().getFilterUsage().intValue() == 1)){
 				controller = new DiscoveryController();
 			}
 
diff --git a/org.eclipse.om2m.das.testsuite/META-INF/MANIFEST.MF b/org.eclipse.om2m.das.testsuite/META-INF/MANIFEST.MF
index 15de7ef..c3393b1 100644
--- a/org.eclipse.om2m.das.testsuite/META-INF/MANIFEST.MF
+++ b/org.eclipse.om2m.das.testsuite/META-INF/MANIFEST.MF
@@ -11,6 +11,7 @@
  org.eclipse.om2m.commons.entities,
  org.eclipse.om2m.commons.exceptions,
  org.eclipse.om2m.commons.resource,
+ org.eclipse.om2m.commons.resource.flexcontainerspec,
  org.eclipse.om2m.core.service,
  org.eclipse.om2m.interworking.service,
  org.osgi.framework
diff --git a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/Test.java b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/Test.java
index 46e8621..cea8a57 100644
--- a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/Test.java
+++ b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/Test.java
@@ -17,11 +17,12 @@
 import org.eclipse.om2m.commons.resource.AccessControlRule;

 import org.eclipse.om2m.commons.resource.DynamicAuthorizationConsultation;

 import org.eclipse.om2m.commons.resource.FlexContainer;

-import org.eclipse.om2m.commons.resource.FlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;

 import org.eclipse.om2m.commons.resource.RemoteCSE;

 import org.eclipse.om2m.commons.resource.RequestPrimitive;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

 import org.eclipse.om2m.commons.resource.SetOfAcrs;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.BinarySwitchFlexContainerAnnc;

 import org.eclipse.om2m.core.service.CseService;

 

 public abstract class Test {

@@ -204,7 +205,6 @@
 		// setup request

 		request.setOperation(Operation.CREATE);

 		request.setTargetId("/" + Constants.CSE_ID + "/" + Constants.CSE_NAME);

-		request.setName(dasName);

 		request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);

 		request.setResourceType(ResourceType.DYNAMIC_AUTHORIZATION_CONSULTATION);

 		request.setRequestContentType(MimeMediaType.OBJ);

@@ -215,6 +215,7 @@
 		das.setDynamicAuthorizationEnabled(enabled);

 		das.setDynamicAuthorisationPoA(poa);

 		das.setDynamicAuthorizationLifetime(new Date().toString());

+		das.setName(dasName);

 

 		request.setContent(das);

 

@@ -239,7 +240,6 @@
 		// setup request

 		request.setOperation(Operation.CREATE);

 		request.setTargetId("/" + Constants.CSE_ID + "/" + Constants.CSE_NAME);

-		request.setName(remoteCseName);

 		request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);

 		request.setResourceType(ResourceType.REMOTE_CSE);

 		request.setRequestContentType(MimeMediaType.OBJ);

@@ -250,6 +250,7 @@
 		remoteCse.setCSEBase("/base/" + remoteCseName);

 		remoteCse.setCSEID(remoteCseName);

 		remoteCse.setRequestReachability(Boolean.FALSE);

+		remoteCse.setName(remoteCseName);

 

 		request.setContent(remoteCse);

 

@@ -285,7 +286,6 @@
 		// setup request

 		request.setOperation(Operation.CREATE);

 		request.setTargetId(url);

-		request.setName(aeAnncCseName);

 		request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);

 		request.setResourceType(ResourceType.AE_ANNC);

 		request.setRequestContentType(MimeMediaType.OBJ);

@@ -293,6 +293,7 @@
 

 		// set RemoteCse

 		AEAnnc aeAnnc = new AEAnnc();

+		aeAnnc.setName(aeAnncCseName);

 		aeAnnc.setAppID("AeAnncAppID_" + UUID.randomUUID());

 		aeAnnc.setLink("/" + aeAnnc.getAppID());

 		aeAnnc.getAccessControlPolicyIDs().add(createdAcp.getResourceID());

@@ -326,6 +327,7 @@
 	protected AccessControlPolicy createAcp() {

 		// create a specific acp for this entity

 		AccessControlPolicy acp = new AccessControlPolicy();

+		acp.setName("ACP" + UUID.randomUUID());

 		AccessControlRule acr = new AccessControlRule();

 		acr.getAccessControlOriginators().add(Constants.ADMIN_REQUESTING_ENTITY);

 		acr.setAccessControlOperations(AccessControl.ALL);

@@ -338,7 +340,6 @@
 		acp.getSelfPrivileges().getAccessControlRule().add(selfAcr);

 

 		RequestPrimitive acpCreateRequest = new RequestPrimitive();

-		acpCreateRequest.setName("ACP" + UUID.randomUUID());

 		acpCreateRequest.setOperation(Operation.CREATE);

 		acpCreateRequest.setRequestContentType(MimeMediaType.OBJ);

 		acpCreateRequest.setReturnContentType(MimeMediaType.OBJ);

@@ -371,9 +372,10 @@
 		}

 

 		AE ae = new AE();

-

+		

 		ae.setAppID("1234");

 		ae.setAppName("appName" + UUID.randomUUID());

+		ae.setName(ae.getAppName());

 		ae.setRequestReachability(Boolean.TRUE);

 		ae.getAccessControlPolicyIDs().add(createdAcp.getResourceID());

 		ae.getPointOfAccess().add("poa_" + UUID.randomUUID()); 

@@ -382,7 +384,6 @@
 		}

 

 		RequestPrimitive request = new RequestPrimitive();

-		request.setName(ae.getAppName());

 		request.setOperation(Operation.CREATE);

 		request.setRequestContentType(MimeMediaType.OBJ);

 		request.setReturnContentType(MimeMediaType.OBJ);

@@ -415,7 +416,7 @@
 		}

 

 		FlexContainer flexContainer = new FlexContainer();

-

+		flexContainer.setName("FlexContainer_" + UUID.randomUUID());

 		flexContainer.setContainerDefinition("myDef");

 		flexContainer.getAccessControlPolicyIDs().add(createdAcp.getResourceID());

 		if (dacis != null) {

@@ -423,7 +424,6 @@
 		}

 

 		RequestPrimitive request = new RequestPrimitive();

-		request.setName("FlexContainer_" + UUID.randomUUID());

 		request.setOperation(Operation.CREATE);

 		request.setRequestContentType(MimeMediaType.OBJ);

 		request.setReturnContentType(MimeMediaType.OBJ);

@@ -441,7 +441,7 @@
 		return null;

 	}

 

-	protected FlexContainerAnnc createFlexContainerAnnc(String resourceUrl, List<String> dacis) {

+	protected BinarySwitchFlexContainerAnnc createFlexContainerAnnc(String resourceUrl, List<String> dacis) {

 

 		AccessControlPolicy createdAcp = createAcp();

 		if (createdAcp == null) {

@@ -449,9 +449,8 @@
 			return null;

 		}

 

-		FlexContainerAnnc flexContainerAnnc = new FlexContainerAnnc();

-

-		flexContainerAnnc.setContainerDefinition("myDef");

+		BinarySwitchFlexContainerAnnc flexContainerAnnc = new BinarySwitchFlexContainerAnnc();

+		flexContainerAnnc.setName("FlexContainer_" + UUID.randomUUID());

 		flexContainerAnnc.getAccessControlPolicyIDs().add(createdAcp.getResourceID());

 		flexContainerAnnc.setLink("/link" + UUID.randomUUID());

 		if (dacis != null) {

@@ -459,7 +458,6 @@
 		}

 

 		RequestPrimitive request = new RequestPrimitive();

-		request.setName("FlexContainer_" + UUID.randomUUID());

 		request.setOperation(Operation.CREATE);

 		request.setRequestContentType(MimeMediaType.OBJ);

 		request.setReturnContentType(MimeMediaType.OBJ);

@@ -471,7 +469,7 @@
 		// execute

 		ResponsePrimitive response = getCseService().doRequest(request);

 		if ((response != null) && (ResponseStatusCode.CREATED.equals(response.getResponseStatusCode()))) {

-			return (FlexContainerAnnc) response.getContent();

+			return (BinarySwitchFlexContainerAnnc) response.getContent();

 		}

 

 		return null;

diff --git a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/ae/DASServiceTest_FlexContainer.java b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/ae/DASServiceTest_FlexContainer.java
index 9ca6ad8..2a53440 100644
--- a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/ae/DASServiceTest_FlexContainer.java
+++ b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/ae/DASServiceTest_FlexContainer.java
@@ -77,7 +77,6 @@
 		FlexContainer toBeUpdated = new FlexContainer();

 		CustomAttribute customAttribute = new CustomAttribute();

 		customAttribute.setCustomAttributeName("test");

-		customAttribute.setCustomAttributeType("xs:string");

 		customAttribute.setCustomAttributeValue("value");

 		createdFlexContainer.getCustomAttributes().add(customAttribute);

 

@@ -116,10 +115,10 @@
 		// create a new childFlexContainer

 		FlexContainer flexContainerChildToBeCreated = new FlexContainer();

 		flexContainerChildToBeCreated.setContainerDefinition("tototto");

+		flexContainerChildToBeCreated.setName("FlexContainer_" + UUID.randomUUID());

 

 		// prepare child creation request

 		RequestPrimitive createChildRequest = new RequestPrimitive();

-		createChildRequest.setName("FlexContainer_" + UUID.randomUUID());

 		createChildRequest.setContent(flexContainerChildToBeCreated);

 		createChildRequest.setRequestContentType(MimeMediaType.OBJ);

 		createChildRequest.setReturnContentType(MimeMediaType.OBJ);

diff --git a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/ae/DASServiceTest_FlexContainerAnnc.java b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/ae/DASServiceTest_FlexContainerAnnc.java
index 34c2437..eff2a28 100644
--- a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/ae/DASServiceTest_FlexContainerAnnc.java
+++ b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/ae/DASServiceTest_FlexContainerAnnc.java
@@ -11,10 +11,11 @@
 import org.eclipse.om2m.commons.resource.AEAnnc;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

 import org.eclipse.om2m.commons.resource.DynamicAuthorizationConsultation;

-import org.eclipse.om2m.commons.resource.FlexContainerAnnc;

 import org.eclipse.om2m.commons.resource.RemoteCSE;

 import org.eclipse.om2m.commons.resource.RequestPrimitive;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.BinarySwitchFlexContainerAnnc;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.ToggleFlexContainerAnnc;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.interworking.service.InterworkingService;

 import org.osgi.framework.ServiceRegistration;

@@ -67,7 +68,7 @@
 		// create flexContainerAnnc (with DynamicAuthorizationConsultationIDs)

 		List<String> dacis = new ArrayList<>();

 		dacis.add(dac.getResourceID());

-		FlexContainerAnnc createdFlexContainerAnnc = createFlexContainerAnnc(aeAnnc.getResourceID(), dacis);

+		BinarySwitchFlexContainerAnnc createdFlexContainerAnnc = createFlexContainerAnnc(aeAnnc.getResourceID(), dacis);

 		if (createdFlexContainerAnnc == null) {

 			setState(State.KO);

 			setMessage("unable to create FlexContainerAnnc");

@@ -92,11 +93,10 @@
 		clearCalls();

 

 		// update FlexContainer

-		FlexContainerAnnc toBeUpdated = new FlexContainerAnnc();

+		BinarySwitchFlexContainerAnnc toBeUpdated = new BinarySwitchFlexContainerAnnc();

 		CustomAttribute customAttribute = new CustomAttribute();

-		customAttribute.setCustomAttributeName("test");

-		customAttribute.setCustomAttributeType("xs:string");

-		customAttribute.setCustomAttributeValue("value");

+		customAttribute.setCustomAttributeName("powSe");

+		customAttribute.setCustomAttributeValue("true");

 		createdFlexContainerAnnc.getCustomAttributes().add(customAttribute);

 

 		// prepare update request

@@ -132,13 +132,12 @@
 		clearCalls();

 

 		// create a new childFlexContainer

-		FlexContainerAnnc flexContainerAnncChildToBeCreated = new FlexContainerAnnc();

-		flexContainerAnncChildToBeCreated.setContainerDefinition("tototto");

+		ToggleFlexContainerAnnc flexContainerAnncChildToBeCreated = new ToggleFlexContainerAnnc();

 		flexContainerAnncChildToBeCreated.setLink("/link" + UUID.randomUUID());

-

+		flexContainerAnncChildToBeCreated.setName("FlexContainer_" + UUID.randomUUID());

+		

 		// prepare child creation request

 		RequestPrimitive createChildRequest = new RequestPrimitive();

-		createChildRequest.setName("FlexContainer_" + UUID.randomUUID());

 		createChildRequest.setContent(flexContainerAnncChildToBeCreated);

 		createChildRequest.setRequestContentType(MimeMediaType.OBJ);

 		createChildRequest.setReturnContentType(MimeMediaType.OBJ);

diff --git a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/ae/DASServiceTest_IndirectDACIs.java b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/ae/DASServiceTest_IndirectDACIs.java
index 5acb436..aac3bda 100644
--- a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/ae/DASServiceTest_IndirectDACIs.java
+++ b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/ae/DASServiceTest_IndirectDACIs.java
@@ -66,6 +66,7 @@
 		// create a child flexContainer

 		FlexContainer childFlexContainer = new FlexContainer();

 		childFlexContainer.setContainerDefinition("grege");

+		childFlexContainer.setName("FlexContainer_" + UUID.randomUUID());

 

 		// prepare childCreateRequest

 		RequestPrimitive childCreateRequest = new RequestPrimitive();

@@ -74,7 +75,6 @@
 		childCreateRequest.setOperation(Operation.CREATE);

 		childCreateRequest.setRequestContentType(MimeMediaType.OBJ);

 		childCreateRequest.setReturnContentType(MimeMediaType.OBJ);

-		childCreateRequest.setName("FlexContainer_" + UUID.randomUUID());

 		childCreateRequest.setResourceType(ResourceType.FLEXCONTAINER);

 		childCreateRequest.setContent(childFlexContainer);

 

@@ -132,6 +132,7 @@
 		// create grandson (with no dacis)

 		FlexContainer grandSonFlexContainer = new FlexContainer();

 		grandSonFlexContainer.setContainerDefinition("juju");

+		grandSonFlexContainer.setName("FlexContainerGrandSon_" + UUID.randomUUID());

 

 		// prepare createGrandSonRequest

 		RequestPrimitive createGrandSonRequest = new RequestPrimitive();

@@ -140,7 +141,6 @@
 		createGrandSonRequest.setTargetId(createdChildFlexContainer.getResourceID());

 		createGrandSonRequest.setRequestContentType(MimeMediaType.OBJ);

 		createGrandSonRequest.setReturnContentType(MimeMediaType.OBJ);

-		createGrandSonRequest.setName("FlexContainerGrandSon_" + UUID.randomUUID());

 		createGrandSonRequest.setResourceType(ResourceType.FLEXCONTAINER);

 		createGrandSonRequest.setContent(grandSonFlexContainer);

 

diff --git a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/crud/CreateDAS_CseBase_Test.java b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/crud/CreateDAS_CseBase_Test.java
index e331799..36187da 100644
--- a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/crud/CreateDAS_CseBase_Test.java
+++ b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/crud/CreateDAS_CseBase_Test.java
@@ -69,7 +69,6 @@
 		// setup request

 		request.setOperation(Operation.CREATE);

 		request.setTargetId(toBeCreatedDasUrl);

-		request.setName(dasName);

 		request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);

 		request.setResourceType(ResourceType.DYNAMIC_AUTHORIZATION_CONSULTATION);

 		request.setRequestContentType(MimeMediaType.OBJ);

@@ -80,7 +79,8 @@
 		das.setDynamicAuthorizationEnabled(enabled);

 		das.setDynamicAuthorisationPoA(poa);

 		das.setDynamicAuthorizationLifetime(new Date().toString());

-

+		das.setName(dasName);

+		

 		request.setContent(das);

 

 		ResponsePrimitive response = getCseService().doRequest(request);

diff --git a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/crud/CreateDAS_RemoteCSE_Test.java b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/crud/CreateDAS_RemoteCSE_Test.java
index 243c52e..6ebaa94 100644
--- a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/crud/CreateDAS_RemoteCSE_Test.java
+++ b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/crud/CreateDAS_RemoteCSE_Test.java
@@ -53,10 +53,10 @@
 		remoteCse.setCSEID("cseId" + UUID.randomUUID());

 		remoteCse.setCSEBase("/base" + remoteCse.getCSEID());

 		remoteCse.setRequestReachability(Boolean.FALSE);

+		remoteCse.setName(remoteCse.getCSEID());

 		

 		

 		RequestPrimitive request = new RequestPrimitive();

-		request.setName(remoteCse.getCSEID());

 		request.setOperation(Operation.CREATE);

 		request.setRequestContentType(MimeMediaType.OBJ);

 		request.setReturnContentType(MimeMediaType.OBJ);

diff --git a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/AeAnncDacisTest.java b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/AeAnncDacisTest.java
index 251182e..0f17d4f 100644
--- a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/AeAnncDacisTest.java
+++ b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/AeAnncDacisTest.java
@@ -51,11 +51,11 @@
 		toBeCreatedAeAnnc.getDynamicAuthorizationConsultationIDs().add(dac.getResourceID());

 		toBeCreatedAeAnnc.setAppID("App" + UUID.randomUUID());

 		toBeCreatedAeAnnc.setLink("/link" + UUID.randomUUID());

+		toBeCreatedAeAnnc.setName(toBeCreatedAeAnnc.getAppID());

 

 		// prepare CREATE request

 		RequestPrimitive createRequest = new RequestPrimitive();

 		createRequest.setOperation(Operation.CREATE);

-		createRequest.setName(toBeCreatedAeAnnc.getAppID());

 		createRequest.setFrom(Constants.ADMIN_REQUESTING_ENTITY);

 		createRequest.setTargetId(remoteCse.getResourceID());

 		createRequest.setRequestContentType(MimeMediaType.OBJ);

diff --git a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/AeDacisTest.java b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/AeDacisTest.java
index 4cdb2a1..35d5375 100644
--- a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/AeDacisTest.java
+++ b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/AeDacisTest.java
@@ -37,11 +37,11 @@
 		toBeCreatedAe.getDynamicAuthorizationConsultationIDs().add(dac.getResourceID());

 		toBeCreatedAe.setAppID("App" + UUID.randomUUID());

 		toBeCreatedAe.setRequestReachability(Boolean.FALSE);

+		toBeCreatedAe.setName(toBeCreatedAe.getAppID());

 

 		// prepare CREATE request

 		RequestPrimitive createRequest = new RequestPrimitive();

 		createRequest.setOperation(Operation.CREATE);

-		createRequest.setName(toBeCreatedAe.getAppID());

 		createRequest.setFrom(Constants.ADMIN_REQUESTING_ENTITY);

 		createRequest.setTargetId("/" + Constants.CSE_ID + "/" + Constants.CSE_NAME);

 		createRequest.setRequestContentType(MimeMediaType.OBJ);

diff --git a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/DynamicAuthorizationConsultationDacisTest.java b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/DynamicAuthorizationConsultationDacisTest.java
index 23a2dd8..2436458 100644
--- a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/DynamicAuthorizationConsultationDacisTest.java
+++ b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/DynamicAuthorizationConsultationDacisTest.java
@@ -47,11 +47,11 @@
 		DynamicAuthorizationConsultation toBeCreatedDac = new DynamicAuthorizationConsultation();

 		toBeCreatedDac.getDynamicAuthorizationConsultationIDs().add(dac.getResourceID());

 		toBeCreatedDac.setDynamicAuthorizationEnabled(Boolean.FALSE);

-

+		toBeCreatedDac.setName("DAC_" + UUID.randomUUID());

+		

 		// prepare CREATE request

 		RequestPrimitive createRequest = new RequestPrimitive();

 		createRequest.setOperation(Operation.CREATE);

-		createRequest.setName("DAC_" + UUID.randomUUID());

 		createRequest.setFrom(Constants.ADMIN_REQUESTING_ENTITY);

 		createRequest.setTargetId("/" + Constants.CSE_ID + "/" + Constants.CSE_NAME);

 		createRequest.setRequestContentType(MimeMediaType.OBJ);

diff --git a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/FlexContainerAnncDacisTest.java b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/FlexContainerAnncDacisTest.java
index 9efd256..4b3b6cb 100644
--- a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/FlexContainerAnncDacisTest.java
+++ b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/FlexContainerAnncDacisTest.java
@@ -10,10 +10,10 @@
 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.AEAnnc;

 import org.eclipse.om2m.commons.resource.DynamicAuthorizationConsultation;

-import org.eclipse.om2m.commons.resource.FlexContainerAnnc;

 import org.eclipse.om2m.commons.resource.RemoteCSE;

 import org.eclipse.om2m.commons.resource.RequestPrimitive;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.BinarySwitchFlexContainerAnnc;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.das.testsuite.Test;

 

@@ -59,15 +59,14 @@
 		

 

 		// create a FlexContainerAnnc with a dynamicAuthorizationConsultationsId

-		FlexContainerAnnc toBeCreatedFlexContainerAnnc = new FlexContainerAnnc();

+		BinarySwitchFlexContainerAnnc toBeCreatedFlexContainerAnnc = new BinarySwitchFlexContainerAnnc();

 		toBeCreatedFlexContainerAnnc.getDynamicAuthorizationConsultationIDs().add(dac.getResourceID());

-		toBeCreatedFlexContainerAnnc.setContainerDefinition("myDef");

 		toBeCreatedFlexContainerAnnc.setLink("/FlexContainerAnnc" + UUID.randomUUID());

+		toBeCreatedFlexContainerAnnc.setName("FlexContainerAnnc_" + UUID.randomUUID());

 

 		// prepare CREATE request

 		RequestPrimitive createRequest = new RequestPrimitive();

 		createRequest.setOperation(Operation.CREATE);

-		createRequest.setName("FlexContainerAnnc_" + UUID.randomUUID());

 		createRequest.setFrom(Constants.ADMIN_REQUESTING_ENTITY);

 		createRequest.setTargetId(aeAnnc.getResourceID());

 		createRequest.setRequestContentType(MimeMediaType.OBJ);

@@ -91,9 +90,9 @@
 			return;

 		}

 

-		FlexContainerAnnc createdFlexContainerAnnc = null;

+		BinarySwitchFlexContainerAnnc createdFlexContainerAnnc = null;

 		try {

-			createdFlexContainerAnnc = (FlexContainerAnnc) createResponse.getContent();

+			createdFlexContainerAnnc = (BinarySwitchFlexContainerAnnc) createResponse.getContent();

 		} catch (ClassCastException e) {

 			setState(State.KO);

 			setMessage("expected response content is not a FlexContainerAnnc");

@@ -123,9 +122,9 @@
 			return;

 		}

 

-		FlexContainerAnnc retrievedFlexContainerAnnc = null;

+		BinarySwitchFlexContainerAnnc retrievedFlexContainerAnnc = null;

 		try {

-			retrievedFlexContainerAnnc = (FlexContainerAnnc) retrieveResponse.getContent();

+			retrievedFlexContainerAnnc = (BinarySwitchFlexContainerAnnc) retrieveResponse.getContent();

 		} catch (ClassCastException e) {

 			setState(State.KO);

 			setMessage("expected response content is not a FlexContainerAnnc");

@@ -170,7 +169,7 @@
 

 		retrievedFlexContainerAnnc = null;

 		try {

-			retrievedFlexContainerAnnc = (FlexContainerAnnc) retrieveResponse.getContent();

+			retrievedFlexContainerAnnc = (BinarySwitchFlexContainerAnnc) retrieveResponse.getContent();

 		} catch (ClassCastException e) {

 			setState(State.KO);

 			setMessage("expected response content is not a FlexContainerAnnc");

diff --git a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/FlexContainerDacisTest.java b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/FlexContainerDacisTest.java
index 2d8a391..6ce8e7e 100644
--- a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/FlexContainerDacisTest.java
+++ b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/FlexContainerDacisTest.java
@@ -39,11 +39,11 @@
 		FlexContainer toBeCreatedFlexContainer = new FlexContainer();

 		toBeCreatedFlexContainer.setContainerDefinition("mydef");

 		toBeCreatedFlexContainer.getDynamicAuthorizationConsultationIDs().add(dac.getResourceID());

+		toBeCreatedFlexContainer.setName(flexContainerName);

 

 		// prepare CREATE request

 		RequestPrimitive createRequest = new RequestPrimitive();

 		createRequest.setOperation(Operation.CREATE);

-		createRequest.setName(flexContainerName);

 		createRequest.setFrom(Constants.ADMIN_REQUESTING_ENTITY);

 		createRequest.setTargetId("/" + Constants.CSE_ID + "/" + Constants.CSE_NAME);

 		createRequest.setRequestContentType(MimeMediaType.OBJ);

diff --git a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/RemoteCseDacisTest.java b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/RemoteCseDacisTest.java
index 1103918..3e73bc9 100644
--- a/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/RemoteCseDacisTest.java
+++ b/org.eclipse.om2m.das.testsuite/src/main/java/org/eclipse/om2m/das/testsuite/dacis/RemoteCseDacisTest.java
@@ -38,11 +38,11 @@
 		toBeCreatedRemoteCse.setRequestReachability(Boolean.FALSE);

 		toBeCreatedRemoteCse.setCSEBase("/cseBase" + UUID.randomUUID());

 		toBeCreatedRemoteCse.setCSEID("cseId" + UUID.randomUUID());

+		toBeCreatedRemoteCse.setName("RemoteCSE_" + UUID.randomUUID());

 

 		// prepare CREATE request

 		RequestPrimitive createRequest = new RequestPrimitive();

 		createRequest.setOperation(Operation.CREATE);

-		createRequest.setName("RemoteCSE_" + UUID.randomUUID());

 		createRequest.setFrom(Constants.ADMIN_REQUESTING_ENTITY);

 		createRequest.setTargetId("/" + Constants.CSE_ID + "/" + Constants.CSE_NAME);

 		createRequest.setRequestContentType(MimeMediaType.OBJ);

diff --git a/org.eclipse.om2m.datamapping.jaxb/.classpath b/org.eclipse.om2m.datamapping.jaxb/.classpath
index c50f969..1a349b2 100644
--- a/org.eclipse.om2m.datamapping.jaxb/.classpath
+++ b/org.eclipse.om2m.datamapping.jaxb/.classpath
@@ -2,7 +2,9 @@
 <classpath>

 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>

 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>

-	<classpathentry kind="src" path="src/main/java/"/>

+	<classpathentry kind="src" path="src/main/java"/>

+	<classpathentry kind="src" path="src/test/java"/>

+	<classpathentry kind="src" path="src/test/resources"/>

 	<classpathentry exported="true" kind="lib" path="eclipselink.jar"/>

 	<classpathentry kind="output" path="target/classes"/>

 </classpath>

diff --git a/org.eclipse.om2m.datamapping.jaxb/META-INF/MANIFEST.MF b/org.eclipse.om2m.datamapping.jaxb/META-INF/MANIFEST.MF
index 8dd8f6d..bebc833 100644
--- a/org.eclipse.om2m.datamapping.jaxb/META-INF/MANIFEST.MF
+++ b/org.eclipse.om2m.datamapping.jaxb/META-INF/MANIFEST.MF
@@ -8,8 +8,10 @@
 Import-Package: org.apache.commons.logging,
  org.eclipse.om2m.commons.constants,
  org.eclipse.om2m.commons.resource,
+ org.eclipse.om2m.commons.resource.flexcontainerspec,
  org.eclipse.om2m.datamapping.service,
  org.osgi.framework,
  org.osgi.util.tracker
 Bundle-ClassPath: .,
  eclipselink.jar
+Require-Bundle: org.junit
diff --git a/org.eclipse.om2m.datamapping.jaxb/src/main/java/org/eclipse/om2m/datamapping/jaxb/Mapper.java b/org.eclipse.om2m.datamapping.jaxb/src/main/java/org/eclipse/om2m/datamapping/jaxb/Mapper.java
index 966c56d..7e34509 100644
--- a/org.eclipse.om2m.datamapping.jaxb/src/main/java/org/eclipse/om2m/datamapping/jaxb/Mapper.java
+++ b/org.eclipse.om2m.datamapping.jaxb/src/main/java/org/eclipse/om2m/datamapping/jaxb/Mapper.java
@@ -23,7 +23,9 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.StringReader;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 import javax.xml.bind.JAXBContext;
@@ -34,6 +36,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.eclipse.om2m.commons.constants.MimeMediaType;
+import org.eclipse.om2m.commons.resource.URIList;
 import org.eclipse.om2m.datamapping.service.DataMapperService;
 import org.eclipse.persistence.jaxb.JAXBContextProperties;
 import org.eclipse.persistence.jaxb.MarshallerProperties;
@@ -48,7 +51,8 @@
 	/** JAXB Context, entry point to the JAXB API */
 	private JAXBContext context;
 	/** Resource package name used for JAXBContext instantiation */
-	private String resourcePackage = "org.eclipse.om2m.commons.resource";
+	// org.eclipse.om2m.commons.resource:
+	private String resourcePackage = "org.eclipse.om2m.commons.resource:org.eclipse.om2m.commons.resource.flexcontainerspec";
 	private String mediaType;
 
 	/**
@@ -59,16 +63,30 @@
 		try {
 			if(context==null){
 				if(mediaType.equals(MimeMediaType.JSON)){
+					// JSON
 					ClassLoader classLoader = Mapper.class.getClassLoader(); 
-					InputStream iStream = classLoader.getResourceAsStream("json-binding.xml"); 
+					InputStream iStreamJsonBinding = classLoader.getResourceAsStream("json-binding.json");
+					InputStream iStreamJsonBindingFlexcontainer = classLoader.getResourceAsStream("json-binding-flexcontainer.json");
+					List<Object> iStreamList = new ArrayList<>();
+					iStreamList.add(iStreamJsonBinding);
+					iStreamList.add(iStreamJsonBindingFlexcontainer);
+					Map<String, Object> properties = new HashMap<String, Object>(); 
+					properties.put("eclipselink-oxm-xml", iStreamList); 
+					properties.put("eclipselink.media-type", "application/json");;
+					context = JAXBContext.newInstance(resourcePackage, classLoader , properties);
+				} else if (mediaType.equals(MimeMediaType.XML)) {
+					// XML
+					ClassLoader classLoader = Mapper.class.getClassLoader(); 
+					InputStream iStream = classLoader.getResourceAsStream("xml-binding.xml"); 
 					Map<String, Object> properties = new HashMap<String, Object>(); 
 					properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, iStream);
 					context = JAXBContext.newInstance(resourcePackage, classLoader , properties);
 				} else {
+					// other
 					context = JAXBContext.newInstance(resourcePackage, Mapper.class.getClassLoader());
 				}
 			}
-		} catch (JAXBException e) { 
+		} catch (Throwable e) { 
 			LOGGER.error("Create JAXBContext error", e);
 		}
 	}
@@ -87,8 +105,25 @@
 			marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
 			OutputStream outputStream = new ByteArrayOutputStream();
 			marshaller.setProperty(MarshallerProperties.MEDIA_TYPE,mediaType);
-			marshaller.setProperty(MarshallerProperties.JSON_INCLUDE_ROOT, true);
+			if (obj instanceof URIList) {
+				marshaller.setProperty(MarshallerProperties.JSON_INCLUDE_ROOT, false);
+				marshaller.setProperty(MarshallerProperties.JSON_MARSHAL_EMPTY_COLLECTIONS, true);
+				marshaller.setProperty(MarshallerProperties.JSON_REDUCE_ANY_ARRAYS, false);
+			} else {
+				marshaller.setProperty(MarshallerProperties.JSON_INCLUDE_ROOT, true);
+				marshaller.setProperty(MarshallerProperties.JSON_MARSHAL_EMPTY_COLLECTIONS, false);
+				marshaller.setProperty(MarshallerProperties.JSON_REDUCE_ANY_ARRAYS, true);
+			}
+			marshaller.setProperty(MarshallerProperties.JSON_VALUE_WRAPPER, "val");
+			
+			
+			Map<String, String> namespaces = new HashMap<String, String>(); 
+			namespaces.put("http://www.onem2m.org/xml/protocols/homedomain", "hd"); 
+			namespaces.put("http://www.onem2m.org/xml/protocols", "m2m"); 
+			marshaller.setProperty(MarshallerProperties.NAMESPACE_PREFIX_MAPPER, namespaces);
+			marshaller.setProperty(MarshallerProperties.JSON_NAMESPACE_SEPARATOR, ':');
 			marshaller.marshal(obj, outputStream);
+			
 			return outputStream.toString();
 		} catch (JAXBException e) {
 			LOGGER.error("JAXB marshalling error!", e);
@@ -112,9 +147,25 @@
 		try {
 			Unmarshaller unmarshaller = context.createUnmarshaller();
 			unmarshaller.setProperty(UnmarshallerProperties.MEDIA_TYPE, mediaType);
-			unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, true);
+			if (representation.contains("m2m:uril")) {
+				unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, true);
+				unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME , true);
+			} else {
+				unmarshaller.setProperty(UnmarshallerProperties.JSON_INCLUDE_ROOT, true);
+				unmarshaller.setProperty(UnmarshallerProperties.JSON_WRAPPER_AS_ARRAY_NAME , false);
+			}
+			unmarshaller.setProperty(UnmarshallerProperties.JSON_VALUE_WRAPPER , "val");
+			Map<String, String> namespaces = new HashMap<String, String>(); 
+			namespaces.put("http://www.onem2m.org/xml/protocols/homedomain", "hd"); 
+			namespaces.put("http://www.onem2m.org/xml/protocols", "m2m"); 
+			unmarshaller.setProperty(MarshallerProperties.NAMESPACE_PREFIX_MAPPER, namespaces);
+			unmarshaller.setProperty(MarshallerProperties.JSON_NAMESPACE_SEPARATOR, ':');
+			
+			Object unmarshaledObject = unmarshaller.unmarshal(stringReader);
+			Object toBeReturned = null;
+			toBeReturned = unmarshaledObject;
 
-			return unmarshaller.unmarshal(stringReader);
+			return toBeReturned;
 		} catch (JAXBException e) {
 			LOGGER.error("JAXB unmarshalling error!", e);
 		}
diff --git a/org.eclipse.om2m.datamapping.jaxb/src/main/resources/json-binding-flexcontainer.json b/org.eclipse.om2m.datamapping.jaxb/src/main/resources/json-binding-flexcontainer.json
new file mode 100644
index 0000000..61cc521
--- /dev/null
+++ b/org.eclipse.om2m.datamapping.jaxb/src/main/resources/json-binding-flexcontainer.json
@@ -0,0 +1,12 @@
+{
+  "package-name": "org.eclipse.om2m.commons.resource.flexcontainerspec",
+  "xml-schema": {
+    "element-form-default": "QUALIFIED",
+    "namespace": "http:\/\/www.onem2m.org\/xml\/protocols\/homedomain"
+  },
+  "java-types": {
+  	"java-type": [
+      ]
+  }
+}
+
diff --git a/org.eclipse.om2m.datamapping.jaxb/src/main/resources/json-binding.json b/org.eclipse.om2m.datamapping.jaxb/src/main/resources/json-binding.json
new file mode 100644
index 0000000..222fadd
--- /dev/null
+++ b/org.eclipse.om2m.datamapping.jaxb/src/main/resources/json-binding.json
@@ -0,0 +1,213 @@
+{
+  "package-name": "org.eclipse.om2m.commons.resource",
+  "xml-schema": {
+    "element-form-default": "QUALIFIED",
+    "namespace": "http://www.onem2m.org/xml/protocols"
+  },
+  "java-types": {
+    "java-type": [
+      {
+        "name": "Resource",
+        "java-attributes": {
+          "xml-element": [
+            {
+              "java-attribute": "labels",
+              "name": "lbl",
+              "namespace": ""
+            }
+          ]
+        }
+      },
+      {
+        "name": "RegularResource",
+        "java-attributes": {
+          "xml-element": [
+            {
+              "java-attribute": "accessControlPolicyIDs",
+              "name": "acpi",
+              "namespace": ""
+            },
+            {
+              "java-attribute": "dynamicAuthorizationConsultationIDs",
+              "name": "daci",
+              "namespace": ""
+            }
+          ]
+        }
+      },
+      {
+        "name": "AnnounceableResource",
+        "java-attributes": {
+          "xml-element": [
+            {
+              "java-attribute": "announceTo",
+              "name": "at",
+              "namespace": ""
+            },
+            {
+              "java-attribute": "announcedAttribute",
+              "name": "aa",
+              "namespace": ""
+            }
+          ]
+        }
+      },
+      {
+        "name": "AnnounceableSubordinateResource",
+        "java-attributes": {
+          "xml-element": [
+            {
+              "java-attribute": "announceTo",
+              "name": "at",
+              "namespace": ""
+            },
+            {
+              "java-attribute": "announcedAttribute",
+              "name": "aa",
+              "namespace": ""
+            }
+          ]
+        }
+      },
+      {
+        "name": "AnnouncedResource",
+        "java-attributes": {
+          "xml-element": [
+            {
+              "java-attribute": "accessControlPolicyIDs",
+              "name": "acpi",
+              "namespace": ""
+            }
+          ]
+        }
+      },
+      {
+        "name": "CSEBase",
+        "java-attributes": {
+          "xml-element": [
+            {
+              "java-attribute": "accessControlPolicyIDs",
+              "name": "acpi",
+              "namespace": ""
+            },
+            {
+              "java-attribute": "dynamicAuthorizationConsultationIDs",
+              "name": "daci",
+              "namespace": ""
+            },
+            {
+              "java-attribute": "supportedResourceType",
+              "name": "srt",
+              "namespace": ""
+            },
+            {
+              "java-attribute": "pointOfAccess",
+              "name": "poa",
+              "namespace": ""
+            }
+          ]
+        }
+      },
+      {
+        "name": "RemoteCSE",
+        "java-attributes": {
+          "xml-element": [
+            {
+              "java-attribute": "pointOfAccess",
+              "name": "poa",
+              "namespace": ""
+            }
+          ]
+        }
+      },
+      {
+        "name": "AccessControlRule",
+        "java-attributes": {
+          "xml-element": [
+            {
+              "java-attribute": "accessControlOriginators",
+              "name": "acor",
+              "namespace": ""
+            }
+          ]
+        }
+      },
+      {
+        "name": "AE",
+        "java-attributes": {
+          "xml-element": [
+            {
+              "java-attribute": "pointOfAccess",
+              "name": "poa",
+              "namespace": ""
+            }
+          ]
+        }
+      },
+      {
+        "name": "AEAnnc",
+        "java-attributes": {
+          "xml-element": [
+            {
+              "java-attribute": "pointOfAccess",
+              "name": "poa",
+              "namespace": ""
+            }
+          ]
+        }
+      },
+      {
+        "name": "Group",
+        "java-attributes": {
+          "xml-element": [
+            {
+              "java-attribute": "memberIDs",
+              "name": "mid",
+              "namespace": ""
+            },
+            {
+              "java-attribute": "membersAccessControlPolicyIDs",
+              "name": "macp",
+              "namespace": ""
+            }
+          ]
+        }
+      },
+      {
+        "name": "Subscription",
+        "java-attributes": {
+          "xml-element": [
+            {
+              "java-attribute": "notificationURI",
+              "name": "nu",
+              "namespace": ""
+            },
+            {
+              "java-attribute": "notificationContentType",
+              "name": "nct",
+              "namespace": ""
+            }
+          ]
+        }
+      },
+      {
+        "name": "URIList",
+        "java-attributes": {
+          "xml-element": [
+            {
+              "java-attribute": "listOfUri",
+              "name":"uril",
+              "namespace":"http://www.onem2m.org/xml/protocols"
+            }
+           ]
+        }
+      },
+      {
+        "name": "ChildResourceRef",
+        "java-attributes": {
+         }
+      }
+    ]
+  }
+}
+
diff --git a/org.eclipse.om2m.datamapping.jaxb/src/main/resources/json-binding.xml b/org.eclipse.om2m.datamapping.jaxb/src/main/resources/json-binding.xml
deleted file mode 100644
index 583a3ee..0000000
--- a/org.eclipse.om2m.datamapping.jaxb/src/main/resources/json-binding.xml
+++ /dev/null
@@ -1,131 +0,0 @@
-<?xml version="1.0" encoding="US-ASCII"?>
-<xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
-	package-name="org.eclipse.om2m.commons.resource">
-	<java-types>
-
-		<!-- Adaptation for labels array and resource names -->
-
-		<!-- Generic resource -->
-		<java-type name="Resource">
-			<java-attributes>
-				<xml-element java-attribute="labels" name="lbl" />
-			</java-attributes>
-		</java-type>
-
-		<java-type name="RegularResource">
-			<java-attributes>
-				<xml-element java-attribute="accessControlPolicyIDs"
-					name="acpi" />
-			</java-attributes>
-		</java-type>
-
-        <!--  Request and Response Descriptions -->
-        <java-type name="RequestPrimitive">
-            <xml-root-element name="m2m:rqp"/>
-        </java-type>
-        
-        <java-type name="PrimitiveContent">
-            <xml-root-element name="pc"/>
-        </java-type>
-        
-        <java-type name="ResponsePrimitive">
-            <xml-root-element name="m2m:rsp"/>
-        </java-type>
-
-		<!-- CSE Descriptions -->
-		<java-type name="CSEBase">
-			<xml-root-element name="m2m:cb" />
-			<java-attributes>
-				<xml-element java-attribute="accessControlPolicyIDs"
-					name="acpi" />
-				<xml-element java-attribute="supportedResourceType"
-					name="srt" />
-				<xml-element java-attribute="pointOfAccess" name="poa" />
-			</java-attributes>
-		</java-type>
-
-		<java-type name="RemoteCSE">
-			<xml-root-element name="m2m:csr" />
-		</java-type>
-
-		<!-- Access Control resources -->
-		<java-type name="AccessControlPolicy">
-			<xml-root-element name="m2m:acp" />
-		</java-type>
-		<java-type name="AccessControlRule">
-			<java-attributes>
-				<xml-element java-attribute="accessControlOriginators"
-					name="acor" />
-			</java-attributes>
-		</java-type>
-
-		<!-- Common resources -->
-		<java-type name="AE">
-			<xml-root-element name="m2m:ae" />
-			<java-attributes>
-				<xml-element java-attribute="pointOfAccess" name="poa" />
-			</java-attributes>
-		</java-type>
-
-		<java-type name="Container">
-			<xml-root-element name="m2m:cnt" />
-		</java-type>
-
-		<java-type name="ContentInstance">
-			<xml-root-element name="m2m:cin" />
-		</java-type>
-
-		<java-type name="Group">
-			<xml-root-element name="m2m:grp" />
-			<java-attributes>
-				<xml-element java-attribute="memberIDs" name="mid" />
-				<xml-element java-attribute="membersAccessControlPolicyIDs"
-					name="macp" />
-			</java-attributes>
-		</java-type>
-
-		<java-type name="Node">
-			<xml-root-element name="m2m:nod" />
-		</java-type>
-
-		<!-- Subscription and notification handling -->
-
-		<java-type name="Subscription">
-			<xml-root-element name="m2m:sub" />
-			<java-attributes>
-				<xml-element java-attribute="notificationURI" name="nu" />
-			</java-attributes>
-		</java-type>
-
-		<java-type name="Notification">
-			<xml-root-element name="m2m:sgn" />
-		</java-type>
-
-		<!-- TODO Mgmt Objects -->
-
-		<!-- Other resources -->
-
-        <java-type name="URIList">
-            <xml-root-element name="m2m:uril"/>
-        </java-type>
-
-		<java-type name="PollingChannel">
-			<xml-root-element name="m2m:pch" />
-		</java-type>
-
-		<java-type name="Schedule">
-			<xml-root-element name="m2m:sch" />
-		</java-type>
-
-		<java-type name="LocationRegion">
-			<java-attributes>
-				<!-- TODO Short name for countryCode -->
-				<xml-element java-attribute="countryCode" />
-				<!-- TODO Short name for circRegion -->
-				<xml-element java-attribute="circRegion" />
-			</java-attributes>
-		</java-type>
-
-	</java-types>
-
-</xml-bindings>
\ No newline at end of file
diff --git a/org.eclipse.om2m.datamapping.jaxb/src/main/resources/xml-binding.xml b/org.eclipse.om2m.datamapping.jaxb/src/main/resources/xml-binding.xml
new file mode 100644
index 0000000..af99631
--- /dev/null
+++ b/org.eclipse.om2m.datamapping.jaxb/src/main/resources/xml-binding.xml
@@ -0,0 +1,171 @@
+<?xml version="1.0" encoding="US-ASCII"?>
+<xml-bindings xmlns="http://www.eclipse.org/eclipselink/xsds/persistence/oxm"
+	package-name="org.eclipse.om2m.commons.resource">
+	<java-types>
+
+		<!-- Adaptation for labels array and resource names -->
+
+		<!-- Generic resource -->
+		<java-type name="Resource">
+			<java-attributes>
+				<xml-element java-attribute="labels" name="lbl"  xml-list="true"/>
+			</java-attributes>
+		</java-type>
+
+		<java-type name="RegularResource">
+			<java-attributes>
+				<xml-element java-attribute="accessControlPolicyIDs"
+					name="acpi"/>
+				<xml-element java-attribute="dynamicAuthorizationConsultationIDs"
+					name="daci"/>
+			</java-attributes>
+		</java-type>
+		
+		<java-type name="AnnounceableResource">
+			<java-attributes>
+				<xml-element java-attribute="announceTo"
+					name="at" />
+				<xml-element java-attribute="announcedAttribute"
+					name="aa"  />
+			</java-attributes>
+		</java-type>
+		
+		<java-type name="AnnounceableSubordinateResource">
+			<java-attributes>
+				<xml-element java-attribute="announceTo"
+					name="at" />
+				<xml-element java-attribute="announcedAttribute"
+					name="aa" />
+			</java-attributes>
+		</java-type>
+		
+		<java-type name="AnnouncedResource">
+			<java-attributes>
+				<xml-element java-attribute="accessControlPolicyIDs"
+					name="acpi"  />
+			</java-attributes>
+		</java-type>
+
+        <!--  Request and Response Descriptions -->
+        <java-type name="RequestPrimitive">
+            <xml-root-element name="m2m:rqp"/>
+        </java-type>
+        
+        <java-type name="PrimitiveContent">
+            <xml-root-element name="pc"/>
+        </java-type>
+        
+        <java-type name="ResponsePrimitive">
+            <xml-root-element name="m2m:rsp"/>
+        </java-type>
+
+		<!-- CSE Descriptions -->
+		<java-type name="CSEBase">
+			<java-attributes>
+				<xml-element java-attribute="accessControlPolicyIDs"
+					name="acpi" />
+				<xml-element java-attribute="dynamicAuthorizationConsultationIDs"
+					name="daci" />
+				<xml-element java-attribute="supportedResourceType"
+					name="srt" xml-list="true" />
+				<xml-element java-attribute="pointOfAccess" name="poa" />
+			</java-attributes>
+		</java-type>
+
+		<java-type name="RemoteCSE">
+			<java-attributes>
+				<xml-element java-attribute="pointOfAccess" name="poa"/>
+			</java-attributes>
+		</java-type>
+
+		<!-- Access Control resources -->
+		<java-type name="AccessControlPolicy">
+		</java-type>
+		<java-type name="AccessControlRule">
+			<java-attributes>
+				<xml-element java-attribute="accessControlOriginators"
+					name="acor" />
+			</java-attributes>
+		</java-type>
+
+		<!-- Common resources -->
+		<java-type name="AE">
+			<java-attributes>
+				<xml-element java-attribute="pointOfAccess" name="poa" xml-list="true" />
+			</java-attributes>
+		</java-type>
+		<java-type name="AEAnnc">
+			<java-attributes>
+				<xml-element java-attribute="pointOfAccess" name="poa" xml-list="true" />
+			</java-attributes>
+		</java-type>
+
+		<java-type name="Container">
+		</java-type>
+		
+		<java-type name="AbstractFlexContainer">
+			<java-attributes>
+			</java-attributes>
+		</java-type>
+		
+
+		<java-type name="ContentInstance">
+		</java-type>
+
+		<java-type name="Group">
+			<java-attributes>
+				<xml-element java-attribute="memberIDs" name="mid" xml-list="true"/>
+				<xml-element java-attribute="membersAccessControlPolicyIDs"
+					name="macp" xml-list="true"/>
+			</java-attributes>
+		</java-type>
+
+		<java-type name="Node">
+		</java-type>
+
+		<!-- Subscription and notification handling -->
+
+		<java-type name="Subscription">
+			<java-attributes>
+				<xml-element java-attribute="notificationURI" name="nu" />
+			</java-attributes>
+		</java-type>
+
+		<java-type name="Notification">
+		</java-type>
+
+		<!-- TODO Mgmt Objects -->
+
+		<!-- Other resources -->
+
+        <java-type name="URIList">
+       		<xml-root-element name="uril" /> 
+       		<java-attributes>
+       			<xml-value java-attribute="listOfUri" xml-list="true"/> 
+       		</java-attributes>
+        </java-type>
+        
+         <java-type name="ChildResourceRef">
+       		<java-attributes>
+       			<xml-value java-attribute="value"  />
+       		</java-attributes>
+        </java-type>
+
+		<java-type name="PollingChannel">
+		</java-type>
+
+		<java-type name="Schedule">
+		</java-type>
+
+		<java-type name="LocationRegion">
+			<java-attributes>
+				<!-- TODO Short name for countryCode -->
+				<xml-element java-attribute="countryCode" />
+				<!-- TODO Short name for circRegion -->
+				<xml-element java-attribute="circRegion" />
+			</java-attributes>
+		</java-type>
+
+	</java-types>
+
+</xml-bindings>
\ No newline at end of file
diff --git a/org.eclipse.om2m.datamapping.jaxb/src/test/java/org/eclipse/om2m/datamapping/jaxb/MapperTestChildResourceRef.java b/org.eclipse.om2m.datamapping.jaxb/src/test/java/org/eclipse/om2m/datamapping/jaxb/MapperTestChildResourceRef.java
new file mode 100644
index 0000000..d711360
--- /dev/null
+++ b/org.eclipse.om2m.datamapping.jaxb/src/test/java/org/eclipse/om2m/datamapping/jaxb/MapperTestChildResourceRef.java
@@ -0,0 +1,145 @@
+package org.eclipse.om2m.datamapping.jaxb;

+

+import static org.junit.Assert.*;

+

+import java.math.BigInteger;

+

+import org.eclipse.om2m.commons.constants.MimeMediaType;

+import org.eclipse.om2m.commons.resource.ChildResourceRef;

+import org.eclipse.om2m.commons.resource.FlexContainer;

+import org.junit.After;

+import org.junit.Before;

+import org.junit.Test;

+

+public class MapperTestChildResourceRef {

+

+	private Mapper jsonMapper;

+	private Mapper xmlMapper;

+

+	@Before

+	public void setUp() throws Exception {

+		jsonMapper = new Mapper(MimeMediaType.JSON);

+		xmlMapper = new Mapper(MimeMediaType.XML);

+	}

+

+	@After

+	public void tearDown() throws Exception {

+	}

+

+	@Test

+	public void test() {

+		FlexContainer flexContainer = new FlexContainer();

+		ChildResourceRef childResourceRef = new ChildResourceRef();

+		childResourceRef.setResourceName("totoname");

+		childResourceRef.setSpid("totospid");

+		childResourceRef.setType(28);

+		childResourceRef.setValue("totoValue");

+		flexContainer.getChildResource().add(childResourceRef);

+

+		ChildResourceRef childResourceRef2 = new ChildResourceRef();

+		childResourceRef2.setResourceName("totoname2");

+		childResourceRef2.setSpid("totospid2");

+		childResourceRef2.setType(28);

+		childResourceRef2.setValue("totoValue2");

+		flexContainer.getChildResource().add(childResourceRef2);

+

+		String flexContainerAsString = jsonMapper.objToString(flexContainer);

+		String flexContainerAsXmlString = xmlMapper.objToString(flexContainer);

+

+		System.out.println(flexContainerAsString);

+		System.out.println(flexContainerAsXmlString);

+

+		FlexContainer fcntFromString = (FlexContainer) jsonMapper.stringToObj(flexContainerAsString);

+		

+

+		System.out.println(fcntFromString.getChildResource().size());

+		for (ChildResourceRef crr : fcntFromString.getChildResource()) {

+			System.out.println(crr.getResourceName());

+			System.out.println(crr.getSpid());

+			System.out.println(crr.getValue());

+			System.out.println(crr.getType());

+		}

+

+	}

+

+	@Test

+	public void test2() {

+

+		String flexContainerString = "{\r\n" + 

+				"   \"m2m:fcnt\" : {\r\n" + 

+				"	  \"cnd\" : \"totoCnd\",\r\n" + 

+				"      \"ch\" : [ {\r\n" + 

+				"         \"nm\" : \"totoname\",\r\n" + 

+				"         \"typ\" : 28,\r\n" + 

+				"         \"spid\" : \"totospid\",\r\n" + 

+				"         \"val\" : \"totoValue\"\r\n" + 

+				"      }, {\r\n" + 

+				"         \"nm\" : \"totoname2\",\r\n" + 

+				"         \"typ\" : 28,\r\n" + 

+				"         \"spid\" : \"totospid2\",\r\n" + 

+				"         \"val\" : \"totoValue2\"\r\n" + 

+				"      } ]\r\n" + 

+				"   }\r\n" + 

+				"}";

+

+		FlexContainer fcntFromString = (FlexContainer) jsonMapper.stringToObj(flexContainerString);

+

+		assertTrue(fcntFromString != null);

+		assertTrue(fcntFromString.getChildResource().size() == 2);

+		

+		for(ChildResourceRef childRed : fcntFromString.getChildResource()) {

+			if (childRed.getResourceName().equals("totoname2")) {

+				assertTrue(childRed.getSpid().equals("totospid2"));

+				assertTrue(childRed.getType().equals(new BigInteger("28")));

+				assertTrue(childRed.getValue().equals("totoValue2"));

+			} else if (childRed.getResourceName().equals("totoname")) {

+				assertTrue(childRed.getSpid().equals("totospid"));

+				assertTrue(childRed.getType().equals(new BigInteger("28")));

+				assertTrue(childRed.getValue().equals("totoValue"));

+			} else {

+				assertFalse(true);

+			}

+		}

+		

+

+	}

+	

+	

+	@Test

+	public void test3() {

+		String json = "{\r\n" + 

+				"   \"m2m:fcnt\" : {\r\n" + 

+				"	  \"cnd\" : \"totoCnd\",\r\n" + 

+				"      \"ch\": [{\r\n" + 

+				"            \"val\": \"/in-cse/fcnt-3016*8929*hue:LCT001@001788fffe16af9e~L2-module-binarySwitch\",\r\n" + 

+				"            \"nm\": \"org.onem2m.home.module.binarySwitch__3016*8929*hue:LCT001@001788fffe16af9e~L2\",\r\n" + 

+				"            \"typ\": 28\r\n" + 

+				"        }, {\r\n" + 

+				"            \"val\": \"/in-cse/fcnt-3016*8929*hue:LCT001@001788fffe16af9e~L2-module-colour\",\r\n" + 

+				"            \"nm\": \"org.onem2m.home.module.colour__3016*8929*hue:LCT001@001788fffe16af9e~L2\",\r\n" + 

+				"            \"typ\": 28\r\n" + 

+				"        }, {\r\n" + 

+				"            \"val\": \"/in-cse/fcnt-3016*8929*hue:LCT001@001788fffe16af9e~L2-module-colourSaturation\",\r\n" + 

+				"            \"nm\": \"org.onem2m.home.module.colourSaturation__3016*8929*hue:LCT001@001788fffe16af9e~L2\",\r\n" + 

+				"            \"typ\": 28,\r\n" + 

+				"            \"spid\": \"toto\"\r\n" + 

+				"        }]\r\n" + 

+				"\r\n" + 

+				"   }\r\n" + 

+				"}";

+		

+		FlexContainer fcntFromString = (FlexContainer) jsonMapper.stringToObj(json);

+

+		System.out.println(fcntFromString.getChildResource().size());

+		for (ChildResourceRef crr : fcntFromString.getChildResource()) {

+			System.out.println("new child");

+			System.out.println("\t nm:" + crr.getResourceName());

+			System.out.println("\t spid:" + crr.getSpid());

+			System.out.println("\t val:" + crr.getValue());

+			System.out.println("\t type:" + crr.getType());

+		}

+		System.out.println(fcntFromString.getContainerDefinition());

+		

+	}

+

+}

diff --git a/org.eclipse.om2m.datamapping.jaxb/src/test/java/org/eclipse/om2m/datamapping/jaxb/MapperTestGroup.java b/org.eclipse.om2m.datamapping.jaxb/src/test/java/org/eclipse/om2m/datamapping/jaxb/MapperTestGroup.java
new file mode 100644
index 0000000..eebecf0
--- /dev/null
+++ b/org.eclipse.om2m.datamapping.jaxb/src/test/java/org/eclipse/om2m/datamapping/jaxb/MapperTestGroup.java
@@ -0,0 +1,101 @@
+package org.eclipse.om2m.datamapping.jaxb;

+

+import static org.junit.Assert.*;

+

+import java.io.BufferedReader;

+import java.io.File;

+import java.io.FileNotFoundException;

+import java.io.FileReader;

+import java.io.IOException;

+import java.math.BigInteger;

+

+import org.eclipse.om2m.commons.constants.MimeMediaType;

+import org.eclipse.om2m.commons.constants.ResourceType;

+import org.eclipse.om2m.commons.resource.Group;

+import org.junit.After;

+import org.junit.Before;

+import org.junit.Test;

+

+public class MapperTestGroup {

+	

+	private Mapper xmlMapper;

+	private Mapper jsonMapper;

+

+	@Before

+	public void setUp() throws Exception {

+		xmlMapper = new Mapper(MimeMediaType.XML);

+		jsonMapper = new Mapper(MimeMediaType.JSON);

+	}

+

+	@After

+	public void tearDown() throws Exception {

+	}

+

+	@Test

+	public void testXMLObjToString() {

+		Group group = new Group();

+		group.setMemberType(BigInteger.valueOf(ResourceType.AE));

+		group.getMemberIDs().add("id1");

+		group.getMemberIDs().add("id2");

+		

+		String xmlString = xmlMapper.objToString(group);

+		System.out.println(xmlString);

+	}

+	

+	@Test

+	public void testXMLStringToObj() {

+		String xmlPayload = readFile("src/test/resources/group.xml");

+		

+		Group group = (Group) xmlMapper.stringToObj(xmlPayload);

+		

+		assertTrue(group != null);

+		assertTrue(BigInteger.valueOf(2).equals(group.getMemberType()));

+		assertTrue(!group.getMemberIDs().isEmpty());

+		assertTrue(group.getMemberIDs().contains("id1"));

+		assertTrue(group.getMemberIDs().contains("id2"));

+	}

+	

+	@Test

+	public void testJSONStringToObj() {

+		String jsonPayload = readFile("src/test/resources/group.json");

+		

+		Group group = (Group) jsonMapper.stringToObj(jsonPayload);

+		

+		assertTrue(group != null);

+		assertTrue(BigInteger.valueOf(2).equals(group.getMemberType()));

+		assertTrue(!group.getMemberIDs().isEmpty());

+		assertTrue(group.getMemberIDs().contains("id1"));

+		assertTrue(group.getMemberIDs().contains("id2"));

+	}

+	

+	@Test

+	public void testJSONObjToString() {

+		Group group = new Group();

+		group.setMemberType(BigInteger.valueOf(ResourceType.AE));

+		group.getMemberIDs().add("id1");

+		group.getMemberIDs().add("id2");

+		

+		String jsonString = jsonMapper.objToString(group);

+		System.out.println(jsonString);

+		

+	}

+	

+	private String readFile(String filename) {

+		StringBuffer sb = new StringBuffer();

+		File file = new File(filename);

+		try {

+			BufferedReader buffReader = new BufferedReader(new FileReader(file));

+			String line = null;

+			while ((line = buffReader.readLine()) != null) {

+				sb.append(line);

+				sb.append("\n");

+			}

+			// sb.setLength(sb.length()-1);

+		} catch (FileNotFoundException e) {

+		} catch (IOException e) {

+		}

+

+		return sb.toString();

+	}

+

+}

diff --git a/org.eclipse.om2m.datamapping.jaxb/src/test/java/org/eclipse/om2m/datamapping/jaxb/MapperTestUrilList.java b/org.eclipse.om2m.datamapping.jaxb/src/test/java/org/eclipse/om2m/datamapping/jaxb/MapperTestUrilList.java
new file mode 100644
index 0000000..35c98fd
--- /dev/null
+++ b/org.eclipse.om2m.datamapping.jaxb/src/test/java/org/eclipse/om2m/datamapping/jaxb/MapperTestUrilList.java
@@ -0,0 +1,116 @@
+package org.eclipse.om2m.datamapping.jaxb;

+

+import static org.junit.Assert.*;

+

+import java.io.BufferedReader;

+import java.io.File;

+import java.io.FileNotFoundException;

+import java.io.FileReader;

+import java.io.IOException;

+import java.io.Reader;

+

+import org.eclipse.om2m.commons.constants.MimeMediaType;

+import org.eclipse.om2m.commons.resource.URIList;

+import org.junit.After;

+import org.junit.Before;

+import org.junit.Test;

+

+public class MapperTestUrilList {

+

+	private Mapper xmlMapper;

+	private Mapper jsonMapper;

+

+	@Before

+	public void setUp() throws Exception {

+		xmlMapper = new Mapper(MimeMediaType.XML);

+		jsonMapper = new Mapper(MimeMediaType.JSON);

+	}

+

+	@After

+	public void tearDown() throws Exception {

+	}

+

+	@Test

+	public void testObjToStringXml() {

+		System.out.println("\n testObjToStringXml");

+

+		URIList uriList = new URIList();

+		uriList.getListOfUri().add("tof");

+		uriList.getListOfUri().add("plouf");

+		String s = xmlMapper.objToString(uriList);

+		System.out.println("xmlMapper");

+		System.out.println(s);

+		System.out.println("fin xmlMapper");

+

+		String expectedResult = readFile("src/test/resources/urilist.xml");

+		System.out.println("expected");

+		System.out.println(expectedResult);

+		System.out.println("fin expected");

+

+	}

+

+	@Test

+	public void testStringToObjXml() {

+		System.out.println("\n testStringToObjXml");

+		String xml = readFile("src/test/resources/urilist.xml");

+

+		Object object = xmlMapper.stringToObj(xml);

+		assertTrue(object != null);

+		assertTrue(object instanceof URIList);

+

+		URIList uriList = (URIList) object;

+

+		assertFalse(uriList.getListOfUri().isEmpty());

+		assertTrue(uriList.getListOfUri().size() == 2);

+		assertTrue(uriList.getListOfUri().contains("plouf"));

+		assertTrue(uriList.getListOfUri().contains("tof"));

+	}

+

+	@Test

+	public void testObjToStringJSON() {

+		System.out.println("\n testObjToStringJSON");

+

+		URIList uriList = new URIList();

+		uriList.getListOfUri().add("tof");

+		uriList.getListOfUri().add("plouf");

+		String s = jsonMapper.objToString(uriList);

+		System.out.println(s);

+		String expectedString = "{\r\n" + "   \"m2m:uril\" : [ \"tof\", \"plouf\" ]\r\n" + "}";

+		assertTrue(expectedString.equals(s));

+	}

+

+	@Test

+	public void testStringToObjJSON() {

+		System.out.println("\n testStringToObjJSON");

+

+		String json = "{\r\n" + "   \"m2m:uril\" : [ \"tof\", \"plouf\" ]\r\n" + "}";

+

+		Object object = jsonMapper.stringToObj(json);

+		assertTrue(object != null);

+		assertTrue(object instanceof URIList);

+

+		URIList uriList = (URIList) object;

+

+		// impossible de passer de string à object.

+

+	}

+

+	private String readFile(String filename) {

+		StringBuffer sb = new StringBuffer();

+		File file = new File(filename);

+		try {

+			BufferedReader buffReader = new BufferedReader(new FileReader(file));

+			String line = null;

+			while ((line = buffReader.readLine()) != null) {

+				sb.append(line);

+				sb.append("\n");

+			}

+			// sb.setLength(sb.length()-1);

+		} catch (FileNotFoundException e) {

+		} catch (IOException e) {

+		}

+

+		return sb.toString();

+	}

+

+}

diff --git a/org.eclipse.om2m.datamapping.jaxb/src/test/resources/group.json b/org.eclipse.om2m.datamapping.jaxb/src/test/resources/group.json
new file mode 100644
index 0000000..3b34bbb
--- /dev/null
+++ b/org.eclipse.om2m.datamapping.jaxb/src/test/resources/group.json
@@ -0,0 +1,6 @@
+{

+   "m2m:grp" : {

+      "mt" : 2,

+      "mid" : [ "id1", "id2" ]

+   }

+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.datamapping.jaxb/src/test/resources/group.xml b/org.eclipse.om2m.datamapping.jaxb/src/test/resources/group.xml
new file mode 100644
index 0000000..985bb4c
--- /dev/null
+++ b/org.eclipse.om2m.datamapping.jaxb/src/test/resources/group.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<m2m:grp xmlns:m2m="http://www.onem2m.org/xml/protocols" xmlns:hd="http://www.onem2m.org/xml/protocols/homedomain">

+   <mt>2</mt>

+   <mid>id1 id2</mid>

+</m2m:grp>
\ No newline at end of file
diff --git a/org.eclipse.om2m.datamapping.jaxb/src/test/resources/urilist.xml b/org.eclipse.om2m.datamapping.jaxb/src/test/resources/urilist.xml
new file mode 100644
index 0000000..0061db6
--- /dev/null
+++ b/org.eclipse.om2m.datamapping.jaxb/src/test/resources/urilist.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>

+

+<m2m:uril xmlns:m2m="http://www.onem2m.org/xml/protocols" xmlns:hd="http://www.onem2m.org/xml/protocols/homedomain">tof plouf</m2m:uril>

+

diff --git a/org.eclipse.om2m.flexcontainer.service/src/main/java/org/eclipse/om2m/flexcontainer/service/FlexContainerService.java b/org.eclipse.om2m.flexcontainer.service/src/main/java/org/eclipse/om2m/flexcontainer/service/FlexContainerService.java
index b0df469..6904249 100644
--- a/org.eclipse.om2m.flexcontainer.service/src/main/java/org/eclipse/om2m/flexcontainer/service/FlexContainerService.java
+++ b/org.eclipse.om2m.flexcontainer.service/src/main/java/org/eclipse/om2m/flexcontainer/service/FlexContainerService.java
@@ -8,6 +8,7 @@
 package org.eclipse.om2m.flexcontainer.service;

 

 import java.util.List;

+import java.util.Map;

 

 import org.eclipse.om2m.commons.exceptions.Om2mException;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

@@ -25,6 +26,15 @@
 	public String getCustomAttributeValue(String customAttributeName) throws Om2mException;

 

 	/**

+	 * Get the most updated values of a list of custom attributes

+	 * 

+	 * @param customAttributeNames

+	 *            name of the custom attributes

+	 * @return the most updated values of the custom attributes

+	 */

+	public Map<String, String> getCustomAttributeValues(List<String> customAttributeNames) throws Om2mException;

+

+	/**

 	 * Set a new value for a customAttribute

 	 * 

 	 * @param customAttributes

diff --git a/org.eclipse.om2m.ipe.sample.sdt/src/main/java/org/eclipse/om2m/ipe/sample/sdt/model/Lamp.java b/org.eclipse.om2m.ipe.sample.sdt/src/main/java/org/eclipse/om2m/ipe/sample/sdt/model/Lamp.java
index 98b8ef9..d0b5259 100644
--- a/org.eclipse.om2m.ipe.sample.sdt/src/main/java/org/eclipse/om2m/ipe/sample/sdt/model/Lamp.java
+++ b/org.eclipse.om2m.ipe.sample.sdt/src/main/java/org/eclipse/om2m/ipe/sample/sdt/model/Lamp.java
@@ -15,6 +15,7 @@
 import org.eclipse.om2m.sdt.home.devices.Light;
 import org.eclipse.om2m.sdt.home.driver.Utils;
 import org.eclipse.om2m.sdt.home.modules.ColourSaturation;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 
@@ -32,7 +33,7 @@
 		addModule(new SampleColour("colour_" + id, domain));
 
 		addModule(new ColourSaturation("colourSaturation_" + id, domain, 
-			new IntegerDataPoint("colourSaturation") {
+			new IntegerDataPoint(DatapointType.colourSat) {
 				private Integer v = new Integer((int)(Math.random() * 100));
 				@Override
 				public void doSetValue(Integer value) throws DataPointException {
diff --git a/org.eclipse.om2m.ipe.sample.sdt/src/main/java/org/eclipse/om2m/ipe/sample/sdt/model/SampleBinarySwitch.java b/org.eclipse.om2m.ipe.sample.sdt/src/main/java/org/eclipse/om2m/ipe/sample/sdt/model/SampleBinarySwitch.java
index e29457e..76ea070 100644
--- a/org.eclipse.om2m.ipe.sample.sdt/src/main/java/org/eclipse/om2m/ipe/sample/sdt/model/SampleBinarySwitch.java
+++ b/org.eclipse.om2m.ipe.sample.sdt/src/main/java/org/eclipse/om2m/ipe/sample/sdt/model/SampleBinarySwitch.java
@@ -15,14 +15,13 @@
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
 import org.eclipse.om2m.sdt.home.actions.Toggle;
 import org.eclipse.om2m.sdt.home.modules.BinarySwitch;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 
 public class SampleBinarySwitch extends BinarySwitch {
-	
-//	priva
 
 	public SampleBinarySwitch(String name, Domain domain) {
 		super(name, domain,
-			new BooleanDataPoint("powerState") {
+			new BooleanDataPoint(DatapointType.powerState) {
 				private Boolean powerState = Boolean.FALSE;
 				@Override
 				public void doSetValue(Boolean value) throws DataPointException {
@@ -52,7 +51,7 @@
 	public void setPowerState(boolean v) throws DataPointException, AccessException {
 		super.setPowerState(v);
 		Event evt = new Event("SWITCH " + getOwner().getId());
-		evt.addDataPoint(getDataPoint("powerState"));
+		evt.addDataPoint(getDataPointByShortName(DatapointType.powerState.getShortName()));
 		evt.setValue(v);
 		addEvent(evt);
 	}
diff --git a/org.eclipse.om2m.ipe.sample.sdt/src/main/java/org/eclipse/om2m/ipe/sample/sdt/model/SampleColour.java b/org.eclipse.om2m.ipe.sample.sdt/src/main/java/org/eclipse/om2m/ipe/sample/sdt/model/SampleColour.java
index 8c8e5ff..12c94d6 100644
--- a/org.eclipse.om2m.ipe.sample.sdt/src/main/java/org/eclipse/om2m/ipe/sample/sdt/model/SampleColour.java
+++ b/org.eclipse.om2m.ipe.sample.sdt/src/main/java/org/eclipse/om2m/ipe/sample/sdt/model/SampleColour.java
@@ -13,13 +13,14 @@
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
 import org.eclipse.om2m.sdt.home.modules.Colour;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 
 public class SampleColour extends Colour {
 
 	public SampleColour(String name, Domain domain) {
 		// Default color: yellow (rgb: 255,255,0)
 		super(name, domain,
-			new IntegerDataPoint("red") {
+			new IntegerDataPoint(DatapointType.red) {
 				private Integer v = 255;
 				@Override
 				public void doSetValue(Integer value) throws DataPointException {
@@ -30,7 +31,7 @@
 					return v;
 				}
 			}, 
-			new IntegerDataPoint("green") {
+			new IntegerDataPoint(DatapointType.green) {
 				private Integer v = 255;
 				@Override
 				public void doSetValue(Integer value) throws DataPointException {
@@ -41,7 +42,7 @@
 					return v;
 				}
 			}, 
-			new IntegerDataPoint("blue") {
+			new IntegerDataPoint(DatapointType.blue) {
 				private Integer v = 0;
 				@Override
 				public void doSetValue(Integer value) throws DataPointException {
@@ -60,7 +61,7 @@
 		super.setRed(v);
 		if (old != v) {
 			Event evt = new Event("Set RED " + getOwner().getId());
-			evt.addDataPoint(getDataPoint("red"));
+			evt.addDataPoint(getDataPointByShortName(DatapointType.red.getShortName()));
 			evt.setValue(v);
 			addEvent(evt);
 		}
@@ -71,7 +72,7 @@
 		super.setGreen(v);
 		if (old != v) {
 			Event evt = new Event("Set GREEN " + getOwner().getId());
-			evt.addDataPoint(getDataPoint("green"));
+			evt.addDataPoint(getDataPointByShortName(DatapointType.green.getShortName()));
 			evt.setValue(v);
 			addEvent(evt);
 		}
@@ -82,7 +83,7 @@
 		super.setBlue(v);
 		if (old != v) {
 			Event evt = new Event("Set BLUE " + getOwner().getId());
-			evt.addDataPoint(getDataPoint("blue"));
+			evt.addDataPoint(getDataPointByShortName(DatapointType.blue.getShortName()));
 			evt.setValue(v);
 			addEvent(evt);
 		}
diff --git a/org.eclipse.om2m.ipe.sample/src/main/java/org/eclipse/om2m/ipe/sample/RequestSender.java b/org.eclipse.om2m.ipe.sample/src/main/java/org/eclipse/om2m/ipe/sample/RequestSender.java
index 938f912..3a61bb8 100644
--- a/org.eclipse.om2m.ipe.sample/src/main/java/org/eclipse/om2m/ipe/sample/RequestSender.java
+++ b/org.eclipse.om2m.ipe.sample/src/main/java/org/eclipse/om2m/ipe/sample/RequestSender.java
@@ -40,7 +40,7 @@
 	 */
 	private RequestSender(){}
 	
-	public static ResponsePrimitive createResource(String targetId, String name, Resource resource, int resourceType){
+	public static ResponsePrimitive createResource(String targetId, Resource resource, int resourceType){
 		RequestPrimitive request = new RequestPrimitive();
 		request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
 		request.setTargetId(targetId);
@@ -48,26 +48,22 @@
 		request.setRequestContentType(MimeMediaType.OBJ);
 		request.setReturnContentType(MimeMediaType.OBJ);
 		request.setContent(resource);
-		request.setName(name);
 		request.setOperation(Operation.CREATE);
 		return SampleController.CSE.doRequest(request);
 	}
 	
-	public static ResponsePrimitive createAE(AE resource, String name){
-		return createResource("/" + Constants.CSE_ID, name, resource, ResourceType.AE);
+	public static ResponsePrimitive createAE(AE resource){
+		return createResource("/" + Constants.CSE_ID, resource, ResourceType.AE);
 	}
 	
-	public static ResponsePrimitive createContainer(String targetId, String name, Container resource){
-		return createResource(targetId, name, resource, ResourceType.CONTAINER);
-	}
-	
-	public static ResponsePrimitive createContentInstance(String targetId, String name, ContentInstance resource){
-		return createResource(targetId, name, resource, ResourceType.CONTENT_INSTANCE);
+	public static ResponsePrimitive createContainer(String targetId, Container resource){
+		return createResource(targetId, resource, ResourceType.CONTAINER);
 	}
 	
 	public static ResponsePrimitive createContentInstance(String targetId, ContentInstance resource){
-		return createContentInstance(targetId, null, resource);
+		return createResource(targetId, resource, ResourceType.CONTENT_INSTANCE);
 	}
+	
 
 	public static ResponsePrimitive getRequest(String targetId){
 		RequestPrimitive request = new RequestPrimitive();
diff --git a/org.eclipse.om2m.ipe.sample/src/main/java/org/eclipse/om2m/ipe/sample/controller/LifeCycleManager.java b/org.eclipse.om2m.ipe.sample/src/main/java/org/eclipse/om2m/ipe/sample/controller/LifeCycleManager.java
index c514249..1a77712 100644
--- a/org.eclipse.om2m.ipe.sample/src/main/java/org/eclipse/om2m/ipe/sample/controller/LifeCycleManager.java
+++ b/org.eclipse.om2m.ipe.sample/src/main/java/org/eclipse/om2m/ipe/sample/controller/LifeCycleManager.java
@@ -87,21 +87,25 @@
 		Container container = new Container();
 		container.getLabels().add("lamp");
 		container.setMaxNrOfInstances(BigInteger.valueOf(0));
+		
 
 		AE ae = new AE();
 		ae.setRequestReachability(true);
 		ae.getPointOfAccess().add(poa);
 		ae.setAppID(appId);
+		ae.setName(appId);
 
-		ResponsePrimitive response = RequestSender.createAE(ae, appId);
+		ResponsePrimitive response = RequestSender.createAE(ae);
 		// Create Application sub-resources only if application not yet created
 		if(response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {
 			container = new Container();
 			container.setMaxNrOfInstances(BigInteger.valueOf(10));
 			// Create DESCRIPTOR container sub-resource
-			LOGGER.info(RequestSender.createContainer(response.getLocation(), SampleConstants.DESC, container));
+			container.setName(SampleConstants.DESC);
+			LOGGER.info(RequestSender.createContainer(response.getLocation(), container));
 			// Create STATE container sub-resource
-			LOGGER.info(RequestSender.createContainer(response.getLocation(), SampleConstants.DATA, container));
+			container.setName(SampleConstants.DATA);
+			LOGGER.info(RequestSender.createContainer(response.getLocation(), container));
 
 			String content;
 			// Create DESCRIPTION contentInstance on the DESCRIPTOR container resource
@@ -110,13 +114,13 @@
 			contentInstance.setContent(content);
 			contentInstance.setContentInfo(MimeMediaType.OBIX);
 			RequestSender.createContentInstance(
-					SampleConstants.CSE_PREFIX + "/" + appId + "/" + SampleConstants.DESC, null, contentInstance);
+					SampleConstants.CSE_PREFIX + "/" + appId + "/" + SampleConstants.DESC, contentInstance);
 
 			// Create initial contentInstance on the STATE container resource
 			content = ObixUtil.getStateRep(appId, initValue);
 			contentInstance.setContent(content);
 			RequestSender.createContentInstance(
-					SampleConstants.CSE_PREFIX + "/" + appId + "/" + SampleConstants.DATA, null, contentInstance);
+					SampleConstants.CSE_PREFIX + "/" + appId + "/" + SampleConstants.DATA, contentInstance);
 		}
 	}
 
@@ -130,20 +134,22 @@
 		ae.setRequestReachability(true);
 		ae.getPointOfAccess().add(poa);
 		ae.setAppID("LAMP_ALL");
-		ResponsePrimitive response = RequestSender.createAE(ae, "LAMP_ALL");
+		ae.setName("LAMP_ALL");
+		ResponsePrimitive response = RequestSender.createAE(ae);
 
 		// Create descriptor container if not yet created
 		if(response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)){
 			// Creation of the DESCRIPTOR container
 			Container cnt = new Container();
 			cnt.setMaxNrOfInstances(BigInteger.valueOf(10));
-			RequestSender.createContainer(SampleConstants.CSE_PREFIX + "/" + "LAMP_ALL", SampleConstants.DESC, cnt);
+			cnt.setName(SampleConstants.DESC);
+			RequestSender.createContainer(SampleConstants.CSE_PREFIX + "/" + "LAMP_ALL", cnt);
 
 			// Create the description
 			ContentInstance cin = new ContentInstance();
 			cin.setContent(ObixUtil.createLampAllDescriptor());
 			cin.setContentInfo(MimeMediaType.OBIX);
-			RequestSender.createContentInstance(SampleConstants.CSE_PREFIX + "/" + "LAMP_ALL" + "/" + SampleConstants.DESC, null, cin);
+			RequestSender.createContentInstance(SampleConstants.CSE_PREFIX + "/" + "LAMP_ALL" + "/" + SampleConstants.DESC, cin);
 		}
 	}
 
diff --git a/org.eclipse.om2m.ipe.sample/src/main/java/org/eclipse/om2m/ipe/sample/controller/SampleController.java b/org.eclipse.om2m.ipe.sample/src/main/java/org/eclipse/om2m/ipe/sample/controller/SampleController.java
index c9b5615..ea73f57 100644
--- a/org.eclipse.om2m.ipe.sample/src/main/java/org/eclipse/om2m/ipe/sample/controller/SampleController.java
+++ b/org.eclipse.om2m.ipe.sample/src/main/java/org/eclipse/om2m/ipe/sample/controller/SampleController.java
@@ -40,7 +40,7 @@
 		ContentInstance cin = new ContentInstance();
 		cin.setContent(ObixUtil.getStateRep(lampId, value));
 		cin.setContentInfo(MimeMediaType.OBIX + ":" + MimeMediaType.ENCOD_PLAIN);
-		RequestSender.createContentInstance(targetID, null, cin);
+		RequestSender.createContentInstance(targetID, cin);
 	}
 	
 	public static String getFormatedLampState(String lampId){
diff --git a/org.eclipse.om2m.ipe.sdt.testsuite/META-INF/MANIFEST.MF b/org.eclipse.om2m.ipe.sdt.testsuite/META-INF/MANIFEST.MF
index c0c364d..4db749e 100644
--- a/org.eclipse.om2m.ipe.sdt.testsuite/META-INF/MANIFEST.MF
+++ b/org.eclipse.om2m.ipe.sdt.testsuite/META-INF/MANIFEST.MF
@@ -11,6 +11,7 @@
  javax.servlet.http,
  org.eclipse.om2m.commons.constants,
  org.eclipse.om2m.commons.resource,
+ org.eclipse.om2m.commons.resource.flexcontainerspec,
  org.eclipse.om2m.core.service,
  org.eclipse.om2m.datamapping.service,
  org.eclipse.om2m.sdt,
diff --git a/org.eclipse.om2m.ipe.sdt.testsuite/pom.xml b/org.eclipse.om2m.ipe.sdt.testsuite/pom.xml
index c631f42..3290c80 100644
--- a/org.eclipse.om2m.ipe.sdt.testsuite/pom.xml
+++ b/org.eclipse.om2m.ipe.sdt.testsuite/pom.xml
@@ -20,6 +20,7 @@
 	</parent>
   
 	<artifactId>org.eclipse.om2m.ipe.sdt.testsuite</artifactId>
+	<name>org.eclipse.om2m :: IPE SDT Test Suite</name>
 	<description>SDT IPE Test Suite</description>
 	<packaging>eclipse-plugin</packaging>
 
diff --git a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/Activator.java b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/Activator.java
index b2acaae..b0018d8 100644
--- a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/Activator.java
+++ b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/Activator.java
@@ -75,7 +75,7 @@
 		try {

 //			DeviceDiscoveryTestSuite deviceDiscoveryTestSuite = new DeviceDiscoveryTestSuite(bundleContext, cseService);

 			

-			SDTModuleTestSuite moduleTestSuite = new SDTModuleTestSuite(bundleContext, cseService);

+//			SDTModuleTestSuite moduleTestSuite = new SDTModuleTestSuite(bundleContext, cseService);

 			

 			subscriptionTestSuite = new SubscriptionTestSuite(bundleContext, cseService);

 		} catch (Exception e) {

diff --git a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/CSEUtil.java b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/CSEUtil.java
index 723fd2d..1cab2e0 100644
--- a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/CSEUtil.java
+++ b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/CSEUtil.java
@@ -15,8 +15,8 @@
 import org.eclipse.om2m.commons.constants.MimeMediaType;

 import org.eclipse.om2m.commons.constants.Operation;

 import org.eclipse.om2m.commons.constants.ResourceType;

+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;

 import org.eclipse.om2m.commons.resource.FilterCriteria;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.RequestPrimitive;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

 import org.eclipse.om2m.commons.resource.Subscription;

@@ -37,7 +37,7 @@
 		

 	}

 	

-	public static ResponsePrimitive updateFlexContainerEntity(CseService cseService, String flexContainerLocation, FlexContainer flexContainer) {

+	public static ResponsePrimitive updateFlexContainerEntity(CseService cseService, String flexContainerLocation, AbstractFlexContainer flexContainer) {

 		RequestPrimitive request = new RequestPrimitive();

 		request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);

 		request.setRequestContentType(MimeMediaType.OBJ);

@@ -66,7 +66,7 @@
 		return cseService.doRequest(request);

 	}

 	

-	public static ResponsePrimitive createSubscription(final CseService cseService, final Subscription subscription, final String subscriptionLocation, final String subscriptionName) {

+	public static ResponsePrimitive createSubscription(final CseService cseService, final Subscription subscription, final String subscriptionLocation) {

 		RequestPrimitive request = new RequestPrimitive();

 		request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);

 		request.setRequestContentType(MimeMediaType.OBJ);

@@ -75,7 +75,6 @@
 		request.setContent(subscription);

 		request.setTo(subscriptionLocation);

 		request.setResourceType(ResourceType.SUBSCRIPTION);

-		request.setName(subscriptionName);

 		

 		return cseService.doRequest(request);

 	}

diff --git a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/DeviceDiscoveryTestSuite.java b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/DeviceDiscoveryTestSuite.java
index 8ff7619..88e929f 100644
--- a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/DeviceDiscoveryTestSuite.java
+++ b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/DeviceDiscoveryTestSuite.java
@@ -12,9 +12,10 @@
 import java.util.Random;

 

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.FlexContainerFactory;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.sdt.Action;

 import org.eclipse.om2m.sdt.DataPoint;

@@ -98,7 +99,7 @@
 			return;

 		}

 

-		FlexContainer deviceFlexContainer = (FlexContainer) response.getContent();

+		AbstractFlexContainer deviceFlexContainer = (AbstractFlexContainer) response.getContent();

 

 		if (!checkName(deviceFlexContainer, DEVICE_PREFIX + device.getId())) {

 			System.out.println("invalid name");

@@ -135,7 +136,7 @@
 		System.out.println("checkDevice(" + device.getId() + "," + device.getName() + "): OK");

 	}

 

-	private boolean checkName(FlexContainer flexContainer, String expectedName) {

+	private boolean checkName(AbstractFlexContainer flexContainer, String expectedName) {

 		System.out.println("checkName(expectedName=" + expectedName + ", currentName=" + flexContainer.getName() + ")");

 		if ((expectedName == null) && (flexContainer.getName() != null)) {

 			return false;

@@ -144,7 +145,7 @@
 		return expectedName.equals(flexContainer.getName());

 	}

 

-	private boolean checkContainerDefinition(FlexContainer flexContainer, String expectedContainerDefinition) {

+	private boolean checkContainerDefinition(AbstractFlexContainer flexContainer, String expectedContainerDefinition) {

 		System.out.println("checkContainerDefinition(expectedContainerDefinition=" + expectedContainerDefinition

 				+ ", currentContainerDefinition=" + flexContainer.getContainerDefinition() + ")");

 		if ((expectedContainerDefinition == null) && (flexContainer.getContainerDefinition() != null)) {

@@ -154,7 +155,7 @@
 		return expectedContainerDefinition.equals(flexContainer.getContainerDefinition());

 	}

 

-	private boolean checkCustomAttribute(FlexContainer flexContainer, String attributeName, String attributeValue) {

+	private boolean checkCustomAttribute(AbstractFlexContainer flexContainer, String attributeName, String attributeValue) {

 		System.out.println("checkCustomAttribute(name=" + attributeName + ", expectedValue=" + attributeValue + ")");

 

 		CustomAttribute customAttribute = flexContainer.getCustomAttribute(attributeName);

@@ -194,7 +195,7 @@
 			return false;

 		}

 

-		FlexContainer moduleFlexContainer = (FlexContainer) response.getContent();

+		AbstractFlexContainer moduleFlexContainer = (AbstractFlexContainer) response.getContent();

 

 		if (!checkName(moduleFlexContainer, module.getName())) {

 			System.out.println("invalid module name");

@@ -208,7 +209,7 @@
 

 		// check module properties

 

-		FlexContainer moduleClassPropertyFlexContainer = (FlexContainer) response.getContent();

+		AbstractFlexContainer moduleClassPropertyFlexContainer = (AbstractFlexContainer) response.getContent();

 		for (Property property : module.getProperties()) {

 			if (!checkCustomAttribute(moduleClassPropertyFlexContainer, property.getName(), property.getValue())) {

 				System.out.println("invalid customProperty (" + property.getName() + ")");

@@ -295,11 +296,9 @@
 

 		if (newValue != null) {

 			// set new value through the ipe

-			FlexContainer updateFc = new FlexContainer();

+			AbstractFlexContainer updateFc = FlexContainerFactory.getSpecializationFlexContainer(module.getShortDefinitionName());

 			CustomAttribute dataPointCA = new CustomAttribute();

 			dataPointCA.setCustomAttributeName(dataPoint.getName());

-			dataPointCA

-					.setCustomAttributeType("xs:" + ((SimpleType) dataPoint.getDataType().getTypeChoice()).getType());

 			dataPointCA.setCustomAttributeValue(newValue);

 			updateFc.getCustomAttributes().add(dataPointCA);

 

@@ -349,7 +348,7 @@
 			System.out.println("invalid response status code: " + response.getResponseStatusCode());

 			return false;

 		}

-		FlexContainer actionFlexContainer = (FlexContainer) response.getContent();

+		AbstractFlexContainer actionFlexContainer = (AbstractFlexContainer) response.getContent();

 

 		if (!checkContainerDefinition(actionFlexContainer, action.getDefinition())) {

 			System.out.println("invalid container definition, expected:" + action.getDefinition() + ", found:"

@@ -371,12 +370,11 @@
 		}

 

 		// execute action

-		FlexContainer executionFlexContainer = new FlexContainer();

+		AbstractFlexContainer executionFlexContainer = FlexContainerFactory.getSpecializationFlexContainer(actionFlexContainer.getShortName());

 		for (String name : action.getArgNames()) {

 			CustomAttribute ca = new CustomAttribute();

 			executionFlexContainer.getCustomAttributes().add(ca);

 			ca.setCustomAttributeName(name);

-			ca.setCustomAttributeType("xs:" + action.getArg(name).getDataType().getName());

 			ca.setCustomAttributeValue("12");

 		}

 		response = CSEUtil.updateFlexContainerEntity(cseService, actionLocation, executionFlexContainer);

@@ -400,7 +398,7 @@
 			System.out.println("invalid response status code: " + response.getResponseStatusCode());

 			return false;

 		}

-		FlexContainer dataPointFlexContainer = (FlexContainer) response.getContent();

+		AbstractFlexContainer dataPointFlexContainer = (AbstractFlexContainer) response.getContent();

 

 		if (!checkContainerDefinition(dataPointFlexContainer, "org.onem2m.home.datapoint")) {

 			System.out.println("invalid container definition");

@@ -436,10 +434,9 @@
 		}

 

 		// update

-		FlexContainer flexContainerToBeUpdated = new FlexContainer();

+		AbstractFlexContainer flexContainerToBeUpdated = FlexContainerFactory.getSpecializationFlexContainer(dataPointFlexContainer.getShortName());

 		CustomAttribute value = new CustomAttribute();

 		value.setCustomAttributeName("value");

-		value.setCustomAttributeType("xs:string");

 		String typedRandomValue = randomValue(dataPoint.getDataType().getName());

 		value.setCustomAttributeValue(typedRandomValue);

 		flexContainerToBeUpdated.getCustomAttributes().add(value);

diff --git a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/SDTModuleTestSuite.java b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/SDTModuleTestSuite.java
index 4a47b75..d23cc40 100644
--- a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/SDTModuleTestSuite.java
+++ b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/SDTModuleTestSuite.java
@@ -85,11 +85,9 @@
 		switch (moduleDefinition) {

 		case "org.onem2m.home.moduleclass.binarySwitch":

 			amt = new BinarySwitchModuleTest(cseService, module);

-			

 			break;

 		case "org.onem2m.home.moduleclass.smokeSensor":

 			amt = new SmokeSensorModuleTest(cseService, module);

-			

 			break;

 		case "org.onem2m.home.moduleclass.colourSaturation":

 			amt = new ColourSaturationModuleTest(cseService, module);

@@ -121,11 +119,12 @@
 			List<TestReport> tests = amt.launchTests();

 			testReports.addAll(tests);

 		} else {

-			TestReport report = null;

-			report = new TestReport("missing ModuleTest");

-			report.setErrorMessage("missing TestModule for module " + module.getDefinition());

-			report.setState(State.KO);

-			testReports.add(report);

+			return;

+//			TestReport report = null;

+//			report = new TestReport("missing ModuleTest");

+//			report.setErrorMessage("missing TestModule for module " + module.getDefinition());

+//			report.setState(State.KO);

+//			testReports.add(report);

 		}

 		

 

diff --git a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/AlarmSpeakerModuleTest.java b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/AlarmSpeakerModuleTest.java
index ef165a0..0706ce4 100644
--- a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/AlarmSpeakerModuleTest.java
+++ b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/AlarmSpeakerModuleTest.java
@@ -9,8 +9,8 @@
 

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.AlarmSpeakerFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.ipe.sdt.testsuite.CSEUtil;

 import org.eclipse.om2m.ipe.sdt.testsuite.TestReport;

@@ -19,6 +19,7 @@
 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;

 import org.eclipse.om2m.sdt.datapoints.EnumDataPoint;

 import org.eclipse.om2m.sdt.home.types.AlertColourCode;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

 import org.eclipse.om2m.sdt.exceptions.AccessException;

 import org.eclipse.om2m.sdt.exceptions.DataPointException;

 

@@ -44,15 +45,15 @@
 			report.setState(State.KO);

 			return report;

 		}

-		FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+		AlarmSpeakerFlexContainer retrievedFlexContainer = (AlarmSpeakerFlexContainer) response.getContent();

 

 		// retrieve tone customAttribute

-		CustomAttribute toneCA = retrievedFlexContainer.getCustomAttribute("tone");

+		CustomAttribute toneCA = retrievedFlexContainer.getCustomAttribute(DatapointType.tone.getShortName());

 

 		// tone is optional

 		if (toneCA == null) {

 			// tone datapoint should not exist

-			if (getModule().getDataPoint("tone") != null) {

+			if (getModule().getDataPoint(DatapointType.tone.getShortName()) != null) {

 				report.setErrorMessage("tone customAttribute does not exist whereas tone Datapoint exists");

 				report.setState(State.KO);

 				return report;

@@ -70,7 +71,7 @@
 				return report;

 			}

 

-			EnumDataPoint<Integer> toneDP = (EnumDataPoint<Integer>) getModule().getDataPoint("tone");

+			EnumDataPoint<Integer> toneDP = (EnumDataPoint<Integer>) getModule().getDataPoint(DatapointType.tone.getShortName());

 			Integer toneValueFromDP = null;

 			try {

 				toneValueFromDP = toneDP.getValue();

@@ -81,7 +82,7 @@
 			}

 

 			// check value between flexContainer and DP

-			if (!checkObject(toneValueFromFlexContainer, toneValueFromDP, report, "tone")) {

+			if (!checkObject(toneValueFromFlexContainer, toneValueFromDP, report, DatapointType.tone.getShortName())) {

 				report.setErrorMessage("tone value from DataPoint and tone value from FlexContainer are different");

 				report.setState(State.KO);

 				return report;

@@ -101,11 +102,11 @@
 		}

 

 		CustomAttribute toneCA;

-		FlexContainer toBeUpdated;

+		AlarmSpeakerFlexContainer toBeUpdated;

 		ResponsePrimitive response;

 

 		// retrieve tone datapoint

-		EnumDataPoint<Integer> toneDP = (EnumDataPoint<Integer>) getModule().getDataPoint("tone");

+		EnumDataPoint<Integer> toneDP = (EnumDataPoint<Integer>) getModule().getDataPoint(DatapointType.tone.getShortName());

 		if (toneDP != null) {

 			// tone datapoint exist

 

@@ -131,12 +132,11 @@
 

 			// set toneCA

 			toneCA = new CustomAttribute();

-			toneCA.setCustomAttributeName("tone");

-			toneCA.setCustomAttributeType("hd:tone");

+			toneCA.setCustomAttributeName(DatapointType.tone.getShortName());

 			toneCA.setCustomAttributeValue(possibleValue.toString());

 

 			// flexcontainer

-			toBeUpdated = new FlexContainer();

+			toBeUpdated = new AlarmSpeakerFlexContainer();

 			toBeUpdated.getCustomAttributes().add(toneCA);

 

 			// perform UPDATE request

@@ -167,12 +167,11 @@
 

 			// set toneCA

 			toneCA = new CustomAttribute();

-			toneCA.setCustomAttributeName("tone");

-			toneCA.setCustomAttributeType("hd:tone");

+			toneCA.setCustomAttributeName(DatapointType.tone.getShortName());

 			toneCA.setCustomAttributeValue("1"); // fire

 

 			// flexcontainer

-			toBeUpdated = new FlexContainer();

+			toBeUpdated = new AlarmSpeakerFlexContainer();

 			toBeUpdated.getCustomAttributes().add(toneCA);

 

 			// perform UPDATE request

@@ -204,10 +203,10 @@
 			report.setState(State.KO);

 			return report;

 		}

-		FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+		AlarmSpeakerFlexContainer retrievedFlexContainer = (AlarmSpeakerFlexContainer) response.getContent();

 

 		// get alarmStatus customAttribute

-		CustomAttribute alarmStatusCA = retrievedFlexContainer.getCustomAttribute("alarmStatus");

+		CustomAttribute alarmStatusCA = retrievedFlexContainer.getCustomAttribute(DatapointType.alarmStatus.getShortName());

 

 		if (alarmStatusCA == null) {

 			if (getModule().getDataPoint("alarmStatus") != null) {

@@ -219,7 +218,7 @@
 			}

 		} else {

 			// retrieve alarmStatus datapoint value

-			BooleanDataPoint alarmStatusDP = (BooleanDataPoint) getModule().getDataPoint("alarmStatus");

+			BooleanDataPoint alarmStatusDP = (BooleanDataPoint) getModule().getDataPoint(DatapointType.alarmStatus.getShortName());

 			Boolean alarmStatusValueFromDP = null;

 			try {

 				alarmStatusValueFromDP = alarmStatusDP.getValue();

@@ -232,7 +231,7 @@
 			// retrieve alarmStatus value from FlexContainer

 			Boolean alarmStatusValueFromFlexContainer = Boolean.valueOf(alarmStatusCA.getCustomAttributeValue());

 

-			if (!checkObject(alarmStatusValueFromDP, alarmStatusValueFromFlexContainer, report, "alarmStatus")) {

+			if (!checkObject(alarmStatusValueFromDP, alarmStatusValueFromFlexContainer, report, DatapointType.alarmStatus.getShortName())) {

 				return report;

 			}

 

@@ -251,7 +250,7 @@
 		// at this point, we are sure the module FlexContainer exist

 

 		// retrieve alarmStatus datapoint

-		BooleanDataPoint alarmStatusDP = (BooleanDataPoint) getModule().getDataPoint("alarmStatus");

+		BooleanDataPoint alarmStatusDP = (BooleanDataPoint) getModule().getDataPoint(DatapointType.alarmStatus.getShortName());

 

 		// retrieve current alarmStatus value from datapoint

 		Boolean alarmStatusValueFromDP = null;

@@ -268,10 +267,9 @@
 

 		// prepare request

 		CustomAttribute alarmStatusCA = new CustomAttribute();

-		alarmStatusCA.setCustomAttributeName("alarmStatus");

-		alarmStatusCA.setCustomAttributeType("xs:boolean");

+		alarmStatusCA.setCustomAttributeName(DatapointType.alarmStatus.getShortName());

 		alarmStatusCA.setCustomAttributeValue(newAlarmStatusValue.toString());

-		FlexContainer toBeUpdated = new FlexContainer();

+		AlarmSpeakerFlexContainer toBeUpdated = new AlarmSpeakerFlexContainer();

 		toBeUpdated.getCustomAttributes().add(alarmStatusCA);

 

 		// send UPDATE request

@@ -292,7 +290,7 @@
 		}

 

 		// check value

-		if (!checkObject(alarmStatusValueFromDP, newAlarmStatusValue, report, "alarmStatus")) {

+		if (!checkObject(alarmStatusValueFromDP, newAlarmStatusValue, report, DatapointType.alarmStatus.getShortName())) {

 			return report;

 		}

 

@@ -310,7 +308,7 @@
 		// at this point, we are sure the module FlexContainer exist

 

 		// retrieve light datapoint

-		AlertColourCode lightDP = (AlertColourCode) getModule().getDataPoint("light");

+		AlertColourCode lightDP = (AlertColourCode) getModule().getDataPoint(DatapointType.light.getShortName());

 		if (lightDP != null) {

 

 			Integer lightValueFromDP = null;

@@ -329,10 +327,10 @@
 				report.setState(State.KO);

 				return report;

 			}

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			AlarmSpeakerFlexContainer retrievedFlexContainer = (AlarmSpeakerFlexContainer) response.getContent();

 

 			// retrieve light customAttribute

-			CustomAttribute lightCA = retrievedFlexContainer.getCustomAttribute("light");

+			CustomAttribute lightCA = retrievedFlexContainer.getCustomAttribute(DatapointType.light.getShortName());

 			if (lightCA == null) {

 				report.setErrorMessage("no light customAttribute but light datapoint exists");

 				report.setState(State.KO);

@@ -350,7 +348,7 @@
 				return report;

 			}

 

-			if (!checkObject(lightValueFromDP, lightValueFromFlexContainer, report, "light")) {

+			if (!checkObject(lightValueFromDP, lightValueFromFlexContainer, report, DatapointType.light.getShortName())) {

 				return report;

 			}

 

@@ -364,10 +362,10 @@
 				report.setState(State.KO);

 				return report;

 			}

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			AlarmSpeakerFlexContainer retrievedFlexContainer = (AlarmSpeakerFlexContainer) response.getContent();

 

 			// retrieve light customAttribute

-			CustomAttribute lightCA = retrievedFlexContainer.getCustomAttribute("light");

+			CustomAttribute lightCA = retrievedFlexContainer.getCustomAttribute(DatapointType.light.getShortName());

 			if (lightCA != null) {

 				report.setErrorMessage("no light datapoint but light customAttribute exists");

 				report.setState(State.KO);

@@ -389,7 +387,7 @@
 		// at this point, we are sure the module FlexContainer exist

 

 		// retrieve light datapoint

-		AlertColourCode lightDP = (AlertColourCode) getModule().getDataPoint("light");

+		AlertColourCode lightDP = (AlertColourCode) getModule().getDataPoint(DatapointType.light.getShortName());

 		if (lightDP != null) {

 			// light datapoint exist

 

@@ -408,10 +406,9 @@
 			Integer newLightValue = (lightValueFromDP.intValue() == 1 ? 2 : 1);

 

 			// prepare request

-			FlexContainer toBeUpdated = new FlexContainer();

+			AlarmSpeakerFlexContainer toBeUpdated = new AlarmSpeakerFlexContainer();

 			CustomAttribute lightCA = new CustomAttribute();

-			lightCA.setCustomAttributeName("light");

-			lightCA.setCustomAttributeType("xs:enum");

+			lightCA.setCustomAttributeName(DatapointType.light.getShortName());

 			lightCA.setCustomAttributeValue(newLightValue.toString());

 			toBeUpdated.getCustomAttributes().add(lightCA);

 

@@ -434,7 +431,7 @@
 				return report;

 			}

 

-			if (!checkObject(lightValueFromDP, newLightValue, report, "light")) {

+			if (!checkObject(lightValueFromDP, newLightValue, report, DatapointType.light.getShortName())) {

 				return report;

 			}

 

@@ -442,10 +439,9 @@
 			// light datapoint does not exist

 			

 			// prepare request

-			FlexContainer toBeUpdated = new FlexContainer();

+			AlarmSpeakerFlexContainer toBeUpdated = new AlarmSpeakerFlexContainer();

 			CustomAttribute lightCA = new CustomAttribute();

-			lightCA.setCustomAttributeName("light");

-			lightCA.setCustomAttributeType("xs:enum");

+			lightCA.setCustomAttributeName(DatapointType.light.getShortName());

 			lightCA.setCustomAttributeValue(Integer.valueOf(AlertColourCode.Red).toString());

 			toBeUpdated.getCustomAttributes().add(lightCA);

 

diff --git a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/BinarySwitchModuleTest.java b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/BinarySwitchModuleTest.java
index 64436a2..60fcc4d 100644
--- a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/BinarySwitchModuleTest.java
+++ b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/BinarySwitchModuleTest.java
@@ -9,8 +9,8 @@
 

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.BinarySwitchFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.ipe.sdt.testsuite.CSEUtil;

 import org.eclipse.om2m.ipe.sdt.testsuite.TestReport;

@@ -20,6 +20,7 @@
 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;

 import org.eclipse.om2m.sdt.exceptions.AccessException;

 import org.eclipse.om2m.sdt.exceptions.DataPointException;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

 

 public class BinarySwitchModuleTest extends AbstractModuleTest {

 

@@ -50,14 +51,14 @@
 			return report;

 		}

 		// get powerState value

-		FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

-		CustomAttribute powerStateCA = retrievedFlexContainer.getCustomAttribute("powerState");

+		BinarySwitchFlexContainer retrievedFlexContainer = (BinarySwitchFlexContainer) response.getContent();

+		CustomAttribute powerStateCA = retrievedFlexContainer.getCustomAttribute(DatapointType.powerState.getShortName());

 		Boolean powerState = Boolean.parseBoolean(powerStateCA.getCustomAttributeValue());

 		System.out.println("powerState=" + powerState);

 		

 		

 		// set powerState value

-		FlexContainer toBeUpdatedFlexContainer = new FlexContainer();

+		BinarySwitchFlexContainer toBeUpdatedFlexContainer = new BinarySwitchFlexContainer();

 		Boolean newPowerState = new Boolean(!powerState.booleanValue());

 		powerStateCA.setCustomAttributeValue(newPowerState.toString());

 		toBeUpdatedFlexContainer.getCustomAttributes().add(powerStateCA);

@@ -69,7 +70,7 @@
 		}

 		

 		// check new value from Module object

-		BooleanDataPoint powerStateDP = (BooleanDataPoint) getModule().getDataPoint("powerState");

+		BooleanDataPoint powerStateDP = (BooleanDataPoint) getModule().getDataPoint(DatapointType.powerState.getShortName());

 		try {

 			Boolean valueFromModule = powerStateDP.getValue();

 			if (!newPowerState.equals(valueFromModule)) {

@@ -88,8 +89,8 @@
 		}

 		

 		// then retrieve from OM2M tree

-		retrievedFlexContainer = (FlexContainer) response.getContent();

-		powerStateCA = retrievedFlexContainer.getCustomAttribute("powerState");

+		retrievedFlexContainer = (BinarySwitchFlexContainer) response.getContent();

+		powerStateCA = retrievedFlexContainer.getCustomAttribute(DatapointType.powerState.getShortName());

 		Boolean currentPowerStateValue = Boolean.parseBoolean(powerStateCA.getCustomAttributeValue());

 		if (!currentPowerStateValue.equals(newPowerState)) {

 			System.out.println("value from flexContainer (" + currentPowerStateValue + ") is the same as the one set (" + newPowerState +")");

diff --git a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/ColourModuleTest.java b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/ColourModuleTest.java
index 67d5fc8..6f5e98a 100644
--- a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/ColourModuleTest.java
+++ b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/ColourModuleTest.java
@@ -9,8 +9,8 @@
 

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.ColourFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.ipe.sdt.testsuite.CSEUtil;

 import org.eclipse.om2m.ipe.sdt.testsuite.TestReport;

@@ -22,6 +22,8 @@
 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;

 import org.eclipse.om2m.sdt.exceptions.AccessException;

 import org.eclipse.om2m.sdt.exceptions.DataPointException;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

+import org.eclipse.om2m.sdt.home.types.ModuleType;

 

 public class ColourModuleTest extends AbstractModuleTest {

 

@@ -32,7 +34,7 @@
 		Device device = getModule().getOwner();

 		String binarySwitchModuleName = null;

 		for(String moduleName : device.getModuleNames()) {

-			if (moduleName.toLowerCase().contains("binaryswitch")) {

+			if (moduleName.toLowerCase().contains(ModuleType.binarySwitch.getShortName())) {

 				binarySwitchModuleName = moduleName;

 				break;

 			}

@@ -40,7 +42,7 @@
 		

 		if (binarySwitchModuleName != null) {

 			BooleanDataPoint powerStateDP = (BooleanDataPoint) getModule().getOwner().getModule(binarySwitchModuleName)

-					.getDataPoint("powerState");

+					.getDataPoint(DatapointType.powerState.getShortName());

 			try {

 				powerStateDP.setValue(Boolean.TRUE);

 			} catch (DataPointException | AccessException e) {

@@ -70,18 +72,18 @@
 			report.setState(State.KO);

 			return report;

 		}

-		FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

-		CustomAttribute redCA = retrievedFlexContainer.getCustomAttribute("red");

-		CustomAttribute greenCA = retrievedFlexContainer.getCustomAttribute("green");

-		CustomAttribute blueCA = retrievedFlexContainer.getCustomAttribute("blue");

+		ColourFlexContainer retrievedFlexContainer = (ColourFlexContainer) response.getContent();

+		CustomAttribute redCA = retrievedFlexContainer.getCustomAttribute(DatapointType.red.getShortName());

+		CustomAttribute greenCA = retrievedFlexContainer.getCustomAttribute(DatapointType.green.getShortName());

+		CustomAttribute blueCA = retrievedFlexContainer.getCustomAttribute(DatapointType.blue.getShortName());

 		Integer redValueFromFlexContainer = Integer.valueOf(redCA.getCustomAttributeValue());

 		Integer greenValueFromFlexContainer = Integer.valueOf(greenCA.getCustomAttributeValue());

 		Integer blueValueFromFlexContainer = Integer.valueOf(blueCA.getCustomAttributeValue());

 

 		// get value from DataPoint

-		IntegerDataPoint redDP = (IntegerDataPoint) getModule().getDataPoint("red");

-		IntegerDataPoint greenDP = (IntegerDataPoint) getModule().getDataPoint("green");

-		IntegerDataPoint blueDP = (IntegerDataPoint) getModule().getDataPoint("blue");

+		IntegerDataPoint redDP = (IntegerDataPoint) getModule().getDataPoint(DatapointType.red.getShortName());

+		IntegerDataPoint greenDP = (IntegerDataPoint) getModule().getDataPoint(DatapointType.green.getShortName());

+		IntegerDataPoint blueDP = (IntegerDataPoint) getModule().getDataPoint(DatapointType.blue.getShortName());

 

 		Integer redValueFromDP = null;

 		Integer greenValueFromDP = null;

@@ -120,7 +122,7 @@
 		Integer newRedValue = (int) (Math.random()*255d);

 		Integer newGreenValue = (int) (Math.random()*255d);

 		Integer newBlueValue = (int) (Math.random()*255d);

-		FlexContainer toBeUpdated = new FlexContainer();

+		ColourFlexContainer toBeUpdated = new ColourFlexContainer();

 		redCA.setCustomAttributeValue(newRedValue.toString());

 		greenCA.setCustomAttributeValue(newGreenValue.toString());

 		blueCA.setCustomAttributeValue(newBlueValue.toString());

@@ -173,10 +175,10 @@
 			report.setState(State.KO);

 			return report;

 		}

-		retrievedFlexContainer = (FlexContainer) response.getContent();

-		redCA = retrievedFlexContainer.getCustomAttribute("red");

-		greenCA = retrievedFlexContainer.getCustomAttribute("green");

-		blueCA = retrievedFlexContainer.getCustomAttribute("blue");

+		retrievedFlexContainer = (ColourFlexContainer) response.getContent();

+		redCA = retrievedFlexContainer.getCustomAttribute(DatapointType.red.getShortName());

+		greenCA = retrievedFlexContainer.getCustomAttribute(DatapointType.green.getShortName());

+		blueCA = retrievedFlexContainer.getCustomAttribute(DatapointType.blue.getShortName());

 		redValueFromFlexContainer = Integer.valueOf(redCA.getCustomAttributeValue());

 		greenValueFromFlexContainer = Integer.valueOf(greenCA.getCustomAttributeValue());

 		blueValueFromFlexContainer = Integer.valueOf(blueCA.getCustomAttributeValue());

diff --git a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/ColourSaturationModuleTest.java b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/ColourSaturationModuleTest.java
index 42f2d0e..6457b32 100644
--- a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/ColourSaturationModuleTest.java
+++ b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/ColourSaturationModuleTest.java
@@ -9,8 +9,8 @@
 

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.ColourSaturationFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.ipe.sdt.testsuite.CSEUtil;

 import org.eclipse.om2m.ipe.sdt.testsuite.TestReport;

@@ -22,6 +22,8 @@
 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;

 import org.eclipse.om2m.sdt.exceptions.AccessException;

 import org.eclipse.om2m.sdt.exceptions.DataPointException;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

+import org.eclipse.om2m.sdt.home.types.ModuleType;

 

 public class ColourSaturationModuleTest extends AbstractModuleTest {

 

@@ -31,7 +33,7 @@
 		Device device = getModule().getOwner();

 		String binarySwitchModuleName = null;

 		for (String moduleName : device.getModuleNames()) {

-			if (moduleName.toLowerCase().contains("binaryswitch")) {

+			if (moduleName.toLowerCase().contains(ModuleType.binarySwitch.getShortName())) {

 				binarySwitchModuleName = moduleName;

 				break;

 			}

@@ -39,7 +41,7 @@
 

 		if (binarySwitchModuleName != null) {

 			BooleanDataPoint powerStateDP = (BooleanDataPoint) getModule().getOwner().getModule(binarySwitchModuleName)

-					.getDataPoint("powerState");

+					.getDataPoint(DatapointType.powerState.getShortName());

 			try {

 				powerStateDP.setValue(Boolean.TRUE);

 			} catch (DataPointException | AccessException e) {

@@ -70,14 +72,14 @@
 			report.setState(State.KO);

 			return report;

 		}

-		FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+		ColourSaturationFlexContainer retrievedFlexContainer = (ColourSaturationFlexContainer) response.getContent();

 

 		// get colourSaturation custom attribute

-		CustomAttribute colourSaturationCA = retrievedFlexContainer.getCustomAttribute("colourSaturation");

+		CustomAttribute colourSaturationCA = retrievedFlexContainer.getCustomAttribute(DatapointType.colourSat.getShortName());

 		Integer colourSaturationFromFlexContainer = Integer.valueOf(colourSaturationCA.getCustomAttributeValue());

 

 		// get colourSaturation from module

-		IntegerDataPoint colourSaturationDP = (IntegerDataPoint) getModule().getDataPoint("colourSaturation");

+		IntegerDataPoint colourSaturationDP = (IntegerDataPoint) getModule().getDataPoint(DatapointType.colourSat.getShortName());

 		Integer colourSaturationFromDP = null;

 		try {

 			colourSaturationFromDP = colourSaturationDP.getValue();

@@ -99,7 +101,7 @@
 		}

 

 		// set colourSaturation

-		FlexContainer toBeUpdated = new FlexContainer();

+		ColourSaturationFlexContainer toBeUpdated = new ColourSaturationFlexContainer();

 		Integer newColourSaturation = new Integer((int) (Math.random() * 100d));

 		colourSaturationCA.setCustomAttributeValue(newColourSaturation.toString());

 		toBeUpdated.getCustomAttributes().add(colourSaturationCA);

@@ -135,10 +137,10 @@
 			report.setState(State.KO);

 			return report;

 		}

-		retrievedFlexContainer = (FlexContainer) response.getContent();

+		retrievedFlexContainer = (ColourSaturationFlexContainer) response.getContent();

 

 		// get colourSaturation custom attribute

-		colourSaturationCA = retrievedFlexContainer.getCustomAttribute("colourSaturation");

+		colourSaturationCA = retrievedFlexContainer.getCustomAttribute(DatapointType.colourSat.getShortName());

 		colourSaturationFromFlexContainer = Integer.valueOf(colourSaturationCA.getCustomAttributeValue());

 		// check value between flexContainer and newValue

 		if (Math.abs(colourSaturationFromFlexContainer - newColourSaturation) > 2) {

diff --git a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/FaultDetectionModuleTest.java b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/FaultDetectionModuleTest.java
index 6345adb..763f0ce 100644
--- a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/FaultDetectionModuleTest.java
+++ b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/FaultDetectionModuleTest.java
@@ -9,8 +9,8 @@
 

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.FaultDetectionFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.ipe.sdt.testsuite.CSEUtil;

 import org.eclipse.om2m.ipe.sdt.testsuite.TestReport;

@@ -22,6 +22,7 @@
 import org.eclipse.om2m.sdt.datapoints.StringDataPoint;

 import org.eclipse.om2m.sdt.exceptions.AccessException;

 import org.eclipse.om2m.sdt.exceptions.DataPointException;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

 

 public class FaultDetectionModuleTest extends AbstractModuleTest {

 

@@ -50,19 +51,19 @@
 			report.setState(State.KO);

 			return report;

 		}

-		FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

-		CustomAttribute statusCA = retrievedFlexContainer.getCustomAttribute("status");

-		CustomAttribute codeCA = retrievedFlexContainer.getCustomAttribute("code"); // optional

-		CustomAttribute descriptionCA = retrievedFlexContainer.getCustomAttribute("description"); // optional

+		FaultDetectionFlexContainer retrievedFlexContainer = (FaultDetectionFlexContainer) response.getContent();

+		CustomAttribute statusCA = retrievedFlexContainer.getCustomAttribute(DatapointType.status.getShortName());

+		CustomAttribute codeCA = retrievedFlexContainer.getCustomAttribute(DatapointType.code.getShortName()); // optional

+		CustomAttribute descriptionCA = retrievedFlexContainer.getCustomAttribute(DatapointType.description.getShortName()); // optional

 		Boolean statusValueFromFlexContainer = Boolean.parseBoolean(statusCA.getCustomAttributeValue());

 		Integer codeValueFromFlexContainer = (codeCA != null ? Integer.valueOf(codeCA.getCustomAttributeValue()) :null);

 		String descriptionValueFromFlexContainer = (descriptionCA != null ? descriptionCA.getCustomAttributeValue() : null);

 		

 		

 		// retrieve Datapoint 

-		BooleanDataPoint statusDP = (BooleanDataPoint) getModule().getDataPoint("status");

-		IntegerDataPoint codeDP = (IntegerDataPoint) getModule().getDataPoint("code");

-		StringDataPoint descriptionDP = (StringDataPoint) getModule().getDataPoint("description");

+		BooleanDataPoint statusDP = (BooleanDataPoint) getModule().getDataPoint(DatapointType.status.getShortName());

+		IntegerDataPoint codeDP = (IntegerDataPoint) getModule().getDataPoint(DatapointType.code.getShortName());

+		StringDataPoint descriptionDP = (StringDataPoint) getModule().getDataPoint(DatapointType.description.getShortName());

 		Boolean statusValueFromDP = null;

 		Integer codeValueFromDP = null;

 		String descriptionValueFromDP = null;

@@ -88,7 +89,7 @@
 				report.setState(State.KO);

 				return report;

 			}

-			if (!checkObject(codeValueFromDP, codeValueFromFlexContainer, report, "code")) {

+			if (!checkObject(codeValueFromDP, codeValueFromFlexContainer, report, DatapointType.code.getShortName())) {

 				// ko

 				return report;

 			}

@@ -124,7 +125,7 @@
 		}

 		

 		// set status customAttribute value

-		FlexContainer toBeUpdated = new FlexContainer();

+		FaultDetectionFlexContainer toBeUpdated = new FaultDetectionFlexContainer();

 		Boolean newStatusValue = (statusValueFromDP.booleanValue() ? Boolean.FALSE : Boolean.TRUE);

 		statusCA.setCustomAttributeValue(newStatusValue.toString());

 		toBeUpdated.getCustomAttributes().add(statusCA);

@@ -143,7 +144,7 @@
 			report.setState(State.KO);

 			return report;

 		}

-		if (checkObject(statusValueFromDP, newStatusValue, report, "status")) {

+		if (checkObject(statusValueFromDP, newStatusValue, report, DatapointType.status.getShortName())) {

 			// statusValueFromDP should not be equal to newStatusValue

 			report.setErrorMessage("status should not be writable");

 			report.setState(State.KO);

@@ -154,11 +155,10 @@
 		}

 		

 		// set code customAttribute

-		toBeUpdated = new FlexContainer();

+		toBeUpdated = new FaultDetectionFlexContainer();

 		if(codeCA == null) {

 			codeCA = new CustomAttribute();

-			codeCA.setCustomAttributeName("code");

-			codeCA.setCustomAttributeType("xs:integer");

+			codeCA.setCustomAttributeName(DatapointType.code.getShortName());

 		}

 		codeCA.setCustomAttributeValue("1");

 		toBeUpdated.getCustomAttributes().add(codeCA);

@@ -176,8 +176,8 @@
 			report.setState(State.KO);

 			return report;

 		}

-		retrievedFlexContainer = (FlexContainer) response.getContent();

-		codeCA = retrievedFlexContainer.getCustomAttribute("code");

+		retrievedFlexContainer = (FaultDetectionFlexContainer) response.getContent();

+		codeCA = retrievedFlexContainer.getCustomAttribute(DatapointType.code.getShortName());

 		if (codeDP == null) {

 			if (codeCA != null) {

 				report.setErrorMessage("code DataPoint does not exist but code customAttribute exist!");

@@ -194,11 +194,10 @@
 		

 		

 		// set description customAttribute

-		toBeUpdated = new FlexContainer();

+		toBeUpdated = new FaultDetectionFlexContainer();

 		if (descriptionCA == null) {

 			descriptionCA = new CustomAttribute();

-			descriptionCA.setCustomAttributeName("description");

-			descriptionCA.setCustomAttributeType("xs:string");

+			descriptionCA.setCustomAttributeName(DatapointType.description.getShortName());

 		}

 		String newDescriptionValue = "A fake description value " + System.currentTimeMillis();

 		descriptionCA.setCustomAttributeValue(newDescriptionValue);

@@ -217,8 +216,8 @@
 			report.setState(State.KO);

 			return report;

 		}

-		retrievedFlexContainer = (FlexContainer) response.getContent();

-		descriptionCA = retrievedFlexContainer.getCustomAttribute("description");

+		retrievedFlexContainer = (FaultDetectionFlexContainer) response.getContent();

+		descriptionCA = retrievedFlexContainer.getCustomAttribute(DatapointType.description.getShortName());

 		

 		if (descriptionDP == null) {

 			// description custom attribute must be null

diff --git a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/RunModeModuleTest.java b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/RunModeModuleTest.java
index 3185d17..00114ae 100644
--- a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/RunModeModuleTest.java
+++ b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/RunModeModuleTest.java
@@ -12,8 +12,8 @@
 

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.RunModeFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.ipe.sdt.testsuite.CSEUtil;

 import org.eclipse.om2m.ipe.sdt.testsuite.TestReport;

@@ -23,6 +23,7 @@
 import org.eclipse.om2m.sdt.datapoints.ArrayDataPoint;

 import org.eclipse.om2m.sdt.exceptions.AccessException;

 import org.eclipse.om2m.sdt.exceptions.DataPointException;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

 

 public class RunModeModuleTest extends AbstractModuleTest {

 

@@ -54,10 +55,10 @@
 			report.setState(State.KO);

 			return report;

 		}

-		FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+		RunModeFlexContainer retrievedFlexContainer = (RunModeFlexContainer) response.getContent();

 

 		// get operationMode customAttribute

-		CustomAttribute operationModeCA = retrievedFlexContainer.getCustomAttribute("operationMode");

+		CustomAttribute operationModeCA = retrievedFlexContainer.getCustomAttribute(DatapointType.operationMode.getShortName());

 		if (operationModeCA == null) {

 			report.setErrorMessage("operationMode customAttribute does not exist");

 			report.setState(State.KO);

@@ -68,7 +69,7 @@
 		List<String> operationModeFromFlexContainer = getListFromStringArray(operationModeCA.getCustomAttributeValue());

 

 		// get operationMode value from Datapoint

-		ArrayDataPoint<String> operationModeDP = (ArrayDataPoint<String>) getModule().getDataPoint("operationMode");

+		ArrayDataPoint<String> operationModeDP = (ArrayDataPoint<String>) getModule().getDataPoint(DatapointType.operationMode.getShortName());

 		List<String> operationModeFromDP = null;

 		try {

 			operationModeFromDP = operationModeDP.getValue();

@@ -79,7 +80,7 @@
 		}

 

 		// check value from flexContainer and from Datapoint

-		if (!checkObject(operationModeFromFlexContainer, operationModeFromDP, report, "operationMode")) {

+		if (!checkObject(operationModeFromFlexContainer, operationModeFromDP, report, DatapointType.operationMode.getShortName())) {

 			return report;

 		}

 

@@ -99,7 +100,7 @@
 		// at this point, we are sure the Module Flexcontainer exist

 

 		// get possible values from supportedMode datapoint

-		ArrayDataPoint<String> supportedModesDP = (ArrayDataPoint<String>) getModule().getDataPoint("supportedModes");

+		ArrayDataPoint<String> supportedModesDP = (ArrayDataPoint<String>) getModule().getDataPoint(DatapointType.supportedModes.getShortName());

 		List<String> supportedModesFromDP;

 		try {

 			supportedModesFromDP = supportedModesDP.getValue();

@@ -110,7 +111,7 @@
 		}

 

 		// get current operationMode

-		ArrayDataPoint<String> operationModeDP = (ArrayDataPoint<String>) getModule().getDataPoint("operationMode");

+		ArrayDataPoint<String> operationModeDP = (ArrayDataPoint<String>) getModule().getDataPoint(DatapointType.operationMode.getShortName());

 		List<String> currentOperationModeValue = null;

 		try {

 			currentOperationModeValue = operationModeDP.getValue();

@@ -131,10 +132,9 @@
 		newOperationModeValue += "";

 

 		// set operationMode value

-		FlexContainer toBeUpdated = new FlexContainer();

+		RunModeFlexContainer toBeUpdated = new RunModeFlexContainer();

 		CustomAttribute customAttribute = new CustomAttribute();

-		customAttribute.setCustomAttributeName("operationMode");

-		customAttribute.setCustomAttributeType("xs:enum");

+		customAttribute.setCustomAttributeName(DatapointType.operationMode.getShortName());

 		customAttribute.setCustomAttributeValue(newOperationModeValue.toString());

 		toBeUpdated.getCustomAttributes().add(customAttribute);

 

@@ -149,23 +149,22 @@
 

 		// perform RETRIEVE request and check value

 		response = CSEUtil.retrieveEntity(getCseService(), moduleUrl);

-		FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+		RunModeFlexContainer retrievedFlexContainer = (RunModeFlexContainer) response.getContent();

 

 		// get operationMode customAttribute and value

-		CustomAttribute operationModeCA = retrievedFlexContainer.getCustomAttribute("operationMode");

+		CustomAttribute operationModeCA = retrievedFlexContainer.getCustomAttribute(DatapointType.operationMode.getShortName());

 		String operationModeFromFlexContainer = operationModeCA.getCustomAttributeValue();

 		// remove first character and last character "[]"

 		operationModeFromFlexContainer = operationModeFromFlexContainer.substring(1,

 				operationModeFromFlexContainer.length() - 1);

-		if (!checkObject(newOperationModeValue, operationModeFromFlexContainer, report, "operationMode")) {

+		if (!checkObject(newOperationModeValue, operationModeFromFlexContainer, report, DatapointType.operationMode.getShortName())) {

 			return report;

 		}

 

 		// set an unknow value

 		String newOperationModeWrongValue = "unknownValue_" + System.currentTimeMillis();

-		toBeUpdated = new FlexContainer();

-		customAttribute.setCustomAttributeName("operationMode");

-		customAttribute.setCustomAttributeType("xs:enum");

+		toBeUpdated = new RunModeFlexContainer();

+		customAttribute.setCustomAttributeName(DatapointType.operationMode.getShortName());

 		customAttribute.setCustomAttributeValue(newOperationModeWrongValue);

 		toBeUpdated.getCustomAttributes().add(customAttribute);

 

@@ -179,15 +178,15 @@
 

 		// perform RETRIEVE request and check value did not change

 		response = CSEUtil.retrieveEntity(getCseService(), moduleUrl);

-		retrievedFlexContainer = (FlexContainer) response.getContent();

+		retrievedFlexContainer = (RunModeFlexContainer) response.getContent();

 

 		// get operationMode customAttribute and value

-		operationModeCA = retrievedFlexContainer.getCustomAttribute("operationMode");

+		operationModeCA = retrievedFlexContainer.getCustomAttribute(DatapointType.operationMode.getShortName());

 		operationModeFromFlexContainer = operationModeCA.getCustomAttributeValue();

 		// remove first character and last character "[]"

 		operationModeFromFlexContainer = operationModeFromFlexContainer.substring(1,

 				operationModeFromFlexContainer.length() - 1);

-		if (!checkObject(newOperationModeValue, operationModeFromFlexContainer, report, "operationMode")) {

+		if (!checkObject(newOperationModeValue, operationModeFromFlexContainer, report, DatapointType.operationMode.getShortName())) {

 			return report;

 		}

 

@@ -212,10 +211,10 @@
 			report.setState(State.KO);

 			return report;

 		}

-		FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+		RunModeFlexContainer retrievedFlexContainer = (RunModeFlexContainer) response.getContent();

 

 		// check supportedModes customAttribute exist

-		CustomAttribute supportedModesCA = retrievedFlexContainer.getCustomAttribute("supportedModes");

+		CustomAttribute supportedModesCA = retrievedFlexContainer.getCustomAttribute(DatapointType.supportedModes.getShortName());

 		if (supportedModesCA == null) {

 			report.setErrorMessage("supportedModes customAttribute does not exist");

 			report.setState(State.KO);

@@ -227,7 +226,7 @@
 				supportedModesCA.getCustomAttributeValue());

 

 		// get value from datapoint

-		ArrayDataPoint<String> supportedModesDP = (ArrayDataPoint<String>) getModule().getDataPoint("supportedModes");

+		ArrayDataPoint<String> supportedModesDP = (ArrayDataPoint<String>) getModule().getDataPoint(DatapointType.supportedModes.getShortName());

 		List<String> supportedModesListFromDP = null;

 		try {

 			supportedModesListFromDP = supportedModesDP.getValue();

@@ -267,11 +266,10 @@
 		// at this point, we are sure the Module Flexcontainer exist

 		

 		CustomAttribute supportedModesCA = new CustomAttribute();

-		supportedModesCA.setCustomAttributeName("supportedModes");

-		supportedModesCA.setCustomAttributeType("xs:enum");

+		supportedModesCA.setCustomAttributeName(DatapointType.supportedModes.getShortName());

 		supportedModesCA.setCustomAttributeValue("mode2,mode3,mode6,mode7");

 		

-		FlexContainer toBeUpdated = new FlexContainer();

+		RunModeFlexContainer toBeUpdated = new RunModeFlexContainer();

 		toBeUpdated.getCustomAttributes().add(supportedModesCA);

 		

 		// perform UPDATE request

@@ -283,7 +281,7 @@
 		}

 		

 		// retrieve value from datapoint

-		ArrayDataPoint<String> supportedModesDP = (ArrayDataPoint<String>) getModule().getDataPoint("supportedModes");

+		ArrayDataPoint<String> supportedModesDP = (ArrayDataPoint<String>) getModule().getDataPoint(DatapointType.supportedModes.getShortName());

 		List<String> supportedModesFromDP = null;

 		try {

 			supportedModesFromDP = supportedModesDP.getValue();

@@ -299,7 +297,7 @@
 		List<String> supportedModesValueFromFlexContainer_list = Arrays.asList(supportedModesValueFromFlexContainer_array);

 		

 		// check value

-		if (!checkObject(supportedModesValueFromFlexContainer_list, supportedModesFromDP, report, "supportedModes")) {

+		if (!checkObject(supportedModesValueFromFlexContainer_list, supportedModesFromDP, report, DatapointType.supportedModes.getShortName())) {

 			return report;

 		}

 		

diff --git a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/SmokeSensorModuleTest.java b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/SmokeSensorModuleTest.java
index a36057c..3502983 100644
--- a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/SmokeSensorModuleTest.java
+++ b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/SmokeSensorModuleTest.java
@@ -9,8 +9,8 @@
 

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.SmokeSensorFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.ipe.sdt.testsuite.CSEUtil;

 import org.eclipse.om2m.ipe.sdt.testsuite.TestReport;

@@ -21,6 +21,7 @@
 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;

 import org.eclipse.om2m.sdt.exceptions.AccessException;

 import org.eclipse.om2m.sdt.exceptions.DataPointException;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

 

 public class SmokeSensorModuleTest extends AbstractModuleTest {

 

@@ -50,10 +51,10 @@
 			report.setState(State.KO);

 			return report;

 		}

-		FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+		SmokeSensorFlexContainer retrievedFlexContainer = (SmokeSensorFlexContainer) response.getContent();

 		

 		// check alarm

-		CustomAttribute alarmCA = retrievedFlexContainer.getCustomAttribute("alarm");

+		CustomAttribute alarmCA = retrievedFlexContainer.getCustomAttribute(DatapointType.alarm.getShortName());

 		if (alarmCA == null) {

 			report.setErrorMessage("ERROR : no alarm customAttribute");

 			report.setState(State.KO);

@@ -62,7 +63,7 @@
 		Boolean alarm = Boolean.parseBoolean(alarmCA.getCustomAttributeValue());

 		

 		// alarm from module

-		BooleanDataPoint alarmDP = (BooleanDataPoint) getModule().getDataPoint("alarm");

+		BooleanDataPoint alarmDP = (BooleanDataPoint) getModule().getDataPoint(DatapointType.alarm.getShortName());

 		Boolean currentValueFromModule = null;

 		try {

 			currentValueFromModule = alarmDP.getValue();

@@ -79,7 +80,7 @@
 		}

 	

 		// try to set value

-		FlexContainer toBeUpdated = new FlexContainer();

+		SmokeSensorFlexContainer toBeUpdated = new SmokeSensorFlexContainer();

 		alarmCA.setCustomAttributeValue("true");

 		toBeUpdated.getCustomAttributes().add(alarmCA);

 		response = CSEUtil.updateFlexContainerEntity(getCseService(), moduleUrl, toBeUpdated);

@@ -98,15 +99,15 @@
 			report.setState(State.KO);

 			return report;

 		}

-		retrievedFlexContainer = (FlexContainer) response.getContent();

-		CustomAttribute detectedTimeCA = retrievedFlexContainer.getCustomAttribute("detectedTime");

+		retrievedFlexContainer = (SmokeSensorFlexContainer) response.getContent();

+		CustomAttribute detectedTimeCA = retrievedFlexContainer.getCustomAttribute(DatapointType.detectedTime.getShortName());

 		if (detectedTimeCA != null) {

 			// detectedTime is optional

 			

 			Integer detectedTime = new Integer(detectedTimeCA.getCustomAttributeValue());

 			

 			// get detectedTime from module

-			IntegerDataPoint detectedTimeDP = (IntegerDataPoint) getModule().getDataPoint("detectedTime");

+			IntegerDataPoint detectedTimeDP = (IntegerDataPoint) getModule().getDataPoint(DatapointType.detectedTime.getShortName());

 			Integer detectedTimeFromModule = null;

 			try {

 				detectedTimeFromModule = detectedTimeDP.getValue();

diff --git a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/WaterLevelModuleTest.java b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/WaterLevelModuleTest.java
index 2374cb8..a56c671 100644
--- a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/WaterLevelModuleTest.java
+++ b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/WaterLevelModuleTest.java
@@ -9,14 +9,15 @@
 

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.LiquidLevelFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.ipe.sdt.testsuite.CSEUtil;

 import org.eclipse.om2m.ipe.sdt.testsuite.TestReport;

 import org.eclipse.om2m.ipe.sdt.testsuite.TestReport.State;

 import org.eclipse.om2m.sdt.Module;

-import org.eclipse.om2m.sdt.home.types.LevelType;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

+import org.eclipse.om2m.sdt.home.types.LiquidLevel;

 import org.eclipse.om2m.sdt.exceptions.AccessException;

 import org.eclipse.om2m.sdt.exceptions.DataPointException;

 

@@ -42,10 +43,10 @@
 			report.setState(State.KO);

 			return report;

 		}

-		FlexContainer retrievedFlexContainer =  (FlexContainer) response.getContent();

+		LiquidLevelFlexContainer retrievedFlexContainer =  (LiquidLevelFlexContainer) response.getContent();

 		

 		// retrieve liquidLevel custom attribute

-		CustomAttribute liquidLevelCA = retrievedFlexContainer.getCustomAttribute("liquidLevel");

+		CustomAttribute liquidLevelCA = retrievedFlexContainer.getCustomAttribute(DatapointType.liquidLevel.getShortName());

 		if (liquidLevelCA == null) {

 			// customAttribute does not exist

 			report.setErrorMessage("liquidLevel customAttribute does not exist");

@@ -54,7 +55,7 @@
 		}

 

 		// retrieve liquidLevel datapoint

-		LevelType liquidLevelDP = (LevelType) getModule().getDataPoint("liquidLevel");

+		LiquidLevel liquidLevelDP = (LiquidLevel) getModule().getDataPoint(DatapointType.liquidLevel.getShortName());

 		

 		// retrieve liquidLevel value from datapoint

 		Integer liquidLevelValueFromDP = null;

@@ -77,7 +78,7 @@
 			return report;

 		}

 		

-		if (!checkObject(liquidLevelFromFlexContainer, liquidLevelValueFromDP, report, "liquidLevel")) {

+		if (!checkObject(liquidLevelFromFlexContainer, liquidLevelValueFromDP, report, DatapointType.liquidLevel.getShortName())) {

 			return report;

 		}

 		

@@ -94,7 +95,7 @@
 		}

 		

 		// retrieve liquidLevel datapoint

-		LevelType liquidLevelDP = (LevelType) getModule().getDataPoint("liquidLevel");

+		LiquidLevel liquidLevelDP = (LiquidLevel) getModule().getDataPoint(DatapointType.liquidLevel.getShortName());

 		Integer liquidLevelFromDP = null;

 		try {

 			liquidLevelFromDP = liquidLevelDP.getValue();

@@ -109,10 +110,9 @@
 		Integer newLiquidLevelValue = (liquidLevelFromDP.intValue() == 1 ? 5 : 1);

 		

 		// prepare FlexContainer + customAttribute

-		FlexContainer toBeUpdated = new FlexContainer();

+		LiquidLevelFlexContainer toBeUpdated = new LiquidLevelFlexContainer();

 		CustomAttribute liquidLevelCA = new CustomAttribute();

-		liquidLevelCA.setCustomAttributeName("liquidLevel");

-		liquidLevelCA.setCustomAttributeType("hd:liquidLevel");

+		liquidLevelCA.setCustomAttributeName(DatapointType.liquidLevel.getShortName());

 		liquidLevelCA.setCustomAttributeValue(newLiquidLevelValue.toString());

 		toBeUpdated.getCustomAttributes().add(liquidLevelCA);

 		

@@ -142,7 +142,7 @@
 		}

 		

 		// check value 

-		if (!checkObject(newLiquidLevelValue, liquidLevelFromDP, report, "liquidLevel")) {

+		if (!checkObject(newLiquidLevelValue, liquidLevelFromDP, report, DatapointType.liquidLevel.getShortName())) {

 			return report;

 		}

 		

diff --git a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/WaterSensorModuleTest.java b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/WaterSensorModuleTest.java
index a8610df..1ee6daf 100644
--- a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/WaterSensorModuleTest.java
+++ b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/module/WaterSensorModuleTest.java
@@ -9,8 +9,8 @@
 

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.WaterSensorFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.ipe.sdt.testsuite.CSEUtil;

 import org.eclipse.om2m.ipe.sdt.testsuite.TestReport;

@@ -19,6 +19,7 @@
 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;

 import org.eclipse.om2m.sdt.exceptions.AccessException;

 import org.eclipse.om2m.sdt.exceptions.DataPointException;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

 

 public class WaterSensorModuleTest extends AbstractModuleTest {

 

@@ -44,10 +45,10 @@
 			report.setState(State.KO);

 			return report;

 		}

-		FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+		WaterSensorFlexContainer retrievedFlexContainer = (WaterSensorFlexContainer) response.getContent();

 		

 		// retrieve alarm customAttribute

-		CustomAttribute alarmCA = retrievedFlexContainer.getCustomAttribute("alarm");

+		CustomAttribute alarmCA = retrievedFlexContainer.getCustomAttribute(DatapointType.alarm.getShortName());

 		if (alarmCA == null) {

 			report.setErrorMessage("alarm customAttribute is missing but it is mandatory");

 			report.setState(State.KO);

@@ -71,7 +72,7 @@
 		// at this point, alarmValueFromFlexContainer contains the alarm value (as a boolean) 

 		

 		// retrieve alarm datapoint

-		BooleanDataPoint alarmDP = (BooleanDataPoint) getModule().getDataPoint("alarm");

+		BooleanDataPoint alarmDP = (BooleanDataPoint) getModule().getDataPoint(DatapointType.alarm.getShortName());

 		

 		// retrieve alarm value from datapoint

 		Boolean alarmValueFromDP = null;

@@ -84,7 +85,7 @@
 		}

 		

 		// check value from datapoint and flexcontainer

-		if (!checkObject(alarmValueFromFlexContainer, alarmValueFromDP, report, "alarm")) {

+		if (!checkObject(alarmValueFromFlexContainer, alarmValueFromDP, report, DatapointType.alarm.getShortName())) {

 			return report;

 		}

 		

@@ -104,7 +105,7 @@
 		// at this point, we are sure the module flexContainer exists

 		

 		// retrieve current value from datapoint

-		BooleanDataPoint alarmDP = (BooleanDataPoint) getModule().getDataPoint("alarm");

+		BooleanDataPoint alarmDP = (BooleanDataPoint) getModule().getDataPoint(DatapointType.alarm.getShortName());

 		Boolean alarmValueFromDP = null;

 		try {

 			alarmValueFromDP = alarmDP.getValue();

@@ -115,10 +116,9 @@
 		}

 		

 		// prepare update

-		FlexContainer toBeUpdated = new FlexContainer();

+		WaterSensorFlexContainer toBeUpdated = new WaterSensorFlexContainer();

 		CustomAttribute alarmCA = new CustomAttribute();

-		alarmCA.setCustomAttributeName("alarm");

-		alarmCA.setCustomAttributeType("xs:boolean");

+		alarmCA.setCustomAttributeName(DatapointType.alarm.getShortName());

 		alarmCA.setCustomAttributeValue(Boolean.valueOf(!alarmValueFromDP.booleanValue()).toString());

 		toBeUpdated.getCustomAttributes().add(alarmCA);

 		

@@ -139,8 +139,8 @@
 			report.setState(State.KO);

 			return report;

 		}

-		FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

-		CustomAttribute ca = retrievedFlexContainer.getCustomAttribute("alarm");

+		WaterSensorFlexContainer retrievedFlexContainer = (WaterSensorFlexContainer) response.getContent();

+		CustomAttribute ca = retrievedFlexContainer.getCustomAttribute(DatapointType.alarm.getShortName());

 		try {

 			currentValueFromDP = Boolean.parseBoolean(ca.getCustomAttributeValue());

 		} catch (Exception e) {

@@ -150,7 +150,7 @@
 		}

 		

 		// check current value is the same value as the value retrieved before UPDATE request

-		if (!checkObject(alarmValueFromDP, currentValueFromDP, report, "alarm")) {

+		if (!checkObject(alarmValueFromDP, currentValueFromDP, report, DatapointType.alarm.getShortName())) {

 			return report;

 		}

 		

diff --git a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/subscription/ReceivedNotification.java b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/subscription/ReceivedNotification.java
index e84f7fb..9c5d826 100644
--- a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/subscription/ReceivedNotification.java
+++ b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/subscription/ReceivedNotification.java
@@ -9,7 +9,7 @@
 

 import java.util.Date;

 

-import org.eclipse.om2m.commons.resource.FlexContainer;

+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;

 import org.eclipse.om2m.sdt.DataPoint;

 

 public class ReceivedNotification {

@@ -17,14 +17,14 @@
 	private Date date;

 	

 	// case FlexContainer

-	private FlexContainer flexContainer;

+	private AbstractFlexContainer abstractFlexContainer;

 	

 	// case SDT

 	private DataPoint dataPoint;

 	private Object value;

 

-	public ReceivedNotification(final FlexContainer pFlexContainer, final Date pDate) {

-		this.flexContainer = pFlexContainer;

+	public ReceivedNotification(final AbstractFlexContainer pAbstractFlexContainer, final Date pDate) {

+		this.abstractFlexContainer = pAbstractFlexContainer;

 		this.date = pDate;

 	}

 	

@@ -34,8 +34,8 @@
 		this.date = pDate;

 	}

 

-	public FlexContainer getFlexContainer() {

-		return flexContainer;

+	public AbstractFlexContainer getFlexContainer() {

+		return abstractFlexContainer;

 	}

 

 	public DataPoint getDataPoint() {

diff --git a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/subscription/SubscriptionHttpServlet.java b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/subscription/SubscriptionHttpServlet.java
index 50b8b6a..155460e 100644
--- a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/subscription/SubscriptionHttpServlet.java
+++ b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/subscription/SubscriptionHttpServlet.java
@@ -17,8 +17,8 @@
 import javax.servlet.http.HttpServletRequest;

 import javax.servlet.http.HttpServletResponse;

 

+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.Notification;

 import org.eclipse.om2m.commons.resource.Notification.NotificationEvent;

 import org.eclipse.om2m.commons.resource.Notification.NotificationEvent.Representation;

@@ -101,8 +101,8 @@
 			NotificationEvent notifEvent = notification.getNotificationEvent();

 			Representation representation = notifEvent.getRepresentation();

 

-			if (representation.getResource() instanceof FlexContainer) {

-				FlexContainer notifiedFlexContainer = (FlexContainer) representation.getResource();

+			if (representation.getResource() instanceof AbstractFlexContainer) {

+				AbstractFlexContainer notifiedFlexContainer = (AbstractFlexContainer) representation.getResource();

 				ReceivedNotification receivedNotification = new ReceivedNotification(notifiedFlexContainer, new Date());

 				if (openToStoreNotification) {

 					this.notificationQueue.addNotificationFromOM2M(receivedNotification);

diff --git a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/subscription/SubscriptionTestSuite.java b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/subscription/SubscriptionTestSuite.java
index e2ea169..15d94cf 100644
--- a/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/subscription/SubscriptionTestSuite.java
+++ b/org.eclipse.om2m.ipe.sdt.testsuite/src/main/java/org/eclipse/om2m/ipe/sdt/testsuite/subscription/SubscriptionTestSuite.java
@@ -23,9 +23,9 @@
 import org.eclipse.om2m.commons.constants.Constants;

 import org.eclipse.om2m.commons.constants.NotificationContentType;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

 import org.eclipse.om2m.commons.resource.DiscoveryResult;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.Notification;

 import org.eclipse.om2m.commons.resource.Notification.NotificationEvent;

 import org.eclipse.om2m.commons.resource.Notification.NotificationEvent.Representation;

@@ -212,7 +212,7 @@
 					Object value = receivedNotificationSDT.getValue();

 					

 					// OM2M

-					FlexContainer fc = receivedNotificationOM2M.getFlexContainer();

+					AbstractFlexContainer fc = receivedNotificationOM2M.getFlexContainer();

 					Date dateOM2M = receivedNotificationOM2M.getDate();

 					CustomAttribute ca = fc.getCustomAttribute(dp.getName());

 					

@@ -262,8 +262,10 @@
 	

 	public String createSubscription(Module pModule, String servletPath) {

 		String subscriptionUrl = null;

+		String subscriptionName = "subscription_" + System.currentTimeMillis();

 		

 		Subscription subscription = new Subscription();

+		subscription.setName(subscriptionName);

 		subscription.getNotificationURI().add("http://127.0.0.1:" + Constants.CSE_PORT + servletPath);

 		subscription.setNotificationContentType(NotificationContentType.WHOLE_RESOURCE);

 		

@@ -285,10 +287,10 @@
 			}

 		}

 		

-		String subscriptionName = "subscription_" + System.currentTimeMillis();

+		

 		

 		if (moduleFlexContainerUrl != null) {

-			ResponsePrimitive response = CSEUtil.createSubscription(cseService, subscription, moduleFlexContainerUrl, subscriptionName);

+			ResponsePrimitive response = CSEUtil.createSubscription(cseService, subscription, moduleFlexContainerUrl);

 			if (!ResponseStatusCode.CREATED.equals(response.getResponseStatusCode())) {

 				System.out.println("unable to create subscription");

 				

diff --git a/org.eclipse.om2m.ipe.sdt/META-INF/MANIFEST.MF b/org.eclipse.om2m.ipe.sdt/META-INF/MANIFEST.MF
index a5e7543..ee1bd15 100644
--- a/org.eclipse.om2m.ipe.sdt/META-INF/MANIFEST.MF
+++ b/org.eclipse.om2m.ipe.sdt/META-INF/MANIFEST.MF
@@ -6,11 +6,12 @@
 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 No-otb-proxy: true
 Bundle-ClassPath: .
-Bundle-Activator: org.eclipse.om2m.ipe.sdt.Activator
+Service-Component: OSGI-INF/component.xml
 Import-Package: org.apache.commons.logging,
  org.eclipse.om2m.commons.constants,
  org.eclipse.om2m.commons.exceptions,
  org.eclipse.om2m.commons.resource,
+ org.eclipse.om2m.commons.resource.flexcontainerspec,
  org.eclipse.om2m.core.service,
  org.eclipse.om2m.datamapping.service,
  org.eclipse.om2m.flexcontainer.service,
@@ -22,5 +23,6 @@
  org.eclipse.om2m.sdt.types,
  org.osgi.framework,
  org.osgi.service.cm,
+ org.osgi.service.component,
  org.osgi.service.event,
  org.osgi.util.tracker
diff --git a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/Activator.java b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/Activator.java
index feb3908..9ec18ac 100644
--- a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/Activator.java
+++ b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/Activator.java
@@ -8,171 +8,105 @@
 package org.eclipse.om2m.ipe.sdt;

 

 import java.util.Dictionary;

-import java.util.Hashtable;

+import java.util.Map;

 

 import org.apache.commons.logging.Log;

 import org.apache.commons.logging.LogFactory;

 import org.eclipse.om2m.commons.constants.Constants;

-import org.eclipse.om2m.commons.constants.MimeMediaType;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.core.service.RemoteCseService;

-import org.eclipse.om2m.datamapping.service.DataMapperService;

 import org.eclipse.om2m.flexcontainer.service.FlexContainerService;

 import org.eclipse.om2m.sdt.Device;

+import org.eclipse.om2m.sdt.Property;

 import org.eclipse.om2m.sdt.events.SDTEventListener;

-import org.osgi.framework.BundleActivator;

 import org.osgi.framework.BundleContext;

-import org.osgi.framework.ServiceReference;

 import org.osgi.framework.ServiceRegistration;

-import org.osgi.service.cm.ConfigurationAdmin;

-import org.osgi.service.cm.ConfigurationException;

-import org.osgi.service.cm.ManagedService;

+import org.osgi.service.component.ComponentContext;

 import org.osgi.service.event.Event;

-import org.osgi.service.event.EventAdmin;

-import org.osgi.service.event.EventConstants;

 import org.osgi.service.event.EventHandler;

-import org.osgi.util.tracker.ServiceTracker;

-import org.osgi.util.tracker.ServiceTrackerCustomizer;

 

 @SuppressWarnings({ "unchecked", "rawtypes" })

-public class Activator implements BundleActivator, ManagedService, EventHandler {

+public class Activator implements EventHandler {

 

 	private static final String CSE_ID_TO_BE_ANNOUNCED = "cse.id.to.be.announced";

 	private static final String CSE_NAME_TO_BE_ANNOUNCED = "cse.name.to.be.announced";

 	private static final String ANNOUNCEMENT_ENABLED = "announcement.enabled";

 	private static final String IPE_UNDER_ANNOUNCED_RESOURCE = "ipe.under.announced.resource";

-	private static final String SDT_IPE = "sdt.ipe";

-	private static final String PROP_PROTOCOL = "propProtocol";

+	private static final String PROP_PROTOCOL = "proPl";//"propProtocol";

 	private static final String CLOUD_PROTOCOL = "Cloud.";

 

 	private String cseIdToBeAnnounced;

 	private String cseNameToBeAnnounced;

 	private boolean ipeUnderAnnouncedResource;

-	private ServiceRegistration<?> serviceRegistration;

+	private boolean hasToBeAnnounced;

 	private boolean isSDTIPEStarted = false;

 

-	private ServiceTracker cseServiceTracker;

-	private ServiceTracker deviceServiceTracker;

-	private ServiceTracker dataMapperServiceTracker;

-

 	private SDTIpeApplication sdtIPEApplication;

 	private CseService cseService;

 

-	private static DataMapperService dataMapperService;

 	private static BundleContext bundleContext;

-	private static Object sync = new Object();

 

 	private static Log logger = LogFactory.getLog(Activator.class);

 

-	@Override

-	public void start(final BundleContext context) throws Exception {

-		bundleContext = context;

-		logger.info("start SDT IPE");

+	public Activator() {

+	}

 

-		dataMapperServiceTracker = new ServiceTracker(bundleContext, DataMapperService.class.getName(),

-				new ServiceTrackerCustomizer() {

-					@Override

-					public void removedService(ServiceReference reference, Object service) {

-						setDataMapper(null);

-					}

+	/**

+	 * Activate method.

+	 * 

+	 * @param pBundleContext

+	 * @param properties

+	 *            contains the first configuration

+	 */

+	protected void activate(BundleContext pBundleContext, Map<String, Object> properties) {

+		logger.info("activate SDT IPE");

+		bundleContext = pBundleContext;

 

-					@Override

-					public void modifiedService(ServiceReference reference, Object service) {

-					}

+		if (checkConfigurations(properties)) {

+			startSdtIpe();

+		}

 

-					@Override

-					public Object addingService(ServiceReference reference) {

-						if (getDataMapper() == null) {

-							DataMapperService dms = (DataMapperService) bundleContext.getService(reference);

-							if (MimeMediaType.XML.equals(dms.getServiceDataType())) {

-								setDataMapper(dms);

-								return dataMapperService;

-							}

-						}

-						return null;

-					}

-				});

-		dataMapperServiceTracker.open();

+	}

 

-		cseServiceTracker = new ServiceTracker(bundleContext, CseService.class.getName(),

-				new ServiceTrackerCustomizer() {

-					@Override

-					public void removedService(ServiceReference reference, Object service) {

-						// a single CSEService

-						// unregister Sdt IPE application

-						unregisterSdtIpeApplication();

-						cseService = null;

-					}

+	protected void deactivate(ComponentContext cc) {

+		logger.info("deactivate SDT IPE");

 

-					@Override

-					public void modifiedService(ServiceReference reference, Object service) {

-						// nothing to do

-					}

+		stopSdtIpe(); 

+		bundleContext = null;

+	}

 

-					@Override

-					public Object addingService(ServiceReference reference) {

-						if (cseService != null) {

-							// a CSE Service has been previously caught.

-							// No need to use a second instance !

-							return null;

-						}

-						// at this point, we are sure this is the firstly

-						// detected CSE Service.

-						cseService = (CseService) bundleContext.getService(reference);

-						if (isSDTIPEStarted)

-							startSDTIpe();

-						return cseService;

-					}

-				});

-		cseServiceTracker.open();

+	protected void modified(Map<String, Object> properties) {

+		logger.info("Modified SDT IPE");

+		checkConfigurations(properties);

 

-		// register this activator as a managed service

-		try {

-			ServiceReference ref = bundleContext.getServiceReference(ConfigurationAdmin.class.getName());

-			if ((ref == null) || (bundleContext.getService(ref) == null)) {

-				// No config admin. Start with default values: no announcement

-				logger.info("Manage default properties");

-				cseIdToBeAnnounced = null;

-				cseNameToBeAnnounced = null;

-				ipeUnderAnnouncedResource = false;

-				startSDTIpe();

-			} else {

-				logger.info("Manage configuration properties");

-				Dictionary properties = new Hashtable<>();

-				properties.put(org.osgi.framework.Constants.SERVICE_PID, SDT_IPE);

-				properties.put(EventConstants.EVENT_TOPIC, RemoteCseService.REMOTE_CSE_TOPIC);

-				serviceRegistration = bundleContext.registerService(

-						new String[] { ManagedService.class.getName(), EventHandler.class.getName() }, this,

-						properties);

-			}

-		} catch (Exception e) {

-			logger.error("Error starting SDT IPE Activator", e);

+	}

+

+	protected void setCseService(CseService cseService) {

+		logger.info("setCseService");

+		this.cseService = cseService;

+	}

+

+	protected void unsetCseService(CseService pCseService) {

+		logger.info("unsetCseService");

+		this.cseService = null;

+	}

+

+	protected void setDevice(Device device) {

+		logger.info("setDevice(" + device.getName() + ") " + device.getProperties());

+		Property protocol = device.getProperty(PROP_PROTOCOL, true);

+		logger.info("Found device, protocol " + protocol);

+		if ((protocol != null) && protocol.getValue().startsWith(CLOUD_PROTOCOL)) {

+			logger.info("Cloud device, ignore...");

+		} else {

+			DeviceList.getInstance().addDevice(device);

 		}

 	}

 

-	@Override

-	public void stop(BundleContext context) throws Exception {

-		logger.info("stop SDT IPE");

-		try {

-			stopSDTIPE();

-

-			if (cseServiceTracker != null) {

-				// stop CseServiceTracker

-				cseServiceTracker.close();

-				cseServiceTracker = null;

-			}

-			if (serviceRegistration != null) {

-				serviceRegistration.unregister();

-				serviceRegistration = null;

-			}

-			deviceServiceTracker = null;

-			sdtIPEApplication = null;

-			bundleContext = null;

-		} catch (Exception e) {

-			e.printStackTrace();

-		}

+	protected void unsetDevice(Device pDevice) {

+		logger.info("unsetDevice(" + pDevice.getName() + ")");

+		DeviceList.getInstance().removeDevice(pDevice);

 	}

 

 	/**

@@ -184,8 +118,13 @@
 	 * @throws Exception

 	 */

 	protected void registerSdtIpeApplication(String announceCseId, String cseName, boolean ipeUnder) throws Exception {

-		sdtIPEApplication = new SDTIpeApplication(cseService, announceCseId, cseName, ipeUnder);

+		if (sdtIPEApplication != null) {

+			// unregister a previous version

+			unregisterSdtIpeApplication();

+		}

+		sdtIPEApplication = new SDTIpeApplication(cseService, announceCseId, cseName, ipeUnder, hasToBeAnnounced);

 		sdtIPEApplication.publishSDTIPEApplication();

+		DeviceList.getInstance().addListenerAndSend(sdtIPEApplication);

 	}

 

 	/**

@@ -195,18 +134,15 @@
 	 */

 	protected void unregisterSdtIpeApplication() {

 		if (sdtIPEApplication != null) {

+			DeviceList.getInstance().removeListener(sdtIPEApplication);

 			sdtIPEApplication.deleteIpeApplicationEntity();

 			sdtIPEApplication = null;

 		}

 	}

 

-	private void startSDTIpe() {

+	private void startSdtIpe() {

 		synchronized (this) {

 			isSDTIPEStarted = true;

-			if (cseService == null) {

-				// Wait for CSEService!

-				return;

-			}

 

 			if (checkIfRemoteCSEExists(cseIdToBeAnnounced, cseNameToBeAnnounced)) {

 

@@ -215,10 +151,9 @@
 					logger.info("Start IPE App " + cseIdToBeAnnounced + " / " + cseNameToBeAnnounced + " / "

 							+ ipeUnderAnnouncedResource);

 					registerSdtIpeApplication(cseIdToBeAnnounced, cseNameToBeAnnounced, ipeUnderAnnouncedResource);

-					startSDTDeviceTracking();

 				} catch (Exception e) {

 					logger.error("SdtIpeApplication oneM2M publishing failed", e);

-					stopSDTIPE();

+					stopSdtIpe();

 				}

 

 			} else {

@@ -228,11 +163,10 @@
 		}

 	}

 

-	private void stopSDTIPE() {

+	private void stopSdtIpe() {

 		synchronized (this) {

 

 			if (isSDTIPEStarted) {

-				stopSDTDeviceTracking();

 				unregisterSdtIpeApplication();

 			}

 			isSDTIPEStarted = false;

@@ -240,62 +174,6 @@
 		}

 	}

 

-	/**

-	 * Start SDTDevice tracking.

-	 * 

-	 * @param pCseService

-	 */

-	private void startSDTDeviceTracking() {

-		deviceServiceTracker = new ServiceTracker(bundleContext, Device.class.getName(),

-				new ServiceTrackerCustomizer() {

-					@Override

-					public void removedService(ServiceReference reference, Object service) {

-						sdtIPEApplication.removeSDTDevice((Device) service);

-					}

-

-					@Override

-					public void modifiedService(ServiceReference reference, Object service) {

-					}

-

-					@Override

-					public Object addingService(ServiceReference reference) {

-						String protocol = (String) reference.getProperty(PROP_PROTOCOL);

-						logger.info("Found device, protocol " + protocol);

-						if ((protocol != null) && protocol.startsWith(CLOUD_PROTOCOL)) {

-							logger.info("Cloud device, ignore...");

-						} else {

-							Device device = (Device) bundleContext.getService(reference);

-							if (sdtIPEApplication.addSDTDevice(device)) {

-								return device;

-							}

-						}

-						return null;

-					}

-				});

-		deviceServiceTracker.open();

-	}

-

-	private void stopSDTDeviceTracking() {

-		if (deviceServiceTracker != null) {

-			deviceServiceTracker.close();

-			deviceServiceTracker = null;

-		}

-	}

-

-	protected static void setDataMapper(DataMapperService dms) {

-		synchronized (sync) {

-			dataMapperService = dms;

-		}

-	}

-

-	protected static DataMapperService getDataMapper() {

-		DataMapperService dms = null;

-		synchronized (sync) {

-			dms = dataMapperService;

-		}

-		return dms;

-	}

-

 	public static ServiceRegistration registerFlexContainerService(FlexContainerService instance) {

 		logger.info("registerFlexContainerService for path " + instance.getFlexContainerLocation());

 		return bundleContext.registerService(FlexContainerService.class.getName(), instance, null);

@@ -306,9 +184,9 @@
 		return bundleContext.registerService(SDTEventListener.class.getName(), listener, dictionary);

 	}

 

-	@Override

-	public void updated(Dictionary properties) throws ConfigurationException {

-		logger.info("updated(properties=" + properties + ")");

+	private boolean checkConfigurations(Map<String, Object> properties) {

+		boolean isValidConfiguration = false;

+

 		if (properties != null) {

 			String propCseIdToBeAnnounced = (String) properties.get(CSE_ID_TO_BE_ANNOUNCED);

 			String propCseNameToBeAnnounced = (String) properties.get(CSE_NAME_TO_BE_ANNOUNCED);

@@ -320,21 +198,10 @@
 					+ ANNOUNCEMENT_ENABLED + "=" + propAnnouncementEnabled + ")\n" + "updated("

 					+ IPE_UNDER_ANNOUNCED_RESOURCE + "=" + propIpeUnderAnnouncedResource + ")");

 

-			if (propAnnouncementEnabled == null) {

-				logger.info("Undefined property announcement.enabled. Announcement disabled");

-				cseIdToBeAnnounced = null;

-				cseNameToBeAnnounced = null;

-				ipeUnderAnnouncedResource = false;

-				return;

-			}

-			boolean isValidConfiguration = false;

-

 			if (propAnnouncementEnabled) {

 				if ((propCseIdToBeAnnounced != null) && (propCseNameToBeAnnounced != null)) {

-					// check if CSE is connected

-					// if (checkIfRemoteCSEExists(propCseIdToBeAnnounced,

-					// propCseNameToBeAnnounced)) {

 					isValidConfiguration = true;

+					hasToBeAnnounced = true;

 					cseIdToBeAnnounced = propCseIdToBeAnnounced;

 					cseNameToBeAnnounced = propCseNameToBeAnnounced;

 					ipeUnderAnnouncedResource = (propIpeUnderAnnouncedResource == null) ? false

@@ -347,20 +214,41 @@
 				}

 			} else {

 				// announcement.enabled = false

-				isValidConfiguration = true;

-				cseIdToBeAnnounced = null;

-				cseNameToBeAnnounced = null;

-				ipeUnderAnnouncedResource = false;

-			}

+				if (propIpeUnderAnnouncedResource.booleanValue()) {

+					if ((propCseIdToBeAnnounced != null) && (propCseNameToBeAnnounced != null)) {

+						isValidConfiguration = true;

+						hasToBeAnnounced = false;

+						cseIdToBeAnnounced = propCseIdToBeAnnounced;

+						cseNameToBeAnnounced = propCseNameToBeAnnounced;

+						ipeUnderAnnouncedResource = true;

+					} else {

+						// invalid configuration

+						isValidConfiguration = false;

+						hasToBeAnnounced = false;

+						cseIdToBeAnnounced = null;

+						cseNameToBeAnnounced = null;

+						ipeUnderAnnouncedResource = false;

+						logger.info("no REMOTE CSE where ipe.under.announced.resource=true");

+					}

+				} else {

+					isValidConfiguration = true;

+					cseIdToBeAnnounced = null;

+					cseNameToBeAnnounced = null;

+					ipeUnderAnnouncedResource = false;

+					hasToBeAnnounced = false;

+				}

 

-			if (isValidConfiguration) {

-				// stop previous configuration

-				stopSDTIPE();

-

-				// start again with the new one

-				startSDTIpe();

 			}

+		} else {

+			logger.info("No properties. Deactivate announcement");

+			cseIdToBeAnnounced = null;

+			cseNameToBeAnnounced = null;

+			ipeUnderAnnouncedResource = false;

+			hasToBeAnnounced = false;

+			isValidConfiguration = true;

 		}

+

+		return isValidConfiguration;

 	}

 

 	/**

@@ -370,9 +258,6 @@
 	 * @return

 	 */

 	private boolean checkIfRemoteCSEExists(final String remoteCseId, final String remoteCseName) {

-		if (cseService == null) {

-			return false;

-		}

 

 		if (remoteCseId == null) {

 			// no need to check remote cse !

@@ -402,30 +287,38 @@
 	@Override

 	public void handleEvent(Event event) {

 

-		logger.debug("handleEvent!!!!!!");

+		logger.info("handleEvent!!!!!!");

+

+		try {

+			Thread.sleep(3000);

+		} catch (InterruptedException e) {

+			// TODO Auto-generated catch block

+			e.printStackTrace();

+		}

+

 		// check event

 		String remoteCseId = (String) event.getProperty(RemoteCseService.REMOTE_CSE_ID_PROPERTY);

-		String remoteCseName=  (String) event.getProperty(RemoteCseService.REMOTE_CSE_NAME_PROPERTY);

-		String operationProperty = (String) event.getProperty(RemoteCseService.REMOTE_CSE_NAME_PROPERTY);

-		

+		String remoteCseName = (String) event.getProperty(RemoteCseService.REMOTE_CSE_NAME_PROPERTY);

+		String operationProperty = (String) event.getProperty(RemoteCseService.OPERATION_PROPERTY);

+

 		if ((remoteCseId == null) || (remoteCseName == null)) {

 			// nothing to do

 			return;

 		}

-		

+

 		if (RemoteCseService.ADD_OPERATION_VALUE.equals(operationProperty)) {

 			// add a new cse

-			if((remoteCseId.equals(cseIdToBeAnnounced)) && (remoteCseName.equals(cseNameToBeAnnounced))) {

-				startSDTIpe();

+			if ((remoteCseId.equals(cseIdToBeAnnounced)) && (remoteCseName.equals(cseNameToBeAnnounced))) {

+				startSdtIpe();

 			}

-			

+

 		} else if (RemoteCseService.REMOVE_OPERATION_VALUE.equals(operationProperty)) {

 			// remove a remoteCse

-			if((remoteCseId.equals(cseIdToBeAnnounced)) && (remoteCseName.equals(cseNameToBeAnnounced))) {

-				stopSDTIPE();

+			if ((remoteCseId.equals(cseIdToBeAnnounced)) && (remoteCseName.equals(cseNameToBeAnnounced))) {

+				stopSdtIpe();

 			}

 		}

-		

+

 	}

 

 }

diff --git a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/CseUtil.java b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/CseUtil.java
index 943e0c9..171875c 100644
--- a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/CseUtil.java
+++ b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/CseUtil.java
@@ -16,9 +16,9 @@
 import org.eclipse.om2m.commons.constants.ResourceType;

 import org.eclipse.om2m.commons.resource.AE;

 import org.eclipse.om2m.commons.resource.AEAnnc;

+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;

 import org.eclipse.om2m.commons.resource.AccessControlPolicy;

 import org.eclipse.om2m.commons.resource.AccessControlRule;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.RequestPrimitive;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

 import org.eclipse.om2m.commons.resource.SetOfAcrs;

@@ -41,13 +41,12 @@
 	 * @return ResponsePrimitive sent by the CSE

 	 */

 	public static ResponsePrimitive sendCreateApplicationEntityRequest(CseService cseService, AE ae,

-			String resourceLocation, String resourceName) {

+			String resourceLocation) {

 		RequestPrimitive request = new RequestPrimitive();

 

 		request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);

 		request.setTo(resourceLocation);

 		request.setOperation(Operation.CREATE);

-		request.setName(resourceName);

 		request.setRequestContentType(MimeMediaType.OBJ);

 		request.setResourceType(ResourceType.AE);

 		request.setReturnContentType(MimeMediaType.OBJ);

@@ -65,8 +64,6 @@
 	 *            new application entity to create

 	 * @param resourceLocation

 	 *            location of the to be created application

-	 * @param resourceName

-	 *            name of the to be created application

 	 * @return ResponsePrimitive sent by the CSE

 	 */

 	public static ResponsePrimitive sendUpdateApplicationAnncEntityRequest(CseService cseService, AEAnnc aeAnnc,

@@ -92,18 +89,15 @@
 	 *            new application entity to create

 	 * @param resourceLocation

 	 *            location of the to be created application

-	 * @param resourceName

-	 *            name of the to be created application

 	 * @return ResponsePrimitive sent by the CSE

 	 */

 	public static ResponsePrimitive sendCreateSubscriptionRequest(CseService cseService, Subscription subscription,

-			String resourceLocation, String resourceName) {

+			String resourceLocation) {

 		RequestPrimitive request = new RequestPrimitive();

 

 		request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);

 		request.setTo(resourceLocation);

 		request.setOperation(Operation.CREATE);

-		request.setName(resourceName);

 		request.setRequestContentType(MimeMediaType.OBJ);

 		request.setResourceType(ResourceType.SUBSCRIPTION);

 		request.setReturnContentType(MimeMediaType.OBJ);

@@ -118,17 +112,15 @@
 	 * @param cseService CSE service

 	 * @param flexContainer flexContainer to be created

 	 * @param resourceLocation location of the to be created resource

-	 * @param resourceName name of the to be created resource

 	 * @return response sent by the CSE

 	 */

-	public static ResponsePrimitive sendCreateFlexContainerRequest(CseService cseService, FlexContainer flexContainer,

-			String resourceLocation, String resourceName) {

+	public static ResponsePrimitive sendCreateFlexContainerRequest(CseService cseService, AbstractFlexContainer flexContainer,

+			String resourceLocation) {

 		RequestPrimitive request = new RequestPrimitive();

 

 		request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);

 		request.setTo(resourceLocation);

 		request.setOperation(Operation.CREATE);

-		request.setName(resourceName);

 		request.setRequestContentType(MimeMediaType.OBJ);

 		request.setResourceType(ResourceType.FLEXCONTAINER);

 		request.setReturnContentType(MimeMediaType.OBJ);

@@ -140,6 +132,7 @@
 	public static ResponsePrimitive sendCreateDefaultACP(CseService cseService, String acpLocation, String acpName, List<String> labels) {

 		

 		AccessControlPolicy acp = new AccessControlPolicy();

+		acp.setName(acpName);

 		acp.getLabels().addAll(labels);

 		

 		// privileges

@@ -162,7 +155,6 @@
 		request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);

 		request.setTo(acpLocation);

 		request.setOperation(Operation.CREATE);

-		request.setName(acpName);

 		request.setRequestContentType(MimeMediaType.OBJ);

 		request.setResourceType(ResourceType.ACCESS_CONTROL_POLICY);

 		request.setReturnContentType(MimeMediaType.OBJ);

@@ -182,7 +174,7 @@
 	 * 

 	 * @return response sent by the CSE

 	 */

-	public static ResponsePrimitive sendInternalNotifyFlexContainerRequest(CseService cseService, FlexContainer flexContainer,

+	public static ResponsePrimitive sendInternalNotifyFlexContainerRequest(CseService cseService, AbstractFlexContainer flexContainer,

 			String resourceLocation) {

 		RequestPrimitive request = new RequestPrimitive();

 

diff --git a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/DeviceList.java b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/DeviceList.java
new file mode 100644
index 0000000..fe01407
--- /dev/null
+++ b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/DeviceList.java
@@ -0,0 +1,148 @@
+package org.eclipse.om2m.ipe.sdt;

+

+import java.util.ArrayList;

+import java.util.List;

+

+import org.eclipse.om2m.sdt.Device;

+

+/**

+ * This class holds the list of available SDT devices.

+ * This class uses the listener pattern to notify about device lifecycle

+ * @author MPCY8647

+ *

+ */

+public class DeviceList implements DeviceListListener {

+	

+	private final static DeviceList INSTANCE = new DeviceList();

+	

+	private List<Device> devices;

+	private List<DeviceListListener> listeners;

+	

+	/**

+	 * Private constructor.

+	 * Initializes internal data structures.

+	 */

+	private DeviceList() {

+		devices = new ArrayList<>();

+		listeners = new ArrayList<>();

+	}

+	

+	public static DeviceList getInstance() {

+		return INSTANCE;

+	}

+	

+	

+	/**

+	 * Add a device

+	 * @param pDevice device to be added

+	 */

+	public void addDevice(Device pDevice) {

+		synchronized (devices) {

+			devices.add(pDevice);

+			notifyNewDevice(pDevice);

+		}

+	}

+	

+	/**

+	 * Remove a device from list

+	 * @param pDevice device to be removed

+	 */

+	public void removeDevice(Device pDevice) {

+		synchronized (devices) {

+			if (devices.remove(pDevice)) {

+				notifyDeviceRemoved(pDevice);

+			}

+		}

+	}

+	

+	/**

+	 * Return a duplicated list of available device

+	 * @return

+	 */

+	public List<Device> getDevices() {

+		List<Device> toBeReturned = new ArrayList<>();

+		synchronized (devices) {

+			toBeReturned.addAll(devices);

+		}

+		return toBeReturned;

+	}

+	

+	/**

+	 * Add a listener and send to it the current list of devices

+	 * @param listenerToBeAdded listener to be added

+	 */

+	public void addListenerAndSend(DeviceListListener listenerToBeAdded) {

+		synchronized (listeners) {

+			listeners.add(listenerToBeAdded);

+		}

+		

+		for(Device device : getDevices()){

+			try {

+				listenerToBeAdded.notifyNewDevice(device);

+			} catch (Exception e) {

+				// silent

+			}

+		}

+	}

+	

+	/**

+	 * Retrieve a duplicated list of listeners

+	 * @return listeners

+	 */

+	public List<DeviceListListener> getListeners() {

+		List<DeviceListListener> toBeReturned = new ArrayList<>();

+		synchronized (listeners) {

+			toBeReturned.addAll(listeners);

+		}

+		return toBeReturned;

+	}

+	

+	/**

+	 * Remove a listener.

+	 * The to-be-removed listener is notified about device removed through notification

+	 * @param listenerToBeRemoved

+	 */

+	public void removeListener(DeviceListListener listenerToBeRemoved) {

+		for(Device device : getDevices()){

+			try {

+				listenerToBeRemoved.notifyDeviceRemoved(device);

+			} catch (Exception e) {

+				// silent

+			}

+		}

+		

+		synchronized (listeners) {

+			listeners.remove(listenerToBeRemoved);

+		}

+		

+	}

+

+	

+	@Override

+	/**

+	 * Retrieve all listeners and notify them about new device

+	 */

+	public void notifyNewDevice(Device newDevice) {

+		for(DeviceListListener listener : getListeners()) {

+			try {

+				listener.notifyNewDevice(newDevice);

+			} catch (Exception e) {

+			}

+		}

+	}

+

+	@Override

+	/**

+	 * Retrieve all listeners and notify them about device removal

+	 */

+	public void notifyDeviceRemoved(Device toBeRemovedDevice) {

+		for(DeviceListListener listener : getListeners()) {

+			try {

+				listener.notifyDeviceRemoved(toBeRemovedDevice);

+			} catch (Exception e) {

+			}

+		}

+	}

+

+

+}

diff --git a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/DeviceListListener.java b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/DeviceListListener.java
new file mode 100644
index 0000000..9affea9
--- /dev/null
+++ b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/DeviceListListener.java
@@ -0,0 +1,11 @@
+package org.eclipse.om2m.ipe.sdt;

+

+import org.eclipse.om2m.sdt.Device;

+

+public interface DeviceListListener {

+	

+	public void notifyNewDevice(Device newDevice);

+	

+	public void notifyDeviceRemoved(Device toBeRemovedDevice);

+

+}

diff --git a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/ModuleSDTListener.java b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/ModuleSDTListener.java
index df86695..4aadb09 100644
--- a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/ModuleSDTListener.java
+++ b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/ModuleSDTListener.java
@@ -13,6 +13,7 @@
 import org.apache.commons.logging.Log;

 import org.apache.commons.logging.LogFactory;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

 import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

@@ -79,11 +80,9 @@
 		logger.info("receive a notification for " + notif.getDataPoint().getName() 

 				+ ", value=" + notif.getValue());

 

-		FlexContainer toBeUpdated = new FlexContainer();

+		AbstractFlexContainer toBeUpdated = new FlexContainer();

 		CustomAttribute ca = new CustomAttribute();

 		ca.setCustomAttributeName(notif.getDataPoint().getName());

-		ca.setCustomAttributeType(

-				notif.getDataPoint().getDataType().getTypeChoice().getOneM2MType());

 		Object value = notif.getValue();

 		ca.setCustomAttributeValue((value != null ? value.toString() : null));

 		toBeUpdated.getCustomAttributes().add(ca);

diff --git a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTActionAdaptor.java b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTActionAdaptor.java
index 85bb611..f160c0b 100644
--- a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTActionAdaptor.java
+++ b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTActionAdaptor.java
@@ -10,9 +10,10 @@
 import org.apache.commons.logging.Log;

 import org.apache.commons.logging.LogFactory;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.FlexContainerFactory;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.ipe.sdt.flexcontainerservice.ActionFlexContainerService;

 import org.eclipse.om2m.sdt.Action;

@@ -25,6 +26,7 @@
 

 	private static final String SEP = "/";

 

+	private final boolean hasToBeAnnounced;

 	private final CseService cseService;

 	private final String parentLocation;

 	private final String resourceLocation;

@@ -36,8 +38,9 @@
 	private ActionFlexContainerService actionFlexContainerService;

 

 	public SDTActionAdaptor(final CseService pCseService, final Action pAction, 

-			final String pParentLocation, final Module pModule, final String announceCseId) {

+			final String pParentLocation, final Module pModule, final String announceCseId, final boolean hasToBeAnnounced) {

 		this.cseService = pCseService;

+		this.hasToBeAnnounced = hasToBeAnnounced;

 		this.action = pAction;

 		this.parentLocation = pParentLocation;

 		this.resourceName = action.getName();

@@ -50,9 +53,12 @@
 		logger.info("publishActionFromOM2MTree(name=" + this.action.getName() 

 				+ ", location=" + resourceLocation + ")");

 

-		FlexContainer actionFlexContainer = new FlexContainer();

+		AbstractFlexContainer actionFlexContainer = FlexContainerFactory.getSpecializationFlexContainer(action.getShortDefinitionName());

+		actionFlexContainer.setName(resourceName);

 		actionFlexContainer.setContainerDefinition(action.getDefinition());

-		if (announceCseId != null) {

+		actionFlexContainer.setLongName(action.getLongDefinitionName());

+		actionFlexContainer.setShortName(action.getShortDefinitionName());

+		if (hasToBeAnnounced) {

 			actionFlexContainer.getAnnounceTo().add(SEP + announceCseId);

 		}

 		

@@ -63,18 +69,17 @@
 		for (Arg arg : action.getArgs()) {

 			CustomAttribute customAttribute = new CustomAttribute();

 			customAttribute.setCustomAttributeName(arg.getName());

-			customAttribute.setCustomAttributeType(arg.getDataType().getTypeChoice().getOneM2MType());

 			actionFlexContainer.getCustomAttributes().add(customAttribute);

 		}

 

 		ResponsePrimitive response = CseUtil.sendCreateFlexContainerRequest(cseService, 

-				actionFlexContainer, parentLocation, resourceName);

+				actionFlexContainer, parentLocation);

 		if (! response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			logger.error("unable to create a FlexContainer for action " + action.getName() 

 					+ ":" + response.getContent(), null);

 			return false;

 		}

-		FlexContainer createdFlexContainer = (FlexContainer) response.getContent(); 

+		AbstractFlexContainer createdFlexContainer = (AbstractFlexContainer) response.getContent(); 

 		actionFlexContainerService = new ActionFlexContainerService(action, 

 				createdFlexContainer.getResourceID());

 		actionFlexContainerService.register();

diff --git a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTDeviceAdaptor.java b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTDeviceAdaptor.java
index 3707ee9..7d17a02 100644
--- a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTDeviceAdaptor.java
+++ b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTDeviceAdaptor.java
@@ -13,9 +13,10 @@
 import org.apache.commons.logging.Log;

 import org.apache.commons.logging.LogFactory;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.FlexContainerFactory;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.sdt.Device;

 import org.eclipse.om2m.sdt.Module;

@@ -28,6 +29,7 @@
 	private static final String SEP = "/";

 	private static final String DEVICE_PREFIX = "DEVICE_";

 	

+	private final boolean hasToBeAnnounced;

 	private final String parentLocation;

 	private final String resourceLocation;

 	private final String resourceName;

@@ -47,8 +49,9 @@
 	 */

 	public SDTDeviceAdaptor(final String pParentLocation, final Device pDevice, 

 			final CseService pCseService, final String pAdminAcpResource, 

-			final String pAnnounceCseId, final String pRemoteCseName) {

+			final String pAnnounceCseId, final String pRemoteCseName, final boolean hasToBeAnnounced) {

 		this.parentLocation = pParentLocation;

+		this.hasToBeAnnounced = hasToBeAnnounced;

 		this.device = pDevice;

 		this.resourceName = DEVICE_PREFIX + device.getId();

 		this.resourceLocation = parentLocation + SEP + resourceName;

@@ -66,11 +69,16 @@
 		logger.info("publishIntoOM2MTree(flexContainerName=" + resourceName 

 				+ ", parentLocation:" + parentLocation);

 		

-		FlexContainer flexContainer = new FlexContainer();

+		AbstractFlexContainer flexContainer = FlexContainerFactory.getSpecializationFlexContainer(device.getShortDefinitionName());

+		flexContainer.setName(resourceName);

 		// set container definition with the value of the Device definition

 		flexContainer.setContainerDefinition(device.getDefinition());

+				

+		// set long and short name

+		flexContainer.setLongName(device.getLongDefinitionName());

+		flexContainer.setShortName(device.getShortDefinitionName());

 		flexContainer.getAccessControlPolicyIDs().add(adminAcpResource);

-		if (announceCseId != null) {

+		if (hasToBeAnnounced) {

 			flexContainer.getAnnounceTo().add(SEP + announceCseId);

 		}

 		

@@ -92,22 +100,23 @@
 				+ ", value=" + sdtProperty.getValue() + ", type=" + sdtProperty.getType() + ")");

 

 			if (sdtProperty.getType() != null) {

+				

+				if ((sdtProperty.getValue() == null) && (sdtProperty.isOptional())) {

+					// do not add this property because it is null and optional

+					continue;

+				}

+				

 				CustomAttribute customAttributeForSdtProperty = new CustomAttribute();

-				customAttributeForSdtProperty.setCustomAttributeName(sdtProperty.getName());

+				customAttributeForSdtProperty.setCustomAttributeName(sdtProperty.getShortName());

 				customAttributeForSdtProperty.setCustomAttributeValue(sdtProperty.getValue());

-				customAttributeForSdtProperty.setCustomAttributeType(

-						sdtProperty.getType().getOneM2MType());

 

-				logger.debug("create a new CustomAttribute (name=" 

-						+ customAttributeForSdtProperty.getCustomAttributeName()

-						+ ", value=" + customAttributeForSdtProperty.getCustomAttributeValue() 

-						+ ", type=" + customAttributeForSdtProperty.getCustomAttributeType() + ")");

+				logger.info("new Property CustomAttribute (" + customAttributeForSdtProperty + ")");

 				flexContainer.getCustomAttributes().add(customAttributeForSdtProperty);

 			}

 		}

 		

 		ResponsePrimitive response = CseUtil.sendCreateFlexContainerRequest(cseService, 

-				flexContainer, parentLocation, resourceName);

+				flexContainer, parentLocation);

 		if (! response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			logger.error("unable to create a FlexContainer for SDT Device "

 					+ resourceName + " : " + response.getContent(), null);

@@ -117,7 +126,7 @@
 		// Modules (must be done now because Device FlexContainer is the parent of each Module)

 		for (Module module : this.device.getModules()) {

 			SDTModuleAdaptor sdtModuleAdaptor = new SDTModuleAdaptor(module, cseService, 

-					resourceLocation, announceCseId);

+					resourceLocation, announceCseId, hasToBeAnnounced);

 			if (sdtModuleAdaptor.publishModuleIntoOM2MTree()) {

 				modules.put(module, sdtModuleAdaptor);

 			} else {

diff --git a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTIpeApplication.java b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTIpeApplication.java
index 50c971f..0c0e8a1 100644
--- a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTIpeApplication.java
+++ b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTIpeApplication.java
@@ -22,7 +22,7 @@
 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.sdt.Device;

 

-public class SDTIpeApplication {

+public class SDTIpeApplication implements DeviceListListener {

 

 	private static Log logger = LogFactory.getLog(SDTIpeApplication.class);

 

@@ -42,16 +42,19 @@
 	private final String sdtIpeApplicationLocation;

 	private final String sdtIpeBaseLocation;

 	private final boolean ipeUnderAnnouncedResource;

-

+	private final boolean hasToBeAnnounced;

+	

 	private AccessControlPolicy adminAccessControlPolicy;

 	private AccessControlPolicy remoteAdminAccessControlPolicy;

+	private AE registeredAe;

 

 	public SDTIpeApplication(final CseService pCseService, final String announceCseId, final String pRemoteCseName,

-			final boolean ipeUnder) {

+			final boolean ipeUnder, final boolean hasToBeAnnounced) {

 		cseService = pCseService;

 		this.remoteCseId = announceCseId;

 		this.remoteCseName = pRemoteCseName;

 		this.ipeUnderAnnouncedResource = ipeUnder;

+		this.hasToBeAnnounced = hasToBeAnnounced;

 

 		if (ipeUnderAnnouncedResource) {

 			if ((remoteCseId != null) && (remoteCseName != null)) {

@@ -68,11 +71,11 @@
 	}

 

 	// SDT Device Management

-	protected boolean addSDTDevice(Device device) {

+	private boolean addSDTDevice(Device device) {

 		logger.info("add SDT Device (id:" + device.getId() + ", name=" + device.getName() + ") into oneM2M");

 

 		SDTDeviceAdaptor sdtDeviceAdaptor = new SDTDeviceAdaptor(sdtIpeApplicationLocation, device, cseService,

-				adminAccessControlPolicy.getResourceID(), remoteCseId, remoteCseName);

+				adminAccessControlPolicy.getResourceID(), remoteCseId, remoteCseName, hasToBeAnnounced);

 		if (sdtDeviceAdaptor.publishIntoOM2MTree()) {

 			synchronized (devices) {

 				devices.put(device, sdtDeviceAdaptor);

@@ -82,7 +85,7 @@
 		return false;

 	}

 

-	protected void removeSDTDevice(Device device) {

+	private void removeSDTDevice(Device device) {

 		logger.info("remove SDT Device (id:" + device.getId() + ", name=" + device.getName() + ") into oneM2M");

 		SDTDeviceAdaptor sdtDeviceAdaptor = null;

 		synchronized (devices) {

@@ -105,17 +108,17 @@
 		logger.info("create ipe application");

 

 		AE ae = new AE();

+		ae.setName(APPLICATION_NAME);

 		ae.setAppID(APPLICATION_NAME);

 		ae.setRequestReachability(Boolean.TRUE);

 		ae.getPointOfAccess().add(POA);

-		if (remoteCseId != null) {

+		if (hasToBeAnnounced) {

 			ae.getAnnounceTo().add(SEP + remoteCseId);

 		}

 

 		ResponsePrimitive resp = null;

-		for (int i = 0; i < 2; i++) {

-			 resp = CseUtil.sendCreateApplicationEntityRequest(cseService, ae, sdtIpeBaseLocation,

-					APPLICATION_NAME);

+		for (int i = 0; i < 3; i++) {

+			 resp = CseUtil.sendCreateApplicationEntityRequest(cseService, ae, sdtIpeBaseLocation);

 

 			 if (ResponseStatusCode.CREATED.equals(resp.getResponseStatusCode())) {

 				 // nothing do 

@@ -132,17 +135,22 @@
 

 		}

 

-		AE receivedAe = (AE) resp.getContent();

+		if (!ResponseStatusCode.CREATED.equals(resp.getResponseStatusCode())) {

+			// no need to continue

+			return;

+		} else {

+			registeredAe = (AE) resp.getContent();

+		}

 

 		ResponsePrimitive response = CseUtil.sendCreateDefaultACP(cseService, sdtIpeBaseLocation,

 				"ACP_Device_Admin_" + System.currentTimeMillis(), new ArrayList<String>());

 		adminAccessControlPolicy = (AccessControlPolicy) response.getContent();

 

-		if ((remoteCseId != null) && (remoteCseName != null)) {

+		if (/*(remoteCseId != null) && (remoteCseName != null)*/ hasToBeAnnounced) {

 			// remote ACP_Device_Admin

 			response = CseUtil.sendCreateDefaultACP(cseService,

 					SEP + remoteCseId + SEP + remoteCseName + SEP + Constants.CSE_NAME,

-					"ACP_Device_Admin" + System.currentTimeMillis(), new ArrayList<String>());

+					"Remote_ACP_Device_Admin" + System.currentTimeMillis(), new ArrayList<String>());

 			remoteAdminAccessControlPolicy = (AccessControlPolicy) response.getContent();

 

 			// update SDT_IPE_ANNC

@@ -158,19 +166,35 @@
 	 */

 	protected void deleteIpeApplicationEntity() {

 		logger.info("delete ipe application");

-		ResponsePrimitive response = CseUtil.sendDeleteRequest(cseService, sdtIpeApplicationLocation);

-		if (!response.getResponseStatusCode().equals(ResponseStatusCode.DELETED)) {

-			// log only

-			// no need to throw an exception

-			logger.error("unable to delete SDT IPE Application entity:" + response.getContent(), null);

+		if (registeredAe != null) { 

+			ResponsePrimitive response = CseUtil.sendDeleteRequest(cseService, registeredAe.getResourceID()/* sdtIpeApplicationLocation*/);

+			if (!response.getResponseStatusCode().equals(ResponseStatusCode.DELETED)) {

+				// log only

+				// no need to throw an exception

+				logger.error("unable to delete SDT IPE Application entity:" + response.getContent(), null);

+			}

+			registeredAe = null;

 		}

+		

 

 		if (adminAccessControlPolicy != null) {

 			CseUtil.sendDeleteRequest(cseService, adminAccessControlPolicy.getResourceID());

+			adminAccessControlPolicy = null;

 		}

 		if (remoteAdminAccessControlPolicy != null) {

 			CseUtil.sendDeleteRequest(cseService, remoteAdminAccessControlPolicy.getResourceID());

+			remoteAdminAccessControlPolicy = null;

 		}

 	}

 

+	@Override

+	public void notifyNewDevice(Device newDevice) {

+		addSDTDevice(newDevice);

+	}

+

+	@Override

+	public void notifyDeviceRemoved(Device toBeRemovedDevice) {

+		removeSDTDevice(toBeRemovedDevice);

+	}

+

 }

diff --git a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTModuleAdaptor.java b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTModuleAdaptor.java
index 44d4844..5382482 100644
--- a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTModuleAdaptor.java
+++ b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTModuleAdaptor.java
@@ -14,9 +14,10 @@
 import org.apache.commons.logging.Log;

 import org.apache.commons.logging.LogFactory;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.FlexContainerFactory;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.ipe.sdt.flexcontainerservice.ModuleFlexContainerService;

 import org.eclipse.om2m.sdt.Action;

@@ -36,6 +37,7 @@
 	private static final String SEP = "/";

 	private static final String SDT_IPE_SUBSCRIPTION_NAME = "SDT_IPE_SUBSCRIPTION";

 

+	private final boolean hasToBeAnnounced;

 	private final Module module;

 	private final CseService cseService;

 	private final String parentLocation;

@@ -46,8 +48,9 @@
 	private ModuleSDTListener moduleSDTListener;

 

 	public SDTModuleAdaptor(final Module pModule, final CseService pCseService, 

-			final String pParentLocation, final String pAnnounceCseId) {

+			final String pParentLocation, final String pAnnounceCseId, final boolean hasToBeAnnounced) {

 		this.module = pModule;

+		this.hasToBeAnnounced = hasToBeAnnounced;

 		this.cseService = pCseService;

 		this.parentLocation = pParentLocation;

 		this.resourceLocation = this.parentLocation + SEP + this.module.getName();

@@ -66,9 +69,12 @@
 		logger.info("publishModuleFromOM2MTree(name=" + this.module.getName() 

 				+ ", parentLocation=" + parentLocation + ")");

 

-		FlexContainer flexContainer = new FlexContainer();

+		AbstractFlexContainer flexContainer = FlexContainerFactory.getSpecializationFlexContainer(this.module.getShortDefinitionName());

+		flexContainer.setName(this.module.getName());

 		flexContainer.setContainerDefinition(this.module.getDefinition());

-		if (announceCseId != null) {

+		flexContainer.setLongName(this.module.getLongDefinitionName());

+		flexContainer.setShortName(this.module.getShortDefinitionName());

+		if (hasToBeAnnounced) {

 			flexContainer.getAnnounceTo().add(SEP + announceCseId);	

 		}

 

@@ -86,8 +92,11 @@
 		/// each DataPoint is a custom attribute

 		for (DataPoint dp : module.getDataPoints()) {

 			CustomAttribute customAttribute = new CustomAttribute();

-			customAttribute.setCustomAttributeName(dp.getName());

-			customAttribute.setCustomAttributeType(dp.getDataType().getTypeChoice().getOneM2MType());

+			String customAttributeName = dp.getShortDefinitionType();

+			if (customAttributeName == null) {

+				customAttributeName = dp.getName();

+			}

+			customAttribute.setCustomAttributeName(customAttributeName);

 			String value = null;

 			try {

 				if (dp instanceof AbstractDateDataPoint) {

@@ -124,38 +133,37 @@
 			}

 			customAttribute.setCustomAttributeValue(value);

 

-			logger.info("add DataPoint customAttribute(name=" + customAttribute.getCustomAttributeName() 

-					+ ", type=" + customAttribute.getCustomAttributeType() 

-					+ ", value=" + customAttribute.getCustomAttributeValue() + ")");

-

+			logger.info("add DataPoint customAttribute(" + customAttribute + ")");

 			flexContainer.getCustomAttributes().add(customAttribute);

 		}

 

 		// SDT properties are customAttribute of the module FlexContainer

 		for (Property sdtProperty : module.getProperties()) {

 			if (sdtProperty.getType() != null) {

+				

+				if ((sdtProperty.getValue() == null) && (sdtProperty.isOptional())) {

+					continue;

+				}

+				

 				CustomAttribute caForSdtProperty = new CustomAttribute();

-				caForSdtProperty.setCustomAttributeName(sdtProperty.getName());

+				caForSdtProperty.setCustomAttributeName(sdtProperty.getShortName());

 				caForSdtProperty.setCustomAttributeValue(sdtProperty.getValue());

-				caForSdtProperty.setCustomAttributeType(sdtProperty.getType().getOneM2MType());

 

-				logger.debug("create a new CustomAttribute (name=" 

-						+ caForSdtProperty.getCustomAttributeName()

-						+ ", value=" + caForSdtProperty.getCustomAttributeValue() 

-						+ ", type=" + caForSdtProperty.getCustomAttributeType() + ")");

+				logger.info("add Property customAttribute(" + caForSdtProperty + ")");

 				flexContainer.getCustomAttributes().add(caForSdtProperty);

 			}

 		}

+		logger.info("customAttributes: " + flexContainer.getCustomAttributes());

 

 		ResponsePrimitive resp = CseUtil.sendCreateFlexContainerRequest(cseService, flexContainer,

-				parentLocation, this.module.getName());

+				parentLocation);

 		if (! resp.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			logger.error("publishModuleFromOM2MTree(name=" + this.module.getName() 

 					+ ", parentLocation=" + parentLocation + ") : failed to publish:" + resp.getContent(),

 					null);

 			return false;

 		}

-		FlexContainer createdFlexContainer = (FlexContainer) resp.getContent();

+		AbstractFlexContainer createdFlexContainer = (AbstractFlexContainer) resp.getContent();

 		// create a ModuleFlexContainerService

 		moduleFlexContainerService = new ModuleFlexContainerService(module, 

 				createdFlexContainer.getResourceID());

@@ -164,7 +172,7 @@
 		// publish actions

 		for (Action action : module.getActions()) {

 			SDTActionAdaptor actionAdaptor = new SDTActionAdaptor(cseService, action, 

-					resourceLocation, module, announceCseId);

+					resourceLocation, module, announceCseId, hasToBeAnnounced);

 			if (actionAdaptor.publishActionIntoOM2MTree()) {

 				actions.put(action.getName(), actionAdaptor);

 			} else {

diff --git a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTUtil.java b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTUtil.java
index 90c7556..364d9d0 100644
--- a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTUtil.java
+++ b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/SDTUtil.java
@@ -10,6 +10,7 @@
 import java.net.URI;

 import java.text.DateFormat;

 import java.util.ArrayList;

+import java.util.Date;

 import java.util.List;

 

 import org.eclipse.om2m.commons.resource.CustomAttribute;

@@ -20,8 +21,8 @@
 	static final private DateFormat dateFormat = DateFormat.getDateInstance();

 	static final private DateFormat timeFormat = DateFormat.getTimeInstance();

 

-	public static Object getValue(CustomAttribute attr) throws Exception {

-		return getValue(attr.getCustomAttributeValue(), attr.getCustomAttributeType());

+	public static Object getValue(CustomAttribute attr, String type) throws Exception {

+		return getValue(attr.getCustomAttributeValue(), type);

 	}

 

 	public static Object getValue(String value, String type) throws Exception {

@@ -30,14 +31,6 @@
 		switch (type) {

 		case "xs:string": return value;

 		case "xs:integer": 

-		case "hd:alertColourCode":

-		case "hd:doorState":

-		case "hd:level":

-		case "hd:lockState":

-		case "hd:supportedMode":

-		case "hd:tone":

-		case "hd:foamStrength":

-		case "hd:tasteStrength":

 			return Integer.parseInt(value);

 		case "xs:float": return Float.parseFloat(value);

 		case "xs:boolean": return Boolean.parseBoolean(value);

@@ -60,8 +53,41 @@
 		case "xs:uri": return new URI(value);

 		case "xs:blob": return value;

 		default:

-			return value;

+			return type.startsWith("hd:") ? Integer.parseInt(value) : value;

 		}

 	}

 	

+	public static String getStringValue(String type, Object val) throws Exception {

+		if (val == null) {

+			return null;

+		}

+		switch (type) {

+		case "xs:string":

+			return val.toString();//"\"" + val.toString() + "\"";

+		case "xs:integer": 

+		case "xs:float":

+		case "xs:boolean":

+		case "xs:byte":

+		case "xs:uri":

+			return val.toString();

+		case "xs:datetime": return dateTimeFormat.format((Date)val);

+		case "xs:time": return timeFormat.format((Date)val);

+		case "xs:date": return dateFormat.format((Date)val);

+		case "xs:enum":

+			String ret = "";

+			boolean first = true;

+			for (Object s : (List<?>)val) {

+				if (first) ret += ",";

+				else first = false;

+				ret += s.toString();

+			}

+			return ret;

+		case "xs:blob": return null;// TODO serialize byte array

+		default:

+			if (type.startsWith("hd:")) 

+				return val.toString();

+			return null;

+		}

+	}

+

 }

diff --git a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/flexcontainerservice/ActionFlexContainerService.java b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/flexcontainerservice/ActionFlexContainerService.java
index 0a30f01..6bc552b 100644
--- a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/flexcontainerservice/ActionFlexContainerService.java
+++ b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/flexcontainerservice/ActionFlexContainerService.java
@@ -7,6 +7,7 @@
  *******************************************************************************/

 package org.eclipse.om2m.ipe.sdt.flexcontainerservice;

 

+import java.util.Collections;

 import java.util.HashMap;

 import java.util.List;

 import java.util.Map;

@@ -60,6 +61,13 @@
 	}

 

 	@Override

+	public Map<String, String> getCustomAttributeValues(List<String> customAttributeNames) 

+			throws Om2mException {

+		// no value

+		return Collections.emptyMap();

+	}

+

+	@Override

 	public void setCustomAttributeValues(List<CustomAttribute> customAttributes, 

 			RequestPrimitive requestPrimitive) throws Om2mException {

 		logger.debug("setCustomAttributeValues(" + customAttributes + ")");

@@ -78,7 +86,7 @@
 					for (String argName : action.getArgNames()) {

 						CustomAttribute ca = getCustomAttribute(customAttributes, argName);

 						if (ca != null) {

-							args.put(argName, SDTUtil.getValue(ca));

+							args.put(argName, SDTUtil.getValue(ca, "string"));

 						}

 					}

 				} catch (Exception e) {

@@ -98,7 +106,6 @@
 				if (response != null) {

 					CustomAttribute output = new CustomAttribute();

 					output.setCustomAttributeName("output");

-					output.setCustomAttributeType("xs:string");

 					output.setCustomAttributeValue(response.toString());

 					customAttributes.add(output);

 				}

@@ -138,4 +145,5 @@
 		}

 		return null;

 	}

+

 }

diff --git a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/flexcontainerservice/ModuleFlexContainerService.java b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/flexcontainerservice/ModuleFlexContainerService.java
index fed4a3b..5fab078 100644
--- a/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/flexcontainerservice/ModuleFlexContainerService.java
+++ b/org.eclipse.om2m.ipe.sdt/src/main/java/org/eclipse/om2m/ipe/sdt/flexcontainerservice/ModuleFlexContainerService.java
@@ -7,7 +7,10 @@
  *******************************************************************************/

 package org.eclipse.om2m.ipe.sdt.flexcontainerservice;

 

+import java.util.ArrayList;

+import java.util.HashMap;

 import java.util.List;

+import java.util.Map;

 

 import org.apache.commons.logging.Log;

 import org.apache.commons.logging.LogFactory;

@@ -21,7 +24,6 @@
 import org.eclipse.om2m.sdt.DataPoint;

 import org.eclipse.om2m.sdt.Module;

 import org.eclipse.om2m.sdt.Property;

-import org.eclipse.om2m.sdt.datapoints.AbstractDateDataPoint;

 import org.eclipse.om2m.sdt.datapoints.ValuedDataPoint;

 import org.eclipse.om2m.sdt.exceptions.AccessException;

 import org.eclipse.om2m.sdt.exceptions.DataPointException;

@@ -60,14 +62,14 @@
 	public String getCustomAttributeValue(String customAttributeName) throws Om2mException {

 		logger.debug("DataPointFlexContainerService - getCustomAttributeValue(customAttributeName=" 

 						+ customAttributeName + ")");

-		Property prop = module.getProperty(customAttributeName);

+		Property prop = module.getPropertyByShortName(customAttributeName);

 		if (prop != null) {

 			logger.debug("CustomAttribute is a property, not a datapoint");

 			return prop.getValue();

 		}

 

 		// retrieve the DataPoint object based on customAttributeName input parameter

-		DataPoint dataPoint = module.getDataPoint(customAttributeName);

+		DataPoint dataPoint = module.getDataPointByShortName(customAttributeName);

 		if (dataPoint == null) {

 			throw new Om2mException("unknown custom attribute " + customAttributeName + " in " + module,

 					ResponseStatusCode.INTERNAL_SERVER_ERROR);

@@ -77,21 +79,16 @@
 		String value = null;

 		try {

 			Object o = ((ValuedDataPoint<?>) dataPoint).getValue();

-			if (o == null) {

-				value = null;

-			} else if (dataPoint instanceof AbstractDateDataPoint) {

-				value = ((AbstractDateDataPoint) dataPoint).getStringValue();

-			} else {

-				value = o.toString();

-			}

-		} catch (DataPointException e) {

-			e.printStackTrace();

-			throw new Om2mException("unable to retrieve value of DataPoint " + dataPoint.getName() + " : " + e.getMessage(),

-					ResponseStatusCode.INTERNAL_SERVER_ERROR);

+			String type = dataPoint.getDataType().getTypeChoice().getOneM2MType();

+			value = SDTUtil.getStringValue(type, o);

 		} catch (AccessException e) {

 			e.printStackTrace();

 			throw new Om2mException("unable to retrieve value of DataPoint " + dataPoint.getName() + " : " + e.getMessage(),

 					ResponseStatusCode.ACCESS_DENIED);

+		} catch (Exception e) {

+			e.printStackTrace();

+			throw new Om2mException("unable to retrieve value of DataPoint " + dataPoint.getName() + " : " + e.getMessage(),

+					ResponseStatusCode.INTERNAL_SERVER_ERROR);

 		}

 

 		logger.debug("DataPointFlexContainerService - getCustomAttributeValue(customAttributeName=" + customAttributeName

@@ -100,43 +97,74 @@
 	}

 

 	@Override

-	public void setCustomAttributeValues(List<CustomAttribute> customAttributes, RequestPrimitive requestPrimitive)

+	public Map<String, String> getCustomAttributeValues(List<String> customAttributeNames) 

 			throws Om2mException {

-		logger.debug("setCustomAttributeValue()");

-

-		for (CustomAttribute ca : customAttributes) {

-			DataPoint dataPoint = module.getDataPoint(ca.getCustomAttributeName());

-			if (dataPoint != null) {

-				// the custom attribute is a dataPoint

-				ValuedDataPoint<Object> valuedDataPoint = (ValuedDataPoint<Object>) dataPoint;

-				String msg = "setCustomAttributeValue(dataPointName=" + dataPoint.getName() 

-						+ ", newValue=" + ca.getCustomAttributeValue() + ") - ";

-

-				// retrieve type of the DataPoint

+		try {

+			Map<String, String> ret = new HashMap<String, String>();

+			List<String> dpNames = new ArrayList<String>();

+			for (String name : customAttributeNames) {

+				Property prop = module.getPropertyByShortName(name);

+				if (prop != null) {

+					logger.debug("CustomAttribute " + name + " is a property, not a datapoint");

+					ret.put(name, prop.getValue());

+				} else if (module.getDataPointByShortName(name) != null) {

+					logger.debug("CustomAttribute " + name + " is a datapoint");

+					dpNames.add(name);

+				} else {

+					logger.warn("CustomAttribute " + name + " unknown");

+					throw new Om2mException(ResponseStatusCode.INVALID_ARGUMENTS);

+				}

+			}

+			for (Map.Entry<String, Object> entry : module.getDatapointHandler().getValues(dpNames).entrySet()) {

+				DataPoint dataPoint = module.getDataPointByShortName(entry.getKey());

 				String type = dataPoint.getDataType().getTypeChoice().getOneM2MType();

-				Object value = null;

-				try {

-					value = SDTUtil.getValue(ca.getCustomAttributeValue(), type);

-				} catch (Exception e) {

-					logger.info(msg + "KO: " + e.getMessage());

-					throw new Om2mException(e.getMessage(), e, ResponseStatusCode.CONTENTS_UNACCEPTABLE);

-				}

-				try {

-					valuedDataPoint.setValue(value);

-					logger.debug(msg + "OK");

-				} catch (AccessException e) {

-					logger.debug(msg + "KO: " + e.getMessage());

-					throw new Om2mException(e.getMessage(), e, ResponseStatusCode.ACCESS_DENIED);

-				} catch (Exception e) {

-					logger.debug(msg + "KO: " + e.getMessage());

-					throw new Om2mException(e.getMessage(), e, ResponseStatusCode.INTERNAL_SERVER_ERROR);

-				}

-			} else {

+				ret.put(entry.getKey(), SDTUtil.getStringValue(type, entry.getValue()));

+			}

+			return ret;

+		} catch (AccessException e) {

+			e.printStackTrace();

+			throw new Om2mException(e.getMessage(), e, ResponseStatusCode.ACCESS_DENIED);

+		} catch (DataPointException e) {

+			e.printStackTrace();

+			throw new Om2mException(e.getMessage(), e, ResponseStatusCode.INTERNAL_SERVER_ERROR);

+		} catch (Exception e) {

+			e.printStackTrace();

+			throw new Om2mException(ResponseStatusCode.INVALID_ARGUMENTS);

+		}

+	}

+

+	@Override

+	public void setCustomAttributeValues(List<CustomAttribute> customAttributes, 

+			RequestPrimitive request) throws Om2mException {

+		logger.debug("setCustomAttributeValues()");

+		

+		Map<String, Object> values = new HashMap<String, Object>();

+		for (CustomAttribute ca : customAttributes) {

+			DataPoint dataPoint = module.getDataPointByShortName(ca.getCustomAttributeName());

+			if (dataPoint == null)

 				// no datapoint for this attribute

 				// throw a Om2mException

 				throw new Om2mException(ResponseStatusCode.INVALID_ARGUMENTS);

+			try {

+				// retrieve type of the DataPoint

+				String type = dataPoint.getDataType().getTypeChoice().getOneM2MType();

+				values.put(ca.getCustomAttributeName(), 

+						SDTUtil.getValue(ca.getCustomAttributeValue(), type));

+			} catch (Exception e) {

+				logger.info("KO: " + e.getMessage());

+				throw new Om2mException(e.getMessage(), e, 

+						ResponseStatusCode.CONTENTS_UNACCEPTABLE);

 			}

 		}

+		try {

+			module.getDatapointHandler().setValues(values);

+		} catch (AccessException e) {

+			logger.warn("KO: " + e.getMessage());

+			throw new Om2mException(e.getMessage(), e, ResponseStatusCode.ACCESS_DENIED);

+		} catch (Exception e) {

+			logger.warn("KO: " + e.getMessage());

+			throw new Om2mException(e.getMessage(), e, ResponseStatusCode.INTERNAL_SERVER_ERROR);

+		}

 	}

 

 	@Override

diff --git a/org.eclipse.om2m.ipe.sdt/src/main/resources/OSGI-INF/component.xml b/org.eclipse.om2m.ipe.sdt/src/main/resources/OSGI-INF/component.xml
new file mode 100644
index 0000000..df19867
--- /dev/null
+++ b/org.eclipse.om2m.ipe.sdt/src/main/resources/OSGI-INF/component.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>

+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" modified="modified" name="sdt.ipe" configuration-policy="optional">

+	

+	<implementation

+		class="org.eclipse.om2m.ipe.sdt.Activator" />

+		

+	<service>

+		<provide interface="org.osgi.service.event.EventHandler" />

+	</service>

+

+	<property name="event.topics" value="org/eclipse/om2m/remoteCse" />

+

+	<reference name="cseService" cardinality="1..1"

+        interface="org.eclipse.om2m.core.service.CseService"

+        bind="setCseService" unbind="unsetCseService" policy="dynamic"/>

+

+	<reference name="Device" cardinality="0..n" policy="dynamic" 

+	    bind="setDevice" unbind="unsetDevice" 

+	    interface="org.eclipse.om2m.sdt.Device" />

+ 

+ 	<property name="configurationPid" type="String" value="sdt.ipe"/>		

+	

+</scr:component>

diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AccessControlPolicyDAO.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AccessControlPolicyDAO.java
index 6f10132..a61982d 100644
--- a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AccessControlPolicyDAO.java
+++ b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AccessControlPolicyDAO.java
@@ -19,9 +19,11 @@
  *******************************************************************************/
 package org.eclipse.om2m.persistence.eclipselink.internal.dao;
 
+import java.util.ArrayList;
 import java.util.List;
 
 import org.eclipse.om2m.commons.entities.AccessControlPolicyEntity;
+import org.eclipse.om2m.commons.entities.AccessControlRuleEntity;
 import org.eclipse.om2m.commons.entities.AeEntity;
 import org.eclipse.om2m.commons.entities.FlexContainerAnncEntity;
 import org.eclipse.om2m.commons.entities.FlexContainerEntity;
@@ -39,7 +41,20 @@
 		DBTransactionJPAImpl transaction = (DBTransactionJPAImpl) dbTransaction;
 		List<LabelEntity> lbls = processLabels(dbTransaction, resource.getLabelsEntities());
 		resource.setLabelsEntities(lbls);
-		transaction.getEm().merge(resource);
+		
+		// persist self privilege
+		for(AccessControlRuleEntity acre : resource.getSelfPrivileges()) {
+			acre.setSelfAccessControlPolicy(resource);
+			transaction.getEm().persist(acre);
+		}
+		
+		// persist privileges
+		for(AccessControlRuleEntity acre : resource.getPrivileges()) {
+			acre.setAccessControlPolicy(resource);
+			transaction.getEm().persist(acre);
+		}
+		
+		transaction.getEm().persist(resource);
 	}
 
 	@Override
@@ -74,9 +89,21 @@
 		for (FlexContainerAnncEntity entity : resource.getLinkedFlexContainerAs()) {
 			entity.getAccessControlPolicies().remove(resource);
 		}
+		
+		if (resource.getParentAE() != null) {
+			resource.getParentAE().getChildAccessControlPolicies().remove(resource);
+		}
+		
+		if (resource.getParentCse() != null) {
+			resource.getParentCse().getChildAccessControlPolicies().remove(resource);
+		}
+		
+		if (resource.getParentCsr() != null) {
+			resource.getParentCsr().getChildAcps().remove(resource);
+		}
 
 		transaction.getEm().remove(resource);
-		transaction.getEm().getEntityManagerFactory().getCache().evictAll();
+//		transaction.getEm().getEntityManagerFactory().getCache().evictAll();
 	}
 
 }
diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AeAnncDAO.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AeAnncDAO.java
index 75c7662..415018e 100644
--- a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AeAnncDAO.java
+++ b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AeAnncDAO.java
@@ -45,10 +45,12 @@
 		for (LabelEntity label : labels) {
 			label.getLinkedFcnt().remove(resource);
 		}
+		
+		if (resource.getParentCsr() != null) {
+			resource.getParentCsr().getChildAeAnncs().remove(resource);
+		}
 
 		transaction.getEm().remove(resource);
-		transaction.getEm().getEntityManagerFactory().getCache().evict(CSEBaseEntity.class);
-		transaction.getEm().getEntityManagerFactory().getCache().evict(RemoteCSEEntity.class);
 	}
 
 }
diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AeDAO.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AeDAO.java
index 8d626ac..0030636 100644
--- a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AeDAO.java
+++ b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/AeDAO.java
@@ -50,11 +50,19 @@
 		for (LabelEntity label : labels) {
 			label.getLinkedFcnt().remove(resource);
 		}
+		
+		if (resource.getParentCse() != null) {
+			resource.getParentCse().getAes().remove(resource);
+		}
+		
+		if (resource.getParentCsr() != null) {
+			resource.getParentCsr().getChildAes().remove(resource);
+		}
 
 		transaction.getEm().remove(resource);
-		transaction.getEm().getEntityManagerFactory().getCache().evict(CSEBaseEntity.class);
-		transaction.getEm().getEntityManagerFactory().getCache().evict(RemoteCSEEntity.class);
-		transaction.getEm().getEntityManagerFactory().getCache().evict(RemoteCseAnncEntity.class);
+//		transaction.getEm().getEntityManagerFactory().getCache().evict(CSEBaseEntity.class);
+//		transaction.getEm().getEntityManagerFactory().getCache().evict(RemoteCSEEntity.class);
+//		transaction.getEm().getEntityManagerFactory().getCache().evict(RemoteCseAnncEntity.class);
 	}
 
 	@Override
diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/FlexContainerAnncDAO.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/FlexContainerAnncDAO.java
index 62b6b91..691a9dd 100644
--- a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/FlexContainerAnncDAO.java
+++ b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/FlexContainerAnncDAO.java
@@ -25,11 +25,17 @@
 		for (LabelEntity label : labels) {

 			label.getLinkedFcnt().remove(resource);

 		}

+		

+		// de-associate parent

+		if (resource.getParentAeAnnc() != null) {

+			resource.getParentAeAnnc().getFlexContainerAnncs().remove(resource);

+		}

+		

+		if (resource.getParentFlexContainerAnnc() != null) {

+			resource.getParentFlexContainerAnnc().getChildFlexContainerAnncs().remove(resource);

+		}

 

 		transaction.getEm().remove(resource);

-		transaction.getEm().getEntityManagerFactory().getCache().evict(AeAnncEntity.class);

-		transaction.getEm().getEntityManagerFactory().getCache().evict(FlexContainerAnncEntity.class);

-		transaction.getEm().getEntityManagerFactory().getCache().evict(LabelEntity.class);

 

 	}

 

diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/FlexContainerDAO.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/FlexContainerDAO.java
index d0b929d..acb5afc 100644
--- a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/FlexContainerDAO.java
+++ b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/FlexContainerDAO.java
@@ -38,13 +38,27 @@
 			label.getLinkedFcnt().remove(resource);
 		}
 		
+		if (resource.getParentAE() != null) {
+			resource.getParentAE().getChildFlexContainers().remove(resource);
+		}
+		
+		if (resource.getParentContainer() != null) {
+			resource.getParentContainer().getChildFlexContainers().remove(resource);
+		}
+		
+		if (resource.getParentCSEB() != null) {
+			resource.getParentCSEB().getChildFlexContainers().remove(resource);
+		}
+		
+		if (resource.getParentCSR() != null) {
+			resource.getParentCSR().getChildFlexContainers().remove(resource);
+		}
+		
+		if (resource.getParentFlexContainer() != null) {
+			resource.getParentFlexContainer().getChildFlexContainers().remove(resource);
+		}
+		
 		transaction.getEm().remove(resource);
-		transaction.getEm().getEntityManagerFactory().getCache().evict(CSEBaseEntity.class);
-		transaction.getEm().getEntityManagerFactory().getCache().evict(AeEntity.class);
-		transaction.getEm().getEntityManagerFactory().getCache().evict(RemoteCSEEntity.class);
-		transaction.getEm().getEntityManagerFactory().getCache().evict(RemoteCseAnncEntity.class);
-		transaction.getEm().getEntityManagerFactory().getCache().evict(AeAnncEntity.class);
-		transaction.getEm().getEntityManagerFactory().getCache().evict(LabelEntity.class);
 	}
 
 }
diff --git a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/RemoteCSEDAO.java b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/RemoteCSEDAO.java
index ab4ca19..f556049 100644
--- a/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/RemoteCSEDAO.java
+++ b/org.eclipse.om2m.persistence.eclipselink/src/main/java/org/eclipse/om2m/persistence/eclipselink/internal/dao/RemoteCSEDAO.java
@@ -35,8 +35,13 @@
 	@Override
 	public void delete(DBTransaction dbTransaction, RemoteCSEEntity resource) {
 		DBTransactionJPAImpl transaction = (DBTransactionJPAImpl) dbTransaction;
+		
+		if (resource.getParentCseBase() != null) {
+			resource.getParentCseBase().getRemoteCses().remove(resource);
+		}
+		
 		transaction.getEm().remove(resource);
-		transaction.getEm().getEntityManagerFactory().getCache().evict(CSEBaseEntity.class);
+//		transaction.getEm().getEntityManagerFactory().getCache().evict(CSEBaseEntity.class);
 	}
 	
 	@Override
diff --git a/org.eclipse.om2m.sdt.comparator.xml/.classpath b/org.eclipse.om2m.sdt.comparator.xml/.classpath
new file mode 100644
index 0000000..98ddc48
--- /dev/null
+++ b/org.eclipse.om2m.sdt.comparator.xml/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
+	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="src" path="src/main/java/"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>
diff --git a/org.eclipse.om2m.sdt.comparator.xml/.project b/org.eclipse.om2m.sdt.comparator.xml/.project
new file mode 100644
index 0000000..5b135b8
--- /dev/null
+++ b/org.eclipse.om2m.sdt.comparator.xml/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>org.eclipse.om2m.sdt.comparator.xml</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.ManifestBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.pde.SchemaBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+		<nature>org.eclipse.pde.PluginNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>
diff --git a/org.eclipse.om2m.sdt.comparator.xml/META-INF/MANIFEST.MF b/org.eclipse.om2m.sdt.comparator.xml/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..c460560
--- /dev/null
+++ b/org.eclipse.om2m.sdt.comparator.xml/META-INF/MANIFEST.MF
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: sdt comparator
+Bundle-SymbolicName: org.eclipse.om2m.sdt.comparator.xml
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.eclipse.om2m.sdt.comparator.xml.Activator
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Import-Package: javax.servlet,
+ javax.servlet.http,
+ org.apache.commons.logging,
+ org.eclipse.om2m.commons.constants,
+ org.osgi.framework,
+ org.osgi.service.http,
+ org.osgi.util.tracker
diff --git a/org.eclipse.om2m.sdt.comparator.xml/build.properties b/org.eclipse.om2m.sdt.comparator.xml/build.properties
new file mode 100644
index 0000000..40d9b62
--- /dev/null
+++ b/org.eclipse.om2m.sdt.comparator.xml/build.properties
@@ -0,0 +1,23 @@
+###############################################################################
+# Copyright (c) 2013-2016 LAAS-CNRS (www.laas.fr)
+# 7 Colonel Roche 31077 Toulouse - France
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+#
+# Initial Contributors:
+#     Thierry Monteil : Project manager, technical co-manager
+#     Mahdi Ben Alaya : Technical co-manager
+#     Samir Medjiah : Technical co-manager
+#     Khalil Drira : Strategy expert
+#     Guillaume Garzone : Developer
+#     François Aïssaoui : Developer
+#
+# New contributors :
+###############################################################################
+source.. = src/main/java/
+output.. = bin/
+bin.includes = META-INF/,\
+               .
diff --git a/org.eclipse.om2m.sdt.comparator.xml/pom.xml b/org.eclipse.om2m.sdt.comparator.xml/pom.xml
new file mode 100644
index 0000000..049d930
--- /dev/null
+++ b/org.eclipse.om2m.sdt.comparator.xml/pom.xml
@@ -0,0 +1,19 @@
+<!--
+
+   
+    Initial Contributors:
+
+   
+    New contributors :
+ -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <artifactId>org.eclipse.om2m.sdt.comparator.xml</artifactId>
+  <packaging>eclipse-plugin</packaging>
+  <name>org.eclipse.om2m :: sdt comparator xml</name>
+  <parent>
+  	<groupId>org.eclipse.om2m</groupId>
+  	<artifactId>org.eclipse.om2m</artifactId>
+  	<version>1.0.0-SNAPSHOT</version>
+  </parent>
+</project>
diff --git a/org.eclipse.om2m.sdt.comparator.xml/src/main/java/org/eclipse/om2m/sdt/comparator/xml/Activator.java b/org.eclipse.om2m.sdt.comparator.xml/src/main/java/org/eclipse/om2m/sdt/comparator/xml/Activator.java
new file mode 100644
index 0000000..26a5085
--- /dev/null
+++ b/org.eclipse.om2m.sdt.comparator.xml/src/main/java/org/eclipse/om2m/sdt/comparator/xml/Activator.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2013-2016 LAAS-CNRS (www.laas.fr)
+ * 7 Colonel Roche 31077 Toulouse - France
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Initial Contributors:
+ *     Thierry Monteil : Project manager, technical co-manager
+ *     Mahdi Ben Alaya : Technical co-manager
+ *     Samir Medjiah : Technical co-manager
+ *     Khalil Drira : Strategy expert
+ *     Guillaume Garzone : Developer
+ *     François Aïssaoui : Developer
+ *
+ * New contributors :
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.comparator.xml;
+
+import javax.servlet.http.HttpServlet;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.HttpService;
+import org.osgi.util.tracker.ServiceTracker;
+
+/**
+ * Manages the starting and stopping of the bundle.
+ * 
+ */
+public class Activator implements BundleActivator {
+	/** logger */
+	private static Log LOGGER = LogFactory.getLog(Activator.class);
+	public static String CONTEXT_URI = "comparator";
+	public static String RESOURCES_URI = "webpage";
+
+	public static String SEP = "/";
+
+	/** HTTP service tracker */
+	private ServiceTracker<Object, Object> httpServiceTracker;
+
+	private WelcomeServlet welcomeServlet;
+
+	@Override
+	public void start(BundleContext context) throws Exception {
+
+		welcomeServlet = new WelcomeServlet();
+
+		httpServiceTracker = new ServiceTracker<Object, Object>(context, HttpService.class.getName(), null) {
+			public void removedService(ServiceReference<Object> reference, Object service) {
+				LOGGER.info("HttpService removed");
+				try {
+					LOGGER.info("Unregister " + SEP + CONTEXT_URI + SEP + RESOURCES_URI + " http context");
+					((HttpService) service).unregister(SEP + CONTEXT_URI + SEP + RESOURCES_URI);
+					LOGGER.info("Unregister " + SEP + CONTEXT_URI + " http context");
+					((HttpService) service).unregister(SEP + CONTEXT_URI);
+				} catch (IllegalArgumentException e) {
+					LOGGER.error("Error unregistring webapp servlet", e);
+				}
+			}
+
+			public Object addingService(ServiceReference<Object> reference) {
+				LOGGER.info("HttpService discovered");
+				HttpService httpService = (HttpService) context.getService(reference);
+				try {
+					LOGGER.info("Register " + SEP + CONTEXT_URI + " http context");
+					httpService.registerServlet(SEP + CONTEXT_URI, welcomeServlet, null, null);
+					httpService.registerResources(SEP + CONTEXT_URI + SEP + RESOURCES_URI, "/webapps", null);
+
+				} catch (Exception e) {
+					LOGGER.error("Error registring webapp servlet", e);
+				}
+				return httpService;
+			}
+		};
+		httpServiceTracker.open();
+	}
+
+	@Override
+	public void stop(BundleContext context) throws Exception {
+	}
+}
diff --git a/org.eclipse.om2m.sdt.comparator.xml/src/main/java/org/eclipse/om2m/sdt/comparator/xml/WelcomeServlet.java b/org.eclipse.om2m.sdt.comparator.xml/src/main/java/org/eclipse/om2m/sdt/comparator/xml/WelcomeServlet.java
new file mode 100644
index 0000000..d21e52f
--- /dev/null
+++ b/org.eclipse.om2m.sdt.comparator.xml/src/main/java/org/eclipse/om2m/sdt/comparator/xml/WelcomeServlet.java
@@ -0,0 +1,31 @@
+package org.eclipse.om2m.sdt.comparator.xml;

+

+import java.io.IOException;

+

+import javax.servlet.ServletException;

+import javax.servlet.http.HttpServlet;

+import javax.servlet.http.HttpServletRequest;

+import javax.servlet.http.HttpServletResponse;

+

+import org.eclipse.om2m.commons.constants.Constants;

+

+/**

+ * WelcomeServlet is registered on /comparator

+ * 

+ * @author MPCY8647

+ *

+ */

+public class WelcomeServlet extends HttpServlet {

+

+	private static final String INDEX_HTML = "index.html";

+	private static final String CONTEXT_PARAMETER = "?context=";

+

+	@Override

+	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

+		

+		String cseContextPath = Activator.SEP + Constants.CSE_ID + Activator.SEP + Constants.CSE_NAME; 

+		// redirect to index.html file

+		resp.sendRedirect(Activator.SEP + Activator.CONTEXT_URI + Activator.SEP + Activator.RESOURCES_URI

+				+ Activator.SEP + INDEX_HTML + CONTEXT_PARAMETER + cseContextPath);

+	}

+}

diff --git a/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/css/abn_tree.css b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/css/abn_tree.css
new file mode 100644
index 0000000..0db4c3c
--- /dev/null
+++ b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/css/abn_tree.css
@@ -0,0 +1,121 @@
+/* 
+   abn-tree.css
+
+   style for the angular-bootstrap-nav-tree
+   for both Bootstrap 2 and Bootstrap 3
+
+*/
+
+
+
+/* ------------------------------------------
+AngularJS Animations...
+
+The first selector is for Angular 1.1.5
+The second selector is for Angular 1.2.0
+
+*/
+.abn-tree-animate-enter,
+li.abn-tree-row.ng-enter {
+  transition: 200ms linear all;
+  position: relative;
+  display: block;
+  opacity: 0;
+  max-height:0px;
+}
+.abn-tree-animate-enter.abn-tree-animate-enter-active,
+li.abn-tree-row.ng-enter-active{
+  opacity: 1;
+  max-height:30px;
+}
+
+.abn-tree-animate-leave,
+li.abn-tree-row.ng-leave {
+  transition: 200ms linear all;
+  position: relative;
+  display: block;
+  height:30px;
+  max-height: 30px;
+  opacity: 1;
+}
+.abn-tree-animate-leave.abn-tree-animate-leave-active,
+li.abn-tree-row.ng-leave-active {  
+  height: 0px;
+  max-height:0px;
+  opacity: 0;
+}
+
+
+/* 
+------------------------------------------
+Angular 1.2.0 Animation 
+*/
+
+
+.abn-tree-animate.ng-enter{
+
+}
+.abn-tree-animate.ng-enter{
+
+}
+
+
+
+
+/*
+   end animation stuff
+-----------------------------------------
+   begin normal css stuff
+*/
+ul.abn-tree li.abn-tree-row {  
+  padding: 0px;
+  margin:0px;
+}
+
+ul.abn-tree li.abn-tree-row a {
+  padding: 3px 10px;
+}
+
+ul.abn-tree i.indented {
+  padding: 2px;
+}
+
+.abn-tree {
+  cursor: pointer;
+}
+ul.nav.abn-tree .level-1 .indented {
+  position: relative;
+  left: 0px;
+}
+ul.nav.abn-tree .level-2 .indented {
+  position: relative;
+  left: 20px;
+}
+ul.nav.abn-tree .level-3 .indented {
+  position: relative;
+  left: 40px;
+}
+ul.nav.abn-tree .level-4 .indented {
+  position: relative;
+  left: 60px;
+}
+ul.nav.abn-tree .level-5 .indented {
+  position: relative;
+  left: 80px;
+}
+ul.nav.abn-tree .level-6 .indented {
+  position: relative;
+  left: 100px;
+}
+ul.nav.nav-list.abn-tree .level-7 .indented {
+  position: relative;
+  left: 120px;
+}
+ul.nav.nav-list.abn-tree .level-8 .indented {
+  position: relative;
+  left: 140px;
+}
+ul.nav.nav-list.abn-tree .level-9 .indented {
+  position: relative;
+  left: 160px;
+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/css/bootstrap-3.0.1.min.css b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/css/bootstrap-3.0.1.min.css
new file mode 100644
index 0000000..871123f
--- /dev/null
+++ b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/css/bootstrap-3.0.1.min.css
@@ -0,0 +1,9 @@
+/*!
+ * Bootstrap v3.0.1 by @fat and @mdo
+ * Copyright 2013 Twitter, Inc.
+ * Licensed under http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Designed and built with all the love in the world by @mdo and @fat.
+ */
+
+/*! normalize.css v2.1.3 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden],template{display:none}html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}a{background:transparent}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{margin:.67em 0;font-size:2em}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}hr{height:0;-moz-box-sizing:content-box;box-sizing:content-box}mark{color:#000;background:#ff0}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre-wrap}q{quotes:"\201C" "\201D" "\2018" "\2019"}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid #c0c0c0}legend{padding:0;border:0}button,input,select,textarea{margin:0;font-family:inherit;font-size:100%}button,input{line-height:normal}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{cursor:pointer;-webkit-appearance:button}button[disabled],html input[disabled]{cursor:default}input[type="checkbox"],input[type="radio"]{padding:0;box-sizing:border-box}input[type="search"]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}@media print{*{color:#000!important;text-shadow:none!important;background:transparent!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100%!important}@page{margin:2cm .5cm}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}select{background:#fff!important}.navbar{display:none}.table td,.table th{background-color:#fff!important}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table-bordered th,.table-bordered td{border:1px solid #ddd!important}}*,*:before,*:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:62.5%;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.428571429;color:#333;background-color:#fff}input,button,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#428bca;text-decoration:none}a:hover,a:focus{color:#2a6496;text-decoration:underline}a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}img{vertical-align:middle}.img-responsive{display:block;height:auto;max-width:100%}.img-rounded{border-radius:6px}.img-thumbnail{display:inline-block;height:auto;max-width:100%;padding:4px;line-height:1.428571429;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:200;line-height:1.4}@media(min-width:768px){.lead{font-size:21px}}small,.small{font-size:85%}cite{font-style:normal}.text-muted{color:#999}.text-primary{color:#428bca}.text-primary:hover{color:#3071a9}.text-warning{color:#c09853}.text-warning:hover{color:#a47e3c}.text-danger{color:#b94a48}.text-danger:hover{color:#953b39}.text-success{color:#468847}.text-success:hover{color:#356635}.text-info{color:#3a87ad}.text-info:hover{color:#2d6987}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:500;line-height:1.1;color:inherit}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small,.h1 small,.h2 small,.h3 small,.h4 small,.h5 small,.h6 small,h1 .small,h2 .small,h3 .small,h4 .small,h5 .small,h6 .small,.h1 .small,.h2 .small,.h3 .small,.h4 .small,.h5 .small,.h6 .small{font-weight:normal;line-height:1;color:#999}h1,h2,h3{margin-top:20px;margin-bottom:10px}h1 small,h2 small,h3 small,h1 .small,h2 .small,h3 .small{font-size:65%}h4,h5,h6{margin-top:10px;margin-bottom:10px}h4 small,h5 small,h6 small,h4 .small,h5 .small,h6 .small{font-size:75%}h1,.h1{font-size:36px}h2,.h2{font-size:30px}h3,.h3{font-size:24px}h4,.h4{font-size:18px}h5,.h5{font-size:14px}h6,.h6{font-size:12px}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ul,ol{margin-top:0;margin-bottom:10px}ul ul,ol ul,ul ol,ol ol{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;list-style:none}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}.list-inline>li:first-child{padding-left:0}dl{margin-bottom:20px}dt,dd{line-height:1.428571429}dt{font-weight:bold}dd{margin-left:0}@media(min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}.dl-horizontal dd:before,.dl-horizontal dd:after{display:table;content:" "}.dl-horizontal dd:after{clear:both}.dl-horizontal dd:before,.dl-horizontal dd:after{display:table;content:" "}.dl-horizontal dd:after{clear:both}}abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #999}abbr.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;border-left:5px solid #eee}blockquote p{font-size:17.5px;font-weight:300;line-height:1.25}blockquote p:last-child{margin-bottom:0}blockquote small{display:block;line-height:1.428571429;color:#999}blockquote small:before{content:'\2014 \00A0'}blockquote.pull-right{padding-right:15px;padding-left:0;border-right:5px solid #eee;border-left:0}blockquote.pull-right p,blockquote.pull-right small,blockquote.pull-right .small{text-align:right}blockquote.pull-right small:before,blockquote.pull-right .small:before{content:''}blockquote.pull-right small:after,blockquote.pull-right .small:after{content:'\00A0 \2014'}blockquote:before,blockquote:after{content:""}address{margin-bottom:20px;font-style:normal;line-height:1.428571429}code,kbd,pre,samp{font-family:Monaco,Menlo,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;white-space:nowrap;background-color:#f9f2f4;border-radius:4px}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.428571429;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.container:before,.container:after{display:table;content:" "}.container:after{clear:both}.container:before,.container:after{display:table;content:" "}.container:after{clear:both}.row{margin-right:-15px;margin-left:-15px}.row:before,.row:after{display:table;content:" "}.row:after{clear:both}.row:before,.row:after{display:table;content:" "}.row:after{clear:both}.col-xs-1,.col-sm-1,.col-md-1,.col-lg-1,.col-xs-2,.col-sm-2,.col-md-2,.col-lg-2,.col-xs-3,.col-sm-3,.col-md-3,.col-lg-3,.col-xs-4,.col-sm-4,.col-md-4,.col-lg-4,.col-xs-5,.col-sm-5,.col-md-5,.col-lg-5,.col-xs-6,.col-sm-6,.col-md-6,.col-lg-6,.col-xs-7,.col-sm-7,.col-md-7,.col-lg-7,.col-xs-8,.col-sm-8,.col-md-8,.col-lg-8,.col-xs-9,.col-sm-9,.col-md-9,.col-lg-9,.col-xs-10,.col-sm-10,.col-md-10,.col-lg-10,.col-xs-11,.col-sm-11,.col-md-11,.col-lg-11,.col-xs-12,.col-sm-12,.col-md-12,.col-lg-12{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-10,.col-xs-11{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666666666666%}.col-xs-10{width:83.33333333333334%}.col-xs-9{width:75%}.col-xs-8{width:66.66666666666666%}.col-xs-7{width:58.333333333333336%}.col-xs-6{width:50%}.col-xs-5{width:41.66666666666667%}.col-xs-4{width:33.33333333333333%}.col-xs-3{width:25%}.col-xs-2{width:16.666666666666664%}.col-xs-1{width:8.333333333333332%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666666666666%}.col-xs-pull-10{right:83.33333333333334%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666666666666%}.col-xs-pull-7{right:58.333333333333336%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666666666667%}.col-xs-pull-4{right:33.33333333333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.666666666666664%}.col-xs-pull-1{right:8.333333333333332%}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666666666666%}.col-xs-push-10{left:83.33333333333334%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666666666666%}.col-xs-push-7{left:58.333333333333336%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666666666667%}.col-xs-push-4{left:33.33333333333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.666666666666664%}.col-xs-push-1{left:8.333333333333332%}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666666666666%}.col-xs-offset-10{margin-left:83.33333333333334%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666666666666%}.col-xs-offset-7{margin-left:58.333333333333336%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666666666667%}.col-xs-offset-4{margin-left:33.33333333333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.666666666666664%}.col-xs-offset-1{margin-left:8.333333333333332%}@media(min-width:768px){.container{width:750px}.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-10,.col-sm-11{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666666666666%}.col-sm-10{width:83.33333333333334%}.col-sm-9{width:75%}.col-sm-8{width:66.66666666666666%}.col-sm-7{width:58.333333333333336%}.col-sm-6{width:50%}.col-sm-5{width:41.66666666666667%}.col-sm-4{width:33.33333333333333%}.col-sm-3{width:25%}.col-sm-2{width:16.666666666666664%}.col-sm-1{width:8.333333333333332%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666666666666%}.col-sm-pull-10{right:83.33333333333334%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666666666666%}.col-sm-pull-7{right:58.333333333333336%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666666666667%}.col-sm-pull-4{right:33.33333333333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.666666666666664%}.col-sm-pull-1{right:8.333333333333332%}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666666666666%}.col-sm-push-10{left:83.33333333333334%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666666666666%}.col-sm-push-7{left:58.333333333333336%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666666666667%}.col-sm-push-4{left:33.33333333333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.666666666666664%}.col-sm-push-1{left:8.333333333333332%}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666666666666%}.col-sm-offset-10{margin-left:83.33333333333334%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666666666666%}.col-sm-offset-7{margin-left:58.333333333333336%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666666666667%}.col-sm-offset-4{margin-left:33.33333333333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.666666666666664%}.col-sm-offset-1{margin-left:8.333333333333332%}}@media(min-width:992px){.container{width:970px}.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666666666666%}.col-md-10{width:83.33333333333334%}.col-md-9{width:75%}.col-md-8{width:66.66666666666666%}.col-md-7{width:58.333333333333336%}.col-md-6{width:50%}.col-md-5{width:41.66666666666667%}.col-md-4{width:33.33333333333333%}.col-md-3{width:25%}.col-md-2{width:16.666666666666664%}.col-md-1{width:8.333333333333332%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666666666666%}.col-md-pull-10{right:83.33333333333334%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666666666666%}.col-md-pull-7{right:58.333333333333336%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666666666667%}.col-md-pull-4{right:33.33333333333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.666666666666664%}.col-md-pull-1{right:8.333333333333332%}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666666666666%}.col-md-push-10{left:83.33333333333334%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666666666666%}.col-md-push-7{left:58.333333333333336%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666666666667%}.col-md-push-4{left:33.33333333333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.666666666666664%}.col-md-push-1{left:8.333333333333332%}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666666666666%}.col-md-offset-10{margin-left:83.33333333333334%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666666666666%}.col-md-offset-7{margin-left:58.333333333333336%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666666666667%}.col-md-offset-4{margin-left:33.33333333333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.666666666666664%}.col-md-offset-1{margin-left:8.333333333333332%}}@media(min-width:1200px){.container{width:1170px}.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666666666666%}.col-lg-10{width:83.33333333333334%}.col-lg-9{width:75%}.col-lg-8{width:66.66666666666666%}.col-lg-7{width:58.333333333333336%}.col-lg-6{width:50%}.col-lg-5{width:41.66666666666667%}.col-lg-4{width:33.33333333333333%}.col-lg-3{width:25%}.col-lg-2{width:16.666666666666664%}.col-lg-1{width:8.333333333333332%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666666666666%}.col-lg-pull-10{right:83.33333333333334%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666666666666%}.col-lg-pull-7{right:58.333333333333336%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666666666667%}.col-lg-pull-4{right:33.33333333333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.666666666666664%}.col-lg-pull-1{right:8.333333333333332%}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666666666666%}.col-lg-push-10{left:83.33333333333334%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666666666666%}.col-lg-push-7{left:58.333333333333336%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666666666667%}.col-lg-push-4{left:33.33333333333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.666666666666664%}.col-lg-push-1{left:8.333333333333332%}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666666666666%}.col-lg-offset-10{margin-left:83.33333333333334%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666666666666%}.col-lg-offset-7{margin-left:58.333333333333336%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666666666667%}.col-lg-offset-4{margin-left:33.33333333333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.666666666666664%}.col-lg-offset-1{margin-left:8.333333333333332%}}table{max-width:100%;background-color:transparent}th{text-align:left}.table{width:100%;margin-bottom:20px}.table>thead>tr>th,.table>tbody>tr>th,.table>tfoot>tr>th,.table>thead>tr>td,.table>tbody>tr>td,.table>tfoot>tr>td{padding:8px;line-height:1.428571429;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>th,.table>caption+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>td,.table>thead:first-child>tr:first-child>td{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>thead>tr>th,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>tbody>tr>td,.table-condensed>tfoot>tr>td{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>td,.table-bordered>tfoot>tr>td{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>thead>tr>td{border-bottom-width:2px}.table-striped>tbody>tr:nth-child(odd)>td,.table-striped>tbody>tr:nth-child(odd)>th{background-color:#f9f9f9}.table-hover>tbody>tr:hover>td,.table-hover>tbody>tr:hover>th{background-color:#f5f5f5}table col[class*="col-"]{display:table-column;float:none}table td[class*="col-"],table th[class*="col-"]{display:table-cell;float:none}.table>thead>tr>td.active,.table>tbody>tr>td.active,.table>tfoot>tr>td.active,.table>thead>tr>th.active,.table>tbody>tr>th.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>tbody>tr.active>td,.table>tfoot>tr.active>td,.table>thead>tr.active>th,.table>tbody>tr.active>th,.table>tfoot>tr.active>th{background-color:#f5f5f5}.table>thead>tr>td.success,.table>tbody>tr>td.success,.table>tfoot>tr>td.success,.table>thead>tr>th.success,.table>tbody>tr>th.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>tbody>tr.success>td,.table>tfoot>tr.success>td,.table>thead>tr.success>th,.table>tbody>tr.success>th,.table>tfoot>tr.success>th{background-color:#dff0d8}.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover,.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr.success:hover>th{background-color:#d0e9c6}.table>thead>tr>td.danger,.table>tbody>tr>td.danger,.table>tfoot>tr>td.danger,.table>thead>tr>th.danger,.table>tbody>tr>th.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>tbody>tr.danger>td,.table>tfoot>tr.danger>td,.table>thead>tr.danger>th,.table>tbody>tr.danger>th,.table>tfoot>tr.danger>th{background-color:#f2dede}.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover,.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr.danger:hover>th{background-color:#ebcccc}.table>thead>tr>td.warning,.table>tbody>tr>td.warning,.table>tfoot>tr>td.warning,.table>thead>tr>th.warning,.table>tbody>tr>th.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>tbody>tr.warning>td,.table>tfoot>tr.warning>td,.table>thead>tr.warning>th,.table>tbody>tr.warning>th,.table>tfoot>tr.warning>th{background-color:#fcf8e3}.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover,.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr.warning:hover>th{background-color:#faf2cc}@media(max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-x:scroll;overflow-y:hidden;border:1px solid #ddd;-ms-overflow-style:-ms-autohiding-scrollbar;-webkit-overflow-scrolling:touch}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>thead>tr>th,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tfoot>tr>td{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>thead>tr>th:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.table-responsive>.table-bordered>thead>tr>th:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>th,.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>td{border-bottom:0}}fieldset{padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;margin-bottom:5px;font-weight:bold}input[type="search"]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type="radio"],input[type="checkbox"]{margin:4px 0 0;margin-top:1px \9;line-height:normal}input[type="file"]{display:block}select[multiple],select[size]{height:auto}select optgroup{font-family:inherit;font-size:inherit;font-style:inherit}input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}input[type="number"]::-webkit-outer-spin-button,input[type="number"]::-webkit-inner-spin-button{height:auto}output{display:block;padding-top:7px;font-size:14px;line-height:1.428571429;color:#555;vertical-align:middle}.form-control:-moz-placeholder{color:#999}.form-control::-moz-placeholder{color:#999}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.428571429;color:#555;vertical-align:middle;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6)}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{cursor:not-allowed;background-color:#eee}textarea.form-control{height:auto}.form-group{margin-bottom:15px}.radio,.checkbox{display:block;min-height:20px;padding-left:20px;margin-top:10px;margin-bottom:10px;vertical-align:middle}.radio label,.checkbox label{display:inline;margin-bottom:0;font-weight:normal;cursor:pointer}.radio input[type="radio"],.radio-inline input[type="radio"],.checkbox input[type="checkbox"],.checkbox-inline input[type="checkbox"]{float:left;margin-left:-20px}.radio+.radio,.checkbox+.checkbox{margin-top:-5px}.radio-inline,.checkbox-inline{display:inline-block;padding-left:20px;margin-bottom:0;font-weight:normal;vertical-align:middle;cursor:pointer}.radio-inline+.radio-inline,.checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px}input[type="radio"][disabled],input[type="checkbox"][disabled],.radio[disabled],.radio-inline[disabled],.checkbox[disabled],.checkbox-inline[disabled],fieldset[disabled] input[type="radio"],fieldset[disabled] input[type="checkbox"],fieldset[disabled] .radio,fieldset[disabled] .radio-inline,fieldset[disabled] .checkbox,fieldset[disabled] .checkbox-inline{cursor:not-allowed}.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}textarea.input-sm{height:auto}.input-lg{height:45px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-lg{height:45px;line-height:45px}textarea.input-lg{height:auto}.has-warning .help-block,.has-warning .control-label,.has-warning .radio,.has-warning .checkbox,.has-warning .radio-inline,.has-warning .checkbox-inline{color:#c09853}.has-warning .form-control{border-color:#c09853;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.has-warning .form-control:focus{border-color:#a47e3c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e}.has-warning .input-group-addon{color:#c09853;background-color:#fcf8e3;border-color:#c09853}.has-error .help-block,.has-error .control-label,.has-error .radio,.has-error .checkbox,.has-error .radio-inline,.has-error .checkbox-inline{color:#b94a48}.has-error .form-control{border-color:#b94a48;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.has-error .form-control:focus{border-color:#953b39;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392}.has-error .input-group-addon{color:#b94a48;background-color:#f2dede;border-color:#b94a48}.has-success .help-block,.has-success .control-label,.has-success .radio,.has-success .checkbox,.has-success .radio-inline,.has-success .checkbox-inline{color:#468847}.has-success .form-control{border-color:#468847;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.has-success .form-control:focus{border-color:#356635;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b}.has-success .input-group-addon{color:#468847;background-color:#dff0d8;border-color:#468847}.form-control-static{margin-bottom:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media(min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block}.form-inline .radio,.form-inline .checkbox{display:inline-block;padding-left:0;margin-top:0;margin-bottom:0}.form-inline .radio input[type="radio"],.form-inline .checkbox input[type="checkbox"]{float:none;margin-left:0}}.form-horizontal .control-label,.form-horizontal .radio,.form-horizontal .checkbox,.form-horizontal .radio-inline,.form-horizontal .checkbox-inline{padding-top:7px;margin-top:0;margin-bottom:0}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}.form-horizontal .form-group:before,.form-horizontal .form-group:after{display:table;content:" "}.form-horizontal .form-group:after{clear:both}.form-horizontal .form-group:before,.form-horizontal .form-group:after{display:table;content:" "}.form-horizontal .form-group:after{clear:both}.form-horizontal .form-control-static{padding-top:7px}@media(min-width:768px){.form-horizontal .control-label{text-align:right}}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:normal;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;background-image:none;border:1px solid transparent;border-radius:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.btn:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn:hover,.btn:focus{color:#333;text-decoration:none}.btn:active,.btn.active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{pointer-events:none;cursor:not-allowed;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default:hover,.btn-default:focus,.btn-default:active,.btn-default.active,.open .dropdown-toggle.btn-default{color:#333;background-color:#ebebeb;border-color:#adadad}.btn-default:active,.btn-default.active,.open .dropdown-toggle.btn-default{background-image:none}.btn-default.disabled,.btn-default[disabled],fieldset[disabled] .btn-default,.btn-default.disabled:hover,.btn-default[disabled]:hover,fieldset[disabled] .btn-default:hover,.btn-default.disabled:focus,.btn-default[disabled]:focus,fieldset[disabled] .btn-default:focus,.btn-default.disabled:active,.btn-default[disabled]:active,fieldset[disabled] .btn-default:active,.btn-default.disabled.active,.btn-default[disabled].active,fieldset[disabled] .btn-default.active{background-color:#fff;border-color:#ccc}.btn-primary{color:#fff;background-color:#428bca;border-color:#357ebd}.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.open .dropdown-toggle.btn-primary{color:#fff;background-color:#3276b1;border-color:#285e8e}.btn-primary:active,.btn-primary.active,.open .dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled,.btn-primary[disabled],fieldset[disabled] .btn-primary,.btn-primary.disabled:hover,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary:hover,.btn-primary.disabled:focus,.btn-primary[disabled]:focus,fieldset[disabled] .btn-primary:focus,.btn-primary.disabled:active,.btn-primary[disabled]:active,fieldset[disabled] .btn-primary:active,.btn-primary.disabled.active,.btn-primary[disabled].active,fieldset[disabled] .btn-primary.active{background-color:#428bca;border-color:#357ebd}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning:hover,.btn-warning:focus,.btn-warning:active,.btn-warning.active,.open .dropdown-toggle.btn-warning{color:#fff;background-color:#ed9c28;border-color:#d58512}.btn-warning:active,.btn-warning.active,.open .dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled,.btn-warning[disabled],fieldset[disabled] .btn-warning,.btn-warning.disabled:hover,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning:hover,.btn-warning.disabled:focus,.btn-warning[disabled]:focus,fieldset[disabled] .btn-warning:focus,.btn-warning.disabled:active,.btn-warning[disabled]:active,fieldset[disabled] .btn-warning:active,.btn-warning.disabled.active,.btn-warning[disabled].active,fieldset[disabled] .btn-warning.active{background-color:#f0ad4e;border-color:#eea236}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger:hover,.btn-danger:focus,.btn-danger:active,.btn-danger.active,.open .dropdown-toggle.btn-danger{color:#fff;background-color:#d2322d;border-color:#ac2925}.btn-danger:active,.btn-danger.active,.open .dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled,.btn-danger[disabled],fieldset[disabled] .btn-danger,.btn-danger.disabled:hover,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger:hover,.btn-danger.disabled:focus,.btn-danger[disabled]:focus,fieldset[disabled] .btn-danger:focus,.btn-danger.disabled:active,.btn-danger[disabled]:active,fieldset[disabled] .btn-danger:active,.btn-danger.disabled.active,.btn-danger[disabled].active,fieldset[disabled] .btn-danger.active{background-color:#d9534f;border-color:#d43f3a}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success:hover,.btn-success:focus,.btn-success:active,.btn-success.active,.open .dropdown-toggle.btn-success{color:#fff;background-color:#47a447;border-color:#398439}.btn-success:active,.btn-success.active,.open .dropdown-toggle.btn-success{background-image:none}.btn-success.disabled,.btn-success[disabled],fieldset[disabled] .btn-success,.btn-success.disabled:hover,.btn-success[disabled]:hover,fieldset[disabled] .btn-success:hover,.btn-success.disabled:focus,.btn-success[disabled]:focus,fieldset[disabled] .btn-success:focus,.btn-success.disabled:active,.btn-success[disabled]:active,fieldset[disabled] .btn-success:active,.btn-success.disabled.active,.btn-success[disabled].active,fieldset[disabled] .btn-success.active{background-color:#5cb85c;border-color:#4cae4c}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info:hover,.btn-info:focus,.btn-info:active,.btn-info.active,.open .dropdown-toggle.btn-info{color:#fff;background-color:#39b3d7;border-color:#269abc}.btn-info:active,.btn-info.active,.open .dropdown-toggle.btn-info{background-image:none}.btn-info.disabled,.btn-info[disabled],fieldset[disabled] .btn-info,.btn-info.disabled:hover,.btn-info[disabled]:hover,fieldset[disabled] .btn-info:hover,.btn-info.disabled:focus,.btn-info[disabled]:focus,fieldset[disabled] .btn-info:focus,.btn-info.disabled:active,.btn-info[disabled]:active,fieldset[disabled] .btn-info:active,.btn-info.disabled.active,.btn-info[disabled].active,fieldset[disabled] .btn-info.active{background-color:#5bc0de;border-color:#46b8da}.btn-link{font-weight:normal;color:#428bca;cursor:pointer;border-radius:0}.btn-link,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:hover,.btn-link:focus,.btn-link:active{border-color:transparent}.btn-link:hover,.btn-link:focus{color:#2a6496;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover,fieldset[disabled] .btn-link:hover,.btn-link[disabled]:focus,fieldset[disabled] .btn-link:focus{color:#999;text-decoration:none}.btn-lg{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.btn-sm,.btn-xs{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-xs{padding:1px 5px}.btn-block{display:block;width:100%;padding-right:0;padding-left:0}.btn-block+.btn-block{margin-top:5px}input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition:height .35s ease;transition:height .35s ease}@font-face{font-family:'Glyphicons Halflings';src:url('../fonts/glyphicons-halflings-regular.eot');src:url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),url('../fonts/glyphicons-halflings-regular.woff') format('woff'),url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'),url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';-webkit-font-smoothing:antialiased;font-style:normal;font-weight:normal;line-height:1;-moz-osx-font-smoothing:grayscale}.glyphicon:empty{width:1em}.glyphicon-asterisk:before{content:"\2a"}.glyphicon-plus:before{content:"\2b"}.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px solid #000;border-right:4px solid transparent;border-bottom:0 dotted;border-left:4px solid transparent}.dropdown{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;list-style:none;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,0.175);box-shadow:0 6px 12px rgba(0,0,0,0.175);background-clip:padding-box}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:normal;line-height:1.428571429;color:#333;white-space:nowrap}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{color:#262626;text-decoration:none;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#fff;text-decoration:none;background-color:#428bca;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{color:#999}.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.428571429;color:#999}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0 dotted;border-bottom:4px solid #000;content:""}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}@media(min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}}.btn-default .caret{border-top-color:#333}.btn-primary .caret,.btn-success .caret,.btn-warning .caret,.btn-danger .caret,.btn-info .caret{border-top-color:#fff}.dropup .btn-default .caret{border-bottom-color:#333}.dropup .btn-primary .caret,.dropup .btn-success .caret,.dropup .btn-warning .caret,.dropup .btn-danger .caret,.dropup .btn-info .caret{border-bottom-color:#fff}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group>.btn,.btn-group-vertical>.btn{position:relative;float:left}.btn-group>.btn:hover,.btn-group-vertical>.btn:hover,.btn-group>.btn:focus,.btn-group-vertical>.btn:focus,.btn-group>.btn:active,.btn-group-vertical>.btn:active,.btn-group>.btn.active,.btn-group-vertical>.btn.active{z-index:2}.btn-group>.btn:focus,.btn-group-vertical>.btn:focus{outline:0}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar:before,.btn-toolbar:after{display:table;content:" "}.btn-toolbar:after{clear:both}.btn-toolbar:before,.btn-toolbar:after{display:table;content:" "}.btn-toolbar:after{clear:both}.btn-toolbar .btn-group{float:left}.btn-toolbar>.btn+.btn,.btn-toolbar>.btn-group+.btn,.btn-toolbar>.btn+.btn-group,.btn-toolbar>.btn-group+.btn-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child>.btn:last-child,.btn-group>.btn-group:first-child>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child>.btn:first-child{border-bottom-left-radius:0;border-top-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group-xs>.btn{padding:5px 10px;padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-sm>.btn{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-lg>.btn{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after{display:table;content:" "}.btn-group-vertical>.btn-group:after{clear:both}.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after{display:table;content:" "}.btn-group-vertical>.btn-group:after{clear:both}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-right-radius:0;border-bottom-left-radius:4px;border-top-left-radius:0}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child>.btn:last-child,.btn-group-vertical>.btn-group:first-child>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child>.btn:first-child{border-top-right-radius:0;border-top-left-radius:0}.btn-group-justified{display:table;width:100%;border-collapse:separate;table-layout:fixed}.btn-group-justified .btn{display:table-cell;float:none;width:1%}[data-toggle="buttons"]>.btn>input[type="radio"],[data-toggle="buttons"]>.btn>input[type="checkbox"]{display:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group.col{float:none;padding-right:0;padding-left:0}.input-group .form-control{width:100%;margin-bottom:0}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:45px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:45px;line-height:45px}textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn{height:auto}.input-group-addon,.input-group-btn,.input-group .form-control{display:table-cell}.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child),.input-group .form-control:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:normal;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type="radio"],.input-group-addon input[type="checkbox"]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:last-child>.btn,.input-group-btn:last-child>.dropdown-toggle,.input-group-btn:first-child>.btn:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;white-space:nowrap}.input-group-btn:first-child>.btn{margin-right:-1px}.input-group-btn:last-child>.btn{margin-left:-1px}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-4px}.input-group-btn>.btn:hover,.input-group-btn>.btn:active{z-index:2}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav:before,.nav:after{display:table;content:" "}.nav:after{clear:both}.nav:before,.nav:after{display:table;content:" "}.nav:after{clear:both}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:hover,.nav>li>a:focus{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#999}.nav>li.disabled>a:hover,.nav>li.disabled>a:focus{color:#999;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:hover,.nav .open>a:focus{background-color:#eee;border-color:#428bca}.nav .open>a .caret,.nav .open>a:hover .caret,.nav .open>a:focus .caret{border-top-color:#2a6496;border-bottom-color:#2a6496}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.428571429;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media(min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border:1px solid #ddd}@media(min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:hover,.nav-pills>li.active>a:focus{color:#fff;background-color:#428bca}.nav-pills>li.active>a .caret,.nav-pills>li.active>a:hover .caret,.nav-pills>li.active>a:focus .caret{border-top-color:#fff;border-bottom-color:#fff}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media(min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border:1px solid #ddd}@media(min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav .caret{border-top-color:#428bca;border-bottom-color:#428bca}.nav a:hover .caret{border-top-color:#2a6496;border-bottom-color:#2a6496}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-right-radius:0;border-top-left-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}.navbar:before,.navbar:after{display:table;content:" "}.navbar:after{clear:both}.navbar:before,.navbar:after{display:table;content:" "}.navbar:after{clear:both}@media(min-width:768px){.navbar{border-radius:4px}}.navbar-header:before,.navbar-header:after{display:table;content:" "}.navbar-header:after{clear:both}.navbar-header:before,.navbar-header:after{display:table;content:" "}.navbar-header:after{clear:both}@media(min-width:768px){.navbar-header{float:left}}.navbar-collapse{max-height:340px;padding-right:15px;padding-left:15px;overflow-x:visible;border-top:1px solid transparent;box-shadow:inset 0 1px 0 rgba(255,255,255,0.1);-webkit-overflow-scrolling:touch}.navbar-collapse:before,.navbar-collapse:after{display:table;content:" "}.navbar-collapse:after{clear:both}.navbar-collapse:before,.navbar-collapse:after{display:table;content:" "}.navbar-collapse:after{clear:both}.navbar-collapse.in{overflow-y:auto}@media(min-width:768px){.navbar-collapse{width:auto;border-top:0;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:auto}.navbar-collapse .navbar-nav.navbar-left:first-child{margin-left:-15px}.navbar-collapse .navbar-nav.navbar-right:last-child{margin-right:-15px}.navbar-collapse .navbar-text:last-child{margin-right:0}}.container>.navbar-header,.container>.navbar-collapse{margin-right:-15px;margin-left:-15px}@media(min-width:768px){.container>.navbar-header,.container>.navbar-collapse{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media(min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030}@media(min-width:768px){.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:hover,.navbar-brand:focus{text-decoration:none}@media(min-width:768px){.navbar>.container .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-top:8px;margin-right:15px;margin-bottom:8px;background-color:transparent;border:1px solid transparent;border-radius:4px}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media(min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media(max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;box-shadow:none}.navbar-nav .open .dropdown-menu>li>a,.navbar-nav .open .dropdown-menu .dropdown-header{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:hover,.navbar-nav .open .dropdown-menu>li>a:focus{background-image:none}}@media(min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}}@media(min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important}}.navbar-form{padding:10px 15px;margin-top:8px;margin-right:-15px;margin-bottom:8px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1);box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1)}@media(min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block}.navbar-form .radio,.navbar-form .checkbox{display:inline-block;padding-left:0;margin-top:0;margin-bottom:0}.navbar-form .radio input[type="radio"],.navbar-form .checkbox input[type="checkbox"]{float:none;margin-left:0}}@media(max-width:767px){.navbar-form .form-group{margin-bottom:5px}}@media(min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-right-radius:0;border-top-left-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-nav.pull-right>li>.dropdown-menu,.navbar-nav>li>.dropdown-menu.pull-right{right:0;left:auto}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-text{float:left;margin-top:15px;margin-bottom:15px}@media(min-width:768px){.navbar-text{margin-right:15px;margin-left:15px}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:hover,.navbar-default .navbar-brand:focus{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:hover,.navbar-default .navbar-nav>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:hover,.navbar-default .navbar-nav>.disabled>a:focus{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:hover,.navbar-default .navbar-toggle:focus{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#ccc}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.dropdown>a:hover .caret,.navbar-default .navbar-nav>.dropdown>a:focus .caret{border-top-color:#333;border-bottom-color:#333}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:hover,.navbar-default .navbar-nav>.open>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.open>a .caret,.navbar-default .navbar-nav>.open>a:hover .caret,.navbar-default .navbar-nav>.open>a:focus .caret{border-top-color:#555;border-bottom-color:#555}.navbar-default .navbar-nav>.dropdown>a .caret{border-top-color:#777;border-bottom-color:#777}@media(max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#999}.navbar-inverse .navbar-brand:hover,.navbar-inverse .navbar-brand:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#999}.navbar-inverse .navbar-nav>li>a{color:#999}.navbar-inverse .navbar-nav>li>a:hover,.navbar-inverse .navbar-nav>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:hover,.navbar-inverse .navbar-nav>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:hover,.navbar-inverse .navbar-nav>.disabled>a:focus{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:hover,.navbar-inverse .navbar-toggle:focus{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:hover,.navbar-inverse .navbar-nav>.open>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.dropdown>a:hover .caret{border-top-color:#fff;border-bottom-color:#fff}.navbar-inverse .navbar-nav>.dropdown>a .caret{border-top-color:#999;border-bottom-color:#999}.navbar-inverse .navbar-nav>.open>a .caret,.navbar-inverse .navbar-nav>.open>a:hover .caret,.navbar-inverse .navbar-nav>.open>a:focus .caret{border-top-color:#fff;border-bottom-color:#fff}@media(max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#999}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#999}.navbar-inverse .navbar-link:hover{color:#fff}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#999}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.428571429;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-bottom-left-radius:4px;border-top-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>li>a:hover,.pagination>li>span:hover,.pagination>li>a:focus,.pagination>li>span:focus{background-color:#eee}.pagination>.active>a,.pagination>.active>span,.pagination>.active>a:hover,.pagination>.active>span:hover,.pagination>.active>a:focus,.pagination>.active>span:focus{z-index:2;color:#fff;cursor:default;background-color:#428bca;border-color:#428bca}.pagination>.disabled>span,.pagination>.disabled>span:hover,.pagination>.disabled>span:focus,.pagination>.disabled>a,.pagination>.disabled>a:hover,.pagination>.disabled>a:focus{color:#999;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-bottom-left-radius:6px;border-top-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-bottom-left-radius:3px;border-top-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager:before,.pager:after{display:table;content:" "}.pager:after{clear:both}.pager:before,.pager:after{display:table;content:" "}.pager:after{clear:both}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:hover,.pager li>a:focus{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>a:focus,.pager .disabled>span{color:#999;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:bold;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}.label[href]:hover,.label[href]:focus{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.label-default{background-color:#999}.label-default[href]:hover,.label-default[href]:focus{background-color:#808080}.label-primary{background-color:#428bca}.label-primary[href]:hover,.label-primary[href]:focus{background-color:#3071a9}.label-success{background-color:#5cb85c}.label-success[href]:hover,.label-success[href]:focus{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:hover,.label-info[href]:focus{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:hover,.label-warning[href]:focus{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:hover,.label-danger[href]:focus{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:bold;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;background-color:#999;border-radius:10px}.badge:empty{display:none}a.badge:hover,a.badge:focus{color:#fff;text-decoration:none;cursor:pointer}.btn .badge{position:relative;top:-1px}a.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#428bca;background-color:#fff}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding:30px;margin-bottom:30px;font-size:21px;font-weight:200;line-height:2.1428571435;color:inherit;background-color:#eee}.jumbotron h1{line-height:1;color:inherit}.jumbotron p{line-height:1.4}.container .jumbotron{border-radius:6px}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron{padding-right:60px;padding-left:60px}.jumbotron h1{font-size:63px}}.thumbnail{display:inline-block;display:block;height:auto;max-width:100%;padding:4px;margin-bottom:20px;line-height:1.428571429;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.thumbnail>img{display:block;height:auto;max-width:100%;margin-right:auto;margin-left:auto}a.thumbnail:hover,a.thumbnail:focus,a.thumbnail.active{border-color:#428bca}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:bold}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable{padding-right:35px}.alert-dismissable .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#356635}.alert-info{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#2d6987}.alert-warning{color:#c09853;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#a47e3c}.alert-danger{color:#b94a48;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#953b39}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-moz-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:0 0}to{background-position:40px 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#428bca;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-webkit-transition:width .6s ease;transition:width .6s ease}.progress-striped .progress-bar{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-size:40px 40px}.progress.active .progress-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.media,.media-body{overflow:hidden;zoom:1}.media,.media .media{margin-top:15px}.media:first-child{margin-top:0}.media-object{display:block}.media-heading{margin:0 0 5px}.media>.pull-left{margin-right:10px}.media>.pull-right{margin-left:10px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-right-radius:4px;border-top-left-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}a.list-group-item{color:#555}a.list-group-item .list-group-item-heading{color:#333}a.list-group-item:hover,a.list-group-item:focus{text-decoration:none;background-color:#f5f5f5}a.list-group-item.active,a.list-group-item.active:hover,a.list-group-item.active:focus{z-index:2;color:#fff;background-color:#428bca;border-color:#428bca}a.list-group-item.active .list-group-item-heading,a.list-group-item.active:hover .list-group-item-heading,a.list-group-item.active:focus .list-group-item-heading{color:inherit}a.list-group-item.active .list-group-item-text,a.list-group-item.active:hover .list-group-item-text,a.list-group-item.active:focus .list-group-item-text{color:#e1edf7}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.05);box-shadow:0 1px 1px rgba(0,0,0,0.05)}.panel-body{padding:15px}.panel-body:before,.panel-body:after{display:table;content:" "}.panel-body:after{clear:both}.panel-body:before,.panel-body:after{display:table;content:" "}.panel-body:after{clear:both}.panel>.list-group{margin-bottom:0}.panel>.list-group .list-group-item{border-width:1px 0}.panel>.list-group .list-group-item:first-child{border-top-right-radius:0;border-top-left-radius:0}.panel>.list-group .list-group-item:last-child{border-bottom:0}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.panel>.table,.panel>.table-responsive{margin-bottom:0}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive{border-top:1px solid #ddd}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.panel>.table-bordered>thead>tr:last-child>th,.panel>.table-responsive>.table-bordered>thead>tr:last-child>th,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th,.panel>.table-bordered>thead>tr:last-child>td,.panel>.table-responsive>.table-bordered>thead>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td{border-bottom:0}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-right-radius:3px;border-top-left-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px}.panel-title>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel-group .panel{margin-bottom:0;overflow:hidden;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse .panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse .panel-body{border-top-color:#ddd}.panel-default>.panel-heading>.dropdown .caret{border-color:#333 transparent}.panel-default>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#428bca}.panel-primary>.panel-heading{color:#fff;background-color:#428bca;border-color:#428bca}.panel-primary>.panel-heading+.panel-collapse .panel-body{border-top-color:#428bca}.panel-primary>.panel-heading>.dropdown .caret{border-color:#fff transparent}.panel-primary>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#428bca}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse .panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading>.dropdown .caret{border-color:#468847 transparent}.panel-success>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#d6e9c6}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#c09853;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse .panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading>.dropdown .caret{border-color:#c09853 transparent}.panel-warning>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#b94a48;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse .panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading>.dropdown .caret{border-color:#b94a48 transparent}.panel-danger>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#ebccd1}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse .panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading>.dropdown .caret{border-color:#3a87ad transparent}.panel-info>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#bce8f1}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.05);box-shadow:inset 0 1px 1px rgba(0,0,0,0.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,0.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:bold;line-height:1;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;filter:alpha(opacity=20)}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer;opacity:.5;filter:alpha(opacity=50)}button.close{padding:0;cursor:pointer;background:transparent;border:0;-webkit-appearance:none}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;display:none;overflow:auto;overflow-y:scroll}.modal.fade .modal-dialog{-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);transform:translate(0,-25%);-webkit-transition:-webkit-transform .3s ease-out;-moz-transition:-moz-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);transform:translate(0,0)}.modal-dialog{position:relative;z-index:1050;width:auto;padding:10px;margin-right:auto;margin-left:auto}.modal-content{position:relative;background-color:#fff;border:1px solid #999;border:1px solid rgba(0,0,0,0.2);border-radius:6px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,0.5);box-shadow:0 3px 9px rgba(0,0,0,0.5);background-clip:padding-box}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1030;background-color:#000}.modal-backdrop.fade{opacity:0;filter:alpha(opacity=0)}.modal-backdrop.in{opacity:.5;filter:alpha(opacity=50)}.modal-header{min-height:16.428571429px;padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.428571429}.modal-body{position:relative;padding:20px}.modal-footer{padding:19px 20px 20px;margin-top:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer:before,.modal-footer:after{display:table;content:" "}.modal-footer:after{clear:both}.modal-footer:before,.modal-footer:after{display:table;content:" "}.modal-footer:after{clear:both}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}@media screen and (min-width:768px){.modal-dialog{width:600px;padding-top:30px;padding-bottom:30px}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,0.5);box-shadow:0 5px 15px rgba(0,0,0,0.5)}}.tooltip{position:absolute;z-index:1030;display:block;font-size:12px;line-height:1.4;opacity:0;filter:alpha(opacity=0);visibility:visible}.tooltip.in{opacity:.9;filter:alpha(opacity=90)}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-top-color:#000;border-width:5px 5px 0}.tooltip.top-left .tooltip-arrow{bottom:0;left:5px;border-top-color:#000;border-width:5px 5px 0}.tooltip.top-right .tooltip-arrow{right:5px;bottom:0;border-top-color:#000;border-width:5px 5px 0}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-right-color:#000;border-width:5px 5px 5px 0}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-left-color:#000;border-width:5px 0 5px 5px}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-bottom-color:#000;border-width:0 5px 5px}.tooltip.bottom-left .tooltip-arrow{top:0;left:5px;border-bottom-color:#000;border-width:0 5px 5px}.tooltip.bottom-right .tooltip-arrow{top:0;right:5px;border-bottom-color:#000;border-width:0 5px 5px}.popover{position:absolute;top:0;left:0;z-index:1010;display:none;max-width:276px;padding:1px;text-align:left;white-space:normal;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);box-shadow:0 5px 10px rgba(0,0,0,0.2);background-clip:padding-box}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;font-weight:normal;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover .arrow,.popover .arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover .arrow{border-width:11px}.popover .arrow:after{border-width:10px;content:""}.popover.top .arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,0.25);border-bottom-width:0}.popover.top .arrow:after{bottom:1px;margin-left:-10px;border-top-color:#fff;border-bottom-width:0;content:" "}.popover.right .arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,0.25);border-left-width:0}.popover.right .arrow:after{bottom:-10px;left:1px;border-right-color:#fff;border-left-width:0;content:" "}.popover.bottom .arrow{top:-11px;left:50%;margin-left:-11px;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,0.25);border-top-width:0}.popover.bottom .arrow:after{top:1px;margin-left:-10px;border-bottom-color:#fff;border-top-width:0;content:" "}.popover.left .arrow{top:50%;right:-11px;margin-top:-11px;border-left-color:#999;border-left-color:rgba(0,0,0,0.25);border-right-width:0}.popover.left .arrow:after{right:1px;bottom:-10px;border-left-color:#fff;border-right-width:0;content:" "}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>img,.carousel-inner>.item>a>img{display:block;height:auto;max-width:100%;line-height:1}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,0.6);opacity:.5;filter:alpha(opacity=50)}.carousel-control.left{background-image:-webkit-gradient(linear,0 top,100% top,from(rgba(0,0,0,0.5)),to(rgba(0,0,0,0.0001)));background-image:-webkit-linear-gradient(left,color-stop(rgba(0,0,0,0.5) 0),color-stop(rgba(0,0,0,0.0001) 100%));background-image:-moz-linear-gradient(left,rgba(0,0,0,0.5) 0,rgba(0,0,0,0.0001) 100%);background-image:linear-gradient(to right,rgba(0,0,0,0.5) 0,rgba(0,0,0,0.0001) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000',endColorstr='#00000000',GradientType=1)}.carousel-control.right{right:0;left:auto;background-image:-webkit-gradient(linear,0 top,100% top,from(rgba(0,0,0,0.0001)),to(rgba(0,0,0,0.5)));background-image:-webkit-linear-gradient(left,color-stop(rgba(0,0,0,0.0001) 0),color-stop(rgba(0,0,0,0.5) 100%));background-image:-moz-linear-gradient(left,rgba(0,0,0,0.0001) 0,rgba(0,0,0,0.5) 100%);background-image:linear-gradient(to right,rgba(0,0,0,0.0001) 0,rgba(0,0,0,0.5) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000',endColorstr='#80000000',GradientType=1)}.carousel-control:hover,.carousel-control:focus{color:#fff;text-decoration:none;opacity:.9;filter:alpha(opacity=90)}.carousel-control .icon-prev,.carousel-control .icon-next,.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right{position:absolute;top:50%;z-index:5;display:inline-block}.carousel-control .icon-prev,.carousel-control .glyphicon-chevron-left{left:50%}.carousel-control .icon-next,.carousel-control .glyphicon-chevron-right{right:50%}.carousel-control .icon-prev,.carousel-control .icon-next{width:20px;height:20px;margin-top:-10px;margin-left:-10px;font-family:serif}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000 \9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,0.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicons-chevron-left,.carousel-control .glyphicons-chevron-right,.carousel-control .icon-prev,.carousel-control .icon-next{width:30px;height:30px;margin-top:-15px;margin-left:-15px;font-size:30px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.clearfix:before,.clearfix:after{display:table;content:" "}.clearfix:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important;visibility:hidden!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-xs,tr.visible-xs,th.visible-xs,td.visible-xs{display:none!important}@media(max-width:767px){.visible-xs{display:block!important}tr.visible-xs{display:table-row!important}th.visible-xs,td.visible-xs{display:table-cell!important}}@media(min-width:768px) and (max-width:991px){.visible-xs.visible-sm{display:block!important}tr.visible-xs.visible-sm{display:table-row!important}th.visible-xs.visible-sm,td.visible-xs.visible-sm{display:table-cell!important}}@media(min-width:992px) and (max-width:1199px){.visible-xs.visible-md{display:block!important}tr.visible-xs.visible-md{display:table-row!important}th.visible-xs.visible-md,td.visible-xs.visible-md{display:table-cell!important}}@media(min-width:1200px){.visible-xs.visible-lg{display:block!important}tr.visible-xs.visible-lg{display:table-row!important}th.visible-xs.visible-lg,td.visible-xs.visible-lg{display:table-cell!important}}.visible-sm,tr.visible-sm,th.visible-sm,td.visible-sm{display:none!important}@media(max-width:767px){.visible-sm.visible-xs{display:block!important}tr.visible-sm.visible-xs{display:table-row!important}th.visible-sm.visible-xs,td.visible-sm.visible-xs{display:table-cell!important}}@media(min-width:768px) and (max-width:991px){.visible-sm{display:block!important}tr.visible-sm{display:table-row!important}th.visible-sm,td.visible-sm{display:table-cell!important}}@media(min-width:992px) and (max-width:1199px){.visible-sm.visible-md{display:block!important}tr.visible-sm.visible-md{display:table-row!important}th.visible-sm.visible-md,td.visible-sm.visible-md{display:table-cell!important}}@media(min-width:1200px){.visible-sm.visible-lg{display:block!important}tr.visible-sm.visible-lg{display:table-row!important}th.visible-sm.visible-lg,td.visible-sm.visible-lg{display:table-cell!important}}.visible-md,tr.visible-md,th.visible-md,td.visible-md{display:none!important}@media(max-width:767px){.visible-md.visible-xs{display:block!important}tr.visible-md.visible-xs{display:table-row!important}th.visible-md.visible-xs,td.visible-md.visible-xs{display:table-cell!important}}@media(min-width:768px) and (max-width:991px){.visible-md.visible-sm{display:block!important}tr.visible-md.visible-sm{display:table-row!important}th.visible-md.visible-sm,td.visible-md.visible-sm{display:table-cell!important}}@media(min-width:992px) and (max-width:1199px){.visible-md{display:block!important}tr.visible-md{display:table-row!important}th.visible-md,td.visible-md{display:table-cell!important}}@media(min-width:1200px){.visible-md.visible-lg{display:block!important}tr.visible-md.visible-lg{display:table-row!important}th.visible-md.visible-lg,td.visible-md.visible-lg{display:table-cell!important}}.visible-lg,tr.visible-lg,th.visible-lg,td.visible-lg{display:none!important}@media(max-width:767px){.visible-lg.visible-xs{display:block!important}tr.visible-lg.visible-xs{display:table-row!important}th.visible-lg.visible-xs,td.visible-lg.visible-xs{display:table-cell!important}}@media(min-width:768px) and (max-width:991px){.visible-lg.visible-sm{display:block!important}tr.visible-lg.visible-sm{display:table-row!important}th.visible-lg.visible-sm,td.visible-lg.visible-sm{display:table-cell!important}}@media(min-width:992px) and (max-width:1199px){.visible-lg.visible-md{display:block!important}tr.visible-lg.visible-md{display:table-row!important}th.visible-lg.visible-md,td.visible-lg.visible-md{display:table-cell!important}}@media(min-width:1200px){.visible-lg{display:block!important}tr.visible-lg{display:table-row!important}th.visible-lg,td.visible-lg{display:table-cell!important}}.hidden-xs{display:block!important}tr.hidden-xs{display:table-row!important}th.hidden-xs,td.hidden-xs{display:table-cell!important}@media(max-width:767px){.hidden-xs,tr.hidden-xs,th.hidden-xs,td.hidden-xs{display:none!important}}@media(min-width:768px) and (max-width:991px){.hidden-xs.hidden-sm,tr.hidden-xs.hidden-sm,th.hidden-xs.hidden-sm,td.hidden-xs.hidden-sm{display:none!important}}@media(min-width:992px) and (max-width:1199px){.hidden-xs.hidden-md,tr.hidden-xs.hidden-md,th.hidden-xs.hidden-md,td.hidden-xs.hidden-md{display:none!important}}@media(min-width:1200px){.hidden-xs.hidden-lg,tr.hidden-xs.hidden-lg,th.hidden-xs.hidden-lg,td.hidden-xs.hidden-lg{display:none!important}}.hidden-sm{display:block!important}tr.hidden-sm{display:table-row!important}th.hidden-sm,td.hidden-sm{display:table-cell!important}@media(max-width:767px){.hidden-sm.hidden-xs,tr.hidden-sm.hidden-xs,th.hidden-sm.hidden-xs,td.hidden-sm.hidden-xs{display:none!important}}@media(min-width:768px) and (max-width:991px){.hidden-sm,tr.hidden-sm,th.hidden-sm,td.hidden-sm{display:none!important}}@media(min-width:992px) and (max-width:1199px){.hidden-sm.hidden-md,tr.hidden-sm.hidden-md,th.hidden-sm.hidden-md,td.hidden-sm.hidden-md{display:none!important}}@media(min-width:1200px){.hidden-sm.hidden-lg,tr.hidden-sm.hidden-lg,th.hidden-sm.hidden-lg,td.hidden-sm.hidden-lg{display:none!important}}.hidden-md{display:block!important}tr.hidden-md{display:table-row!important}th.hidden-md,td.hidden-md{display:table-cell!important}@media(max-width:767px){.hidden-md.hidden-xs,tr.hidden-md.hidden-xs,th.hidden-md.hidden-xs,td.hidden-md.hidden-xs{display:none!important}}@media(min-width:768px) and (max-width:991px){.hidden-md.hidden-sm,tr.hidden-md.hidden-sm,th.hidden-md.hidden-sm,td.hidden-md.hidden-sm{display:none!important}}@media(min-width:992px) and (max-width:1199px){.hidden-md,tr.hidden-md,th.hidden-md,td.hidden-md{display:none!important}}@media(min-width:1200px){.hidden-md.hidden-lg,tr.hidden-md.hidden-lg,th.hidden-md.hidden-lg,td.hidden-md.hidden-lg{display:none!important}}.hidden-lg{display:block!important}tr.hidden-lg{display:table-row!important}th.hidden-lg,td.hidden-lg{display:table-cell!important}@media(max-width:767px){.hidden-lg.hidden-xs,tr.hidden-lg.hidden-xs,th.hidden-lg.hidden-xs,td.hidden-lg.hidden-xs{display:none!important}}@media(min-width:768px) and (max-width:991px){.hidden-lg.hidden-sm,tr.hidden-lg.hidden-sm,th.hidden-lg.hidden-sm,td.hidden-lg.hidden-sm{display:none!important}}@media(min-width:992px) and (max-width:1199px){.hidden-lg.hidden-md,tr.hidden-lg.hidden-md,th.hidden-lg.hidden-md,td.hidden-lg.hidden-md{display:none!important}}@media(min-width:1200px){.hidden-lg,tr.hidden-lg,th.hidden-lg,td.hidden-lg{display:none!important}}.visible-print,tr.visible-print,th.visible-print,td.visible-print{display:none!important}@media print{.visible-print{display:block!important}tr.visible-print{display:table-row!important}th.visible-print,td.visible-print{display:table-cell!important}.hidden-print,tr.hidden-print,th.hidden-print,td.hidden-print{display:none!important}}
\ No newline at end of file
diff --git a/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/css/comparator.css b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/css/comparator.css
new file mode 100644
index 0000000..5598deb
--- /dev/null
+++ b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/css/comparator.css
@@ -0,0 +1,157 @@
+.app_logo_new_delegation { 
+	.img-thumbnail;
+	width: 70px;
+	height: 70px;
+}
+
+.app_logo_list_delegations {
+	.img-responsive;
+	width: 70px;
+	height: 70px;
+}
+
+.cont {
+	margin-top: 15px;
+	margin-left: 15px;
+	margin-right:15px;
+	margin-bottom:15px;
+}
+
+.table > tbody > tr > td {
+     vertical-align: middle;
+}
+
+table {    
+	border-spacing: 10px 0px;
+}
+
+
+li.waterSensor a {
+	color:blue;
+	background-color:#f0f2ff;
+}
+
+li.waterLevel a {
+	color:navy;
+	background-color:#fffdf0;
+}
+
+li.faultDetection a {
+	color:purple;
+	background-color:azure;
+}
+
+li.alarmSpeaker a {
+	color:#685fa0;
+	background-color:#f3ffb0;
+}
+
+li.color a {
+	color:orange;
+	background-color:#c0c0c0;
+}
+
+li.colorSaturation a {
+	color:fuchsia;
+	background-color:#cafffe;
+}
+
+li.binarySwitch a {
+	color:#b900b9;
+	background-color:#f3d6f1;
+}
+
+li.runMode a {
+	color:black;
+	background-color:#f3f4fe;
+}
+
+li.smokeSensor a {
+	color:teal;
+	background-color:#e9fefe;
+}
+
+li.energyGeneration a {
+	color:#004040;
+		background-color:#eee6ff;
+}
+
+li.energyConsumption a {
+	color:black;
+	background-color:#FFFFB0;
+}
+
+li.clock a {
+	color:aqua;
+	color:#c0c0c0;
+}
+
+li.personSensor a {
+	color:black;
+	background-color:#ffe6f9;
+	}
+
+li.streaming a {
+		color:#ea6400;
+	background-color:#fff1e6;
+}
+
+li.noise a {
+	color:#000000;
+	background-color:#dfe8c1;	
+}
+
+li.extendedCarbonDioxideSensor a {
+	color:#000000;
+	background-color:#d4d4d4;	
+}
+
+li.atmosphericPressureSensor a {
+	color:#0000a0;
+	background-color:#ccf9f8;	
+}
+
+li.temperature a {
+	color:#000000;
+	background-color:#fffdaa;	
+}
+
+li.relativeHumidity a {
+	color:#000000;
+	background-color:#d7deff;	
+}
+
+li.colour a {
+	color:#ffffff;
+	background-color:#0000a0;	
+}
+
+li.colourSaturation a {
+	color:#000000;
+	background-color:#81fcef;	
+}
+
+li.lock a {
+	color:#000000;
+	background-color:#c1b0cc;	
+}
+
+li.doorStatus a {
+	color:#000000;
+	background-color:#e9f2db;	
+}
+
+li.grinder a {
+	color:#ffffff;
+	background-color:#794041;	
+}
+
+li.brewing a {
+	color:#ffffff;
+	background-color:#354755;	
+}
+
+li.level a {
+	color:#ffffff;
+	background-color:#44dde6;	
+}
diff --git a/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/images/logo.png b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/images/logo.png
new file mode 100644
index 0000000..0d3de3c
--- /dev/null
+++ b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/images/logo.png
Binary files differ
diff --git a/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/index.html b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/index.html
new file mode 100644
index 0000000..bc66079
--- /dev/null
+++ b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/index.html
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html ng-app="gemDelegate">
+<head>
+<script src="js/angular.js"></script>
+<script src="js/angular-animate.js"></script>
+<script src="js/angular-sanitize.js"></script>
+<script src="js/xml2json.min.js"></script>
+<!-- script src="js/ui-bootstrap-tpls-2.1.2.js"></script-->
+<link href="css/bootstrap-3.0.1.min.css" rel="stylesheet">
+<script type="text/javascript" src="js/abn_tree_directive.js"></script>
+<link href="css/abn_tree.css" rel="stylesheet">
+<link href="css/comparator.css" rel="stylesheet">
+<script type="text/javascript" src="js/comparator.js"></script>
+</head>
+<body>
+
+	<script type="text/javascript">
+	
+		function getContext() {
+			var url = new URL(window.location);
+			var context = url.searchParams.get("context");
+			return context;
+		}
+		
+		// this script checks if context http parameter is valued in the url
+		// if not, it redirects automatically to the /comparator root url
+		context = getContext();
+		if (context == undefined) {
+			window.location = "/comparator";
+		}
+	
+	</script>
+	
+	
+	<div class="cont">
+		<figure>
+			<a href="#"><img src="images/logo.png" alt=""></a>
+		</figure>
+		<h2>oneM2M Smart Device Template Viewer</h2>
+		<br />
+		<div ng-app="gemDelegate" ng-controller="delegationController" ng-init="initContext(context)" >
+		
+
+			<table width="100%">
+				<tr>
+					<td class="half" width="50%" valign="top"><select
+						ng-model="selectedDevice" ng-options="x.name for x in devices"
+						ng-change="updateTree1()"></select> <abn-tree tree-data="my_data"
+							tree-control="my_tree" on-select="my_tree_handler1(branch)"
+							expand-level="4" icon-leaf="icon-caret-right"></abn-tree> <!--p>selectbox: {{selectedDevice.model}}</p>
+					<p>treeItem: {{selectedItem1}}</p--></td>
+					<td class="half" width="50%" valign="top"><select
+						ng-model="selectedDevice2" ng-options="x.name for x in devices"
+						ng-change="updateTree2()"></select> <abn-tree tree-data="my_data2"
+							tree-control="my_tree2" on-select="my_tree_handler2(branch)"
+							expand-level="4" icon-leaf="imgPath"></abn-tree> <!--p>selectbox: {{selectedDevice2.model}}</p>
+					<p>treeItem: {{selectedItem2}}</p--></td>
+				</tr>
+			</table>
+		</div>
+	</div>
+</body>
+</html>
\ No newline at end of file
diff --git a/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/js/abn_tree_directive.js b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/js/abn_tree_directive.js
new file mode 100644
index 0000000..1013e47
--- /dev/null
+++ b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/js/abn_tree_directive.js
@@ -0,0 +1,492 @@
+(function() {
+  var module,
+    __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
+
+  module = angular.module('angularBootstrapNavTree', []);
+
+  module.directive('abnTree', [
+    '$timeout', function($timeout) {
+      return {
+        restrict: 'E',
+        template: "<ul class=\"nav nav-list nav-pills nav-stacked abn-tree\">\n  <li ng-repeat=\"row in tree_rows | filter:{visible:true} track by row.branch.uid\" ng-animate=\"'abn-tree-animate'\" ng-class=\"'level-' + {{ row.level }} + (row.branch.selected ? ' active':'') + ' ' +row.classes.join(' ')\" class=\"abn-tree-row\"><a ng-click=\"user_clicks_branch(row.branch)\"><i ng-class=\"row.tree_icon\" ng-click=\"row.branch.expanded = !row.branch.expanded\" class=\"indented tree-icon\"> </i><span class=\"indented tree-label\">{{ row.label }} </span></a></li>\n</ul>",
+        replace: true,
+        scope: {
+          treeData: '=',
+          onSelect: '&',
+          initialSelection: '@',
+          treeControl: '='
+        },
+        link: function(scope, element, attrs) {
+          var error, expand_all_parents, expand_level, for_all_ancestors, for_each_branch, get_parent, n, on_treeData_change, select_branch, selected_branch, tree;
+          error = function(s) {
+            console.log('ERROR:' + s);
+            debugger;
+            return void 0;
+          };
+          if (attrs.iconExpand == null) {
+            attrs.iconExpand = 'icon-plus  glyphicon glyphicon-plus  fa fa-plus';
+          }
+          if (attrs.iconCollapse == null) {
+            attrs.iconCollapse = 'icon-minus glyphicon glyphicon-minus fa fa-minus';
+          }
+          if (attrs.iconLeaf == null) {
+            attrs.iconLeaf = 'icon-file  glyphicon glyphicon-file  fa fa-file';
+          }
+          if (attrs.expandLevel == null) {
+            attrs.expandLevel = '3';
+          }
+          expand_level = parseInt(attrs.expandLevel, 10);
+          if (!scope.treeData) {
+            alert('no treeData defined for the tree!');
+            return;
+          }
+          if (scope.treeData.length == null) {
+            if (treeData.label != null) {
+              scope.treeData = [treeData];
+            } else {
+              alert('treeData should be an array of root branches');
+              return;
+            }
+          }
+          for_each_branch = function(f) {
+            var do_f, root_branch, _i, _len, _ref, _results;
+            do_f = function(branch, level) {
+              var child, _i, _len, _ref, _results;
+              f(branch, level);
+              if (branch.children != null) {
+                _ref = branch.children;
+                _results = [];
+                for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+                  child = _ref[_i];
+                  _results.push(do_f(child, level + 1));
+                }
+                return _results;
+              }
+            };
+            _ref = scope.treeData;
+            _results = [];
+            for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+              root_branch = _ref[_i];
+              _results.push(do_f(root_branch, 1));
+            }
+            return _results;
+          };
+          selected_branch = null;
+          select_branch = function(branch) {
+            if (!branch) {
+              if (selected_branch != null) {
+                selected_branch.selected = false;
+              }
+              selected_branch = null;
+              return;
+            }
+            if (branch !== selected_branch) {
+              if (selected_branch != null) {
+                selected_branch.selected = false;
+              }
+              branch.selected = true;
+              selected_branch = branch;
+              expand_all_parents(branch);
+              if (branch.onSelect != null) {
+                return $timeout(function() {
+                  return branch.onSelect(branch);
+                });
+              } else {
+                if (scope.onSelect != null) {
+                  return $timeout(function() {
+                    return scope.onSelect({
+                      branch: branch
+                    });
+                  });
+                }
+              }
+            }
+          };
+          scope.user_clicks_branch = function(branch) {
+            if (branch !== selected_branch) {
+              return select_branch(branch);
+            }
+          };
+          get_parent = function(child) {
+            var parent;
+            parent = void 0;
+            if (child.parent_uid) {
+              for_each_branch(function(b) {
+                if (b.uid === child.parent_uid) {
+                  return parent = b;
+                }
+              });
+            }
+            return parent;
+          };
+          for_all_ancestors = function(child, fn) {
+            var parent;
+            parent = get_parent(child);
+            if (parent != null) {
+              fn(parent);
+              return for_all_ancestors(parent, fn);
+            }
+          };
+          expand_all_parents = function(child) {
+            return for_all_ancestors(child, function(b) {
+              return b.expanded = true;
+            });
+          };
+          scope.tree_rows = [];
+          on_treeData_change = function() {
+            var add_branch_to_list, root_branch, _i, _len, _ref, _results;
+            for_each_branch(function(b, level) {
+              if (!b.uid) {
+                return b.uid = "" + Math.random();
+              }
+            });
+            console.log('UIDs are set.');
+            for_each_branch(function(b) {
+              var child, _i, _len, _ref, _results;
+              if (angular.isArray(b.children)) {
+                _ref = b.children;
+                _results = [];
+                for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+                  child = _ref[_i];
+                  _results.push(child.parent_uid = b.uid);
+                }
+                return _results;
+              }
+            });
+            scope.tree_rows = [];
+            for_each_branch(function(branch) {
+              var child, f;
+              if (branch.children) {
+                if (branch.children.length > 0) {
+                  f = function(e) {
+                    if (typeof e === 'string') {
+                      return {
+                        label: e,
+                        children: []
+                      };
+                    } else {
+                      return e;
+                    }
+                  };
+                  return branch.children = (function() {
+                    var _i, _len, _ref, _results;
+                    _ref = branch.children;
+                    _results = [];
+                    for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+                      child = _ref[_i];
+                      _results.push(f(child));
+                    }
+                    return _results;
+                  })();
+                }
+              } else {
+                return branch.children = [];
+              }
+            });
+            add_branch_to_list = function(level, branch, visible) {
+              var child, child_visible, tree_icon, _i, _len, _ref, _results;
+              if (branch.expanded == null) {
+                branch.expanded = false;
+              }
+              if (branch.classes == null) {
+                branch.classes = [];
+              }
+              if (!branch.noLeaf && (!branch.children || branch.children.length === 0)) {
+                tree_icon = attrs.iconLeaf;
+                if (__indexOf.call(branch.classes, "leaf") < 0) {
+                  branch.classes.push("leaf");
+                }
+              } else {
+                if (branch.expanded) {
+                  tree_icon = attrs.iconCollapse;
+                } else {
+                  tree_icon = attrs.iconExpand;
+                }
+              }
+              scope.tree_rows.push({
+                level: level,
+                branch: branch,
+                label: branch.label,
+                classes: branch.classes,
+                tree_icon: tree_icon,
+                visible: visible
+              });
+              if (branch.children != null) {
+                _ref = branch.children;
+                _results = [];
+                for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+                  child = _ref[_i];
+                  child_visible = visible && branch.expanded;
+                  _results.push(add_branch_to_list(level + 1, child, child_visible));
+                }
+                return _results;
+              }
+            };
+            _ref = scope.treeData;
+            _results = [];
+            for (_i = 0, _len = _ref.length; _i < _len; _i++) {
+              root_branch = _ref[_i];
+              _results.push(add_branch_to_list(1, root_branch, true));
+            }
+            return _results;
+          };
+          scope.$watch('treeData', on_treeData_change, true);
+          if (attrs.initialSelection != null) {
+            for_each_branch(function(b) {
+              if (b.label === attrs.initialSelection) {
+                return $timeout(function() {
+                  return select_branch(b);
+                });
+              }
+            });
+          }
+          n = scope.treeData.length;
+          console.log('num root branches = ' + n);
+          for_each_branch(function(b, level) {
+            b.level = level;
+            return b.expanded = b.level < expand_level;
+          });
+          if (scope.treeControl != null) {
+            if (angular.isObject(scope.treeControl)) {
+              tree = scope.treeControl;
+              tree.expand_all = function() {
+                return for_each_branch(function(b, level) {
+                  return b.expanded = true;
+                });
+              };
+              tree.collapse_all = function() {
+                return for_each_branch(function(b, level) {
+                  return b.expanded = false;
+                });
+              };
+              tree.get_first_branch = function() {
+                n = scope.treeData.length;
+                if (n > 0) {
+                  return scope.treeData[0];
+                }
+              };
+              tree.select_first_branch = function() {
+                var b;
+                b = tree.get_first_branch();
+                return tree.select_branch(b);
+              };
+              tree.get_selected_branch = function() {
+                return selected_branch;
+              };
+              tree.get_parent_branch = function(b) {
+                return get_parent(b);
+              };
+              tree.select_branch = function(b) {
+                select_branch(b);
+                return b;
+              };
+              tree.get_children = function(b) {
+                return b.children;
+              };
+              tree.select_parent_branch = function(b) {
+                var p;
+                if (b == null) {
+                  b = tree.get_selected_branch();
+                }
+                if (b != null) {
+                  p = tree.get_parent_branch(b);
+                  if (p != null) {
+                    tree.select_branch(p);
+                    return p;
+                  }
+                }
+              };
+              tree.add_branch = function(parent, new_branch) {
+                if (parent != null) {
+                  parent.children.push(new_branch);
+                  parent.expanded = true;
+                } else {
+                  scope.treeData.push(new_branch);
+                }
+                return new_branch;
+              };
+              tree.add_root_branch = function(new_branch) {
+                tree.add_branch(null, new_branch);
+                return new_branch;
+              };
+              tree.expand_branch = function(b) {
+                if (b == null) {
+                  b = tree.get_selected_branch();
+                }
+                if (b != null) {
+                  b.expanded = true;
+                  return b;
+                }
+              };
+              tree.collapse_branch = function(b) {
+                if (b == null) {
+                  b = selected_branch;
+                }
+                if (b != null) {
+                  b.expanded = false;
+                  return b;
+                }
+              };
+              tree.get_siblings = function(b) {
+                var p, siblings;
+                if (b == null) {
+                  b = selected_branch;
+                }
+                if (b != null) {
+                  p = tree.get_parent_branch(b);
+                  if (p) {
+                    siblings = p.children;
+                  } else {
+                    siblings = scope.treeData;
+                  }
+                  return siblings;
+                }
+              };
+              tree.get_next_sibling = function(b) {
+                var i, siblings;
+                if (b == null) {
+                  b = selected_branch;
+                }
+                if (b != null) {
+                  siblings = tree.get_siblings(b);
+                  n = siblings.length;
+                  i = siblings.indexOf(b);
+                  if (i < n) {
+                    return siblings[i + 1];
+                  }
+                }
+              };
+              tree.get_prev_sibling = function(b) {
+                var i, siblings;
+                if (b == null) {
+                  b = selected_branch;
+                }
+                siblings = tree.get_siblings(b);
+                n = siblings.length;
+                i = siblings.indexOf(b);
+                if (i > 0) {
+                  return siblings[i - 1];
+                }
+              };
+              tree.select_next_sibling = function(b) {
+                var next;
+                if (b == null) {
+                  b = selected_branch;
+                }
+                if (b != null) {
+                  next = tree.get_next_sibling(b);
+                  if (next != null) {
+                    return tree.select_branch(next);
+                  }
+                }
+              };
+              tree.select_prev_sibling = function(b) {
+                var prev;
+                if (b == null) {
+                  b = selected_branch;
+                }
+                if (b != null) {
+                  prev = tree.get_prev_sibling(b);
+                  if (prev != null) {
+                    return tree.select_branch(prev);
+                  }
+                }
+              };
+              tree.get_first_child = function(b) {
+                var _ref;
+                if (b == null) {
+                  b = selected_branch;
+                }
+                if (b != null) {
+                  if (((_ref = b.children) != null ? _ref.length : void 0) > 0) {
+                    return b.children[0];
+                  }
+                }
+              };
+              tree.get_closest_ancestor_next_sibling = function(b) {
+                var next, parent;
+                next = tree.get_next_sibling(b);
+                if (next != null) {
+                  return next;
+                } else {
+                  parent = tree.get_parent_branch(b);
+                  return tree.get_closest_ancestor_next_sibling(parent);
+                }
+              };
+              tree.get_next_branch = function(b) {
+                var next;
+                if (b == null) {
+                  b = selected_branch;
+                }
+                if (b != null) {
+                  next = tree.get_first_child(b);
+                  if (next != null) {
+                    return next;
+                  } else {
+                    next = tree.get_closest_ancestor_next_sibling(b);
+                    return next;
+                  }
+                }
+              };
+              tree.select_next_branch = function(b) {
+                var next;
+                if (b == null) {
+                  b = selected_branch;
+                }
+                if (b != null) {
+                  next = tree.get_next_branch(b);
+                  if (next != null) {
+                    tree.select_branch(next);
+                    return next;
+                  }
+                }
+              };
+              tree.last_descendant = function(b) {
+                var last_child;
+                if (b == null) {
+                  debugger;
+                }
+                n = b.children.length;
+                if (n === 0) {
+                  return b;
+                } else {
+                  last_child = b.children[n - 1];
+                  return tree.last_descendant(last_child);
+                }
+              };
+              tree.get_prev_branch = function(b) {
+                var parent, prev_sibling;
+                if (b == null) {
+                  b = selected_branch;
+                }
+                if (b != null) {
+                  prev_sibling = tree.get_prev_sibling(b);
+                  if (prev_sibling != null) {
+                    return tree.last_descendant(prev_sibling);
+                  } else {
+                    parent = tree.get_parent_branch(b);
+                    return parent;
+                  }
+                }
+              };
+              return tree.select_prev_branch = function(b) {
+                var prev;
+                if (b == null) {
+                  b = selected_branch;
+                }
+                if (b != null) {
+                  prev = tree.get_prev_branch(b);
+                  if (prev != null) {
+                    tree.select_branch(prev);
+                    return prev;
+                  }
+                }
+              };
+            }
+          }
+        }
+      };
+    }
+  ]);
+
+}).call(this);
\ No newline at end of file
diff --git a/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/js/angular-animate.js b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/js/angular-animate.js
new file mode 100644
index 0000000..b18b828
--- /dev/null
+++ b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/js/angular-animate.js
@@ -0,0 +1,4139 @@
+/**
+ * @license AngularJS v1.5.8
+ * (c) 2010-2016 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, angular) {'use strict';
+
+var ELEMENT_NODE = 1;
+var COMMENT_NODE = 8;
+
+var ADD_CLASS_SUFFIX = '-add';
+var REMOVE_CLASS_SUFFIX = '-remove';
+var EVENT_CLASS_PREFIX = 'ng-';
+var ACTIVE_CLASS_SUFFIX = '-active';
+var PREPARE_CLASS_SUFFIX = '-prepare';
+
+var NG_ANIMATE_CLASSNAME = 'ng-animate';
+var NG_ANIMATE_CHILDREN_DATA = '$$ngAnimateChildren';
+
+// Detect proper transitionend/animationend event names.
+var CSS_PREFIX = '', TRANSITION_PROP, TRANSITIONEND_EVENT, ANIMATION_PROP, ANIMATIONEND_EVENT;
+
+// If unprefixed events are not supported but webkit-prefixed are, use the latter.
+// Otherwise, just use W3C names, browsers not supporting them at all will just ignore them.
+// Note: Chrome implements `window.onwebkitanimationend` and doesn't implement `window.onanimationend`
+// but at the same time dispatches the `animationend` event and not `webkitAnimationEnd`.
+// Register both events in case `window.onanimationend` is not supported because of that,
+// do the same for `transitionend` as Safari is likely to exhibit similar behavior.
+// Also, the only modern browser that uses vendor prefixes for transitions/keyframes is webkit
+// therefore there is no reason to test anymore for other vendor prefixes:
+// http://caniuse.com/#search=transition
+if ((window.ontransitionend === void 0) && (window.onwebkittransitionend !== void 0)) {
+  CSS_PREFIX = '-webkit-';
+  TRANSITION_PROP = 'WebkitTransition';
+  TRANSITIONEND_EVENT = 'webkitTransitionEnd transitionend';
+} else {
+  TRANSITION_PROP = 'transition';
+  TRANSITIONEND_EVENT = 'transitionend';
+}
+
+if ((window.onanimationend === void 0) && (window.onwebkitanimationend !== void 0)) {
+  CSS_PREFIX = '-webkit-';
+  ANIMATION_PROP = 'WebkitAnimation';
+  ANIMATIONEND_EVENT = 'webkitAnimationEnd animationend';
+} else {
+  ANIMATION_PROP = 'animation';
+  ANIMATIONEND_EVENT = 'animationend';
+}
+
+var DURATION_KEY = 'Duration';
+var PROPERTY_KEY = 'Property';
+var DELAY_KEY = 'Delay';
+var TIMING_KEY = 'TimingFunction';
+var ANIMATION_ITERATION_COUNT_KEY = 'IterationCount';
+var ANIMATION_PLAYSTATE_KEY = 'PlayState';
+var SAFE_FAST_FORWARD_DURATION_VALUE = 9999;
+
+var ANIMATION_DELAY_PROP = ANIMATION_PROP + DELAY_KEY;
+var ANIMATION_DURATION_PROP = ANIMATION_PROP + DURATION_KEY;
+var TRANSITION_DELAY_PROP = TRANSITION_PROP + DELAY_KEY;
+var TRANSITION_DURATION_PROP = TRANSITION_PROP + DURATION_KEY;
+
+var ngMinErr = angular.$$minErr('ng');
+function assertArg(arg, name, reason) {
+  if (!arg) {
+    throw ngMinErr('areq', "Argument '{0}' is {1}", (name || '?'), (reason || "required"));
+  }
+  return arg;
+}
+
+function mergeClasses(a,b) {
+  if (!a && !b) return '';
+  if (!a) return b;
+  if (!b) return a;
+  if (isArray(a)) a = a.join(' ');
+  if (isArray(b)) b = b.join(' ');
+  return a + ' ' + b;
+}
+
+function packageStyles(options) {
+  var styles = {};
+  if (options && (options.to || options.from)) {
+    styles.to = options.to;
+    styles.from = options.from;
+  }
+  return styles;
+}
+
+function pendClasses(classes, fix, isPrefix) {
+  var className = '';
+  classes = isArray(classes)
+      ? classes
+      : classes && isString(classes) && classes.length
+          ? classes.split(/\s+/)
+          : [];
+  forEach(classes, function(klass, i) {
+    if (klass && klass.length > 0) {
+      className += (i > 0) ? ' ' : '';
+      className += isPrefix ? fix + klass
+                            : klass + fix;
+    }
+  });
+  return className;
+}
+
+function removeFromArray(arr, val) {
+  var index = arr.indexOf(val);
+  if (val >= 0) {
+    arr.splice(index, 1);
+  }
+}
+
+function stripCommentsFromElement(element) {
+  if (element instanceof jqLite) {
+    switch (element.length) {
+      case 0:
+        return element;
+
+      case 1:
+        // there is no point of stripping anything if the element
+        // is the only element within the jqLite wrapper.
+        // (it's important that we retain the element instance.)
+        if (element[0].nodeType === ELEMENT_NODE) {
+          return element;
+        }
+        break;
+
+      default:
+        return jqLite(extractElementNode(element));
+    }
+  }
+
+  if (element.nodeType === ELEMENT_NODE) {
+    return jqLite(element);
+  }
+}
+
+function extractElementNode(element) {
+  if (!element[0]) return element;
+  for (var i = 0; i < element.length; i++) {
+    var elm = element[i];
+    if (elm.nodeType == ELEMENT_NODE) {
+      return elm;
+    }
+  }
+}
+
+function $$addClass($$jqLite, element, className) {
+  forEach(element, function(elm) {
+    $$jqLite.addClass(elm, className);
+  });
+}
+
+function $$removeClass($$jqLite, element, className) {
+  forEach(element, function(elm) {
+    $$jqLite.removeClass(elm, className);
+  });
+}
+
+function applyAnimationClassesFactory($$jqLite) {
+  return function(element, options) {
+    if (options.addClass) {
+      $$addClass($$jqLite, element, options.addClass);
+      options.addClass = null;
+    }
+    if (options.removeClass) {
+      $$removeClass($$jqLite, element, options.removeClass);
+      options.removeClass = null;
+    }
+  };
+}
+
+function prepareAnimationOptions(options) {
+  options = options || {};
+  if (!options.$$prepared) {
+    var domOperation = options.domOperation || noop;
+    options.domOperation = function() {
+      options.$$domOperationFired = true;
+      domOperation();
+      domOperation = noop;
+    };
+    options.$$prepared = true;
+  }
+  return options;
+}
+
+function applyAnimationStyles(element, options) {
+  applyAnimationFromStyles(element, options);
+  applyAnimationToStyles(element, options);
+}
+
+function applyAnimationFromStyles(element, options) {
+  if (options.from) {
+    element.css(options.from);
+    options.from = null;
+  }
+}
+
+function applyAnimationToStyles(element, options) {
+  if (options.to) {
+    element.css(options.to);
+    options.to = null;
+  }
+}
+
+function mergeAnimationDetails(element, oldAnimation, newAnimation) {
+  var target = oldAnimation.options || {};
+  var newOptions = newAnimation.options || {};
+
+  var toAdd = (target.addClass || '') + ' ' + (newOptions.addClass || '');
+  var toRemove = (target.removeClass || '') + ' ' + (newOptions.removeClass || '');
+  var classes = resolveElementClasses(element.attr('class'), toAdd, toRemove);
+
+  if (newOptions.preparationClasses) {
+    target.preparationClasses = concatWithSpace(newOptions.preparationClasses, target.preparationClasses);
+    delete newOptions.preparationClasses;
+  }
+
+  // noop is basically when there is no callback; otherwise something has been set
+  var realDomOperation = target.domOperation !== noop ? target.domOperation : null;
+
+  extend(target, newOptions);
+
+  // TODO(matsko or sreeramu): proper fix is to maintain all animation callback in array and call at last,but now only leave has the callback so no issue with this.
+  if (realDomOperation) {
+    target.domOperation = realDomOperation;
+  }
+
+  if (classes.addClass) {
+    target.addClass = classes.addClass;
+  } else {
+    target.addClass = null;
+  }
+
+  if (classes.removeClass) {
+    target.removeClass = classes.removeClass;
+  } else {
+    target.removeClass = null;
+  }
+
+  oldAnimation.addClass = target.addClass;
+  oldAnimation.removeClass = target.removeClass;
+
+  return target;
+}
+
+function resolveElementClasses(existing, toAdd, toRemove) {
+  var ADD_CLASS = 1;
+  var REMOVE_CLASS = -1;
+
+  var flags = {};
+  existing = splitClassesToLookup(existing);
+
+  toAdd = splitClassesToLookup(toAdd);
+  forEach(toAdd, function(value, key) {
+    flags[key] = ADD_CLASS;
+  });
+
+  toRemove = splitClassesToLookup(toRemove);
+  forEach(toRemove, function(value, key) {
+    flags[key] = flags[key] === ADD_CLASS ? null : REMOVE_CLASS;
+  });
+
+  var classes = {
+    addClass: '',
+    removeClass: ''
+  };
+
+  forEach(flags, function(val, klass) {
+    var prop, allow;
+    if (val === ADD_CLASS) {
+      prop = 'addClass';
+      allow = !existing[klass] || existing[klass + REMOVE_CLASS_SUFFIX];
+    } else if (val === REMOVE_CLASS) {
+      prop = 'removeClass';
+      allow = existing[klass] || existing[klass + ADD_CLASS_SUFFIX];
+    }
+    if (allow) {
+      if (classes[prop].length) {
+        classes[prop] += ' ';
+      }
+      classes[prop] += klass;
+    }
+  });
+
+  function splitClassesToLookup(classes) {
+    if (isString(classes)) {
+      classes = classes.split(' ');
+    }
+
+    var obj = {};
+    forEach(classes, function(klass) {
+      // sometimes the split leaves empty string values
+      // incase extra spaces were applied to the options
+      if (klass.length) {
+        obj[klass] = true;
+      }
+    });
+    return obj;
+  }
+
+  return classes;
+}
+
+function getDomNode(element) {
+  return (element instanceof jqLite) ? element[0] : element;
+}
+
+function applyGeneratedPreparationClasses(element, event, options) {
+  var classes = '';
+  if (event) {
+    classes = pendClasses(event, EVENT_CLASS_PREFIX, true);
+  }
+  if (options.addClass) {
+    classes = concatWithSpace(classes, pendClasses(options.addClass, ADD_CLASS_SUFFIX));
+  }
+  if (options.removeClass) {
+    classes = concatWithSpace(classes, pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX));
+  }
+  if (classes.length) {
+    options.preparationClasses = classes;
+    element.addClass(classes);
+  }
+}
+
+function clearGeneratedClasses(element, options) {
+  if (options.preparationClasses) {
+    element.removeClass(options.preparationClasses);
+    options.preparationClasses = null;
+  }
+  if (options.activeClasses) {
+    element.removeClass(options.activeClasses);
+    options.activeClasses = null;
+  }
+}
+
+function blockTransitions(node, duration) {
+  // we use a negative delay value since it performs blocking
+  // yet it doesn't kill any existing transitions running on the
+  // same element which makes this safe for class-based animations
+  var value = duration ? '-' + duration + 's' : '';
+  applyInlineStyle(node, [TRANSITION_DELAY_PROP, value]);
+  return [TRANSITION_DELAY_PROP, value];
+}
+
+function blockKeyframeAnimations(node, applyBlock) {
+  var value = applyBlock ? 'paused' : '';
+  var key = ANIMATION_PROP + ANIMATION_PLAYSTATE_KEY;
+  applyInlineStyle(node, [key, value]);
+  return [key, value];
+}
+
+function applyInlineStyle(node, styleTuple) {
+  var prop = styleTuple[0];
+  var value = styleTuple[1];
+  node.style[prop] = value;
+}
+
+function concatWithSpace(a,b) {
+  if (!a) return b;
+  if (!b) return a;
+  return a + ' ' + b;
+}
+
+var $$rAFSchedulerFactory = ['$$rAF', function($$rAF) {
+  var queue, cancelFn;
+
+  function scheduler(tasks) {
+    // we make a copy since RAFScheduler mutates the state
+    // of the passed in array variable and this would be difficult
+    // to track down on the outside code
+    queue = queue.concat(tasks);
+    nextTick();
+  }
+
+  queue = scheduler.queue = [];
+
+  /* waitUntilQuiet does two things:
+   * 1. It will run the FINAL `fn` value only when an uncanceled RAF has passed through
+   * 2. It will delay the next wave of tasks from running until the quiet `fn` has run.
+   *
+   * The motivation here is that animation code can request more time from the scheduler
+   * before the next wave runs. This allows for certain DOM properties such as classes to
+   * be resolved in time for the next animation to run.
+   */
+  scheduler.waitUntilQuiet = function(fn) {
+    if (cancelFn) cancelFn();
+
+    cancelFn = $$rAF(function() {
+      cancelFn = null;
+      fn();
+      nextTick();
+    });
+  };
+
+  return scheduler;
+
+  function nextTick() {
+    if (!queue.length) return;
+
+    var items = queue.shift();
+    for (var i = 0; i < items.length; i++) {
+      items[i]();
+    }
+
+    if (!cancelFn) {
+      $$rAF(function() {
+        if (!cancelFn) nextTick();
+      });
+    }
+  }
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngAnimateChildren
+ * @restrict AE
+ * @element ANY
+ *
+ * @description
+ *
+ * ngAnimateChildren allows you to specify that children of this element should animate even if any
+ * of the children's parents are currently animating. By default, when an element has an active `enter`, `leave`, or `move`
+ * (structural) animation, child elements that also have an active structural animation are not animated.
+ *
+ * Note that even if `ngAnimteChildren` is set, no child animations will run when the parent element is removed from the DOM (`leave` animation).
+ *
+ *
+ * @param {string} ngAnimateChildren If the value is empty, `true` or `on`,
+ *     then child animations are allowed. If the value is `false`, child animations are not allowed.
+ *
+ * @example
+ * <example module="ngAnimateChildren" name="ngAnimateChildren" deps="angular-animate.js" animations="true">
+     <file name="index.html">
+       <div ng-controller="mainController as main">
+         <label>Show container? <input type="checkbox" ng-model="main.enterElement" /></label>
+         <label>Animate children? <input type="checkbox" ng-model="main.animateChildren" /></label>
+         <hr>
+         <div ng-animate-children="{{main.animateChildren}}">
+           <div ng-if="main.enterElement" class="container">
+             List of items:
+             <div ng-repeat="item in [0, 1, 2, 3]" class="item">Item {{item}}</div>
+           </div>
+         </div>
+       </div>
+     </file>
+     <file name="animations.css">
+
+      .container.ng-enter,
+      .container.ng-leave {
+        transition: all ease 1.5s;
+      }
+
+      .container.ng-enter,
+      .container.ng-leave-active {
+        opacity: 0;
+      }
+
+      .container.ng-leave,
+      .container.ng-enter-active {
+        opacity: 1;
+      }
+
+      .item {
+        background: firebrick;
+        color: #FFF;
+        margin-bottom: 10px;
+      }
+
+      .item.ng-enter,
+      .item.ng-leave {
+        transition: transform 1.5s ease;
+      }
+
+      .item.ng-enter {
+        transform: translateX(50px);
+      }
+
+      .item.ng-enter-active {
+        transform: translateX(0);
+      }
+    </file>
+    <file name="script.js">
+      angular.module('ngAnimateChildren', ['ngAnimate'])
+        .controller('mainController', function() {
+          this.animateChildren = false;
+          this.enterElement = false;
+        });
+    </file>
+  </example>
+ */
+var $$AnimateChildrenDirective = ['$interpolate', function($interpolate) {
+  return {
+    link: function(scope, element, attrs) {
+      var val = attrs.ngAnimateChildren;
+      if (isString(val) && val.length === 0) { //empty attribute
+        element.data(NG_ANIMATE_CHILDREN_DATA, true);
+      } else {
+        // Interpolate and set the value, so that it is available to
+        // animations that run right after compilation
+        setData($interpolate(val)(scope));
+        attrs.$observe('ngAnimateChildren', setData);
+      }
+
+      function setData(value) {
+        value = value === 'on' || value === 'true';
+        element.data(NG_ANIMATE_CHILDREN_DATA, value);
+      }
+    }
+  };
+}];
+
+var ANIMATE_TIMER_KEY = '$$animateCss';
+
+/**
+ * @ngdoc service
+ * @name $animateCss
+ * @kind object
+ *
+ * @description
+ * The `$animateCss` service is a useful utility to trigger customized CSS-based transitions/keyframes
+ * from a JavaScript-based animation or directly from a directive. The purpose of `$animateCss` is NOT
+ * to side-step how `$animate` and ngAnimate work, but the goal is to allow pre-existing animations or
+ * directives to create more complex animations that can be purely driven using CSS code.
+ *
+ * Note that only browsers that support CSS transitions and/or keyframe animations are capable of
+ * rendering animations triggered via `$animateCss` (bad news for IE9 and lower).
+ *
+ * ## Usage
+ * Once again, `$animateCss` is designed to be used inside of a registered JavaScript animation that
+ * is powered by ngAnimate. It is possible to use `$animateCss` directly inside of a directive, however,
+ * any automatic control over cancelling animations and/or preventing animations from being run on
+ * child elements will not be handled by Angular. For this to work as expected, please use `$animate` to
+ * trigger the animation and then setup a JavaScript animation that injects `$animateCss` to trigger
+ * the CSS animation.
+ *
+ * The example below shows how we can create a folding animation on an element using `ng-if`:
+ *
+ * ```html
+ * <!-- notice the `fold-animation` CSS class -->
+ * <div ng-if="onOff" class="fold-animation">
+ *   This element will go BOOM
+ * </div>
+ * <button ng-click="onOff=true">Fold In</button>
+ * ```
+ *
+ * Now we create the **JavaScript animation** that will trigger the CSS transition:
+ *
+ * ```js
+ * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) {
+ *   return {
+ *     enter: function(element, doneFn) {
+ *       var height = element[0].offsetHeight;
+ *       return $animateCss(element, {
+ *         from: { height:'0px' },
+ *         to: { height:height + 'px' },
+ *         duration: 1 // one second
+ *       });
+ *     }
+ *   }
+ * }]);
+ * ```
+ *
+ * ## More Advanced Uses
+ *
+ * `$animateCss` is the underlying code that ngAnimate uses to power **CSS-based animations** behind the scenes. Therefore CSS hooks
+ * like `.ng-EVENT`, `.ng-EVENT-active`, `.ng-EVENT-stagger` are all features that can be triggered using `$animateCss` via JavaScript code.
+ *
+ * This also means that just about any combination of adding classes, removing classes, setting styles, dynamically setting a keyframe animation,
+ * applying a hardcoded duration or delay value, changing the animation easing or applying a stagger animation are all options that work with
+ * `$animateCss`. The service itself is smart enough to figure out the combination of options and examine the element styling properties in order
+ * to provide a working animation that will run in CSS.
+ *
+ * The example below showcases a more advanced version of the `.fold-animation` from the example above:
+ *
+ * ```js
+ * ngModule.animation('.fold-animation', ['$animateCss', function($animateCss) {
+ *   return {
+ *     enter: function(element, doneFn) {
+ *       var height = element[0].offsetHeight;
+ *       return $animateCss(element, {
+ *         addClass: 'red large-text pulse-twice',
+ *         easing: 'ease-out',
+ *         from: { height:'0px' },
+ *         to: { height:height + 'px' },
+ *         duration: 1 // one second
+ *       });
+ *     }
+ *   }
+ * }]);
+ * ```
+ *
+ * Since we're adding/removing CSS classes then the CSS transition will also pick those up:
+ *
+ * ```css
+ * /&#42; since a hardcoded duration value of 1 was provided in the JavaScript animation code,
+ * the CSS classes below will be transitioned despite them being defined as regular CSS classes &#42;/
+ * .red { background:red; }
+ * .large-text { font-size:20px; }
+ *
+ * /&#42; we can also use a keyframe animation and $animateCss will make it work alongside the transition &#42;/
+ * .pulse-twice {
+ *   animation: 0.5s pulse linear 2;
+ *   -webkit-animation: 0.5s pulse linear 2;
+ * }
+ *
+ * @keyframes pulse {
+ *   from { transform: scale(0.5); }
+ *   to { transform: scale(1.5); }
+ * }
+ *
+ * @-webkit-keyframes pulse {
+ *   from { -webkit-transform: scale(0.5); }
+ *   to { -webkit-transform: scale(1.5); }
+ * }
+ * ```
+ *
+ * Given this complex combination of CSS classes, styles and options, `$animateCss` will figure everything out and make the animation happen.
+ *
+ * ## How the Options are handled
+ *
+ * `$animateCss` is very versatile and intelligent when it comes to figuring out what configurations to apply to the element to ensure the animation
+ * works with the options provided. Say for example we were adding a class that contained a keyframe value and we wanted to also animate some inline
+ * styles using the `from` and `to` properties.
+ *
+ * ```js
+ * var animator = $animateCss(element, {
+ *   from: { background:'red' },
+ *   to: { background:'blue' }
+ * });
+ * animator.start();
+ * ```
+ *
+ * ```css
+ * .rotating-animation {
+ *   animation:0.5s rotate linear;
+ *   -webkit-animation:0.5s rotate linear;
+ * }
+ *
+ * @keyframes rotate {
+ *   from { transform: rotate(0deg); }
+ *   to { transform: rotate(360deg); }
+ * }
+ *
+ * @-webkit-keyframes rotate {
+ *   from { -webkit-transform: rotate(0deg); }
+ *   to { -webkit-transform: rotate(360deg); }
+ * }
+ * ```
+ *
+ * The missing pieces here are that we do not have a transition set (within the CSS code nor within the `$animateCss` options) and the duration of the animation is
+ * going to be detected from what the keyframe styles on the CSS class are. In this event, `$animateCss` will automatically create an inline transition
+ * style matching the duration detected from the keyframe style (which is present in the CSS class that is being added) and then prepare both the transition
+ * and keyframe animations to run in parallel on the element. Then when the animation is underway the provided `from` and `to` CSS styles will be applied
+ * and spread across the transition and keyframe animation.
+ *
+ * ## What is returned
+ *
+ * `$animateCss` works in two stages: a preparation phase and an animation phase. Therefore when `$animateCss` is first called it will NOT actually
+ * start the animation. All that is going on here is that the element is being prepared for the animation (which means that the generated CSS classes are
+ * added and removed on the element). Once `$animateCss` is called it will return an object with the following properties:
+ *
+ * ```js
+ * var animator = $animateCss(element, { ... });
+ * ```
+ *
+ * Now what do the contents of our `animator` variable look like:
+ *
+ * ```js
+ * {
+ *   // starts the animation
+ *   start: Function,
+ *
+ *   // ends (aborts) the animation
+ *   end: Function
+ * }
+ * ```
+ *
+ * To actually start the animation we need to run `animation.start()` which will then return a promise that we can hook into to detect when the animation ends.
+ * If we choose not to run the animation then we MUST run `animation.end()` to perform a cleanup on the element (since some CSS classes and styles may have been
+ * applied to the element during the preparation phase). Note that all other properties such as duration, delay, transitions and keyframes are just properties
+ * and that changing them will not reconfigure the parameters of the animation.
+ *
+ * ### runner.done() vs runner.then()
+ * It is documented that `animation.start()` will return a promise object and this is true, however, there is also an additional method available on the
+ * runner called `.done(callbackFn)`. The done method works the same as `.finally(callbackFn)`, however, it does **not trigger a digest to occur**.
+ * Therefore, for performance reasons, it's always best to use `runner.done(callback)` instead of `runner.then()`, `runner.catch()` or `runner.finally()`
+ * unless you really need a digest to kick off afterwards.
+ *
+ * Keep in mind that, to make this easier, ngAnimate has tweaked the JS animations API to recognize when a runner instance is returned from $animateCss
+ * (so there is no need to call `runner.done(doneFn)` inside of your JavaScript animation code).
+ * Check the {@link ngAnimate.$animateCss#usage animation code above} to see how this works.
+ *
+ * @param {DOMElement} element the element that will be animated
+ * @param {object} options the animation-related options that will be applied during the animation
+ *
+ * * `event` - The DOM event (e.g. enter, leave, move). When used, a generated CSS class of `ng-EVENT` and `ng-EVENT-active` will be applied
+ * to the element during the animation. Multiple events can be provided when spaces are used as a separator. (Note that this will not perform any DOM operation.)
+ * * `structural` - Indicates that the `ng-` prefix will be added to the event class. Setting to `false` or omitting will turn `ng-EVENT` and
+ * `ng-EVENT-active` in `EVENT` and `EVENT-active`. Unused if `event` is omitted.
+ * * `easing` - The CSS easing value that will be applied to the transition or keyframe animation (or both).
+ * * `transitionStyle` - The raw CSS transition style that will be used (e.g. `1s linear all`).
+ * * `keyframeStyle` - The raw CSS keyframe animation style that will be used (e.g. `1s my_animation linear`).
+ * * `from` - The starting CSS styles (a key/value object) that will be applied at the start of the animation.
+ * * `to` - The ending CSS styles (a key/value object) that will be applied across the animation via a CSS transition.
+ * * `addClass` - A space separated list of CSS classes that will be added to the element and spread across the animation.
+ * * `removeClass` - A space separated list of CSS classes that will be removed from the element and spread across the animation.
+ * * `duration` - A number value representing the total duration of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `0`
+ * is provided then the animation will be skipped entirely.
+ * * `delay` - A number value representing the total delay of the transition and/or keyframe (note that a value of 1 is 1000ms). If a value of `true` is
+ * used then whatever delay value is detected from the CSS classes will be mirrored on the elements styles (e.g. by setting delay true then the style value
+ * of the element will be `transition-delay: DETECTED_VALUE`). Using `true` is useful when you want the CSS classes and inline styles to all share the same
+ * CSS delay value.
+ * * `stagger` - A numeric time value representing the delay between successively animated elements
+ * ({@link ngAnimate#css-staggering-animations Click here to learn how CSS-based staggering works in ngAnimate.})
+ * * `staggerIndex` - The numeric index representing the stagger item (e.g. a value of 5 is equal to the sixth item in the stagger; therefore when a
+ *   `stagger` option value of `0.1` is used then there will be a stagger delay of `600ms`)
+ * * `applyClassesEarly` - Whether or not the classes being added or removed will be used when detecting the animation. This is set by `$animate` when enter/leave/move animations are fired to ensure that the CSS classes are resolved in time. (Note that this will prevent any transitions from occurring on the classes being added and removed.)
+ * * `cleanupStyles` - Whether or not the provided `from` and `to` styles will be removed once
+ *    the animation is closed. This is useful for when the styles are used purely for the sake of
+ *    the animation and do not have a lasting visual effect on the element (e.g. a collapse and open animation).
+ *    By default this value is set to `false`.
+ *
+ * @return {object} an object with start and end methods and details about the animation.
+ *
+ * * `start` - The method to start the animation. This will return a `Promise` when called.
+ * * `end` - This method will cancel the animation and remove all applied CSS classes and styles.
+ */
+var ONE_SECOND = 1000;
+var BASE_TEN = 10;
+
+var ELAPSED_TIME_MAX_DECIMAL_PLACES = 3;
+var CLOSING_TIME_BUFFER = 1.5;
+
+var DETECT_CSS_PROPERTIES = {
+  transitionDuration:      TRANSITION_DURATION_PROP,
+  transitionDelay:         TRANSITION_DELAY_PROP,
+  transitionProperty:      TRANSITION_PROP + PROPERTY_KEY,
+  animationDuration:       ANIMATION_DURATION_PROP,
+  animationDelay:          ANIMATION_DELAY_PROP,
+  animationIterationCount: ANIMATION_PROP + ANIMATION_ITERATION_COUNT_KEY
+};
+
+var DETECT_STAGGER_CSS_PROPERTIES = {
+  transitionDuration:      TRANSITION_DURATION_PROP,
+  transitionDelay:         TRANSITION_DELAY_PROP,
+  animationDuration:       ANIMATION_DURATION_PROP,
+  animationDelay:          ANIMATION_DELAY_PROP
+};
+
+function getCssKeyframeDurationStyle(duration) {
+  return [ANIMATION_DURATION_PROP, duration + 's'];
+}
+
+function getCssDelayStyle(delay, isKeyframeAnimation) {
+  var prop = isKeyframeAnimation ? ANIMATION_DELAY_PROP : TRANSITION_DELAY_PROP;
+  return [prop, delay + 's'];
+}
+
+function computeCssStyles($window, element, properties) {
+  var styles = Object.create(null);
+  var detectedStyles = $window.getComputedStyle(element) || {};
+  forEach(properties, function(formalStyleName, actualStyleName) {
+    var val = detectedStyles[formalStyleName];
+    if (val) {
+      var c = val.charAt(0);
+
+      // only numerical-based values have a negative sign or digit as the first value
+      if (c === '-' || c === '+' || c >= 0) {
+        val = parseMaxTime(val);
+      }
+
+      // by setting this to null in the event that the delay is not set or is set directly as 0
+      // then we can still allow for negative values to be used later on and not mistake this
+      // value for being greater than any other negative value.
+      if (val === 0) {
+        val = null;
+      }
+      styles[actualStyleName] = val;
+    }
+  });
+
+  return styles;
+}
+
+function parseMaxTime(str) {
+  var maxValue = 0;
+  var values = str.split(/\s*,\s*/);
+  forEach(values, function(value) {
+    // it's always safe to consider only second values and omit `ms` values since
+    // getComputedStyle will always handle the conversion for us
+    if (value.charAt(value.length - 1) == 's') {
+      value = value.substring(0, value.length - 1);
+    }
+    value = parseFloat(value) || 0;
+    maxValue = maxValue ? Math.max(value, maxValue) : value;
+  });
+  return maxValue;
+}
+
+function truthyTimingValue(val) {
+  return val === 0 || val != null;
+}
+
+function getCssTransitionDurationStyle(duration, applyOnlyDuration) {
+  var style = TRANSITION_PROP;
+  var value = duration + 's';
+  if (applyOnlyDuration) {
+    style += DURATION_KEY;
+  } else {
+    value += ' linear all';
+  }
+  return [style, value];
+}
+
+function createLocalCacheLookup() {
+  var cache = Object.create(null);
+  return {
+    flush: function() {
+      cache = Object.create(null);
+    },
+
+    count: function(key) {
+      var entry = cache[key];
+      return entry ? entry.total : 0;
+    },
+
+    get: function(key) {
+      var entry = cache[key];
+      return entry && entry.value;
+    },
+
+    put: function(key, value) {
+      if (!cache[key]) {
+        cache[key] = { total: 1, value: value };
+      } else {
+        cache[key].total++;
+      }
+    }
+  };
+}
+
+// we do not reassign an already present style value since
+// if we detect the style property value again we may be
+// detecting styles that were added via the `from` styles.
+// We make use of `isDefined` here since an empty string
+// or null value (which is what getPropertyValue will return
+// for a non-existing style) will still be marked as a valid
+// value for the style (a falsy value implies that the style
+// is to be removed at the end of the animation). If we had a simple
+// "OR" statement then it would not be enough to catch that.
+function registerRestorableStyles(backup, node, properties) {
+  forEach(properties, function(prop) {
+    backup[prop] = isDefined(backup[prop])
+        ? backup[prop]
+        : node.style.getPropertyValue(prop);
+  });
+}
+
+var $AnimateCssProvider = ['$animateProvider', function($animateProvider) {
+  var gcsLookup = createLocalCacheLookup();
+  var gcsStaggerLookup = createLocalCacheLookup();
+
+  this.$get = ['$window', '$$jqLite', '$$AnimateRunner', '$timeout',
+               '$$forceReflow', '$sniffer', '$$rAFScheduler', '$$animateQueue',
+       function($window,   $$jqLite,   $$AnimateRunner,   $timeout,
+                $$forceReflow,   $sniffer,   $$rAFScheduler, $$animateQueue) {
+
+    var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);
+
+    var parentCounter = 0;
+    function gcsHashFn(node, extraClasses) {
+      var KEY = "$$ngAnimateParentKey";
+      var parentNode = node.parentNode;
+      var parentID = parentNode[KEY] || (parentNode[KEY] = ++parentCounter);
+      return parentID + '-' + node.getAttribute('class') + '-' + extraClasses;
+    }
+
+    function computeCachedCssStyles(node, className, cacheKey, properties) {
+      var timings = gcsLookup.get(cacheKey);
+
+      if (!timings) {
+        timings = computeCssStyles($window, node, properties);
+        if (timings.animationIterationCount === 'infinite') {
+          timings.animationIterationCount = 1;
+        }
+      }
+
+      // we keep putting this in multiple times even though the value and the cacheKey are the same
+      // because we're keeping an internal tally of how many duplicate animations are detected.
+      gcsLookup.put(cacheKey, timings);
+      return timings;
+    }
+
+    function computeCachedCssStaggerStyles(node, className, cacheKey, properties) {
+      var stagger;
+
+      // if we have one or more existing matches of matching elements
+      // containing the same parent + CSS styles (which is how cacheKey works)
+      // then staggering is possible
+      if (gcsLookup.count(cacheKey) > 0) {
+        stagger = gcsStaggerLookup.get(cacheKey);
+
+        if (!stagger) {
+          var staggerClassName = pendClasses(className, '-stagger');
+
+          $$jqLite.addClass(node, staggerClassName);
+
+          stagger = computeCssStyles($window, node, properties);
+
+          // force the conversion of a null value to zero incase not set
+          stagger.animationDuration = Math.max(stagger.animationDuration, 0);
+          stagger.transitionDuration = Math.max(stagger.transitionDuration, 0);
+
+          $$jqLite.removeClass(node, staggerClassName);
+
+          gcsStaggerLookup.put(cacheKey, stagger);
+        }
+      }
+
+      return stagger || {};
+    }
+
+    var cancelLastRAFRequest;
+    var rafWaitQueue = [];
+    function waitUntilQuiet(callback) {
+      rafWaitQueue.push(callback);
+      $$rAFScheduler.waitUntilQuiet(function() {
+        gcsLookup.flush();
+        gcsStaggerLookup.flush();
+
+        // DO NOT REMOVE THIS LINE OR REFACTOR OUT THE `pageWidth` variable.
+        // PLEASE EXAMINE THE `$$forceReflow` service to understand why.
+        var pageWidth = $$forceReflow();
+
+        // we use a for loop to ensure that if the queue is changed
+        // during this looping then it will consider new requests
+        for (var i = 0; i < rafWaitQueue.length; i++) {
+          rafWaitQueue[i](pageWidth);
+        }
+        rafWaitQueue.length = 0;
+      });
+    }
+
+    function computeTimings(node, className, cacheKey) {
+      var timings = computeCachedCssStyles(node, className, cacheKey, DETECT_CSS_PROPERTIES);
+      var aD = timings.animationDelay;
+      var tD = timings.transitionDelay;
+      timings.maxDelay = aD && tD
+          ? Math.max(aD, tD)
+          : (aD || tD);
+      timings.maxDuration = Math.max(
+          timings.animationDuration * timings.animationIterationCount,
+          timings.transitionDuration);
+
+      return timings;
+    }
+
+    return function init(element, initialOptions) {
+      // all of the animation functions should create
+      // a copy of the options data, however, if a
+      // parent service has already created a copy then
+      // we should stick to using that
+      var options = initialOptions || {};
+      if (!options.$$prepared) {
+        options = prepareAnimationOptions(copy(options));
+      }
+
+      var restoreStyles = {};
+      var node = getDomNode(element);
+      if (!node
+          || !node.parentNode
+          || !$$animateQueue.enabled()) {
+        return closeAndReturnNoopAnimator();
+      }
+
+      var temporaryStyles = [];
+      var classes = element.attr('class');
+      var styles = packageStyles(options);
+      var animationClosed;
+      var animationPaused;
+      var animationCompleted;
+      var runner;
+      var runnerHost;
+      var maxDelay;
+      var maxDelayTime;
+      var maxDuration;
+      var maxDurationTime;
+      var startTime;
+      var events = [];
+
+      if (options.duration === 0 || (!$sniffer.animations && !$sniffer.transitions)) {
+        return closeAndReturnNoopAnimator();
+      }
+
+      var method = options.event && isArray(options.event)
+            ? options.event.join(' ')
+            : options.event;
+
+      var isStructural = method && options.structural;
+      var structuralClassName = '';
+      var addRemoveClassName = '';
+
+      if (isStructural) {
+        structuralClassName = pendClasses(method, EVENT_CLASS_PREFIX, true);
+      } else if (method) {
+        structuralClassName = method;
+      }
+
+      if (options.addClass) {
+        addRemoveClassName += pendClasses(options.addClass, ADD_CLASS_SUFFIX);
+      }
+
+      if (options.removeClass) {
+        if (addRemoveClassName.length) {
+          addRemoveClassName += ' ';
+        }
+        addRemoveClassName += pendClasses(options.removeClass, REMOVE_CLASS_SUFFIX);
+      }
+
+      // there may be a situation where a structural animation is combined together
+      // with CSS classes that need to resolve before the animation is computed.
+      // However this means that there is no explicit CSS code to block the animation
+      // from happening (by setting 0s none in the class name). If this is the case
+      // we need to apply the classes before the first rAF so we know to continue if
+      // there actually is a detected transition or keyframe animation
+      if (options.applyClassesEarly && addRemoveClassName.length) {
+        applyAnimationClasses(element, options);
+      }
+
+      var preparationClasses = [structuralClassName, addRemoveClassName].join(' ').trim();
+      var fullClassName = classes + ' ' + preparationClasses;
+      var activeClasses = pendClasses(preparationClasses, ACTIVE_CLASS_SUFFIX);
+      var hasToStyles = styles.to && Object.keys(styles.to).length > 0;
+      var containsKeyframeAnimation = (options.keyframeStyle || '').length > 0;
+
+      // there is no way we can trigger an animation if no styles and
+      // no classes are being applied which would then trigger a transition,
+      // unless there a is raw keyframe value that is applied to the element.
+      if (!containsKeyframeAnimation
+           && !hasToStyles
+           && !preparationClasses) {
+        return closeAndReturnNoopAnimator();
+      }
+
+      var cacheKey, stagger;
+      if (options.stagger > 0) {
+        var staggerVal = parseFloat(options.stagger);
+        stagger = {
+          transitionDelay: staggerVal,
+          animationDelay: staggerVal,
+          transitionDuration: 0,
+          animationDuration: 0
+        };
+      } else {
+        cacheKey = gcsHashFn(node, fullClassName);
+        stagger = computeCachedCssStaggerStyles(node, preparationClasses, cacheKey, DETECT_STAGGER_CSS_PROPERTIES);
+      }
+
+      if (!options.$$skipPreparationClasses) {
+        $$jqLite.addClass(element, preparationClasses);
+      }
+
+      var applyOnlyDuration;
+
+      if (options.transitionStyle) {
+        var transitionStyle = [TRANSITION_PROP, options.transitionStyle];
+        applyInlineStyle(node, transitionStyle);
+        temporaryStyles.push(transitionStyle);
+      }
+
+      if (options.duration >= 0) {
+        applyOnlyDuration = node.style[TRANSITION_PROP].length > 0;
+        var durationStyle = getCssTransitionDurationStyle(options.duration, applyOnlyDuration);
+
+        // we set the duration so that it will be picked up by getComputedStyle later
+        applyInlineStyle(node, durationStyle);
+        temporaryStyles.push(durationStyle);
+      }
+
+      if (options.keyframeStyle) {
+        var keyframeStyle = [ANIMATION_PROP, options.keyframeStyle];
+        applyInlineStyle(node, keyframeStyle);
+        temporaryStyles.push(keyframeStyle);
+      }
+
+      var itemIndex = stagger
+          ? options.staggerIndex >= 0
+              ? options.staggerIndex
+              : gcsLookup.count(cacheKey)
+          : 0;
+
+      var isFirst = itemIndex === 0;
+
+      // this is a pre-emptive way of forcing the setup classes to be added and applied INSTANTLY
+      // without causing any combination of transitions to kick in. By adding a negative delay value
+      // it forces the setup class' transition to end immediately. We later then remove the negative
+      // transition delay to allow for the transition to naturally do it's thing. The beauty here is
+      // that if there is no transition defined then nothing will happen and this will also allow
+      // other transitions to be stacked on top of each other without any chopping them out.
+      if (isFirst && !options.skipBlocking) {
+        blockTransitions(node, SAFE_FAST_FORWARD_DURATION_VALUE);
+      }
+
+      var timings = computeTimings(node, fullClassName, cacheKey);
+      var relativeDelay = timings.maxDelay;
+      maxDelay = Math.max(relativeDelay, 0);
+      maxDuration = timings.maxDuration;
+
+      var flags = {};
+      flags.hasTransitions          = timings.transitionDuration > 0;
+      flags.hasAnimations           = timings.animationDuration > 0;
+      flags.hasTransitionAll        = flags.hasTransitions && timings.transitionProperty == 'all';
+      flags.applyTransitionDuration = hasToStyles && (
+                                        (flags.hasTransitions && !flags.hasTransitionAll)
+                                         || (flags.hasAnimations && !flags.hasTransitions));
+      flags.applyAnimationDuration  = options.duration && flags.hasAnimations;
+      flags.applyTransitionDelay    = truthyTimingValue(options.delay) && (flags.applyTransitionDuration || flags.hasTransitions);
+      flags.applyAnimationDelay     = truthyTimingValue(options.delay) && flags.hasAnimations;
+      flags.recalculateTimingStyles = addRemoveClassName.length > 0;
+
+      if (flags.applyTransitionDuration || flags.applyAnimationDuration) {
+        maxDuration = options.duration ? parseFloat(options.duration) : maxDuration;
+
+        if (flags.applyTransitionDuration) {
+          flags.hasTransitions = true;
+          timings.transitionDuration = maxDuration;
+          applyOnlyDuration = node.style[TRANSITION_PROP + PROPERTY_KEY].length > 0;
+          temporaryStyles.push(getCssTransitionDurationStyle(maxDuration, applyOnlyDuration));
+        }
+
+        if (flags.applyAnimationDuration) {
+          flags.hasAnimations = true;
+          timings.animationDuration = maxDuration;
+          temporaryStyles.push(getCssKeyframeDurationStyle(maxDuration));
+        }
+      }
+
+      if (maxDuration === 0 && !flags.recalculateTimingStyles) {
+        return closeAndReturnNoopAnimator();
+      }
+
+      if (options.delay != null) {
+        var delayStyle;
+        if (typeof options.delay !== "boolean") {
+          delayStyle = parseFloat(options.delay);
+          // number in options.delay means we have to recalculate the delay for the closing timeout
+          maxDelay = Math.max(delayStyle, 0);
+        }
+
+        if (flags.applyTransitionDelay) {
+          temporaryStyles.push(getCssDelayStyle(delayStyle));
+        }
+
+        if (flags.applyAnimationDelay) {
+          temporaryStyles.push(getCssDelayStyle(delayStyle, true));
+        }
+      }
+
+      // we need to recalculate the delay value since we used a pre-emptive negative
+      // delay value and the delay value is required for the final event checking. This
+      // property will ensure that this will happen after the RAF phase has passed.
+      if (options.duration == null && timings.transitionDuration > 0) {
+        flags.recalculateTimingStyles = flags.recalculateTimingStyles || isFirst;
+      }
+
+      maxDelayTime = maxDelay * ONE_SECOND;
+      maxDurationTime = maxDuration * ONE_SECOND;
+      if (!options.skipBlocking) {
+        flags.blockTransition = timings.transitionDuration > 0;
+        flags.blockKeyframeAnimation = timings.animationDuration > 0 &&
+                                       stagger.animationDelay > 0 &&
+                                       stagger.animationDuration === 0;
+      }
+
+      if (options.from) {
+        if (options.cleanupStyles) {
+          registerRestorableStyles(restoreStyles, node, Object.keys(options.from));
+        }
+        applyAnimationFromStyles(element, options);
+      }
+
+      if (flags.blockTransition || flags.blockKeyframeAnimation) {
+        applyBlocking(maxDuration);
+      } else if (!options.skipBlocking) {
+        blockTransitions(node, false);
+      }
+
+      // TODO(matsko): for 1.5 change this code to have an animator object for better debugging
+      return {
+        $$willAnimate: true,
+        end: endFn,
+        start: function() {
+          if (animationClosed) return;
+
+          runnerHost = {
+            end: endFn,
+            cancel: cancelFn,
+            resume: null, //this will be set during the start() phase
+            pause: null
+          };
+
+          runner = new $$AnimateRunner(runnerHost);
+
+          waitUntilQuiet(start);
+
+          // we don't have access to pause/resume the animation
+          // since it hasn't run yet. AnimateRunner will therefore
+          // set noop functions for resume and pause and they will
+          // later be overridden once the animation is triggered
+          return runner;
+        }
+      };
+
+      function endFn() {
+        close();
+      }
+
+      function cancelFn() {
+        close(true);
+      }
+
+      function close(rejected) { // jshint ignore:line
+        // if the promise has been called already then we shouldn't close
+        // the animation again
+        if (animationClosed || (animationCompleted && animationPaused)) return;
+        animationClosed = true;
+        animationPaused = false;
+
+        if (!options.$$skipPreparationClasses) {
+          $$jqLite.removeClass(element, preparationClasses);
+        }
+        $$jqLite.removeClass(element, activeClasses);
+
+        blockKeyframeAnimations(node, false);
+        blockTransitions(node, false);
+
+        forEach(temporaryStyles, function(entry) {
+          // There is only one way to remove inline style properties entirely from elements.
+          // By using `removeProperty` this works, but we need to convert camel-cased CSS
+          // styles down to hyphenated values.
+          node.style[entry[0]] = '';
+        });
+
+        applyAnimationClasses(element, options);
+        applyAnimationStyles(element, options);
+
+        if (Object.keys(restoreStyles).length) {
+          forEach(restoreStyles, function(value, prop) {
+            value ? node.style.setProperty(prop, value)
+                  : node.style.removeProperty(prop);
+          });
+        }
+
+        // the reason why we have this option is to allow a synchronous closing callback
+        // that is fired as SOON as the animation ends (when the CSS is removed) or if
+        // the animation never takes off at all. A good example is a leave animation since
+        // the element must be removed just after the animation is over or else the element
+        // will appear on screen for one animation frame causing an overbearing flicker.
+        if (options.onDone) {
+          options.onDone();
+        }
+
+        if (events && events.length) {
+          // Remove the transitionend / animationend listener(s)
+          element.off(events.join(' '), onAnimationProgress);
+        }
+
+        //Cancel the fallback closing timeout and remove the timer data
+        var animationTimerData = element.data(ANIMATE_TIMER_KEY);
+        if (animationTimerData) {
+          $timeout.cancel(animationTimerData[0].timer);
+          element.removeData(ANIMATE_TIMER_KEY);
+        }
+
+        // if the preparation function fails then the promise is not setup
+        if (runner) {
+          runner.complete(!rejected);
+        }
+      }
+
+      function applyBlocking(duration) {
+        if (flags.blockTransition) {
+          blockTransitions(node, duration);
+        }
+
+        if (flags.blockKeyframeAnimation) {
+          blockKeyframeAnimations(node, !!duration);
+        }
+      }
+
+      function closeAndReturnNoopAnimator() {
+        runner = new $$AnimateRunner({
+          end: endFn,
+          cancel: cancelFn
+        });
+
+        // should flush the cache animation
+        waitUntilQuiet(noop);
+        close();
+
+        return {
+          $$willAnimate: false,
+          start: function() {
+            return runner;
+          },
+          end: endFn
+        };
+      }
+
+      function onAnimationProgress(event) {
+        event.stopPropagation();
+        var ev = event.originalEvent || event;
+
+        // we now always use `Date.now()` due to the recent changes with
+        // event.timeStamp in Firefox, Webkit and Chrome (see #13494 for more info)
+        var timeStamp = ev.$manualTimeStamp || Date.now();
+
+        /* Firefox (or possibly just Gecko) likes to not round values up
+         * when a ms measurement is used for the animation */
+        var elapsedTime = parseFloat(ev.elapsedTime.toFixed(ELAPSED_TIME_MAX_DECIMAL_PLACES));
+
+        /* $manualTimeStamp is a mocked timeStamp value which is set
+         * within browserTrigger(). This is only here so that tests can
+         * mock animations properly. Real events fallback to event.timeStamp,
+         * or, if they don't, then a timeStamp is automatically created for them.
+         * We're checking to see if the timeStamp surpasses the expected delay,
+         * but we're using elapsedTime instead of the timeStamp on the 2nd
+         * pre-condition since animationPauseds sometimes close off early */
+        if (Math.max(timeStamp - startTime, 0) >= maxDelayTime && elapsedTime >= maxDuration) {
+          // we set this flag to ensure that if the transition is paused then, when resumed,
+          // the animation will automatically close itself since transitions cannot be paused.
+          animationCompleted = true;
+          close();
+        }
+      }
+
+      function start() {
+        if (animationClosed) return;
+        if (!node.parentNode) {
+          close();
+          return;
+        }
+
+        // even though we only pause keyframe animations here the pause flag
+        // will still happen when transitions are used. Only the transition will
+        // not be paused since that is not possible. If the animation ends when
+        // paused then it will not complete until unpaused or cancelled.
+        var playPause = function(playAnimation) {
+          if (!animationCompleted) {
+            animationPaused = !playAnimation;
+            if (timings.animationDuration) {
+              var value = blockKeyframeAnimations(node, animationPaused);
+              animationPaused
+                  ? temporaryStyles.push(value)
+                  : removeFromArray(temporaryStyles, value);
+            }
+          } else if (animationPaused && playAnimation) {
+            animationPaused = false;
+            close();
+          }
+        };
+
+        // checking the stagger duration prevents an accidentally cascade of the CSS delay style
+        // being inherited from the parent. If the transition duration is zero then we can safely
+        // rely that the delay value is an intentional stagger delay style.
+        var maxStagger = itemIndex > 0
+                         && ((timings.transitionDuration && stagger.transitionDuration === 0) ||
+                            (timings.animationDuration && stagger.animationDuration === 0))
+                         && Math.max(stagger.animationDelay, stagger.transitionDelay);
+        if (maxStagger) {
+          $timeout(triggerAnimationStart,
+                   Math.floor(maxStagger * itemIndex * ONE_SECOND),
+                   false);
+        } else {
+          triggerAnimationStart();
+        }
+
+        // this will decorate the existing promise runner with pause/resume methods
+        runnerHost.resume = function() {
+          playPause(true);
+        };
+
+        runnerHost.pause = function() {
+          playPause(false);
+        };
+
+        function triggerAnimationStart() {
+          // just incase a stagger animation kicks in when the animation
+          // itself was cancelled entirely
+          if (animationClosed) return;
+
+          applyBlocking(false);
+
+          forEach(temporaryStyles, function(entry) {
+            var key = entry[0];
+            var value = entry[1];
+            node.style[key] = value;
+          });
+
+          applyAnimationClasses(element, options);
+          $$jqLite.addClass(element, activeClasses);
+
+          if (flags.recalculateTimingStyles) {
+            fullClassName = node.className + ' ' + preparationClasses;
+            cacheKey = gcsHashFn(node, fullClassName);
+
+            timings = computeTimings(node, fullClassName, cacheKey);
+            relativeDelay = timings.maxDelay;
+            maxDelay = Math.max(relativeDelay, 0);
+            maxDuration = timings.maxDuration;
+
+            if (maxDuration === 0) {
+              close();
+              return;
+            }
+
+            flags.hasTransitions = timings.transitionDuration > 0;
+            flags.hasAnimations = timings.animationDuration > 0;
+          }
+
+          if (flags.applyAnimationDelay) {
+            relativeDelay = typeof options.delay !== "boolean" && truthyTimingValue(options.delay)
+                  ? parseFloat(options.delay)
+                  : relativeDelay;
+
+            maxDelay = Math.max(relativeDelay, 0);
+            timings.animationDelay = relativeDelay;
+            delayStyle = getCssDelayStyle(relativeDelay, true);
+            temporaryStyles.push(delayStyle);
+            node.style[delayStyle[0]] = delayStyle[1];
+          }
+
+          maxDelayTime = maxDelay * ONE_SECOND;
+          maxDurationTime = maxDuration * ONE_SECOND;
+
+          if (options.easing) {
+            var easeProp, easeVal = options.easing;
+            if (flags.hasTransitions) {
+              easeProp = TRANSITION_PROP + TIMING_KEY;
+              temporaryStyles.push([easeProp, easeVal]);
+              node.style[easeProp] = easeVal;
+            }
+            if (flags.hasAnimations) {
+              easeProp = ANIMATION_PROP + TIMING_KEY;
+              temporaryStyles.push([easeProp, easeVal]);
+              node.style[easeProp] = easeVal;
+            }
+          }
+
+          if (timings.transitionDuration) {
+            events.push(TRANSITIONEND_EVENT);
+          }
+
+          if (timings.animationDuration) {
+            events.push(ANIMATIONEND_EVENT);
+          }
+
+          startTime = Date.now();
+          var timerTime = maxDelayTime + CLOSING_TIME_BUFFER * maxDurationTime;
+          var endTime = startTime + timerTime;
+
+          var animationsData = element.data(ANIMATE_TIMER_KEY) || [];
+          var setupFallbackTimer = true;
+          if (animationsData.length) {
+            var currentTimerData = animationsData[0];
+            setupFallbackTimer = endTime > currentTimerData.expectedEndTime;
+            if (setupFallbackTimer) {
+              $timeout.cancel(currentTimerData.timer);
+            } else {
+              animationsData.push(close);
+            }
+          }
+
+          if (setupFallbackTimer) {
+            var timer = $timeout(onAnimationExpired, timerTime, false);
+            animationsData[0] = {
+              timer: timer,
+              expectedEndTime: endTime
+            };
+            animationsData.push(close);
+            element.data(ANIMATE_TIMER_KEY, animationsData);
+          }
+
+          if (events.length) {
+            element.on(events.join(' '), onAnimationProgress);
+          }
+
+          if (options.to) {
+            if (options.cleanupStyles) {
+              registerRestorableStyles(restoreStyles, node, Object.keys(options.to));
+            }
+            applyAnimationToStyles(element, options);
+          }
+        }
+
+        function onAnimationExpired() {
+          var animationsData = element.data(ANIMATE_TIMER_KEY);
+
+          // this will be false in the event that the element was
+          // removed from the DOM (via a leave animation or something
+          // similar)
+          if (animationsData) {
+            for (var i = 1; i < animationsData.length; i++) {
+              animationsData[i]();
+            }
+            element.removeData(ANIMATE_TIMER_KEY);
+          }
+        }
+      }
+    };
+  }];
+}];
+
+var $$AnimateCssDriverProvider = ['$$animationProvider', function($$animationProvider) {
+  $$animationProvider.drivers.push('$$animateCssDriver');
+
+  var NG_ANIMATE_SHIM_CLASS_NAME = 'ng-animate-shim';
+  var NG_ANIMATE_ANCHOR_CLASS_NAME = 'ng-anchor';
+
+  var NG_OUT_ANCHOR_CLASS_NAME = 'ng-anchor-out';
+  var NG_IN_ANCHOR_CLASS_NAME = 'ng-anchor-in';
+
+  function isDocumentFragment(node) {
+    return node.parentNode && node.parentNode.nodeType === 11;
+  }
+
+  this.$get = ['$animateCss', '$rootScope', '$$AnimateRunner', '$rootElement', '$sniffer', '$$jqLite', '$document',
+       function($animateCss,   $rootScope,   $$AnimateRunner,   $rootElement,   $sniffer,   $$jqLite,   $document) {
+
+    // only browsers that support these properties can render animations
+    if (!$sniffer.animations && !$sniffer.transitions) return noop;
+
+    var bodyNode = $document[0].body;
+    var rootNode = getDomNode($rootElement);
+
+    var rootBodyElement = jqLite(
+      // this is to avoid using something that exists outside of the body
+      // we also special case the doc fragment case because our unit test code
+      // appends the $rootElement to the body after the app has been bootstrapped
+      isDocumentFragment(rootNode) || bodyNode.contains(rootNode) ? rootNode : bodyNode
+    );
+
+    var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);
+
+    return function initDriverFn(animationDetails) {
+      return animationDetails.from && animationDetails.to
+          ? prepareFromToAnchorAnimation(animationDetails.from,
+                                         animationDetails.to,
+                                         animationDetails.classes,
+                                         animationDetails.anchors)
+          : prepareRegularAnimation(animationDetails);
+    };
+
+    function filterCssClasses(classes) {
+      //remove all the `ng-` stuff
+      return classes.replace(/\bng-\S+\b/g, '');
+    }
+
+    function getUniqueValues(a, b) {
+      if (isString(a)) a = a.split(' ');
+      if (isString(b)) b = b.split(' ');
+      return a.filter(function(val) {
+        return b.indexOf(val) === -1;
+      }).join(' ');
+    }
+
+    function prepareAnchoredAnimation(classes, outAnchor, inAnchor) {
+      var clone = jqLite(getDomNode(outAnchor).cloneNode(true));
+      var startingClasses = filterCssClasses(getClassVal(clone));
+
+      outAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME);
+      inAnchor.addClass(NG_ANIMATE_SHIM_CLASS_NAME);
+
+      clone.addClass(NG_ANIMATE_ANCHOR_CLASS_NAME);
+
+      rootBodyElement.append(clone);
+
+      var animatorIn, animatorOut = prepareOutAnimation();
+
+      // the user may not end up using the `out` animation and
+      // only making use of the `in` animation or vice-versa.
+      // In either case we should allow this and not assume the
+      // animation is over unless both animations are not used.
+      if (!animatorOut) {
+        animatorIn = prepareInAnimation();
+        if (!animatorIn) {
+          return end();
+        }
+      }
+
+      var startingAnimator = animatorOut || animatorIn;
+
+      return {
+        start: function() {
+          var runner;
+
+          var currentAnimation = startingAnimator.start();
+          currentAnimation.done(function() {
+            currentAnimation = null;
+            if (!animatorIn) {
+              animatorIn = prepareInAnimation();
+              if (animatorIn) {
+                currentAnimation = animatorIn.start();
+                currentAnimation.done(function() {
+                  currentAnimation = null;
+                  end();
+                  runner.complete();
+                });
+                return currentAnimation;
+              }
+            }
+            // in the event that there is no `in` animation
+            end();
+            runner.complete();
+          });
+
+          runner = new $$AnimateRunner({
+            end: endFn,
+            cancel: endFn
+          });
+
+          return runner;
+
+          function endFn() {
+            if (currentAnimation) {
+              currentAnimation.end();
+            }
+          }
+        }
+      };
+
+      function calculateAnchorStyles(anchor) {
+        var styles = {};
+
+        var coords = getDomNode(anchor).getBoundingClientRect();
+
+        // we iterate directly since safari messes up and doesn't return
+        // all the keys for the coords object when iterated
+        forEach(['width','height','top','left'], function(key) {
+          var value = coords[key];
+          switch (key) {
+            case 'top':
+              value += bodyNode.scrollTop;
+              break;
+            case 'left':
+              value += bodyNode.scrollLeft;
+              break;
+          }
+          styles[key] = Math.floor(value) + 'px';
+        });
+        return styles;
+      }
+
+      function prepareOutAnimation() {
+        var animator = $animateCss(clone, {
+          addClass: NG_OUT_ANCHOR_CLASS_NAME,
+          delay: true,
+          from: calculateAnchorStyles(outAnchor)
+        });
+
+        // read the comment within `prepareRegularAnimation` to understand
+        // why this check is necessary
+        return animator.$$willAnimate ? animator : null;
+      }
+
+      function getClassVal(element) {
+        return element.attr('class') || '';
+      }
+
+      function prepareInAnimation() {
+        var endingClasses = filterCssClasses(getClassVal(inAnchor));
+        var toAdd = getUniqueValues(endingClasses, startingClasses);
+        var toRemove = getUniqueValues(startingClasses, endingClasses);
+
+        var animator = $animateCss(clone, {
+          to: calculateAnchorStyles(inAnchor),
+          addClass: NG_IN_ANCHOR_CLASS_NAME + ' ' + toAdd,
+          removeClass: NG_OUT_ANCHOR_CLASS_NAME + ' ' + toRemove,
+          delay: true
+        });
+
+        // read the comment within `prepareRegularAnimation` to understand
+        // why this check is necessary
+        return animator.$$willAnimate ? animator : null;
+      }
+
+      function end() {
+        clone.remove();
+        outAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME);
+        inAnchor.removeClass(NG_ANIMATE_SHIM_CLASS_NAME);
+      }
+    }
+
+    function prepareFromToAnchorAnimation(from, to, classes, anchors) {
+      var fromAnimation = prepareRegularAnimation(from, noop);
+      var toAnimation = prepareRegularAnimation(to, noop);
+
+      var anchorAnimations = [];
+      forEach(anchors, function(anchor) {
+        var outElement = anchor['out'];
+        var inElement = anchor['in'];
+        var animator = prepareAnchoredAnimation(classes, outElement, inElement);
+        if (animator) {
+          anchorAnimations.push(animator);
+        }
+      });
+
+      // no point in doing anything when there are no elements to animate
+      if (!fromAnimation && !toAnimation && anchorAnimations.length === 0) return;
+
+      return {
+        start: function() {
+          var animationRunners = [];
+
+          if (fromAnimation) {
+            animationRunners.push(fromAnimation.start());
+          }
+
+          if (toAnimation) {
+            animationRunners.push(toAnimation.start());
+          }
+
+          forEach(anchorAnimations, function(animation) {
+            animationRunners.push(animation.start());
+          });
+
+          var runner = new $$AnimateRunner({
+            end: endFn,
+            cancel: endFn // CSS-driven animations cannot be cancelled, only ended
+          });
+
+          $$AnimateRunner.all(animationRunners, function(status) {
+            runner.complete(status);
+          });
+
+          return runner;
+
+          function endFn() {
+            forEach(animationRunners, function(runner) {
+              runner.end();
+            });
+          }
+        }
+      };
+    }
+
+    function prepareRegularAnimation(animationDetails) {
+      var element = animationDetails.element;
+      var options = animationDetails.options || {};
+
+      if (animationDetails.structural) {
+        options.event = animationDetails.event;
+        options.structural = true;
+        options.applyClassesEarly = true;
+
+        // we special case the leave animation since we want to ensure that
+        // the element is removed as soon as the animation is over. Otherwise
+        // a flicker might appear or the element may not be removed at all
+        if (animationDetails.event === 'leave') {
+          options.onDone = options.domOperation;
+        }
+      }
+
+      // We assign the preparationClasses as the actual animation event since
+      // the internals of $animateCss will just suffix the event token values
+      // with `-active` to trigger the animation.
+      if (options.preparationClasses) {
+        options.event = concatWithSpace(options.event, options.preparationClasses);
+      }
+
+      var animator = $animateCss(element, options);
+
+      // the driver lookup code inside of $$animation attempts to spawn a
+      // driver one by one until a driver returns a.$$willAnimate animator object.
+      // $animateCss will always return an object, however, it will pass in
+      // a flag as a hint as to whether an animation was detected or not
+      return animator.$$willAnimate ? animator : null;
+    }
+  }];
+}];
+
+// TODO(matsko): use caching here to speed things up for detection
+// TODO(matsko): add documentation
+//  by the time...
+
+var $$AnimateJsProvider = ['$animateProvider', function($animateProvider) {
+  this.$get = ['$injector', '$$AnimateRunner', '$$jqLite',
+       function($injector,   $$AnimateRunner,   $$jqLite) {
+
+    var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);
+         // $animateJs(element, 'enter');
+    return function(element, event, classes, options) {
+      var animationClosed = false;
+
+      // the `classes` argument is optional and if it is not used
+      // then the classes will be resolved from the element's className
+      // property as well as options.addClass/options.removeClass.
+      if (arguments.length === 3 && isObject(classes)) {
+        options = classes;
+        classes = null;
+      }
+
+      options = prepareAnimationOptions(options);
+      if (!classes) {
+        classes = element.attr('class') || '';
+        if (options.addClass) {
+          classes += ' ' + options.addClass;
+        }
+        if (options.removeClass) {
+          classes += ' ' + options.removeClass;
+        }
+      }
+
+      var classesToAdd = options.addClass;
+      var classesToRemove = options.removeClass;
+
+      // the lookupAnimations function returns a series of animation objects that are
+      // matched up with one or more of the CSS classes. These animation objects are
+      // defined via the module.animation factory function. If nothing is detected then
+      // we don't return anything which then makes $animation query the next driver.
+      var animations = lookupAnimations(classes);
+      var before, after;
+      if (animations.length) {
+        var afterFn, beforeFn;
+        if (event == 'leave') {
+          beforeFn = 'leave';
+          afterFn = 'afterLeave'; // TODO(matsko): get rid of this
+        } else {
+          beforeFn = 'before' + event.charAt(0).toUpperCase() + event.substr(1);
+          afterFn = event;
+        }
+
+        if (event !== 'enter' && event !== 'move') {
+          before = packageAnimations(element, event, options, animations, beforeFn);
+        }
+        after  = packageAnimations(element, event, options, animations, afterFn);
+      }
+
+      // no matching animations
+      if (!before && !after) return;
+
+      function applyOptions() {
+        options.domOperation();
+        applyAnimationClasses(element, options);
+      }
+
+      function close() {
+        animationClosed = true;
+        applyOptions();
+        applyAnimationStyles(element, options);
+      }
+
+      var runner;
+
+      return {
+        $$willAnimate: true,
+        end: function() {
+          if (runner) {
+            runner.end();
+          } else {
+            close();
+            runner = new $$AnimateRunner();
+            runner.complete(true);
+          }
+          return runner;
+        },
+        start: function() {
+          if (runner) {
+            return runner;
+          }
+
+          runner = new $$AnimateRunner();
+          var closeActiveAnimations;
+          var chain = [];
+
+          if (before) {
+            chain.push(function(fn) {
+              closeActiveAnimations = before(fn);
+            });
+          }
+
+          if (chain.length) {
+            chain.push(function(fn) {
+              applyOptions();
+              fn(true);
+            });
+          } else {
+            applyOptions();
+          }
+
+          if (after) {
+            chain.push(function(fn) {
+              closeActiveAnimations = after(fn);
+            });
+          }
+
+          runner.setHost({
+            end: function() {
+              endAnimations();
+            },
+            cancel: function() {
+              endAnimations(true);
+            }
+          });
+
+          $$AnimateRunner.chain(chain, onComplete);
+          return runner;
+
+          function onComplete(success) {
+            close(success);
+            runner.complete(success);
+          }
+
+          function endAnimations(cancelled) {
+            if (!animationClosed) {
+              (closeActiveAnimations || noop)(cancelled);
+              onComplete(cancelled);
+            }
+          }
+        }
+      };
+
+      function executeAnimationFn(fn, element, event, options, onDone) {
+        var args;
+        switch (event) {
+          case 'animate':
+            args = [element, options.from, options.to, onDone];
+            break;
+
+          case 'setClass':
+            args = [element, classesToAdd, classesToRemove, onDone];
+            break;
+
+          case 'addClass':
+            args = [element, classesToAdd, onDone];
+            break;
+
+          case 'removeClass':
+            args = [element, classesToRemove, onDone];
+            break;
+
+          default:
+            args = [element, onDone];
+            break;
+        }
+
+        args.push(options);
+
+        var value = fn.apply(fn, args);
+        if (value) {
+          if (isFunction(value.start)) {
+            value = value.start();
+          }
+
+          if (value instanceof $$AnimateRunner) {
+            value.done(onDone);
+          } else if (isFunction(value)) {
+            // optional onEnd / onCancel callback
+            return value;
+          }
+        }
+
+        return noop;
+      }
+
+      function groupEventedAnimations(element, event, options, animations, fnName) {
+        var operations = [];
+        forEach(animations, function(ani) {
+          var animation = ani[fnName];
+          if (!animation) return;
+
+          // note that all of these animations will run in parallel
+          operations.push(function() {
+            var runner;
+            var endProgressCb;
+
+            var resolved = false;
+            var onAnimationComplete = function(rejected) {
+              if (!resolved) {
+                resolved = true;
+                (endProgressCb || noop)(rejected);
+                runner.complete(!rejected);
+              }
+            };
+
+            runner = new $$AnimateRunner({
+              end: function() {
+                onAnimationComplete();
+              },
+              cancel: function() {
+                onAnimationComplete(true);
+              }
+            });
+
+            endProgressCb = executeAnimationFn(animation, element, event, options, function(result) {
+              var cancelled = result === false;
+              onAnimationComplete(cancelled);
+            });
+
+            return runner;
+          });
+        });
+
+        return operations;
+      }
+
+      function packageAnimations(element, event, options, animations, fnName) {
+        var operations = groupEventedAnimations(element, event, options, animations, fnName);
+        if (operations.length === 0) {
+          var a,b;
+          if (fnName === 'beforeSetClass') {
+            a = groupEventedAnimations(element, 'removeClass', options, animations, 'beforeRemoveClass');
+            b = groupEventedAnimations(element, 'addClass', options, animations, 'beforeAddClass');
+          } else if (fnName === 'setClass') {
+            a = groupEventedAnimations(element, 'removeClass', options, animations, 'removeClass');
+            b = groupEventedAnimations(element, 'addClass', options, animations, 'addClass');
+          }
+
+          if (a) {
+            operations = operations.concat(a);
+          }
+          if (b) {
+            operations = operations.concat(b);
+          }
+        }
+
+        if (operations.length === 0) return;
+
+        // TODO(matsko): add documentation
+        return function startAnimation(callback) {
+          var runners = [];
+          if (operations.length) {
+            forEach(operations, function(animateFn) {
+              runners.push(animateFn());
+            });
+          }
+
+          runners.length ? $$AnimateRunner.all(runners, callback) : callback();
+
+          return function endFn(reject) {
+            forEach(runners, function(runner) {
+              reject ? runner.cancel() : runner.end();
+            });
+          };
+        };
+      }
+    };
+
+    function lookupAnimations(classes) {
+      classes = isArray(classes) ? classes : classes.split(' ');
+      var matches = [], flagMap = {};
+      for (var i=0; i < classes.length; i++) {
+        var klass = classes[i],
+            animationFactory = $animateProvider.$$registeredAnimations[klass];
+        if (animationFactory && !flagMap[klass]) {
+          matches.push($injector.get(animationFactory));
+          flagMap[klass] = true;
+        }
+      }
+      return matches;
+    }
+  }];
+}];
+
+var $$AnimateJsDriverProvider = ['$$animationProvider', function($$animationProvider) {
+  $$animationProvider.drivers.push('$$animateJsDriver');
+  this.$get = ['$$animateJs', '$$AnimateRunner', function($$animateJs, $$AnimateRunner) {
+    return function initDriverFn(animationDetails) {
+      if (animationDetails.from && animationDetails.to) {
+        var fromAnimation = prepareAnimation(animationDetails.from);
+        var toAnimation = prepareAnimation(animationDetails.to);
+        if (!fromAnimation && !toAnimation) return;
+
+        return {
+          start: function() {
+            var animationRunners = [];
+
+            if (fromAnimation) {
+              animationRunners.push(fromAnimation.start());
+            }
+
+            if (toAnimation) {
+              animationRunners.push(toAnimation.start());
+            }
+
+            $$AnimateRunner.all(animationRunners, done);
+
+            var runner = new $$AnimateRunner({
+              end: endFnFactory(),
+              cancel: endFnFactory()
+            });
+
+            return runner;
+
+            function endFnFactory() {
+              return function() {
+                forEach(animationRunners, function(runner) {
+                  // at this point we cannot cancel animations for groups just yet. 1.5+
+                  runner.end();
+                });
+              };
+            }
+
+            function done(status) {
+              runner.complete(status);
+            }
+          }
+        };
+      } else {
+        return prepareAnimation(animationDetails);
+      }
+    };
+
+    function prepareAnimation(animationDetails) {
+      // TODO(matsko): make sure to check for grouped animations and delegate down to normal animations
+      var element = animationDetails.element;
+      var event = animationDetails.event;
+      var options = animationDetails.options;
+      var classes = animationDetails.classes;
+      return $$animateJs(element, event, classes, options);
+    }
+  }];
+}];
+
+var NG_ANIMATE_ATTR_NAME = 'data-ng-animate';
+var NG_ANIMATE_PIN_DATA = '$ngAnimatePin';
+var $$AnimateQueueProvider = ['$animateProvider', function($animateProvider) {
+  var PRE_DIGEST_STATE = 1;
+  var RUNNING_STATE = 2;
+  var ONE_SPACE = ' ';
+
+  var rules = this.rules = {
+    skip: [],
+    cancel: [],
+    join: []
+  };
+
+  function makeTruthyCssClassMap(classString) {
+    if (!classString) {
+      return null;
+    }
+
+    var keys = classString.split(ONE_SPACE);
+    var map = Object.create(null);
+
+    forEach(keys, function(key) {
+      map[key] = true;
+    });
+    return map;
+  }
+
+  function hasMatchingClasses(newClassString, currentClassString) {
+    if (newClassString && currentClassString) {
+      var currentClassMap = makeTruthyCssClassMap(currentClassString);
+      return newClassString.split(ONE_SPACE).some(function(className) {
+        return currentClassMap[className];
+      });
+    }
+  }
+
+  function isAllowed(ruleType, element, currentAnimation, previousAnimation) {
+    return rules[ruleType].some(function(fn) {
+      return fn(element, currentAnimation, previousAnimation);
+    });
+  }
+
+  function hasAnimationClasses(animation, and) {
+    var a = (animation.addClass || '').length > 0;
+    var b = (animation.removeClass || '').length > 0;
+    return and ? a && b : a || b;
+  }
+
+  rules.join.push(function(element, newAnimation, currentAnimation) {
+    // if the new animation is class-based then we can just tack that on
+    return !newAnimation.structural && hasAnimationClasses(newAnimation);
+  });
+
+  rules.skip.push(function(element, newAnimation, currentAnimation) {
+    // there is no need to animate anything if no classes are being added and
+    // there is no structural animation that will be triggered
+    return !newAnimation.structural && !hasAnimationClasses(newAnimation);
+  });
+
+  rules.skip.push(function(element, newAnimation, currentAnimation) {
+    // why should we trigger a new structural animation if the element will
+    // be removed from the DOM anyway?
+    return currentAnimation.event == 'leave' && newAnimation.structural;
+  });
+
+  rules.skip.push(function(element, newAnimation, currentAnimation) {
+    // if there is an ongoing current animation then don't even bother running the class-based animation
+    return currentAnimation.structural && currentAnimation.state === RUNNING_STATE && !newAnimation.structural;
+  });
+
+  rules.cancel.push(function(element, newAnimation, currentAnimation) {
+    // there can never be two structural animations running at the same time
+    return currentAnimation.structural && newAnimation.structural;
+  });
+
+  rules.cancel.push(function(element, newAnimation, currentAnimation) {
+    // if the previous animation is already running, but the new animation will
+    // be triggered, but the new animation is structural
+    return currentAnimation.state === RUNNING_STATE && newAnimation.structural;
+  });
+
+  rules.cancel.push(function(element, newAnimation, currentAnimation) {
+    // cancel the animation if classes added / removed in both animation cancel each other out,
+    // but only if the current animation isn't structural
+
+    if (currentAnimation.structural) return false;
+
+    var nA = newAnimation.addClass;
+    var nR = newAnimation.removeClass;
+    var cA = currentAnimation.addClass;
+    var cR = currentAnimation.removeClass;
+
+    // early detection to save the global CPU shortage :)
+    if ((isUndefined(nA) && isUndefined(nR)) || (isUndefined(cA) && isUndefined(cR))) {
+      return false;
+    }
+
+    return hasMatchingClasses(nA, cR) || hasMatchingClasses(nR, cA);
+  });
+
+  this.$get = ['$$rAF', '$rootScope', '$rootElement', '$document', '$$HashMap',
+               '$$animation', '$$AnimateRunner', '$templateRequest', '$$jqLite', '$$forceReflow',
+       function($$rAF,   $rootScope,   $rootElement,   $document,   $$HashMap,
+                $$animation,   $$AnimateRunner,   $templateRequest,   $$jqLite,   $$forceReflow) {
+
+    var activeAnimationsLookup = new $$HashMap();
+    var disabledElementsLookup = new $$HashMap();
+    var animationsEnabled = null;
+
+    function postDigestTaskFactory() {
+      var postDigestCalled = false;
+      return function(fn) {
+        // we only issue a call to postDigest before
+        // it has first passed. This prevents any callbacks
+        // from not firing once the animation has completed
+        // since it will be out of the digest cycle.
+        if (postDigestCalled) {
+          fn();
+        } else {
+          $rootScope.$$postDigest(function() {
+            postDigestCalled = true;
+            fn();
+          });
+        }
+      };
+    }
+
+    // Wait until all directive and route-related templates are downloaded and
+    // compiled. The $templateRequest.totalPendingRequests variable keeps track of
+    // all of the remote templates being currently downloaded. If there are no
+    // templates currently downloading then the watcher will still fire anyway.
+    var deregisterWatch = $rootScope.$watch(
+      function() { return $templateRequest.totalPendingRequests === 0; },
+      function(isEmpty) {
+        if (!isEmpty) return;
+        deregisterWatch();
+
+        // Now that all templates have been downloaded, $animate will wait until
+        // the post digest queue is empty before enabling animations. By having two
+        // calls to $postDigest calls we can ensure that the flag is enabled at the
+        // very end of the post digest queue. Since all of the animations in $animate
+        // use $postDigest, it's important that the code below executes at the end.
+        // This basically means that the page is fully downloaded and compiled before
+        // any animations are triggered.
+        $rootScope.$$postDigest(function() {
+          $rootScope.$$postDigest(function() {
+            // we check for null directly in the event that the application already called
+            // .enabled() with whatever arguments that it provided it with
+            if (animationsEnabled === null) {
+              animationsEnabled = true;
+            }
+          });
+        });
+      }
+    );
+
+    var callbackRegistry = Object.create(null);
+
+    // remember that the classNameFilter is set during the provider/config
+    // stage therefore we can optimize here and setup a helper function
+    var classNameFilter = $animateProvider.classNameFilter();
+    var isAnimatableClassName = !classNameFilter
+              ? function() { return true; }
+              : function(className) {
+                return classNameFilter.test(className);
+              };
+
+    var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);
+
+    function normalizeAnimationDetails(element, animation) {
+      return mergeAnimationDetails(element, animation, {});
+    }
+
+    // IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259.
+    var contains = window.Node.prototype.contains || function(arg) {
+      // jshint bitwise: false
+      return this === arg || !!(this.compareDocumentPosition(arg) & 16);
+      // jshint bitwise: true
+    };
+
+    function findCallbacks(parent, element, event) {
+      var targetNode = getDomNode(element);
+      var targetParentNode = getDomNode(parent);
+
+      var matches = [];
+      var entries = callbackRegistry[event];
+      if (entries) {
+        forEach(entries, function(entry) {
+          if (contains.call(entry.node, targetNode)) {
+            matches.push(entry.callback);
+          } else if (event === 'leave' && contains.call(entry.node, targetParentNode)) {
+            matches.push(entry.callback);
+          }
+        });
+      }
+
+      return matches;
+    }
+
+    function filterFromRegistry(list, matchContainer, matchCallback) {
+      var containerNode = extractElementNode(matchContainer);
+      return list.filter(function(entry) {
+        var isMatch = entry.node === containerNode &&
+                        (!matchCallback || entry.callback === matchCallback);
+        return !isMatch;
+      });
+    }
+
+    function cleanupEventListeners(phase, element) {
+      if (phase === 'close' && !element[0].parentNode) {
+        // If the element is not attached to a parentNode, it has been removed by
+        // the domOperation, and we can safely remove the event callbacks
+        $animate.off(element);
+      }
+    }
+
+    var $animate = {
+      on: function(event, container, callback) {
+        var node = extractElementNode(container);
+        callbackRegistry[event] = callbackRegistry[event] || [];
+        callbackRegistry[event].push({
+          node: node,
+          callback: callback
+        });
+
+        // Remove the callback when the element is removed from the DOM
+        jqLite(container).on('$destroy', function() {
+          var animationDetails = activeAnimationsLookup.get(node);
+
+          if (!animationDetails) {
+            // If there's an animation ongoing, the callback calling code will remove
+            // the event listeners. If we'd remove here, the callbacks would be removed
+            // before the animation ends
+            $animate.off(event, container, callback);
+          }
+        });
+      },
+
+      off: function(event, container, callback) {
+        if (arguments.length === 1 && !isString(arguments[0])) {
+          container = arguments[0];
+          for (var eventType in callbackRegistry) {
+            callbackRegistry[eventType] = filterFromRegistry(callbackRegistry[eventType], container);
+          }
+
+          return;
+        }
+
+        var entries = callbackRegistry[event];
+        if (!entries) return;
+
+        callbackRegistry[event] = arguments.length === 1
+            ? null
+            : filterFromRegistry(entries, container, callback);
+      },
+
+      pin: function(element, parentElement) {
+        assertArg(isElement(element), 'element', 'not an element');
+        assertArg(isElement(parentElement), 'parentElement', 'not an element');
+        element.data(NG_ANIMATE_PIN_DATA, parentElement);
+      },
+
+      push: function(element, event, options, domOperation) {
+        options = options || {};
+        options.domOperation = domOperation;
+        return queueAnimation(element, event, options);
+      },
+
+      // this method has four signatures:
+      //  () - global getter
+      //  (bool) - global setter
+      //  (element) - element getter
+      //  (element, bool) - element setter<F37>
+      enabled: function(element, bool) {
+        var argCount = arguments.length;
+
+        if (argCount === 0) {
+          // () - Global getter
+          bool = !!animationsEnabled;
+        } else {
+          var hasElement = isElement(element);
+
+          if (!hasElement) {
+            // (bool) - Global setter
+            bool = animationsEnabled = !!element;
+          } else {
+            var node = getDomNode(element);
+
+            if (argCount === 1) {
+              // (element) - Element getter
+              bool = !disabledElementsLookup.get(node);
+            } else {
+              // (element, bool) - Element setter
+              disabledElementsLookup.put(node, !bool);
+            }
+          }
+        }
+
+        return bool;
+      }
+    };
+
+    return $animate;
+
+    function queueAnimation(element, event, initialOptions) {
+      // we always make a copy of the options since
+      // there should never be any side effects on
+      // the input data when running `$animateCss`.
+      var options = copy(initialOptions);
+
+      var node, parent;
+      element = stripCommentsFromElement(element);
+      if (element) {
+        node = getDomNode(element);
+        parent = element.parent();
+      }
+
+      options = prepareAnimationOptions(options);
+
+      // we create a fake runner with a working promise.
+      // These methods will become available after the digest has passed
+      var runner = new $$AnimateRunner();
+
+      // this is used to trigger callbacks in postDigest mode
+      var runInNextPostDigestOrNow = postDigestTaskFactory();
+
+      if (isArray(options.addClass)) {
+        options.addClass = options.addClass.join(' ');
+      }
+
+      if (options.addClass && !isString(options.addClass)) {
+        options.addClass = null;
+      }
+
+      if (isArray(options.removeClass)) {
+        options.removeClass = options.removeClass.join(' ');
+      }
+
+      if (options.removeClass && !isString(options.removeClass)) {
+        options.removeClass = null;
+      }
+
+      if (options.from && !isObject(options.from)) {
+        options.from = null;
+      }
+
+      if (options.to && !isObject(options.to)) {
+        options.to = null;
+      }
+
+      // there are situations where a directive issues an animation for
+      // a jqLite wrapper that contains only comment nodes... If this
+      // happens then there is no way we can perform an animation
+      if (!node) {
+        close();
+        return runner;
+      }
+
+      var className = [node.className, options.addClass, options.removeClass].join(' ');
+      if (!isAnimatableClassName(className)) {
+        close();
+        return runner;
+      }
+
+      var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0;
+
+      var documentHidden = $document[0].hidden;
+
+      // this is a hard disable of all animations for the application or on
+      // the element itself, therefore  there is no need to continue further
+      // past this point if not enabled
+      // Animations are also disabled if the document is currently hidden (page is not visible
+      // to the user), because browsers slow down or do not flush calls to requestAnimationFrame
+      var skipAnimations = !animationsEnabled || documentHidden || disabledElementsLookup.get(node);
+      var existingAnimation = (!skipAnimations && activeAnimationsLookup.get(node)) || {};
+      var hasExistingAnimation = !!existingAnimation.state;
+
+      // there is no point in traversing the same collection of parent ancestors if a followup
+      // animation will be run on the same element that already did all that checking work
+      if (!skipAnimations && (!hasExistingAnimation || existingAnimation.state != PRE_DIGEST_STATE)) {
+        skipAnimations = !areAnimationsAllowed(element, parent, event);
+      }
+
+      if (skipAnimations) {
+        // Callbacks should fire even if the document is hidden (regression fix for issue #14120)
+        if (documentHidden) notifyProgress(runner, event, 'start');
+        close();
+        if (documentHidden) notifyProgress(runner, event, 'close');
+        return runner;
+      }
+
+      if (isStructural) {
+        closeChildAnimations(element);
+      }
+
+      var newAnimation = {
+        structural: isStructural,
+        element: element,
+        event: event,
+        addClass: options.addClass,
+        removeClass: options.removeClass,
+        close: close,
+        options: options,
+        runner: runner
+      };
+
+      if (hasExistingAnimation) {
+        var skipAnimationFlag = isAllowed('skip', element, newAnimation, existingAnimation);
+        if (skipAnimationFlag) {
+          if (existingAnimation.state === RUNNING_STATE) {
+            close();
+            return runner;
+          } else {
+            mergeAnimationDetails(element, existingAnimation, newAnimation);
+            return existingAnimation.runner;
+          }
+        }
+        var cancelAnimationFlag = isAllowed('cancel', element, newAnimation, existingAnimation);
+        if (cancelAnimationFlag) {
+          if (existingAnimation.state === RUNNING_STATE) {
+            // this will end the animation right away and it is safe
+            // to do so since the animation is already running and the
+            // runner callback code will run in async
+            existingAnimation.runner.end();
+          } else if (existingAnimation.structural) {
+            // this means that the animation is queued into a digest, but
+            // hasn't started yet. Therefore it is safe to run the close
+            // method which will call the runner methods in async.
+            existingAnimation.close();
+          } else {
+            // this will merge the new animation options into existing animation options
+            mergeAnimationDetails(element, existingAnimation, newAnimation);
+
+            return existingAnimation.runner;
+          }
+        } else {
+          // a joined animation means that this animation will take over the existing one
+          // so an example would involve a leave animation taking over an enter. Then when
+          // the postDigest kicks in the enter will be ignored.
+          var joinAnimationFlag = isAllowed('join', element, newAnimation, existingAnimation);
+          if (joinAnimationFlag) {
+            if (existingAnimation.state === RUNNING_STATE) {
+              normalizeAnimationDetails(element, newAnimation);
+            } else {
+              applyGeneratedPreparationClasses(element, isStructural ? event : null, options);
+
+              event = newAnimation.event = existingAnimation.event;
+              options = mergeAnimationDetails(element, existingAnimation, newAnimation);
+
+              //we return the same runner since only the option values of this animation will
+              //be fed into the `existingAnimation`.
+              return existingAnimation.runner;
+            }
+          }
+        }
+      } else {
+        // normalization in this case means that it removes redundant CSS classes that
+        // already exist (addClass) or do not exist (removeClass) on the element
+        normalizeAnimationDetails(element, newAnimation);
+      }
+
+      // when the options are merged and cleaned up we may end up not having to do
+      // an animation at all, therefore we should check this before issuing a post
+      // digest callback. Structural animations will always run no matter what.
+      var isValidAnimation = newAnimation.structural;
+      if (!isValidAnimation) {
+        // animate (from/to) can be quickly checked first, otherwise we check if any classes are present
+        isValidAnimation = (newAnimation.event === 'animate' && Object.keys(newAnimation.options.to || {}).length > 0)
+                            || hasAnimationClasses(newAnimation);
+      }
+
+      if (!isValidAnimation) {
+        close();
+        clearElementAnimationState(element);
+        return runner;
+      }
+
+      // the counter keeps track of cancelled animations
+      var counter = (existingAnimation.counter || 0) + 1;
+      newAnimation.counter = counter;
+
+      markElementAnimationState(element, PRE_DIGEST_STATE, newAnimation);
+
+      $rootScope.$$postDigest(function() {
+        var animationDetails = activeAnimationsLookup.get(node);
+        var animationCancelled = !animationDetails;
+        animationDetails = animationDetails || {};
+
+        // if addClass/removeClass is called before something like enter then the
+        // registered parent element may not be present. The code below will ensure
+        // that a final value for parent element is obtained
+        var parentElement = element.parent() || [];
+
+        // animate/structural/class-based animations all have requirements. Otherwise there
+        // is no point in performing an animation. The parent node must also be set.
+        var isValidAnimation = parentElement.length > 0
+                                && (animationDetails.event === 'animate'
+                                    || animationDetails.structural
+                                    || hasAnimationClasses(animationDetails));
+
+        // this means that the previous animation was cancelled
+        // even if the follow-up animation is the same event
+        if (animationCancelled || animationDetails.counter !== counter || !isValidAnimation) {
+          // if another animation did not take over then we need
+          // to make sure that the domOperation and options are
+          // handled accordingly
+          if (animationCancelled) {
+            applyAnimationClasses(element, options);
+            applyAnimationStyles(element, options);
+          }
+
+          // if the event changed from something like enter to leave then we do
+          // it, otherwise if it's the same then the end result will be the same too
+          if (animationCancelled || (isStructural && animationDetails.event !== event)) {
+            options.domOperation();
+            runner.end();
+          }
+
+          // in the event that the element animation was not cancelled or a follow-up animation
+          // isn't allowed to animate from here then we need to clear the state of the element
+          // so that any future animations won't read the expired animation data.
+          if (!isValidAnimation) {
+            clearElementAnimationState(element);
+          }
+
+          return;
+        }
+
+        // this combined multiple class to addClass / removeClass into a setClass event
+        // so long as a structural event did not take over the animation
+        event = !animationDetails.structural && hasAnimationClasses(animationDetails, true)
+            ? 'setClass'
+            : animationDetails.event;
+
+        markElementAnimationState(element, RUNNING_STATE);
+        var realRunner = $$animation(element, event, animationDetails.options);
+
+        // this will update the runner's flow-control events based on
+        // the `realRunner` object.
+        runner.setHost(realRunner);
+        notifyProgress(runner, event, 'start', {});
+
+        realRunner.done(function(status) {
+          close(!status);
+          var animationDetails = activeAnimationsLookup.get(node);
+          if (animationDetails && animationDetails.counter === counter) {
+            clearElementAnimationState(getDomNode(element));
+          }
+          notifyProgress(runner, event, 'close', {});
+        });
+      });
+
+      return runner;
+
+      function notifyProgress(runner, event, phase, data) {
+        runInNextPostDigestOrNow(function() {
+          var callbacks = findCallbacks(parent, element, event);
+          if (callbacks.length) {
+            // do not optimize this call here to RAF because
+            // we don't know how heavy the callback code here will
+            // be and if this code is buffered then this can
+            // lead to a performance regression.
+            $$rAF(function() {
+              forEach(callbacks, function(callback) {
+                callback(element, phase, data);
+              });
+              cleanupEventListeners(phase, element);
+            });
+          } else {
+            cleanupEventListeners(phase, element);
+          }
+        });
+        runner.progress(event, phase, data);
+      }
+
+      function close(reject) { // jshint ignore:line
+        clearGeneratedClasses(element, options);
+        applyAnimationClasses(element, options);
+        applyAnimationStyles(element, options);
+        options.domOperation();
+        runner.complete(!reject);
+      }
+    }
+
+    function closeChildAnimations(element) {
+      var node = getDomNode(element);
+      var children = node.querySelectorAll('[' + NG_ANIMATE_ATTR_NAME + ']');
+      forEach(children, function(child) {
+        var state = parseInt(child.getAttribute(NG_ANIMATE_ATTR_NAME));
+        var animationDetails = activeAnimationsLookup.get(child);
+        if (animationDetails) {
+          switch (state) {
+            case RUNNING_STATE:
+              animationDetails.runner.end();
+              /* falls through */
+            case PRE_DIGEST_STATE:
+              activeAnimationsLookup.remove(child);
+              break;
+          }
+        }
+      });
+    }
+
+    function clearElementAnimationState(element) {
+      var node = getDomNode(element);
+      node.removeAttribute(NG_ANIMATE_ATTR_NAME);
+      activeAnimationsLookup.remove(node);
+    }
+
+    function isMatchingElement(nodeOrElmA, nodeOrElmB) {
+      return getDomNode(nodeOrElmA) === getDomNode(nodeOrElmB);
+    }
+
+    /**
+     * This fn returns false if any of the following is true:
+     * a) animations on any parent element are disabled, and animations on the element aren't explicitly allowed
+     * b) a parent element has an ongoing structural animation, and animateChildren is false
+     * c) the element is not a child of the body
+     * d) the element is not a child of the $rootElement
+     */
+    function areAnimationsAllowed(element, parentElement, event) {
+      var bodyElement = jqLite($document[0].body);
+      var bodyElementDetected = isMatchingElement(element, bodyElement) || element[0].nodeName === 'HTML';
+      var rootElementDetected = isMatchingElement(element, $rootElement);
+      var parentAnimationDetected = false;
+      var animateChildren;
+      var elementDisabled = disabledElementsLookup.get(getDomNode(element));
+
+      var parentHost = jqLite.data(element[0], NG_ANIMATE_PIN_DATA);
+      if (parentHost) {
+        parentElement = parentHost;
+      }
+
+      parentElement = getDomNode(parentElement);
+
+      while (parentElement) {
+        if (!rootElementDetected) {
+          // angular doesn't want to attempt to animate elements outside of the application
+          // therefore we need to ensure that the rootElement is an ancestor of the current element
+          rootElementDetected = isMatchingElement(parentElement, $rootElement);
+        }
+
+        if (parentElement.nodeType !== ELEMENT_NODE) {
+          // no point in inspecting the #document element
+          break;
+        }
+
+        var details = activeAnimationsLookup.get(parentElement) || {};
+        // either an enter, leave or move animation will commence
+        // therefore we can't allow any animations to take place
+        // but if a parent animation is class-based then that's ok
+        if (!parentAnimationDetected) {
+          var parentElementDisabled = disabledElementsLookup.get(parentElement);
+
+          if (parentElementDisabled === true && elementDisabled !== false) {
+            // disable animations if the user hasn't explicitly enabled animations on the
+            // current element
+            elementDisabled = true;
+            // element is disabled via parent element, no need to check anything else
+            break;
+          } else if (parentElementDisabled === false) {
+            elementDisabled = false;
+          }
+          parentAnimationDetected = details.structural;
+        }
+
+        if (isUndefined(animateChildren) || animateChildren === true) {
+          var value = jqLite.data(parentElement, NG_ANIMATE_CHILDREN_DATA);
+          if (isDefined(value)) {
+            animateChildren = value;
+          }
+        }
+
+        // there is no need to continue traversing at this point
+        if (parentAnimationDetected && animateChildren === false) break;
+
+        if (!bodyElementDetected) {
+          // we also need to ensure that the element is or will be a part of the body element
+          // otherwise it is pointless to even issue an animation to be rendered
+          bodyElementDetected = isMatchingElement(parentElement, bodyElement);
+        }
+
+        if (bodyElementDetected && rootElementDetected) {
+          // If both body and root have been found, any other checks are pointless,
+          // as no animation data should live outside the application
+          break;
+        }
+
+        if (!rootElementDetected) {
+          // If no rootElement is detected, check if the parentElement is pinned to another element
+          parentHost = jqLite.data(parentElement, NG_ANIMATE_PIN_DATA);
+          if (parentHost) {
+            // The pin target element becomes the next parent element
+            parentElement = getDomNode(parentHost);
+            continue;
+          }
+        }
+
+        parentElement = parentElement.parentNode;
+      }
+
+      var allowAnimation = (!parentAnimationDetected || animateChildren) && elementDisabled !== true;
+      return allowAnimation && rootElementDetected && bodyElementDetected;
+    }
+
+    function markElementAnimationState(element, state, details) {
+      details = details || {};
+      details.state = state;
+
+      var node = getDomNode(element);
+      node.setAttribute(NG_ANIMATE_ATTR_NAME, state);
+
+      var oldValue = activeAnimationsLookup.get(node);
+      var newValue = oldValue
+          ? extend(oldValue, details)
+          : details;
+      activeAnimationsLookup.put(node, newValue);
+    }
+  }];
+}];
+
+var $$AnimationProvider = ['$animateProvider', function($animateProvider) {
+  var NG_ANIMATE_REF_ATTR = 'ng-animate-ref';
+
+  var drivers = this.drivers = [];
+
+  var RUNNER_STORAGE_KEY = '$$animationRunner';
+
+  function setRunner(element, runner) {
+    element.data(RUNNER_STORAGE_KEY, runner);
+  }
+
+  function removeRunner(element) {
+    element.removeData(RUNNER_STORAGE_KEY);
+  }
+
+  function getRunner(element) {
+    return element.data(RUNNER_STORAGE_KEY);
+  }
+
+  this.$get = ['$$jqLite', '$rootScope', '$injector', '$$AnimateRunner', '$$HashMap', '$$rAFScheduler',
+       function($$jqLite,   $rootScope,   $injector,   $$AnimateRunner,   $$HashMap,   $$rAFScheduler) {
+
+    var animationQueue = [];
+    var applyAnimationClasses = applyAnimationClassesFactory($$jqLite);
+
+    function sortAnimations(animations) {
+      var tree = { children: [] };
+      var i, lookup = new $$HashMap();
+
+      // this is done first beforehand so that the hashmap
+      // is filled with a list of the elements that will be animated
+      for (i = 0; i < animations.length; i++) {
+        var animation = animations[i];
+        lookup.put(animation.domNode, animations[i] = {
+          domNode: animation.domNode,
+          fn: animation.fn,
+          children: []
+        });
+      }
+
+      for (i = 0; i < animations.length; i++) {
+        processNode(animations[i]);
+      }
+
+      return flatten(tree);
+
+      function processNode(entry) {
+        if (entry.processed) return entry;
+        entry.processed = true;
+
+        var elementNode = entry.domNode;
+        var parentNode = elementNode.parentNode;
+        lookup.put(elementNode, entry);
+
+        var parentEntry;
+        while (parentNode) {
+          parentEntry = lookup.get(parentNode);
+          if (parentEntry) {
+            if (!parentEntry.processed) {
+              parentEntry = processNode(parentEntry);
+            }
+            break;
+          }
+          parentNode = parentNode.parentNode;
+        }
+
+        (parentEntry || tree).children.push(entry);
+        return entry;
+      }
+
+      function flatten(tree) {
+        var result = [];
+        var queue = [];
+        var i;
+
+        for (i = 0; i < tree.children.length; i++) {
+          queue.push(tree.children[i]);
+        }
+
+        var remainingLevelEntries = queue.length;
+        var nextLevelEntries = 0;
+        var row = [];
+
+        for (i = 0; i < queue.length; i++) {
+          var entry = queue[i];
+          if (remainingLevelEntries <= 0) {
+            remainingLevelEntries = nextLevelEntries;
+            nextLevelEntries = 0;
+            result.push(row);
+            row = [];
+          }
+          row.push(entry.fn);
+          entry.children.forEach(function(childEntry) {
+            nextLevelEntries++;
+            queue.push(childEntry);
+          });
+          remainingLevelEntries--;
+        }
+
+        if (row.length) {
+          result.push(row);
+        }
+
+        return result;
+      }
+    }
+
+    // TODO(matsko): document the signature in a better way
+    return function(element, event, options) {
+      options = prepareAnimationOptions(options);
+      var isStructural = ['enter', 'move', 'leave'].indexOf(event) >= 0;
+
+      // there is no animation at the current moment, however
+      // these runner methods will get later updated with the
+      // methods leading into the driver's end/cancel methods
+      // for now they just stop the animation from starting
+      var runner = new $$AnimateRunner({
+        end: function() { close(); },
+        cancel: function() { close(true); }
+      });
+
+      if (!drivers.length) {
+        close();
+        return runner;
+      }
+
+      setRunner(element, runner);
+
+      var classes = mergeClasses(element.attr('class'), mergeClasses(options.addClass, options.removeClass));
+      var tempClasses = options.tempClasses;
+      if (tempClasses) {
+        classes += ' ' + tempClasses;
+        options.tempClasses = null;
+      }
+
+      var prepareClassName;
+      if (isStructural) {
+        prepareClassName = 'ng-' + event + PREPARE_CLASS_SUFFIX;
+        $$jqLite.addClass(element, prepareClassName);
+      }
+
+      animationQueue.push({
+        // this data is used by the postDigest code and passed into
+        // the driver step function
+        element: element,
+        classes: classes,
+        event: event,
+        structural: isStructural,
+        options: options,
+        beforeStart: beforeStart,
+        close: close
+      });
+
+      element.on('$destroy', handleDestroyedElement);
+
+      // we only want there to be one function called within the post digest
+      // block. This way we can group animations for all the animations that
+      // were apart of the same postDigest flush call.
+      if (animationQueue.length > 1) return runner;
+
+      $rootScope.$$postDigest(function() {
+        var animations = [];
+        forEach(animationQueue, function(entry) {
+          // the element was destroyed early on which removed the runner
+          // form its storage. This means we can't animate this element
+          // at all and it already has been closed due to destruction.
+          if (getRunner(entry.element)) {
+            animations.push(entry);
+          } else {
+            entry.close();
+          }
+        });
+
+        // now any future animations will be in another postDigest
+        animationQueue.length = 0;
+
+        var groupedAnimations = groupAnimations(animations);
+        var toBeSortedAnimations = [];
+
+        forEach(groupedAnimations, function(animationEntry) {
+          toBeSortedAnimations.push({
+            domNode: getDomNode(animationEntry.from ? animationEntry.from.element : animationEntry.element),
+            fn: function triggerAnimationStart() {
+              // it's important that we apply the `ng-animate` CSS class and the
+              // temporary classes before we do any driver invoking since these
+              // CSS classes may be required for proper CSS detection.
+              animationEntry.beforeStart();
+
+              var startAnimationFn, closeFn = animationEntry.close;
+
+              // in the event that the element was removed before the digest runs or
+              // during the RAF sequencing then we should not trigger the animation.
+              var targetElement = animationEntry.anchors
+                  ? (animationEntry.from.element || animationEntry.to.element)
+                  : animationEntry.element;
+
+              if (getRunner(targetElement)) {
+                var operation = invokeFirstDriver(animationEntry);
+                if (operation) {
+                  startAnimationFn = operation.start;
+                }
+              }
+
+              if (!startAnimationFn) {
+                closeFn();
+              } else {
+                var animationRunner = startAnimationFn();
+                animationRunner.done(function(status) {
+                  closeFn(!status);
+                });
+                updateAnimationRunners(animationEntry, animationRunner);
+              }
+            }
+          });
+        });
+
+        // we need to sort each of the animations in order of parent to child
+        // relationships. This ensures that the child classes are applied at the
+        // right time.
+        $$rAFScheduler(sortAnimations(toBeSortedAnimations));
+      });
+
+      return runner;
+
+      // TODO(matsko): change to reference nodes
+      function getAnchorNodes(node) {
+        var SELECTOR = '[' + NG_ANIMATE_REF_ATTR + ']';
+        var items = node.hasAttribute(NG_ANIMATE_REF_ATTR)
+              ? [node]
+              : node.querySelectorAll(SELECTOR);
+        var anchors = [];
+        forEach(items, function(node) {
+          var attr = node.getAttribute(NG_ANIMATE_REF_ATTR);
+          if (attr && attr.length) {
+            anchors.push(node);
+          }
+        });
+        return anchors;
+      }
+
+      function groupAnimations(animations) {
+        var preparedAnimations = [];
+        var refLookup = {};
+        forEach(animations, function(animation, index) {
+          var element = animation.element;
+          var node = getDomNode(element);
+          var event = animation.event;
+          var enterOrMove = ['enter', 'move'].indexOf(event) >= 0;
+          var anchorNodes = animation.structural ? getAnchorNodes(node) : [];
+
+          if (anchorNodes.length) {
+            var direction = enterOrMove ? 'to' : 'from';
+
+            forEach(anchorNodes, function(anchor) {
+              var key = anchor.getAttribute(NG_ANIMATE_REF_ATTR);
+              refLookup[key] = refLookup[key] || {};
+              refLookup[key][direction] = {
+                animationID: index,
+                element: jqLite(anchor)
+              };
+            });
+          } else {
+            preparedAnimations.push(animation);
+          }
+        });
+
+        var usedIndicesLookup = {};
+        var anchorGroups = {};
+        forEach(refLookup, function(operations, key) {
+          var from = operations.from;
+          var to = operations.to;
+
+          if (!from || !to) {
+            // only one of these is set therefore we can't have an
+            // anchor animation since all three pieces are required
+            var index = from ? from.animationID : to.animationID;
+            var indexKey = index.toString();
+            if (!usedIndicesLookup[indexKey]) {
+              usedIndicesLookup[indexKey] = true;
+              preparedAnimations.push(animations[index]);
+            }
+            return;
+          }
+
+          var fromAnimation = animations[from.animationID];
+          var toAnimation = animations[to.animationID];
+          var lookupKey = from.animationID.toString();
+          if (!anchorGroups[lookupKey]) {
+            var group = anchorGroups[lookupKey] = {
+              structural: true,
+              beforeStart: function() {
+                fromAnimation.beforeStart();
+                toAnimation.beforeStart();
+              },
+              close: function() {
+                fromAnimation.close();
+                toAnimation.close();
+              },
+              classes: cssClassesIntersection(fromAnimation.classes, toAnimation.classes),
+              from: fromAnimation,
+              to: toAnimation,
+              anchors: [] // TODO(matsko): change to reference nodes
+            };
+
+            // the anchor animations require that the from and to elements both have at least
+            // one shared CSS class which effectively marries the two elements together to use
+            // the same animation driver and to properly sequence the anchor animation.
+            if (group.classes.length) {
+              preparedAnimations.push(group);
+            } else {
+              preparedAnimations.push(fromAnimation);
+              preparedAnimations.push(toAnimation);
+            }
+          }
+
+          anchorGroups[lookupKey].anchors.push({
+            'out': from.element, 'in': to.element
+          });
+        });
+
+        return preparedAnimations;
+      }
+
+      function cssClassesIntersection(a,b) {
+        a = a.split(' ');
+        b = b.split(' ');
+        var matches = [];
+
+        for (var i = 0; i < a.length; i++) {
+          var aa = a[i];
+          if (aa.substring(0,3) === 'ng-') continue;
+
+          for (var j = 0; j < b.length; j++) {
+            if (aa === b[j]) {
+              matches.push(aa);
+              break;
+            }
+          }
+        }
+
+        return matches.join(' ');
+      }
+
+      function invokeFirstDriver(animationDetails) {
+        // we loop in reverse order since the more general drivers (like CSS and JS)
+        // may attempt more elements, but custom drivers are more particular
+        for (var i = drivers.length - 1; i >= 0; i--) {
+          var driverName = drivers[i];
+          var factory = $injector.get(driverName);
+          var driver = factory(animationDetails);
+          if (driver) {
+            return driver;
+          }
+        }
+      }
+
+      function beforeStart() {
+        element.addClass(NG_ANIMATE_CLASSNAME);
+        if (tempClasses) {
+          $$jqLite.addClass(element, tempClasses);
+        }
+        if (prepareClassName) {
+          $$jqLite.removeClass(element, prepareClassName);
+          prepareClassName = null;
+        }
+      }
+
+      function updateAnimationRunners(animation, newRunner) {
+        if (animation.from && animation.to) {
+          update(animation.from.element);
+          update(animation.to.element);
+        } else {
+          update(animation.element);
+        }
+
+        function update(element) {
+          var runner = getRunner(element);
+          if (runner) runner.setHost(newRunner);
+        }
+      }
+
+      function handleDestroyedElement() {
+        var runner = getRunner(element);
+        if (runner && (event !== 'leave' || !options.$$domOperationFired)) {
+          runner.end();
+        }
+      }
+
+      function close(rejected) { // jshint ignore:line
+        element.off('$destroy', handleDestroyedElement);
+        removeRunner(element);
+
+        applyAnimationClasses(element, options);
+        applyAnimationStyles(element, options);
+        options.domOperation();
+
+        if (tempClasses) {
+          $$jqLite.removeClass(element, tempClasses);
+        }
+
+        element.removeClass(NG_ANIMATE_CLASSNAME);
+        runner.complete(!rejected);
+      }
+    };
+  }];
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngAnimateSwap
+ * @restrict A
+ * @scope
+ *
+ * @description
+ *
+ * ngAnimateSwap is a animation-oriented directive that allows for the container to
+ * be removed and entered in whenever the associated expression changes. A
+ * common usecase for this directive is a rotating banner or slider component which
+ * contains one image being present at a time. When the active image changes
+ * then the old image will perform a `leave` animation and the new element
+ * will be inserted via an `enter` animation.
+ *
+ * @animations
+ * | Animation                        | Occurs                               |
+ * |----------------------------------|--------------------------------------|
+ * | {@link ng.$animate#enter enter}  | when the new element is inserted to the DOM  |
+ * | {@link ng.$animate#leave leave}  | when the old element is removed from the DOM |
+ *
+ * @example
+ * <example name="ngAnimateSwap-directive" module="ngAnimateSwapExample"
+ *          deps="angular-animate.js"
+ *          animations="true" fixBase="true">
+ *   <file name="index.html">
+ *     <div class="container" ng-controller="AppCtrl">
+ *       <div ng-animate-swap="number" class="cell swap-animation" ng-class="colorClass(number)">
+ *         {{ number }}
+ *       </div>
+ *     </div>
+ *   </file>
+ *   <file name="script.js">
+ *     angular.module('ngAnimateSwapExample', ['ngAnimate'])
+ *       .controller('AppCtrl', ['$scope', '$interval', function($scope, $interval) {
+ *         $scope.number = 0;
+ *         $interval(function() {
+ *           $scope.number++;
+ *         }, 1000);
+ *
+ *         var colors = ['red','blue','green','yellow','orange'];
+ *         $scope.colorClass = function(number) {
+ *           return colors[number % colors.length];
+ *         };
+ *       }]);
+ *   </file>
+ *  <file name="animations.css">
+ *  .container {
+ *    height:250px;
+ *    width:250px;
+ *    position:relative;
+ *    overflow:hidden;
+ *    border:2px solid black;
+ *  }
+ *  .container .cell {
+ *    font-size:150px;
+ *    text-align:center;
+ *    line-height:250px;
+ *    position:absolute;
+ *    top:0;
+ *    left:0;
+ *    right:0;
+ *    border-bottom:2px solid black;
+ *  }
+ *  .swap-animation.ng-enter, .swap-animation.ng-leave {
+ *    transition:0.5s linear all;
+ *  }
+ *  .swap-animation.ng-enter {
+ *    top:-250px;
+ *  }
+ *  .swap-animation.ng-enter-active {
+ *    top:0px;
+ *  }
+ *  .swap-animation.ng-leave {
+ *    top:0px;
+ *  }
+ *  .swap-animation.ng-leave-active {
+ *    top:250px;
+ *  }
+ *  .red { background:red; }
+ *  .green { background:green; }
+ *  .blue { background:blue; }
+ *  .yellow { background:yellow; }
+ *  .orange { background:orange; }
+ *  </file>
+ * </example>
+ */
+var ngAnimateSwapDirective = ['$animate', '$rootScope', function($animate, $rootScope) {
+  return {
+    restrict: 'A',
+    transclude: 'element',
+    terminal: true,
+    priority: 600, // we use 600 here to ensure that the directive is caught before others
+    link: function(scope, $element, attrs, ctrl, $transclude) {
+      var previousElement, previousScope;
+      scope.$watchCollection(attrs.ngAnimateSwap || attrs['for'], function(value) {
+        if (previousElement) {
+          $animate.leave(previousElement);
+        }
+        if (previousScope) {
+          previousScope.$destroy();
+          previousScope = null;
+        }
+        if (value || value === 0) {
+          previousScope = scope.$new();
+          $transclude(previousScope, function(element) {
+            previousElement = element;
+            $animate.enter(element, null, $element);
+          });
+        }
+      });
+    }
+  };
+}];
+
+/**
+ * @ngdoc module
+ * @name ngAnimate
+ * @description
+ *
+ * The `ngAnimate` module provides support for CSS-based animations (keyframes and transitions) as well as JavaScript-based animations via
+ * callback hooks. Animations are not enabled by default, however, by including `ngAnimate` the animation hooks are enabled for an Angular app.
+ *
+ * <div doc-module-components="ngAnimate"></div>
+ *
+ * # Usage
+ * Simply put, there are two ways to make use of animations when ngAnimate is used: by using **CSS** and **JavaScript**. The former works purely based
+ * using CSS (by using matching CSS selectors/styles) and the latter triggers animations that are registered via `module.animation()`. For
+ * both CSS and JS animations the sole requirement is to have a matching `CSS class` that exists both in the registered animation and within
+ * the HTML element that the animation will be triggered on.
+ *
+ * ## Directive Support
+ * The following directives are "animation aware":
+ *
+ * | Directive                                                                                                | Supported Animations                                                     |
+ * |----------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------|
+ * | {@link ng.directive:ngRepeat#animations ngRepeat}                                                        | enter, leave and move                                                    |
+ * | {@link ngRoute.directive:ngView#animations ngView}                                                       | enter and leave                                                          |
+ * | {@link ng.directive:ngInclude#animations ngInclude}                                                      | enter and leave                                                          |
+ * | {@link ng.directive:ngSwitch#animations ngSwitch}                                                        | enter and leave                                                          |
+ * | {@link ng.directive:ngIf#animations ngIf}                                                                | enter and leave                                                          |
+ * | {@link ng.directive:ngClass#animations ngClass}                                                          | add and remove (the CSS class(es) present)                               |
+ * | {@link ng.directive:ngShow#animations ngShow} & {@link ng.directive:ngHide#animations ngHide}            | add and remove (the ng-hide class value)                                 |
+ * | {@link ng.directive:form#animation-hooks form} & {@link ng.directive:ngModel#animation-hooks ngModel}    | add and remove (dirty, pristine, valid, invalid & all other validations) |
+ * | {@link module:ngMessages#animations ngMessages}                                                          | add and remove (ng-active & ng-inactive)                                 |
+ * | {@link module:ngMessages#animations ngMessage}                                                           | enter and leave                                                          |
+ *
+ * (More information can be found by visiting each the documentation associated with each directive.)
+ *
+ * ## CSS-based Animations
+ *
+ * CSS-based animations with ngAnimate are unique since they require no JavaScript code at all. By using a CSS class that we reference between our HTML
+ * and CSS code we can create an animation that will be picked up by Angular when an the underlying directive performs an operation.
+ *
+ * The example below shows how an `enter` animation can be made possible on an element using `ng-if`:
+ *
+ * ```html
+ * <div ng-if="bool" class="fade">
+ *    Fade me in out
+ * </div>
+ * <button ng-click="bool=true">Fade In!</button>
+ * <button ng-click="bool=false">Fade Out!</button>
+ * ```
+ *
+ * Notice the CSS class **fade**? We can now create the CSS transition code that references this class:
+ *
+ * ```css
+ * /&#42; The starting CSS styles for the enter animation &#42;/
+ * .fade.ng-enter {
+ *   transition:0.5s linear all;
+ *   opacity:0;
+ * }
+ *
+ * /&#42; The finishing CSS styles for the enter animation &#42;/
+ * .fade.ng-enter.ng-enter-active {
+ *   opacity:1;
+ * }
+ * ```
+ *
+ * The key thing to remember here is that, depending on the animation event (which each of the directives above trigger depending on what's going on) two
+ * generated CSS classes will be applied to the element; in the example above we have `.ng-enter` and `.ng-enter-active`. For CSS transitions, the transition
+ * code **must** be defined within the starting CSS class (in this case `.ng-enter`). The destination class is what the transition will animate towards.
+ *
+ * If for example we wanted to create animations for `leave` and `move` (ngRepeat triggers move) then we can do so using the same CSS naming conventions:
+ *
+ * ```css
+ * /&#42; now the element will fade out before it is removed from the DOM &#42;/
+ * .fade.ng-leave {
+ *   transition:0.5s linear all;
+ *   opacity:1;
+ * }
+ * .fade.ng-leave.ng-leave-active {
+ *   opacity:0;
+ * }
+ * ```
+ *
+ * We can also make use of **CSS Keyframes** by referencing the keyframe animation within the starting CSS class:
+ *
+ * ```css
+ * /&#42; there is no need to define anything inside of the destination
+ * CSS class since the keyframe will take charge of the animation &#42;/
+ * .fade.ng-leave {
+ *   animation: my_fade_animation 0.5s linear;
+ *   -webkit-animation: my_fade_animation 0.5s linear;
+ * }
+ *
+ * @keyframes my_fade_animation {
+ *   from { opacity:1; }
+ *   to { opacity:0; }
+ * }
+ *
+ * @-webkit-keyframes my_fade_animation {
+ *   from { opacity:1; }
+ *   to { opacity:0; }
+ * }
+ * ```
+ *
+ * Feel free also mix transitions and keyframes together as well as any other CSS classes on the same element.
+ *
+ * ### CSS Class-based Animations
+ *
+ * Class-based animations (animations that are triggered via `ngClass`, `ngShow`, `ngHide` and some other directives) have a slightly different
+ * naming convention. Class-based animations are basic enough that a standard transition or keyframe can be referenced on the class being added
+ * and removed.
+ *
+ * For example if we wanted to do a CSS animation for `ngHide` then we place an animation on the `.ng-hide` CSS class:
+ *
+ * ```html
+ * <div ng-show="bool" class="fade">
+ *   Show and hide me
+ * </div>
+ * <button ng-click="bool=!bool">Toggle</button>
+ *
+ * <style>
+ * .fade.ng-hide {
+ *   transition:0.5s linear all;
+ *   opacity:0;
+ * }
+ * </style>
+ * ```
+ *
+ * All that is going on here with ngShow/ngHide behind the scenes is the `.ng-hide` class is added/removed (when the hidden state is valid). Since
+ * ngShow and ngHide are animation aware then we can match up a transition and ngAnimate handles the rest.
+ *
+ * In addition the addition and removal of the CSS class, ngAnimate also provides two helper methods that we can use to further decorate the animation
+ * with CSS styles.
+ *
+ * ```html
+ * <div ng-class="{on:onOff}" class="highlight">
+ *   Highlight this box
+ * </div>
+ * <button ng-click="onOff=!onOff">Toggle</button>
+ *
+ * <style>
+ * .highlight {
+ *   transition:0.5s linear all;
+ * }
+ * .highlight.on-add {
+ *   background:white;
+ * }
+ * .highlight.on {
+ *   background:yellow;
+ * }
+ * .highlight.on-remove {
+ *   background:black;
+ * }
+ * </style>
+ * ```
+ *
+ * We can also make use of CSS keyframes by placing them within the CSS classes.
+ *
+ *
+ * ### CSS Staggering Animations
+ * A Staggering animation is a collection of animations that are issued with a slight delay in between each successive operation resulting in a
+ * curtain-like effect. The ngAnimate module (versions >=1.2) supports staggering animations and the stagger effect can be
+ * performed by creating a **ng-EVENT-stagger** CSS class and attaching that class to the base CSS class used for
+ * the animation. The style property expected within the stagger class can either be a **transition-delay** or an
+ * **animation-delay** property (or both if your animation contains both transitions and keyframe animations).
+ *
+ * ```css
+ * .my-animation.ng-enter {
+ *   /&#42; standard transition code &#42;/
+ *   transition: 1s linear all;
+ *   opacity:0;
+ * }
+ * .my-animation.ng-enter-stagger {
+ *   /&#42; this will have a 100ms delay between each successive leave animation &#42;/
+ *   transition-delay: 0.1s;
+ *
+ *   /&#42; As of 1.4.4, this must always be set: it signals ngAnimate
+ *     to not accidentally inherit a delay property from another CSS class &#42;/
+ *   transition-duration: 0s;
+ * }
+ * .my-animation.ng-enter.ng-enter-active {
+ *   /&#42; standard transition styles &#42;/
+ *   opacity:1;
+ * }
+ * ```
+ *
+ * Staggering animations work by default in ngRepeat (so long as the CSS class is defined). Outside of ngRepeat, to use staggering animations
+ * on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this
+ * are that each of the elements must have the same CSS className value as well as the same parent element. A stagger operation
+ * will also be reset if one or more animation frames have passed since the multiple calls to `$animate` were fired.
+ *
+ * The following code will issue the **ng-leave-stagger** event on the element provided:
+ *
+ * ```js
+ * var kids = parent.children();
+ *
+ * $animate.leave(kids[0]); //stagger index=0
+ * $animate.leave(kids[1]); //stagger index=1
+ * $animate.leave(kids[2]); //stagger index=2
+ * $animate.leave(kids[3]); //stagger index=3
+ * $animate.leave(kids[4]); //stagger index=4
+ *
+ * window.requestAnimationFrame(function() {
+ *   //stagger has reset itself
+ *   $animate.leave(kids[5]); //stagger index=0
+ *   $animate.leave(kids[6]); //stagger index=1
+ *
+ *   $scope.$digest();
+ * });
+ * ```
+ *
+ * Stagger animations are currently only supported within CSS-defined animations.
+ *
+ * ### The `ng-animate` CSS class
+ *
+ * When ngAnimate is animating an element it will apply the `ng-animate` CSS class to the element for the duration of the animation.
+ * This is a temporary CSS class and it will be removed once the animation is over (for both JavaScript and CSS-based animations).
+ *
+ * Therefore, animations can be applied to an element using this temporary class directly via CSS.
+ *
+ * ```css
+ * .zipper.ng-animate {
+ *   transition:0.5s linear all;
+ * }
+ * .zipper.ng-enter {
+ *   opacity:0;
+ * }
+ * .zipper.ng-enter.ng-enter-active {
+ *   opacity:1;
+ * }
+ * .zipper.ng-leave {
+ *   opacity:1;
+ * }
+ * .zipper.ng-leave.ng-leave-active {
+ *   opacity:0;
+ * }
+ * ```
+ *
+ * (Note that the `ng-animate` CSS class is reserved and it cannot be applied on an element directly since ngAnimate will always remove
+ * the CSS class once an animation has completed.)
+ *
+ *
+ * ### The `ng-[event]-prepare` class
+ *
+ * This is a special class that can be used to prevent unwanted flickering / flash of content before
+ * the actual animation starts. The class is added as soon as an animation is initialized, but removed
+ * before the actual animation starts (after waiting for a $digest).
+ * It is also only added for *structural* animations (`enter`, `move`, and `leave`).
+ *
+ * In practice, flickering can appear when nesting elements with structural animations such as `ngIf`
+ * into elements that have class-based animations such as `ngClass`.
+ *
+ * ```html
+ * <div ng-class="{red: myProp}">
+ *   <div ng-class="{blue: myProp}">
+ *     <div class="message" ng-if="myProp"></div>
+ *   </div>
+ * </div>
+ * ```
+ *
+ * It is possible that during the `enter` animation, the `.message` div will be briefly visible before it starts animating.
+ * In that case, you can add styles to the CSS that make sure the element stays hidden before the animation starts:
+ *
+ * ```css
+ * .message.ng-enter-prepare {
+ *   opacity: 0;
+ * }
+ *
+ * ```
+ *
+ * ## JavaScript-based Animations
+ *
+ * ngAnimate also allows for animations to be consumed by JavaScript code. The approach is similar to CSS-based animations (where there is a shared
+ * CSS class that is referenced in our HTML code) but in addition we need to register the JavaScript animation on the module. By making use of the
+ * `module.animation()` module function we can register the animation.
+ *
+ * Let's see an example of a enter/leave animation using `ngRepeat`:
+ *
+ * ```html
+ * <div ng-repeat="item in items" class="slide">
+ *   {{ item }}
+ * </div>
+ * ```
+ *
+ * See the **slide** CSS class? Let's use that class to define an animation that we'll structure in our module code by using `module.animation`:
+ *
+ * ```js
+ * myModule.animation('.slide', [function() {
+ *   return {
+ *     // make note that other events (like addClass/removeClass)
+ *     // have different function input parameters
+ *     enter: function(element, doneFn) {
+ *       jQuery(element).fadeIn(1000, doneFn);
+ *
+ *       // remember to call doneFn so that angular
+ *       // knows that the animation has concluded
+ *     },
+ *
+ *     move: function(element, doneFn) {
+ *       jQuery(element).fadeIn(1000, doneFn);
+ *     },
+ *
+ *     leave: function(element, doneFn) {
+ *       jQuery(element).fadeOut(1000, doneFn);
+ *     }
+ *   }
+ * }]);
+ * ```
+ *
+ * The nice thing about JS-based animations is that we can inject other services and make use of advanced animation libraries such as
+ * greensock.js and velocity.js.
+ *
+ * If our animation code class-based (meaning that something like `ngClass`, `ngHide` and `ngShow` triggers it) then we can still define
+ * our animations inside of the same registered animation, however, the function input arguments are a bit different:
+ *
+ * ```html
+ * <div ng-class="color" class="colorful">
+ *   this box is moody
+ * </div>
+ * <button ng-click="color='red'">Change to red</button>
+ * <button ng-click="color='blue'">Change to blue</button>
+ * <button ng-click="color='green'">Change to green</button>
+ * ```
+ *
+ * ```js
+ * myModule.animation('.colorful', [function() {
+ *   return {
+ *     addClass: function(element, className, doneFn) {
+ *       // do some cool animation and call the doneFn
+ *     },
+ *     removeClass: function(element, className, doneFn) {
+ *       // do some cool animation and call the doneFn
+ *     },
+ *     setClass: function(element, addedClass, removedClass, doneFn) {
+ *       // do some cool animation and call the doneFn
+ *     }
+ *   }
+ * }]);
+ * ```
+ *
+ * ## CSS + JS Animations Together
+ *
+ * AngularJS 1.4 and higher has taken steps to make the amalgamation of CSS and JS animations more flexible. However, unlike earlier versions of Angular,
+ * defining CSS and JS animations to work off of the same CSS class will not work anymore. Therefore the example below will only result in **JS animations taking
+ * charge of the animation**:
+ *
+ * ```html
+ * <div ng-if="bool" class="slide">
+ *   Slide in and out
+ * </div>
+ * ```
+ *
+ * ```js
+ * myModule.animation('.slide', [function() {
+ *   return {
+ *     enter: function(element, doneFn) {
+ *       jQuery(element).slideIn(1000, doneFn);
+ *     }
+ *   }
+ * }]);
+ * ```
+ *
+ * ```css
+ * .slide.ng-enter {
+ *   transition:0.5s linear all;
+ *   transform:translateY(-100px);
+ * }
+ * .slide.ng-enter.ng-enter-active {
+ *   transform:translateY(0);
+ * }
+ * ```
+ *
+ * Does this mean that CSS and JS animations cannot be used together? Do JS-based animations always have higher priority? We can make up for the
+ * lack of CSS animations by using the `$animateCss` service to trigger our own tweaked-out, CSS-based animations directly from
+ * our own JS-based animation code:
+ *
+ * ```js
+ * myModule.animation('.slide', ['$animateCss', function($animateCss) {
+ *   return {
+ *     enter: function(element) {
+*        // this will trigger `.slide.ng-enter` and `.slide.ng-enter-active`.
+ *       return $animateCss(element, {
+ *         event: 'enter',
+ *         structural: true
+ *       });
+ *     }
+ *   }
+ * }]);
+ * ```
+ *
+ * The nice thing here is that we can save bandwidth by sticking to our CSS-based animation code and we don't need to rely on a 3rd-party animation framework.
+ *
+ * The `$animateCss` service is very powerful since we can feed in all kinds of extra properties that will be evaluated and fed into a CSS transition or
+ * keyframe animation. For example if we wanted to animate the height of an element while adding and removing classes then we can do so by providing that
+ * data into `$animateCss` directly:
+ *
+ * ```js
+ * myModule.animation('.slide', ['$animateCss', function($animateCss) {
+ *   return {
+ *     enter: function(element) {
+ *       return $animateCss(element, {
+ *         event: 'enter',
+ *         structural: true,
+ *         addClass: 'maroon-setting',
+ *         from: { height:0 },
+ *         to: { height: 200 }
+ *       });
+ *     }
+ *   }
+ * }]);
+ * ```
+ *
+ * Now we can fill in the rest via our transition CSS code:
+ *
+ * ```css
+ * /&#42; the transition tells ngAnimate to make the animation happen &#42;/
+ * .slide.ng-enter { transition:0.5s linear all; }
+ *
+ * /&#42; this extra CSS class will be absorbed into the transition
+ * since the $animateCss code is adding the class &#42;/
+ * .maroon-setting { background:red; }
+ * ```
+ *
+ * And `$animateCss` will figure out the rest. Just make sure to have the `done()` callback fire the `doneFn` function to signal when the animation is over.
+ *
+ * To learn more about what's possible be sure to visit the {@link ngAnimate.$animateCss $animateCss service}.
+ *
+ * ## Animation Anchoring (via `ng-animate-ref`)
+ *
+ * ngAnimate in AngularJS 1.4 comes packed with the ability to cross-animate elements between
+ * structural areas of an application (like views) by pairing up elements using an attribute
+ * called `ng-animate-ref`.
+ *
+ * Let's say for example we have two views that are managed by `ng-view` and we want to show
+ * that there is a relationship between two components situated in within these views. By using the
+ * `ng-animate-ref` attribute we can identify that the two components are paired together and we
+ * can then attach an animation, which is triggered when the view changes.
+ *
+ * Say for example we have the following template code:
+ *
+ * ```html
+ * <!-- index.html -->
+ * <div ng-view class="view-animation">
+ * </div>
+ *
+ * <!-- home.html -->
+ * <a href="#/banner-page">
+ *   <img src="./banner.jpg" class="banner" ng-animate-ref="banner">
+ * </a>
+ *
+ * <!-- banner-page.html -->
+ * <img src="./banner.jpg" class="banner" ng-animate-ref="banner">
+ * ```
+ *
+ * Now, when the view changes (once the link is clicked), ngAnimate will examine the
+ * HTML contents to see if there is a match reference between any components in the view
+ * that is leaving and the view that is entering. It will scan both the view which is being
+ * removed (leave) and inserted (enter) to see if there are any paired DOM elements that
+ * contain a matching ref value.
+ *
+ * The two images match since they share the same ref value. ngAnimate will now create a
+ * transport element (which is a clone of the first image element) and it will then attempt
+ * to animate to the position of the second image element in the next view. For the animation to
+ * work a special CSS class called `ng-anchor` will be added to the transported element.
+ *
+ * We can now attach a transition onto the `.banner.ng-anchor` CSS class and then
+ * ngAnimate will handle the entire transition for us as well as the addition and removal of
+ * any changes of CSS classes between the elements:
+ *
+ * ```css
+ * .banner.ng-anchor {
+ *   /&#42; this animation will last for 1 second since there are
+ *          two phases to the animation (an `in` and an `out` phase) &#42;/
+ *   transition:0.5s linear all;
+ * }
+ * ```
+ *
+ * We also **must** include animations for the views that are being entered and removed
+ * (otherwise anchoring wouldn't be possible since the new view would be inserted right away).
+ *
+ * ```css
+ * .view-animation.ng-enter, .view-animation.ng-leave {
+ *   transition:0.5s linear all;
+ *   position:fixed;
+ *   left:0;
+ *   top:0;
+ *   width:100%;
+ * }
+ * .view-animation.ng-enter {
+ *   transform:translateX(100%);
+ * }
+ * .view-animation.ng-leave,
+ * .view-animation.ng-enter.ng-enter-active {
+ *   transform:translateX(0%);
+ * }
+ * .view-animation.ng-leave.ng-leave-active {
+ *   transform:translateX(-100%);
+ * }
+ * ```
+ *
+ * Now we can jump back to the anchor animation. When the animation happens, there are two stages that occur:
+ * an `out` and an `in` stage. The `out` stage happens first and that is when the element is animated away
+ * from its origin. Once that animation is over then the `in` stage occurs which animates the
+ * element to its destination. The reason why there are two animations is to give enough time
+ * for the enter animation on the new element to be ready.
+ *
+ * The example above sets up a transition for both the in and out phases, but we can also target the out or
+ * in phases directly via `ng-anchor-out` and `ng-anchor-in`.
+ *
+ * ```css
+ * .banner.ng-anchor-out {
+ *   transition: 0.5s linear all;
+ *
+ *   /&#42; the scale will be applied during the out animation,
+ *          but will be animated away when the in animation runs &#42;/
+ *   transform: scale(1.2);
+ * }
+ *
+ * .banner.ng-anchor-in {
+ *   transition: 1s linear all;
+ * }
+ * ```
+ *
+ *
+ *
+ *
+ * ### Anchoring Demo
+ *
+  <example module="anchoringExample"
+           name="anchoringExample"
+           id="anchoringExample"
+           deps="angular-animate.js;angular-route.js"
+           animations="true">
+    <file name="index.html">
+      <a href="#/">Home</a>
+      <hr />
+      <div class="view-container">
+        <div ng-view class="view"></div>
+      </div>
+    </file>
+    <file name="script.js">
+      angular.module('anchoringExample', ['ngAnimate', 'ngRoute'])
+        .config(['$routeProvider', function($routeProvider) {
+          $routeProvider.when('/', {
+            templateUrl: 'home.html',
+            controller: 'HomeController as home'
+          });
+          $routeProvider.when('/profile/:id', {
+            templateUrl: 'profile.html',
+            controller: 'ProfileController as profile'
+          });
+        }])
+        .run(['$rootScope', function($rootScope) {
+          $rootScope.records = [
+            { id:1, title: "Miss Beulah Roob" },
+            { id:2, title: "Trent Morissette" },
+            { id:3, title: "Miss Ava Pouros" },
+            { id:4, title: "Rod Pouros" },
+            { id:5, title: "Abdul Rice" },
+            { id:6, title: "Laurie Rutherford Sr." },
+            { id:7, title: "Nakia McLaughlin" },
+            { id:8, title: "Jordon Blanda DVM" },
+            { id:9, title: "Rhoda Hand" },
+            { id:10, title: "Alexandrea Sauer" }
+          ];
+        }])
+        .controller('HomeController', [function() {
+          //empty
+        }])
+        .controller('ProfileController', ['$rootScope', '$routeParams', function($rootScope, $routeParams) {
+          var index = parseInt($routeParams.id, 10);
+          var record = $rootScope.records[index - 1];
+
+          this.title = record.title;
+          this.id = record.id;
+        }]);
+    </file>
+    <file name="home.html">
+      <h2>Welcome to the home page</h1>
+      <p>Please click on an element</p>
+      <a class="record"
+         ng-href="#/profile/{{ record.id }}"
+         ng-animate-ref="{{ record.id }}"
+         ng-repeat="record in records">
+        {{ record.title }}
+      </a>
+    </file>
+    <file name="profile.html">
+      <div class="profile record" ng-animate-ref="{{ profile.id }}">
+        {{ profile.title }}
+      </div>
+    </file>
+    <file name="animations.css">
+      .record {
+        display:block;
+        font-size:20px;
+      }
+      .profile {
+        background:black;
+        color:white;
+        font-size:100px;
+      }
+      .view-container {
+        position:relative;
+      }
+      .view-container > .view.ng-animate {
+        position:absolute;
+        top:0;
+        left:0;
+        width:100%;
+        min-height:500px;
+      }
+      .view.ng-enter, .view.ng-leave,
+      .record.ng-anchor {
+        transition:0.5s linear all;
+      }
+      .view.ng-enter {
+        transform:translateX(100%);
+      }
+      .view.ng-enter.ng-enter-active, .view.ng-leave {
+        transform:translateX(0%);
+      }
+      .view.ng-leave.ng-leave-active {
+        transform:translateX(-100%);
+      }
+      .record.ng-anchor-out {
+        background:red;
+      }
+    </file>
+  </example>
+ *
+ * ### How is the element transported?
+ *
+ * When an anchor animation occurs, ngAnimate will clone the starting element and position it exactly where the starting
+ * element is located on screen via absolute positioning. The cloned element will be placed inside of the root element
+ * of the application (where ng-app was defined) and all of the CSS classes of the starting element will be applied. The
+ * element will then animate into the `out` and `in` animations and will eventually reach the coordinates and match
+ * the dimensions of the destination element. During the entire animation a CSS class of `.ng-animate-shim` will be applied
+ * to both the starting and destination elements in order to hide them from being visible (the CSS styling for the class
+ * is: `visibility:hidden`). Once the anchor reaches its destination then it will be removed and the destination element
+ * will become visible since the shim class will be removed.
+ *
+ * ### How is the morphing handled?
+ *
+ * CSS Anchoring relies on transitions and keyframes and the internal code is intelligent enough to figure out
+ * what CSS classes differ between the starting element and the destination element. These different CSS classes
+ * will be added/removed on the anchor element and a transition will be applied (the transition that is provided
+ * in the anchor class). Long story short, ngAnimate will figure out what classes to add and remove which will
+ * make the transition of the element as smooth and automatic as possible. Be sure to use simple CSS classes that
+ * do not rely on DOM nesting structure so that the anchor element appears the same as the starting element (since
+ * the cloned element is placed inside of root element which is likely close to the body element).
+ *
+ * Note that if the root element is on the `<html>` element then the cloned node will be placed inside of body.
+ *
+ *
+ * ## Using $animate in your directive code
+ *
+ * So far we've explored how to feed in animations into an Angular application, but how do we trigger animations within our own directives in our application?
+ * By injecting the `$animate` service into our directive code, we can trigger structural and class-based hooks which can then be consumed by animations. Let's
+ * imagine we have a greeting box that shows and hides itself when the data changes
+ *
+ * ```html
+ * <greeting-box active="onOrOff">Hi there</greeting-box>
+ * ```
+ *
+ * ```js
+ * ngModule.directive('greetingBox', ['$animate', function($animate) {
+ *   return function(scope, element, attrs) {
+ *     attrs.$observe('active', function(value) {
+ *       value ? $animate.addClass(element, 'on') : $animate.removeClass(element, 'on');
+ *     });
+ *   });
+ * }]);
+ * ```
+ *
+ * Now the `on` CSS class is added and removed on the greeting box component. Now if we add a CSS class on top of the greeting box element
+ * in our HTML code then we can trigger a CSS or JS animation to happen.
+ *
+ * ```css
+ * /&#42; normally we would create a CSS class to reference on the element &#42;/
+ * greeting-box.on { transition:0.5s linear all; background:green; color:white; }
+ * ```
+ *
+ * The `$animate` service contains a variety of other methods like `enter`, `leave`, `animate` and `setClass`. To learn more about what's
+ * possible be sure to visit the {@link ng.$animate $animate service API page}.
+ *
+ *
+ * ## Callbacks and Promises
+ *
+ * When `$animate` is called it returns a promise that can be used to capture when the animation has ended. Therefore if we were to trigger
+ * an animation (within our directive code) then we can continue performing directive and scope related activities after the animation has
+ * ended by chaining onto the returned promise that animation method returns.
+ *
+ * ```js
+ * // somewhere within the depths of the directive
+ * $animate.enter(element, parent).then(function() {
+ *   //the animation has completed
+ * });
+ * ```
+ *
+ * (Note that earlier versions of Angular prior to v1.4 required the promise code to be wrapped using `$scope.$apply(...)`. This is not the case
+ * anymore.)
+ *
+ * In addition to the animation promise, we can also make use of animation-related callbacks within our directives and controller code by registering
+ * an event listener using the `$animate` service. Let's say for example that an animation was triggered on our view
+ * routing controller to hook into that:
+ *
+ * ```js
+ * ngModule.controller('HomePageController', ['$animate', function($animate) {
+ *   $animate.on('enter', ngViewElement, function(element) {
+ *     // the animation for this route has completed
+ *   }]);
+ * }])
+ * ```
+ *
+ * (Note that you will need to trigger a digest within the callback to get angular to notice any scope-related changes.)
+ */
+
+var copy;
+var extend;
+var forEach;
+var isArray;
+var isDefined;
+var isElement;
+var isFunction;
+var isObject;
+var isString;
+var isUndefined;
+var jqLite;
+var noop;
+
+/**
+ * @ngdoc service
+ * @name $animate
+ * @kind object
+ *
+ * @description
+ * The ngAnimate `$animate` service documentation is the same for the core `$animate` service.
+ *
+ * Click here {@link ng.$animate to learn more about animations with `$animate`}.
+ */
+angular.module('ngAnimate', [], function initAngularHelpers() {
+  // Access helpers from angular core.
+  // Do it inside a `config` block to ensure `window.angular` is available.
+  noop        = angular.noop;
+  copy        = angular.copy;
+  extend      = angular.extend;
+  jqLite      = angular.element;
+  forEach     = angular.forEach;
+  isArray     = angular.isArray;
+  isString    = angular.isString;
+  isObject    = angular.isObject;
+  isUndefined = angular.isUndefined;
+  isDefined   = angular.isDefined;
+  isFunction  = angular.isFunction;
+  isElement   = angular.isElement;
+})
+  .directive('ngAnimateSwap', ngAnimateSwapDirective)
+
+  .directive('ngAnimateChildren', $$AnimateChildrenDirective)
+  .factory('$$rAFScheduler', $$rAFSchedulerFactory)
+
+  .provider('$$animateQueue', $$AnimateQueueProvider)
+  .provider('$$animation', $$AnimationProvider)
+
+  .provider('$animateCss', $AnimateCssProvider)
+  .provider('$$animateCssDriver', $$AnimateCssDriverProvider)
+
+  .provider('$$animateJs', $$AnimateJsProvider)
+  .provider('$$animateJsDriver', $$AnimateJsDriverProvider);
+
+
+})(window, window.angular);
diff --git a/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/js/angular-sanitize.js b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/js/angular-sanitize.js
new file mode 100644
index 0000000..a283e43
--- /dev/null
+++ b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/js/angular-sanitize.js
@@ -0,0 +1,738 @@
+/**
+ * @license AngularJS v1.5.8
+ * (c) 2010-2016 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window, angular) {'use strict';
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *     Any commits to this file should be reviewed with security in mind.  *
+ *   Changes to this file can potentially create security vulnerabilities. *
+ *          An approval from 2 Core members with history of modifying      *
+ *                         this file is required.                          *
+ *                                                                         *
+ *  Does the change somehow allow for arbitrary javascript to be executed? *
+ *    Or allows for someone to change the prototype of built-in objects?   *
+ *     Or gives undesired access to variables likes document or window?    *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+var $sanitizeMinErr = angular.$$minErr('$sanitize');
+var bind;
+var extend;
+var forEach;
+var isDefined;
+var lowercase;
+var noop;
+var htmlParser;
+var htmlSanitizeWriter;
+
+/**
+ * @ngdoc module
+ * @name ngSanitize
+ * @description
+ *
+ * # ngSanitize
+ *
+ * The `ngSanitize` module provides functionality to sanitize HTML.
+ *
+ *
+ * <div doc-module-components="ngSanitize"></div>
+ *
+ * See {@link ngSanitize.$sanitize `$sanitize`} for usage.
+ */
+
+/**
+ * @ngdoc service
+ * @name $sanitize
+ * @kind function
+ *
+ * @description
+ *   Sanitizes an html string by stripping all potentially dangerous tokens.
+ *
+ *   The input is sanitized by parsing the HTML into tokens. All safe tokens (from a whitelist) are
+ *   then serialized back to properly escaped html string. This means that no unsafe input can make
+ *   it into the returned string.
+ *
+ *   The whitelist for URL sanitization of attribute values is configured using the functions
+ *   `aHrefSanitizationWhitelist` and `imgSrcSanitizationWhitelist` of {@link ng.$compileProvider
+ *   `$compileProvider`}.
+ *
+ *   The input may also contain SVG markup if this is enabled via {@link $sanitizeProvider}.
+ *
+ * @param {string} html HTML input.
+ * @returns {string} Sanitized HTML.
+ *
+ * @example
+   <example module="sanitizeExample" deps="angular-sanitize.js">
+   <file name="index.html">
+     <script>
+         angular.module('sanitizeExample', ['ngSanitize'])
+           .controller('ExampleController', ['$scope', '$sce', function($scope, $sce) {
+             $scope.snippet =
+               '<p style="color:blue">an html\n' +
+               '<em onmouseover="this.textContent=\'PWN3D!\'">click here</em>\n' +
+               'snippet</p>';
+             $scope.deliberatelyTrustDangerousSnippet = function() {
+               return $sce.trustAsHtml($scope.snippet);
+             };
+           }]);
+     </script>
+     <div ng-controller="ExampleController">
+        Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
+       <table>
+         <tr>
+           <td>Directive</td>
+           <td>How</td>
+           <td>Source</td>
+           <td>Rendered</td>
+         </tr>
+         <tr id="bind-html-with-sanitize">
+           <td>ng-bind-html</td>
+           <td>Automatically uses $sanitize</td>
+           <td><pre>&lt;div ng-bind-html="snippet"&gt;<br/>&lt;/div&gt;</pre></td>
+           <td><div ng-bind-html="snippet"></div></td>
+         </tr>
+         <tr id="bind-html-with-trust">
+           <td>ng-bind-html</td>
+           <td>Bypass $sanitize by explicitly trusting the dangerous value</td>
+           <td>
+           <pre>&lt;div ng-bind-html="deliberatelyTrustDangerousSnippet()"&gt;
+&lt;/div&gt;</pre>
+           </td>
+           <td><div ng-bind-html="deliberatelyTrustDangerousSnippet()"></div></td>
+         </tr>
+         <tr id="bind-default">
+           <td>ng-bind</td>
+           <td>Automatically escapes</td>
+           <td><pre>&lt;div ng-bind="snippet"&gt;<br/>&lt;/div&gt;</pre></td>
+           <td><div ng-bind="snippet"></div></td>
+         </tr>
+       </table>
+       </div>
+   </file>
+   <file name="protractor.js" type="protractor">
+     it('should sanitize the html snippet by default', function() {
+       expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
+         toBe('<p>an html\n<em>click here</em>\nsnippet</p>');
+     });
+
+     it('should inline raw snippet if bound to a trusted value', function() {
+       expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).
+         toBe("<p style=\"color:blue\">an html\n" +
+              "<em onmouseover=\"this.textContent='PWN3D!'\">click here</em>\n" +
+              "snippet</p>");
+     });
+
+     it('should escape snippet without any filter', function() {
+       expect(element(by.css('#bind-default div')).getInnerHtml()).
+         toBe("&lt;p style=\"color:blue\"&gt;an html\n" +
+              "&lt;em onmouseover=\"this.textContent='PWN3D!'\"&gt;click here&lt;/em&gt;\n" +
+              "snippet&lt;/p&gt;");
+     });
+
+     it('should update', function() {
+       element(by.model('snippet')).clear();
+       element(by.model('snippet')).sendKeys('new <b onclick="alert(1)">text</b>');
+       expect(element(by.css('#bind-html-with-sanitize div')).getInnerHtml()).
+         toBe('new <b>text</b>');
+       expect(element(by.css('#bind-html-with-trust div')).getInnerHtml()).toBe(
+         'new <b onclick="alert(1)">text</b>');
+       expect(element(by.css('#bind-default div')).getInnerHtml()).toBe(
+         "new &lt;b onclick=\"alert(1)\"&gt;text&lt;/b&gt;");
+     });
+   </file>
+   </example>
+ */
+
+
+/**
+ * @ngdoc provider
+ * @name $sanitizeProvider
+ *
+ * @description
+ * Creates and configures {@link $sanitize} instance.
+ */
+function $SanitizeProvider() {
+  var svgEnabled = false;
+
+  this.$get = ['$$sanitizeUri', function($$sanitizeUri) {
+    if (svgEnabled) {
+      extend(validElements, svgElements);
+    }
+    return function(html) {
+      var buf = [];
+      htmlParser(html, htmlSanitizeWriter(buf, function(uri, isImage) {
+        return !/^unsafe:/.test($$sanitizeUri(uri, isImage));
+      }));
+      return buf.join('');
+    };
+  }];
+
+
+  /**
+   * @ngdoc method
+   * @name $sanitizeProvider#enableSvg
+   * @kind function
+   *
+   * @description
+   * Enables a subset of svg to be supported by the sanitizer.
+   *
+   * <div class="alert alert-warning">
+   *   <p>By enabling this setting without taking other precautions, you might expose your
+   *   application to click-hijacking attacks. In these attacks, sanitized svg elements could be positioned
+   *   outside of the containing element and be rendered over other elements on the page (e.g. a login
+   *   link). Such behavior can then result in phishing incidents.</p>
+   *
+   *   <p>To protect against these, explicitly setup `overflow: hidden` css rule for all potential svg
+   *   tags within the sanitized content:</p>
+   *
+   *   <br>
+   *
+   *   <pre><code>
+   *   .rootOfTheIncludedContent svg {
+   *     overflow: hidden !important;
+   *   }
+   *   </code></pre>
+   * </div>
+   *
+   * @param {boolean=} flag Enable or disable SVG support in the sanitizer.
+   * @returns {boolean|ng.$sanitizeProvider} Returns the currently configured value if called
+   *    without an argument or self for chaining otherwise.
+   */
+  this.enableSvg = function(enableSvg) {
+    if (isDefined(enableSvg)) {
+      svgEnabled = enableSvg;
+      return this;
+    } else {
+      return svgEnabled;
+    }
+  };
+
+  //////////////////////////////////////////////////////////////////////////////////////////////////
+  // Private stuff
+  //////////////////////////////////////////////////////////////////////////////////////////////////
+
+  bind = angular.bind;
+  extend = angular.extend;
+  forEach = angular.forEach;
+  isDefined = angular.isDefined;
+  lowercase = angular.lowercase;
+  noop = angular.noop;
+
+  htmlParser = htmlParserImpl;
+  htmlSanitizeWriter = htmlSanitizeWriterImpl;
+
+  // Regular Expressions for parsing tags and attributes
+  var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g,
+    // Match everything outside of normal chars and " (quote character)
+    NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g;
+
+
+  // Good source of info about elements and attributes
+  // http://dev.w3.org/html5/spec/Overview.html#semantics
+  // http://simon.html5.org/html-elements
+
+  // Safe Void Elements - HTML5
+  // http://dev.w3.org/html5/spec/Overview.html#void-elements
+  var voidElements = toMap("area,br,col,hr,img,wbr");
+
+  // Elements that you can, intentionally, leave open (and which close themselves)
+  // http://dev.w3.org/html5/spec/Overview.html#optional-tags
+  var optionalEndTagBlockElements = toMap("colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr"),
+      optionalEndTagInlineElements = toMap("rp,rt"),
+      optionalEndTagElements = extend({},
+                                              optionalEndTagInlineElements,
+                                              optionalEndTagBlockElements);
+
+  // Safe Block Elements - HTML5
+  var blockElements = extend({}, optionalEndTagBlockElements, toMap("address,article," +
+          "aside,blockquote,caption,center,del,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5," +
+          "h6,header,hgroup,hr,ins,map,menu,nav,ol,pre,section,table,ul"));
+
+  // Inline Elements - HTML5
+  var inlineElements = extend({}, optionalEndTagInlineElements, toMap("a,abbr,acronym,b," +
+          "bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,q,ruby,rp,rt,s," +
+          "samp,small,span,strike,strong,sub,sup,time,tt,u,var"));
+
+  // SVG Elements
+  // https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Elements
+  // Note: the elements animate,animateColor,animateMotion,animateTransform,set are intentionally omitted.
+  // They can potentially allow for arbitrary javascript to be executed. See #11290
+  var svgElements = toMap("circle,defs,desc,ellipse,font-face,font-face-name,font-face-src,g,glyph," +
+          "hkern,image,linearGradient,line,marker,metadata,missing-glyph,mpath,path,polygon,polyline," +
+          "radialGradient,rect,stop,svg,switch,text,title,tspan");
+
+  // Blocked Elements (will be stripped)
+  var blockedElements = toMap("script,style");
+
+  var validElements = extend({},
+                                     voidElements,
+                                     blockElements,
+                                     inlineElements,
+                                     optionalEndTagElements);
+
+  //Attributes that have href and hence need to be sanitized
+  var uriAttrs = toMap("background,cite,href,longdesc,src,xlink:href");
+
+  var htmlAttrs = toMap('abbr,align,alt,axis,bgcolor,border,cellpadding,cellspacing,class,clear,' +
+      'color,cols,colspan,compact,coords,dir,face,headers,height,hreflang,hspace,' +
+      'ismap,lang,language,nohref,nowrap,rel,rev,rows,rowspan,rules,' +
+      'scope,scrolling,shape,size,span,start,summary,tabindex,target,title,type,' +
+      'valign,value,vspace,width');
+
+  // SVG attributes (without "id" and "name" attributes)
+  // https://wiki.whatwg.org/wiki/Sanitization_rules#svg_Attributes
+  var svgAttrs = toMap('accent-height,accumulate,additive,alphabetic,arabic-form,ascent,' +
+      'baseProfile,bbox,begin,by,calcMode,cap-height,class,color,color-rendering,content,' +
+      'cx,cy,d,dx,dy,descent,display,dur,end,fill,fill-rule,font-family,font-size,font-stretch,' +
+      'font-style,font-variant,font-weight,from,fx,fy,g1,g2,glyph-name,gradientUnits,hanging,' +
+      'height,horiz-adv-x,horiz-origin-x,ideographic,k,keyPoints,keySplines,keyTimes,lang,' +
+      'marker-end,marker-mid,marker-start,markerHeight,markerUnits,markerWidth,mathematical,' +
+      'max,min,offset,opacity,orient,origin,overline-position,overline-thickness,panose-1,' +
+      'path,pathLength,points,preserveAspectRatio,r,refX,refY,repeatCount,repeatDur,' +
+      'requiredExtensions,requiredFeatures,restart,rotate,rx,ry,slope,stemh,stemv,stop-color,' +
+      'stop-opacity,strikethrough-position,strikethrough-thickness,stroke,stroke-dasharray,' +
+      'stroke-dashoffset,stroke-linecap,stroke-linejoin,stroke-miterlimit,stroke-opacity,' +
+      'stroke-width,systemLanguage,target,text-anchor,to,transform,type,u1,u2,underline-position,' +
+      'underline-thickness,unicode,unicode-range,units-per-em,values,version,viewBox,visibility,' +
+      'width,widths,x,x-height,x1,x2,xlink:actuate,xlink:arcrole,xlink:role,xlink:show,xlink:title,' +
+      'xlink:type,xml:base,xml:lang,xml:space,xmlns,xmlns:xlink,y,y1,y2,zoomAndPan', true);
+
+  var validAttrs = extend({},
+                                  uriAttrs,
+                                  svgAttrs,
+                                  htmlAttrs);
+
+  function toMap(str, lowercaseKeys) {
+    var obj = {}, items = str.split(','), i;
+    for (i = 0; i < items.length; i++) {
+      obj[lowercaseKeys ? lowercase(items[i]) : items[i]] = true;
+    }
+    return obj;
+  }
+
+  var inertBodyElement;
+  (function(window) {
+    var doc;
+    if (window.document && window.document.implementation) {
+      doc = window.document.implementation.createHTMLDocument("inert");
+    } else {
+      throw $sanitizeMinErr('noinert', "Can't create an inert html document");
+    }
+    var docElement = doc.documentElement || doc.getDocumentElement();
+    var bodyElements = docElement.getElementsByTagName('body');
+
+    // usually there should be only one body element in the document, but IE doesn't have any, so we need to create one
+    if (bodyElements.length === 1) {
+      inertBodyElement = bodyElements[0];
+    } else {
+      var html = doc.createElement('html');
+      inertBodyElement = doc.createElement('body');
+      html.appendChild(inertBodyElement);
+      doc.appendChild(html);
+    }
+  })(window);
+
+  /**
+   * @example
+   * htmlParser(htmlString, {
+   *     start: function(tag, attrs) {},
+   *     end: function(tag) {},
+   *     chars: function(text) {},
+   *     comment: function(text) {}
+   * });
+   *
+   * @param {string} html string
+   * @param {object} handler
+   */
+  function htmlParserImpl(html, handler) {
+    if (html === null || html === undefined) {
+      html = '';
+    } else if (typeof html !== 'string') {
+      html = '' + html;
+    }
+    inertBodyElement.innerHTML = html;
+
+    //mXSS protection
+    var mXSSAttempts = 5;
+    do {
+      if (mXSSAttempts === 0) {
+        throw $sanitizeMinErr('uinput', "Failed to sanitize html because the input is unstable");
+      }
+      mXSSAttempts--;
+
+      // strip custom-namespaced attributes on IE<=11
+      if (window.document.documentMode) {
+        stripCustomNsAttrs(inertBodyElement);
+      }
+      html = inertBodyElement.innerHTML; //trigger mXSS
+      inertBodyElement.innerHTML = html;
+    } while (html !== inertBodyElement.innerHTML);
+
+    var node = inertBodyElement.firstChild;
+    while (node) {
+      switch (node.nodeType) {
+        case 1: // ELEMENT_NODE
+          handler.start(node.nodeName.toLowerCase(), attrToMap(node.attributes));
+          break;
+        case 3: // TEXT NODE
+          handler.chars(node.textContent);
+          break;
+      }
+
+      var nextNode;
+      if (!(nextNode = node.firstChild)) {
+      if (node.nodeType == 1) {
+          handler.end(node.nodeName.toLowerCase());
+        }
+        nextNode = node.nextSibling;
+        if (!nextNode) {
+          while (nextNode == null) {
+            node = node.parentNode;
+            if (node === inertBodyElement) break;
+            nextNode = node.nextSibling;
+          if (node.nodeType == 1) {
+              handler.end(node.nodeName.toLowerCase());
+            }
+          }
+        }
+      }
+      node = nextNode;
+    }
+
+    while (node = inertBodyElement.firstChild) {
+      inertBodyElement.removeChild(node);
+    }
+  }
+
+  function attrToMap(attrs) {
+    var map = {};
+    for (var i = 0, ii = attrs.length; i < ii; i++) {
+      var attr = attrs[i];
+      map[attr.name] = attr.value;
+    }
+    return map;
+  }
+
+
+  /**
+   * Escapes all potentially dangerous characters, so that the
+   * resulting string can be safely inserted into attribute or
+   * element text.
+   * @param value
+   * @returns {string} escaped text
+   */
+  function encodeEntities(value) {
+    return value.
+      replace(/&/g, '&amp;').
+      replace(SURROGATE_PAIR_REGEXP, function(value) {
+        var hi = value.charCodeAt(0);
+        var low = value.charCodeAt(1);
+        return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
+      }).
+      replace(NON_ALPHANUMERIC_REGEXP, function(value) {
+        return '&#' + value.charCodeAt(0) + ';';
+      }).
+      replace(/</g, '&lt;').
+      replace(/>/g, '&gt;');
+  }
+
+  /**
+   * create an HTML/XML writer which writes to buffer
+   * @param {Array} buf use buf.join('') to get out sanitized html string
+   * @returns {object} in the form of {
+   *     start: function(tag, attrs) {},
+   *     end: function(tag) {},
+   *     chars: function(text) {},
+   *     comment: function(text) {}
+   * }
+   */
+  function htmlSanitizeWriterImpl(buf, uriValidator) {
+    var ignoreCurrentElement = false;
+    var out = bind(buf, buf.push);
+    return {
+      start: function(tag, attrs) {
+        tag = lowercase(tag);
+        if (!ignoreCurrentElement && blockedElements[tag]) {
+          ignoreCurrentElement = tag;
+        }
+        if (!ignoreCurrentElement && validElements[tag] === true) {
+          out('<');
+          out(tag);
+          forEach(attrs, function(value, key) {
+            var lkey = lowercase(key);
+            var isImage = (tag === 'img' && lkey === 'src') || (lkey === 'background');
+            if (validAttrs[lkey] === true &&
+              (uriAttrs[lkey] !== true || uriValidator(value, isImage))) {
+              out(' ');
+              out(key);
+              out('="');
+              out(encodeEntities(value));
+              out('"');
+            }
+          });
+          out('>');
+        }
+      },
+      end: function(tag) {
+        tag = lowercase(tag);
+        if (!ignoreCurrentElement && validElements[tag] === true && voidElements[tag] !== true) {
+          out('</');
+          out(tag);
+          out('>');
+        }
+        if (tag == ignoreCurrentElement) {
+          ignoreCurrentElement = false;
+        }
+      },
+      chars: function(chars) {
+        if (!ignoreCurrentElement) {
+          out(encodeEntities(chars));
+        }
+      }
+    };
+  }
+
+
+  /**
+   * When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1' attribute to declare
+   * ns1 namespace and prefixes the attribute with 'ns1' (e.g. 'ns1:xlink:foo'). This is undesirable since we don't want
+   * to allow any of these custom attributes. This method strips them all.
+   *
+   * @param node Root element to process
+   */
+  function stripCustomNsAttrs(node) {
+    if (node.nodeType === window.Node.ELEMENT_NODE) {
+      var attrs = node.attributes;
+      for (var i = 0, l = attrs.length; i < l; i++) {
+        var attrNode = attrs[i];
+        var attrName = attrNode.name.toLowerCase();
+        if (attrName === 'xmlns:ns1' || attrName.lastIndexOf('ns1:', 0) === 0) {
+          node.removeAttributeNode(attrNode);
+          i--;
+          l--;
+        }
+      }
+    }
+
+    var nextNode = node.firstChild;
+    if (nextNode) {
+      stripCustomNsAttrs(nextNode);
+    }
+
+    nextNode = node.nextSibling;
+    if (nextNode) {
+      stripCustomNsAttrs(nextNode);
+    }
+  }
+}
+
+function sanitizeText(chars) {
+  var buf = [];
+  var writer = htmlSanitizeWriter(buf, noop);
+  writer.chars(chars);
+  return buf.join('');
+}
+
+
+// define ngSanitize module and register $sanitize service
+angular.module('ngSanitize', []).provider('$sanitize', $SanitizeProvider);
+
+/**
+ * @ngdoc filter
+ * @name linky
+ * @kind function
+ *
+ * @description
+ * Finds links in text input and turns them into html links. Supports `http/https/ftp/mailto` and
+ * plain email address links.
+ *
+ * Requires the {@link ngSanitize `ngSanitize`} module to be installed.
+ *
+ * @param {string} text Input text.
+ * @param {string} target Window (`_blank|_self|_parent|_top`) or named frame to open links in.
+ * @param {object|function(url)} [attributes] Add custom attributes to the link element.
+ *
+ *    Can be one of:
+ *
+ *    - `object`: A map of attributes
+ *    - `function`: Takes the url as a parameter and returns a map of attributes
+ *
+ *    If the map of attributes contains a value for `target`, it overrides the value of
+ *    the target parameter.
+ *
+ *
+ * @returns {string} Html-linkified and {@link $sanitize sanitized} text.
+ *
+ * @usage
+   <span ng-bind-html="linky_expression | linky"></span>
+ *
+ * @example
+   <example module="linkyExample" deps="angular-sanitize.js">
+     <file name="index.html">
+       <div ng-controller="ExampleController">
+       Snippet: <textarea ng-model="snippet" cols="60" rows="3"></textarea>
+       <table>
+         <tr>
+           <th>Filter</th>
+           <th>Source</th>
+           <th>Rendered</th>
+         </tr>
+         <tr id="linky-filter">
+           <td>linky filter</td>
+           <td>
+             <pre>&lt;div ng-bind-html="snippet | linky"&gt;<br>&lt;/div&gt;</pre>
+           </td>
+           <td>
+             <div ng-bind-html="snippet | linky"></div>
+           </td>
+         </tr>
+         <tr id="linky-target">
+          <td>linky target</td>
+          <td>
+            <pre>&lt;div ng-bind-html="snippetWithSingleURL | linky:'_blank'"&gt;<br>&lt;/div&gt;</pre>
+          </td>
+          <td>
+            <div ng-bind-html="snippetWithSingleURL | linky:'_blank'"></div>
+          </td>
+         </tr>
+         <tr id="linky-custom-attributes">
+          <td>linky custom attributes</td>
+          <td>
+            <pre>&lt;div ng-bind-html="snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}"&gt;<br>&lt;/div&gt;</pre>
+          </td>
+          <td>
+            <div ng-bind-html="snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}"></div>
+          </td>
+         </tr>
+         <tr id="escaped-html">
+           <td>no filter</td>
+           <td><pre>&lt;div ng-bind="snippet"&gt;<br>&lt;/div&gt;</pre></td>
+           <td><div ng-bind="snippet"></div></td>
+         </tr>
+       </table>
+     </file>
+     <file name="script.js">
+       angular.module('linkyExample', ['ngSanitize'])
+         .controller('ExampleController', ['$scope', function($scope) {
+           $scope.snippet =
+             'Pretty text with some links:\n'+
+             'http://angularjs.org/,\n'+
+             'mailto:us@somewhere.org,\n'+
+             'another@somewhere.org,\n'+
+             'and one more: ftp://127.0.0.1/.';
+           $scope.snippetWithSingleURL = 'http://angularjs.org/';
+         }]);
+     </file>
+     <file name="protractor.js" type="protractor">
+       it('should linkify the snippet with urls', function() {
+         expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
+             toBe('Pretty text with some links: http://angularjs.org/, us@somewhere.org, ' +
+                  'another@somewhere.org, and one more: ftp://127.0.0.1/.');
+         expect(element.all(by.css('#linky-filter a')).count()).toEqual(4);
+       });
+
+       it('should not linkify snippet without the linky filter', function() {
+         expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText()).
+             toBe('Pretty text with some links: http://angularjs.org/, mailto:us@somewhere.org, ' +
+                  'another@somewhere.org, and one more: ftp://127.0.0.1/.');
+         expect(element.all(by.css('#escaped-html a')).count()).toEqual(0);
+       });
+
+       it('should update', function() {
+         element(by.model('snippet')).clear();
+         element(by.model('snippet')).sendKeys('new http://link.');
+         expect(element(by.id('linky-filter')).element(by.binding('snippet | linky')).getText()).
+             toBe('new http://link.');
+         expect(element.all(by.css('#linky-filter a')).count()).toEqual(1);
+         expect(element(by.id('escaped-html')).element(by.binding('snippet')).getText())
+             .toBe('new http://link.');
+       });
+
+       it('should work with the target property', function() {
+        expect(element(by.id('linky-target')).
+            element(by.binding("snippetWithSingleURL | linky:'_blank'")).getText()).
+            toBe('http://angularjs.org/');
+        expect(element(by.css('#linky-target a')).getAttribute('target')).toEqual('_blank');
+       });
+
+       it('should optionally add custom attributes', function() {
+        expect(element(by.id('linky-custom-attributes')).
+            element(by.binding("snippetWithSingleURL | linky:'_self':{rel: 'nofollow'}")).getText()).
+            toBe('http://angularjs.org/');
+        expect(element(by.css('#linky-custom-attributes a')).getAttribute('rel')).toEqual('nofollow');
+       });
+     </file>
+   </example>
+ */
+angular.module('ngSanitize').filter('linky', ['$sanitize', function($sanitize) {
+  var LINKY_URL_REGEXP =
+        /((ftp|https?):\/\/|(www\.)|(mailto:)?[A-Za-z0-9._%+-]+@)\S*[^\s.;,(){}<>"\u201d\u2019]/i,
+      MAILTO_REGEXP = /^mailto:/i;
+
+  var linkyMinErr = angular.$$minErr('linky');
+  var isDefined = angular.isDefined;
+  var isFunction = angular.isFunction;
+  var isObject = angular.isObject;
+  var isString = angular.isString;
+
+  return function(text, target, attributes) {
+    if (text == null || text === '') return text;
+    if (!isString(text)) throw linkyMinErr('notstring', 'Expected string but received: {0}', text);
+
+    var attributesFn =
+      isFunction(attributes) ? attributes :
+      isObject(attributes) ? function getAttributesObject() {return attributes;} :
+      function getEmptyAttributesObject() {return {};};
+
+    var match;
+    var raw = text;
+    var html = [];
+    var url;
+    var i;
+    while ((match = raw.match(LINKY_URL_REGEXP))) {
+      // We can not end in these as they are sometimes found at the end of the sentence
+      url = match[0];
+      // if we did not match ftp/http/www/mailto then assume mailto
+      if (!match[2] && !match[4]) {
+        url = (match[3] ? 'http://' : 'mailto:') + url;
+      }
+      i = match.index;
+      addText(raw.substr(0, i));
+      addLink(url, match[0].replace(MAILTO_REGEXP, ''));
+      raw = raw.substring(i + match[0].length);
+    }
+    addText(raw);
+    return $sanitize(html.join(''));
+
+    function addText(text) {
+      if (!text) {
+        return;
+      }
+      html.push(sanitizeText(text));
+    }
+
+    function addLink(url, text) {
+      var key, linkAttributes = attributesFn(url);
+      html.push('<a ');
+
+      for (key in linkAttributes) {
+        html.push(key + '="' + linkAttributes[key] + '" ');
+      }
+
+      if (isDefined(target) && !('target' in linkAttributes)) {
+        html.push('target="',
+                  target,
+                  '" ');
+      }
+      html.push('href="',
+                url.replace(/"/g, '&quot;'),
+                '">');
+      addText(text);
+      html.push('</a>');
+    }
+  };
+}]);
+
+
+})(window, window.angular);
diff --git a/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/js/angular.js b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/js/angular.js
new file mode 100644
index 0000000..54f6558
--- /dev/null
+++ b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/js/angular.js
@@ -0,0 +1,31768 @@
+/**
+ * @license AngularJS v1.5.8
+ * (c) 2010-2016 Google, Inc. http://angularjs.org
+ * License: MIT
+ */
+(function(window) {'use strict';
+
+/**
+ * @description
+ *
+ * This object provides a utility for producing rich Error messages within
+ * Angular. It can be called as follows:
+ *
+ * var exampleMinErr = minErr('example');
+ * throw exampleMinErr('one', 'This {0} is {1}', foo, bar);
+ *
+ * The above creates an instance of minErr in the example namespace. The
+ * resulting error will have a namespaced error code of example.one.  The
+ * resulting error will replace {0} with the value of foo, and {1} with the
+ * value of bar. The object is not restricted in the number of arguments it can
+ * take.
+ *
+ * If fewer arguments are specified than necessary for interpolation, the extra
+ * interpolation markers will be preserved in the final string.
+ *
+ * Since data will be parsed statically during a build step, some restrictions
+ * are applied with respect to how minErr instances are created and called.
+ * Instances should have names of the form namespaceMinErr for a minErr created
+ * using minErr('namespace') . Error codes, namespaces and template strings
+ * should all be static strings, not variables or general expressions.
+ *
+ * @param {string} module The namespace to use for the new minErr instance.
+ * @param {function} ErrorConstructor Custom error constructor to be instantiated when returning
+ *   error from returned function, for cases when a particular type of error is useful.
+ * @returns {function(code:string, template:string, ...templateArgs): Error} minErr instance
+ */
+
+function minErr(module, ErrorConstructor) {
+  ErrorConstructor = ErrorConstructor || Error;
+  return function() {
+    var SKIP_INDEXES = 2;
+
+    var templateArgs = arguments,
+      code = templateArgs[0],
+      message = '[' + (module ? module + ':' : '') + code + '] ',
+      template = templateArgs[1],
+      paramPrefix, i;
+
+    message += template.replace(/\{\d+\}/g, function(match) {
+      var index = +match.slice(1, -1),
+        shiftedIndex = index + SKIP_INDEXES;
+
+      if (shiftedIndex < templateArgs.length) {
+        return toDebugString(templateArgs[shiftedIndex]);
+      }
+
+      return match;
+    });
+
+    message += '\nhttp://errors.angularjs.org/1.5.8/' +
+      (module ? module + '/' : '') + code;
+
+    for (i = SKIP_INDEXES, paramPrefix = '?'; i < templateArgs.length; i++, paramPrefix = '&') {
+      message += paramPrefix + 'p' + (i - SKIP_INDEXES) + '=' +
+        encodeURIComponent(toDebugString(templateArgs[i]));
+    }
+
+    return new ErrorConstructor(message);
+  };
+}
+
+/* We need to tell jshint what variables are being exported */
+/* global angular: true,
+  msie: true,
+  jqLite: true,
+  jQuery: true,
+  slice: true,
+  splice: true,
+  push: true,
+  toString: true,
+  ngMinErr: true,
+  angularModule: true,
+  uid: true,
+  REGEX_STRING_REGEXP: true,
+  VALIDITY_STATE_PROPERTY: true,
+
+  lowercase: true,
+  uppercase: true,
+  manualLowercase: true,
+  manualUppercase: true,
+  nodeName_: true,
+  isArrayLike: true,
+  forEach: true,
+  forEachSorted: true,
+  reverseParams: true,
+  nextUid: true,
+  setHashKey: true,
+  extend: true,
+  toInt: true,
+  inherit: true,
+  merge: true,
+  noop: true,
+  identity: true,
+  valueFn: true,
+  isUndefined: true,
+  isDefined: true,
+  isObject: true,
+  isBlankObject: true,
+  isString: true,
+  isNumber: true,
+  isDate: true,
+  isArray: true,
+  isFunction: true,
+  isRegExp: true,
+  isWindow: true,
+  isScope: true,
+  isFile: true,
+  isFormData: true,
+  isBlob: true,
+  isBoolean: true,
+  isPromiseLike: true,
+  trim: true,
+  escapeForRegexp: true,
+  isElement: true,
+  makeMap: true,
+  includes: true,
+  arrayRemove: true,
+  copy: true,
+  equals: true,
+  csp: true,
+  jq: true,
+  concat: true,
+  sliceArgs: true,
+  bind: true,
+  toJsonReplacer: true,
+  toJson: true,
+  fromJson: true,
+  convertTimezoneToLocal: true,
+  timezoneToOffset: true,
+  startingTag: true,
+  tryDecodeURIComponent: true,
+  parseKeyValue: true,
+  toKeyValue: true,
+  encodeUriSegment: true,
+  encodeUriQuery: true,
+  angularInit: true,
+  bootstrap: true,
+  getTestability: true,
+  snake_case: true,
+  bindJQuery: true,
+  assertArg: true,
+  assertArgFn: true,
+  assertNotHasOwnProperty: true,
+  getter: true,
+  getBlockNodes: true,
+  hasOwnProperty: true,
+  createMap: true,
+
+  NODE_TYPE_ELEMENT: true,
+  NODE_TYPE_ATTRIBUTE: true,
+  NODE_TYPE_TEXT: true,
+  NODE_TYPE_COMMENT: true,
+  NODE_TYPE_DOCUMENT: true,
+  NODE_TYPE_DOCUMENT_FRAGMENT: true,
+*/
+
+////////////////////////////////////
+
+/**
+ * @ngdoc module
+ * @name ng
+ * @module ng
+ * @installation
+ * @description
+ *
+ * # ng (core module)
+ * The ng module is loaded by default when an AngularJS application is started. The module itself
+ * contains the essential components for an AngularJS application to function. The table below
+ * lists a high level breakdown of each of the services/factories, filters, directives and testing
+ * components available within this core module.
+ *
+ * <div doc-module-components="ng"></div>
+ */
+
+var REGEX_STRING_REGEXP = /^\/(.+)\/([a-z]*)$/;
+
+// The name of a form control's ValidityState property.
+// This is used so that it's possible for internal tests to create mock ValidityStates.
+var VALIDITY_STATE_PROPERTY = 'validity';
+
+var hasOwnProperty = Object.prototype.hasOwnProperty;
+
+var lowercase = function(string) {return isString(string) ? string.toLowerCase() : string;};
+var uppercase = function(string) {return isString(string) ? string.toUpperCase() : string;};
+
+
+var manualLowercase = function(s) {
+  /* jshint bitwise: false */
+  return isString(s)
+      ? s.replace(/[A-Z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) | 32);})
+      : s;
+};
+var manualUppercase = function(s) {
+  /* jshint bitwise: false */
+  return isString(s)
+      ? s.replace(/[a-z]/g, function(ch) {return String.fromCharCode(ch.charCodeAt(0) & ~32);})
+      : s;
+};
+
+
+// String#toLowerCase and String#toUpperCase don't produce correct results in browsers with Turkish
+// locale, for this reason we need to detect this case and redefine lowercase/uppercase methods
+// with correct but slower alternatives. See https://github.com/angular/angular.js/issues/11387
+if ('i' !== 'I'.toLowerCase()) {
+  lowercase = manualLowercase;
+  uppercase = manualUppercase;
+}
+
+
+var
+    msie,             // holds major version number for IE, or NaN if UA is not IE.
+    jqLite,           // delay binding since jQuery could be loaded after us.
+    jQuery,           // delay binding
+    slice             = [].slice,
+    splice            = [].splice,
+    push              = [].push,
+    toString          = Object.prototype.toString,
+    getPrototypeOf    = Object.getPrototypeOf,
+    ngMinErr          = minErr('ng'),
+
+    /** @name angular */
+    angular           = window.angular || (window.angular = {}),
+    angularModule,
+    uid               = 0;
+
+/**
+ * documentMode is an IE-only property
+ * http://msdn.microsoft.com/en-us/library/ie/cc196988(v=vs.85).aspx
+ */
+msie = window.document.documentMode;
+
+
+/**
+ * @private
+ * @param {*} obj
+ * @return {boolean} Returns true if `obj` is an array or array-like object (NodeList, Arguments,
+ *                   String ...)
+ */
+function isArrayLike(obj) {
+
+  // `null`, `undefined` and `window` are not array-like
+  if (obj == null || isWindow(obj)) return false;
+
+  // arrays, strings and jQuery/jqLite objects are array like
+  // * jqLite is either the jQuery or jqLite constructor function
+  // * we have to check the existence of jqLite first as this method is called
+  //   via the forEach method when constructing the jqLite object in the first place
+  if (isArray(obj) || isString(obj) || (jqLite && obj instanceof jqLite)) return true;
+
+  // Support: iOS 8.2 (not reproducible in simulator)
+  // "length" in obj used to prevent JIT error (gh-11508)
+  var length = "length" in Object(obj) && obj.length;
+
+  // NodeList objects (with `item` method) and
+  // other objects with suitable length characteristics are array-like
+  return isNumber(length) &&
+    (length >= 0 && ((length - 1) in obj || obj instanceof Array) || typeof obj.item == 'function');
+
+}
+
+/**
+ * @ngdoc function
+ * @name angular.forEach
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Invokes the `iterator` function once for each item in `obj` collection, which can be either an
+ * object or an array. The `iterator` function is invoked with `iterator(value, key, obj)`, where `value`
+ * is the value of an object property or an array element, `key` is the object property key or
+ * array element index and obj is the `obj` itself. Specifying a `context` for the function is optional.
+ *
+ * It is worth noting that `.forEach` does not iterate over inherited properties because it filters
+ * using the `hasOwnProperty` method.
+ *
+ * Unlike ES262's
+ * [Array.prototype.forEach](http://www.ecma-international.org/ecma-262/5.1/#sec-15.4.4.18),
+ * providing 'undefined' or 'null' values for `obj` will not throw a TypeError, but rather just
+ * return the value provided.
+ *
+   ```js
+     var values = {name: 'misko', gender: 'male'};
+     var log = [];
+     angular.forEach(values, function(value, key) {
+       this.push(key + ': ' + value);
+     }, log);
+     expect(log).toEqual(['name: misko', 'gender: male']);
+   ```
+ *
+ * @param {Object|Array} obj Object to iterate over.
+ * @param {Function} iterator Iterator function.
+ * @param {Object=} context Object to become context (`this`) for the iterator function.
+ * @returns {Object|Array} Reference to `obj`.
+ */
+
+function forEach(obj, iterator, context) {
+  var key, length;
+  if (obj) {
+    if (isFunction(obj)) {
+      for (key in obj) {
+        // Need to check if hasOwnProperty exists,
+        // as on IE8 the result of querySelectorAll is an object without a hasOwnProperty function
+        if (key != 'prototype' && key != 'length' && key != 'name' && (!obj.hasOwnProperty || obj.hasOwnProperty(key))) {
+          iterator.call(context, obj[key], key, obj);
+        }
+      }
+    } else if (isArray(obj) || isArrayLike(obj)) {
+      var isPrimitive = typeof obj !== 'object';
+      for (key = 0, length = obj.length; key < length; key++) {
+        if (isPrimitive || key in obj) {
+          iterator.call(context, obj[key], key, obj);
+        }
+      }
+    } else if (obj.forEach && obj.forEach !== forEach) {
+        obj.forEach(iterator, context, obj);
+    } else if (isBlankObject(obj)) {
+      // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
+      for (key in obj) {
+        iterator.call(context, obj[key], key, obj);
+      }
+    } else if (typeof obj.hasOwnProperty === 'function') {
+      // Slow path for objects inheriting Object.prototype, hasOwnProperty check needed
+      for (key in obj) {
+        if (obj.hasOwnProperty(key)) {
+          iterator.call(context, obj[key], key, obj);
+        }
+      }
+    } else {
+      // Slow path for objects which do not have a method `hasOwnProperty`
+      for (key in obj) {
+        if (hasOwnProperty.call(obj, key)) {
+          iterator.call(context, obj[key], key, obj);
+        }
+      }
+    }
+  }
+  return obj;
+}
+
+function forEachSorted(obj, iterator, context) {
+  var keys = Object.keys(obj).sort();
+  for (var i = 0; i < keys.length; i++) {
+    iterator.call(context, obj[keys[i]], keys[i]);
+  }
+  return keys;
+}
+
+
+/**
+ * when using forEach the params are value, key, but it is often useful to have key, value.
+ * @param {function(string, *)} iteratorFn
+ * @returns {function(*, string)}
+ */
+function reverseParams(iteratorFn) {
+  return function(value, key) {iteratorFn(key, value);};
+}
+
+/**
+ * A consistent way of creating unique IDs in angular.
+ *
+ * Using simple numbers allows us to generate 28.6 million unique ids per second for 10 years before
+ * we hit number precision issues in JavaScript.
+ *
+ * Math.pow(2,53) / 60 / 60 / 24 / 365 / 10 = 28.6M
+ *
+ * @returns {number} an unique alpha-numeric string
+ */
+function nextUid() {
+  return ++uid;
+}
+
+
+/**
+ * Set or clear the hashkey for an object.
+ * @param obj object
+ * @param h the hashkey (!truthy to delete the hashkey)
+ */
+function setHashKey(obj, h) {
+  if (h) {
+    obj.$$hashKey = h;
+  } else {
+    delete obj.$$hashKey;
+  }
+}
+
+
+function baseExtend(dst, objs, deep) {
+  var h = dst.$$hashKey;
+
+  for (var i = 0, ii = objs.length; i < ii; ++i) {
+    var obj = objs[i];
+    if (!isObject(obj) && !isFunction(obj)) continue;
+    var keys = Object.keys(obj);
+    for (var j = 0, jj = keys.length; j < jj; j++) {
+      var key = keys[j];
+      var src = obj[key];
+
+      if (deep && isObject(src)) {
+        if (isDate(src)) {
+          dst[key] = new Date(src.valueOf());
+        } else if (isRegExp(src)) {
+          dst[key] = new RegExp(src);
+        } else if (src.nodeName) {
+          dst[key] = src.cloneNode(true);
+        } else if (isElement(src)) {
+          dst[key] = src.clone();
+        } else {
+          if (!isObject(dst[key])) dst[key] = isArray(src) ? [] : {};
+          baseExtend(dst[key], [src], true);
+        }
+      } else {
+        dst[key] = src;
+      }
+    }
+  }
+
+  setHashKey(dst, h);
+  return dst;
+}
+
+/**
+ * @ngdoc function
+ * @name angular.extend
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Extends the destination object `dst` by copying own enumerable properties from the `src` object(s)
+ * to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so
+ * by passing an empty object as the target: `var object = angular.extend({}, object1, object2)`.
+ *
+ * **Note:** Keep in mind that `angular.extend` does not support recursive merge (deep copy). Use
+ * {@link angular.merge} for this.
+ *
+ * @param {Object} dst Destination object.
+ * @param {...Object} src Source object(s).
+ * @returns {Object} Reference to `dst`.
+ */
+function extend(dst) {
+  return baseExtend(dst, slice.call(arguments, 1), false);
+}
+
+
+/**
+* @ngdoc function
+* @name angular.merge
+* @module ng
+* @kind function
+*
+* @description
+* Deeply extends the destination object `dst` by copying own enumerable properties from the `src` object(s)
+* to `dst`. You can specify multiple `src` objects. If you want to preserve original objects, you can do so
+* by passing an empty object as the target: `var object = angular.merge({}, object1, object2)`.
+*
+* Unlike {@link angular.extend extend()}, `merge()` recursively descends into object properties of source
+* objects, performing a deep copy.
+*
+* @param {Object} dst Destination object.
+* @param {...Object} src Source object(s).
+* @returns {Object} Reference to `dst`.
+*/
+function merge(dst) {
+  return baseExtend(dst, slice.call(arguments, 1), true);
+}
+
+
+
+function toInt(str) {
+  return parseInt(str, 10);
+}
+
+
+function inherit(parent, extra) {
+  return extend(Object.create(parent), extra);
+}
+
+/**
+ * @ngdoc function
+ * @name angular.noop
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * A function that performs no operations. This function can be useful when writing code in the
+ * functional style.
+   ```js
+     function foo(callback) {
+       var result = calculateResult();
+       (callback || angular.noop)(result);
+     }
+   ```
+ */
+function noop() {}
+noop.$inject = [];
+
+
+/**
+ * @ngdoc function
+ * @name angular.identity
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * A function that returns its first argument. This function is useful when writing code in the
+ * functional style.
+ *
+   ```js
+   function transformer(transformationFn, value) {
+     return (transformationFn || angular.identity)(value);
+   };
+
+   // E.g.
+   function getResult(fn, input) {
+     return (fn || angular.identity)(input);
+   };
+
+   getResult(function(n) { return n * 2; }, 21);   // returns 42
+   getResult(null, 21);                            // returns 21
+   getResult(undefined, 21);                       // returns 21
+   ```
+ *
+ * @param {*} value to be returned.
+ * @returns {*} the value passed in.
+ */
+function identity($) {return $;}
+identity.$inject = [];
+
+
+function valueFn(value) {return function valueRef() {return value;};}
+
+function hasCustomToString(obj) {
+  return isFunction(obj.toString) && obj.toString !== toString;
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isUndefined
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is undefined.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is undefined.
+ */
+function isUndefined(value) {return typeof value === 'undefined';}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isDefined
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is defined.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is defined.
+ */
+function isDefined(value) {return typeof value !== 'undefined';}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isObject
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is an `Object`. Unlike `typeof` in JavaScript, `null`s are not
+ * considered to be objects. Note that JavaScript arrays are objects.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is an `Object` but not `null`.
+ */
+function isObject(value) {
+  // http://jsperf.com/isobject4
+  return value !== null && typeof value === 'object';
+}
+
+
+/**
+ * Determine if a value is an object with a null prototype
+ *
+ * @returns {boolean} True if `value` is an `Object` with a null prototype
+ */
+function isBlankObject(value) {
+  return value !== null && typeof value === 'object' && !getPrototypeOf(value);
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isString
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is a `String`.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `String`.
+ */
+function isString(value) {return typeof value === 'string';}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isNumber
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is a `Number`.
+ *
+ * This includes the "special" numbers `NaN`, `+Infinity` and `-Infinity`.
+ *
+ * If you wish to exclude these then you can use the native
+ * [`isFinite'](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/isFinite)
+ * method.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `Number`.
+ */
+function isNumber(value) {return typeof value === 'number';}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isDate
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a value is a date.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `Date`.
+ */
+function isDate(value) {
+  return toString.call(value) === '[object Date]';
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.isArray
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is an `Array`.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is an `Array`.
+ */
+var isArray = Array.isArray;
+
+/**
+ * @ngdoc function
+ * @name angular.isFunction
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is a `Function`.
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `Function`.
+ */
+function isFunction(value) {return typeof value === 'function';}
+
+
+/**
+ * Determines if a value is a regular expression object.
+ *
+ * @private
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a `RegExp`.
+ */
+function isRegExp(value) {
+  return toString.call(value) === '[object RegExp]';
+}
+
+
+/**
+ * Checks if `obj` is a window object.
+ *
+ * @private
+ * @param {*} obj Object to check
+ * @returns {boolean} True if `obj` is a window obj.
+ */
+function isWindow(obj) {
+  return obj && obj.window === obj;
+}
+
+
+function isScope(obj) {
+  return obj && obj.$evalAsync && obj.$watch;
+}
+
+
+function isFile(obj) {
+  return toString.call(obj) === '[object File]';
+}
+
+
+function isFormData(obj) {
+  return toString.call(obj) === '[object FormData]';
+}
+
+
+function isBlob(obj) {
+  return toString.call(obj) === '[object Blob]';
+}
+
+
+function isBoolean(value) {
+  return typeof value === 'boolean';
+}
+
+
+function isPromiseLike(obj) {
+  return obj && isFunction(obj.then);
+}
+
+
+var TYPED_ARRAY_REGEXP = /^\[object (?:Uint8|Uint8Clamped|Uint16|Uint32|Int8|Int16|Int32|Float32|Float64)Array\]$/;
+function isTypedArray(value) {
+  return value && isNumber(value.length) && TYPED_ARRAY_REGEXP.test(toString.call(value));
+}
+
+function isArrayBuffer(obj) {
+  return toString.call(obj) === '[object ArrayBuffer]';
+}
+
+
+var trim = function(value) {
+  return isString(value) ? value.trim() : value;
+};
+
+// Copied from:
+// http://docs.closure-library.googlecode.com/git/local_closure_goog_string_string.js.source.html#line1021
+// Prereq: s is a string.
+var escapeForRegexp = function(s) {
+  return s.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g, '\\$1').
+           replace(/\x08/g, '\\x08');
+};
+
+
+/**
+ * @ngdoc function
+ * @name angular.isElement
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if a reference is a DOM element (or wrapped jQuery element).
+ *
+ * @param {*} value Reference to check.
+ * @returns {boolean} True if `value` is a DOM element (or wrapped jQuery element).
+ */
+function isElement(node) {
+  return !!(node &&
+    (node.nodeName  // We are a direct element.
+    || (node.prop && node.attr && node.find)));  // We have an on and find method part of jQuery API.
+}
+
+/**
+ * @param str 'key1,key2,...'
+ * @returns {object} in the form of {key1:true, key2:true, ...}
+ */
+function makeMap(str) {
+  var obj = {}, items = str.split(','), i;
+  for (i = 0; i < items.length; i++) {
+    obj[items[i]] = true;
+  }
+  return obj;
+}
+
+
+function nodeName_(element) {
+  return lowercase(element.nodeName || (element[0] && element[0].nodeName));
+}
+
+function includes(array, obj) {
+  return Array.prototype.indexOf.call(array, obj) != -1;
+}
+
+function arrayRemove(array, value) {
+  var index = array.indexOf(value);
+  if (index >= 0) {
+    array.splice(index, 1);
+  }
+  return index;
+}
+
+/**
+ * @ngdoc function
+ * @name angular.copy
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Creates a deep copy of `source`, which should be an object or an array.
+ *
+ * * If no destination is supplied, a copy of the object or array is created.
+ * * If a destination is provided, all of its elements (for arrays) or properties (for objects)
+ *   are deleted and then all elements/properties from the source are copied to it.
+ * * If `source` is not an object or array (inc. `null` and `undefined`), `source` is returned.
+ * * If `source` is identical to `destination` an exception will be thrown.
+ *
+ * <br />
+ * <div class="alert alert-warning">
+ *   Only enumerable properties are taken into account. Non-enumerable properties (both on `source`
+ *   and on `destination`) will be ignored.
+ * </div>
+ *
+ * @param {*} source The source that will be used to make a copy.
+ *                   Can be any type, including primitives, `null`, and `undefined`.
+ * @param {(Object|Array)=} destination Destination into which the source is copied. If
+ *     provided, must be of the same type as `source`.
+ * @returns {*} The copy or updated `destination`, if `destination` was specified.
+ *
+ * @example
+  <example module="copyExample">
+    <file name="index.html">
+      <div ng-controller="ExampleController">
+        <form novalidate class="simple-form">
+          <label>Name: <input type="text" ng-model="user.name" /></label><br />
+          <label>Age:  <input type="number" ng-model="user.age" /></label><br />
+          Gender: <label><input type="radio" ng-model="user.gender" value="male" />male</label>
+                  <label><input type="radio" ng-model="user.gender" value="female" />female</label><br />
+          <button ng-click="reset()">RESET</button>
+          <button ng-click="update(user)">SAVE</button>
+        </form>
+        <pre>form = {{user | json}}</pre>
+        <pre>master = {{master | json}}</pre>
+      </div>
+    </file>
+    <file name="script.js">
+      // Module: copyExample
+      angular.
+        module('copyExample', []).
+        controller('ExampleController', ['$scope', function($scope) {
+          $scope.master = {};
+
+          $scope.reset = function() {
+            // Example with 1 argument
+            $scope.user = angular.copy($scope.master);
+          };
+
+          $scope.update = function(user) {
+            // Example with 2 arguments
+            angular.copy(user, $scope.master);
+          };
+
+          $scope.reset();
+        }]);
+    </file>
+  </example>
+ */
+function copy(source, destination) {
+  var stackSource = [];
+  var stackDest = [];
+
+  if (destination) {
+    if (isTypedArray(destination) || isArrayBuffer(destination)) {
+      throw ngMinErr('cpta', "Can't copy! TypedArray destination cannot be mutated.");
+    }
+    if (source === destination) {
+      throw ngMinErr('cpi', "Can't copy! Source and destination are identical.");
+    }
+
+    // Empty the destination object
+    if (isArray(destination)) {
+      destination.length = 0;
+    } else {
+      forEach(destination, function(value, key) {
+        if (key !== '$$hashKey') {
+          delete destination[key];
+        }
+      });
+    }
+
+    stackSource.push(source);
+    stackDest.push(destination);
+    return copyRecurse(source, destination);
+  }
+
+  return copyElement(source);
+
+  function copyRecurse(source, destination) {
+    var h = destination.$$hashKey;
+    var key;
+    if (isArray(source)) {
+      for (var i = 0, ii = source.length; i < ii; i++) {
+        destination.push(copyElement(source[i]));
+      }
+    } else if (isBlankObject(source)) {
+      // createMap() fast path --- Safe to avoid hasOwnProperty check because prototype chain is empty
+      for (key in source) {
+        destination[key] = copyElement(source[key]);
+      }
+    } else if (source && typeof source.hasOwnProperty === 'function') {
+      // Slow path, which must rely on hasOwnProperty
+      for (key in source) {
+        if (source.hasOwnProperty(key)) {
+          destination[key] = copyElement(source[key]);
+        }
+      }
+    } else {
+      // Slowest path --- hasOwnProperty can't be called as a method
+      for (key in source) {
+        if (hasOwnProperty.call(source, key)) {
+          destination[key] = copyElement(source[key]);
+        }
+      }
+    }
+    setHashKey(destination, h);
+    return destination;
+  }
+
+  function copyElement(source) {
+    // Simple values
+    if (!isObject(source)) {
+      return source;
+    }
+
+    // Already copied values
+    var index = stackSource.indexOf(source);
+    if (index !== -1) {
+      return stackDest[index];
+    }
+
+    if (isWindow(source) || isScope(source)) {
+      throw ngMinErr('cpws',
+        "Can't copy! Making copies of Window or Scope instances is not supported.");
+    }
+
+    var needsRecurse = false;
+    var destination = copyType(source);
+
+    if (destination === undefined) {
+      destination = isArray(source) ? [] : Object.create(getPrototypeOf(source));
+      needsRecurse = true;
+    }
+
+    stackSource.push(source);
+    stackDest.push(destination);
+
+    return needsRecurse
+      ? copyRecurse(source, destination)
+      : destination;
+  }
+
+  function copyType(source) {
+    switch (toString.call(source)) {
+      case '[object Int8Array]':
+      case '[object Int16Array]':
+      case '[object Int32Array]':
+      case '[object Float32Array]':
+      case '[object Float64Array]':
+      case '[object Uint8Array]':
+      case '[object Uint8ClampedArray]':
+      case '[object Uint16Array]':
+      case '[object Uint32Array]':
+        return new source.constructor(copyElement(source.buffer), source.byteOffset, source.length);
+
+      case '[object ArrayBuffer]':
+        //Support: IE10
+        if (!source.slice) {
+          var copied = new ArrayBuffer(source.byteLength);
+          new Uint8Array(copied).set(new Uint8Array(source));
+          return copied;
+        }
+        return source.slice(0);
+
+      case '[object Boolean]':
+      case '[object Number]':
+      case '[object String]':
+      case '[object Date]':
+        return new source.constructor(source.valueOf());
+
+      case '[object RegExp]':
+        var re = new RegExp(source.source, source.toString().match(/[^\/]*$/)[0]);
+        re.lastIndex = source.lastIndex;
+        return re;
+
+      case '[object Blob]':
+        return new source.constructor([source], {type: source.type});
+    }
+
+    if (isFunction(source.cloneNode)) {
+      return source.cloneNode(true);
+    }
+  }
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.equals
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Determines if two objects or two values are equivalent. Supports value types, regular
+ * expressions, arrays and objects.
+ *
+ * Two objects or values are considered equivalent if at least one of the following is true:
+ *
+ * * Both objects or values pass `===` comparison.
+ * * Both objects or values are of the same type and all of their properties are equal by
+ *   comparing them with `angular.equals`.
+ * * Both values are NaN. (In JavaScript, NaN == NaN => false. But we consider two NaN as equal)
+ * * Both values represent the same regular expression (In JavaScript,
+ *   /abc/ == /abc/ => false. But we consider two regular expressions as equal when their textual
+ *   representation matches).
+ *
+ * During a property comparison, properties of `function` type and properties with names
+ * that begin with `$` are ignored.
+ *
+ * Scope and DOMWindow objects are being compared only by identify (`===`).
+ *
+ * @param {*} o1 Object or value to compare.
+ * @param {*} o2 Object or value to compare.
+ * @returns {boolean} True if arguments are equal.
+ *
+ * @example
+   <example module="equalsExample" name="equalsExample">
+     <file name="index.html">
+      <div ng-controller="ExampleController">
+        <form novalidate>
+          <h3>User 1</h3>
+          Name: <input type="text" ng-model="user1.name">
+          Age: <input type="number" ng-model="user1.age">
+
+          <h3>User 2</h3>
+          Name: <input type="text" ng-model="user2.name">
+          Age: <input type="number" ng-model="user2.age">
+
+          <div>
+            <br/>
+            <input type="button" value="Compare" ng-click="compare()">
+          </div>
+          User 1: <pre>{{user1 | json}}</pre>
+          User 2: <pre>{{user2 | json}}</pre>
+          Equal: <pre>{{result}}</pre>
+        </form>
+      </div>
+    </file>
+    <file name="script.js">
+        angular.module('equalsExample', []).controller('ExampleController', ['$scope', function($scope) {
+          $scope.user1 = {};
+          $scope.user2 = {};
+          $scope.result;
+          $scope.compare = function() {
+            $scope.result = angular.equals($scope.user1, $scope.user2);
+          };
+        }]);
+    </file>
+  </example>
+ */
+function equals(o1, o2) {
+  if (o1 === o2) return true;
+  if (o1 === null || o2 === null) return false;
+  if (o1 !== o1 && o2 !== o2) return true; // NaN === NaN
+  var t1 = typeof o1, t2 = typeof o2, length, key, keySet;
+  if (t1 == t2 && t1 == 'object') {
+    if (isArray(o1)) {
+      if (!isArray(o2)) return false;
+      if ((length = o1.length) == o2.length) {
+        for (key = 0; key < length; key++) {
+          if (!equals(o1[key], o2[key])) return false;
+        }
+        return true;
+      }
+    } else if (isDate(o1)) {
+      if (!isDate(o2)) return false;
+      return equals(o1.getTime(), o2.getTime());
+    } else if (isRegExp(o1)) {
+      if (!isRegExp(o2)) return false;
+      return o1.toString() == o2.toString();
+    } else {
+      if (isScope(o1) || isScope(o2) || isWindow(o1) || isWindow(o2) ||
+        isArray(o2) || isDate(o2) || isRegExp(o2)) return false;
+      keySet = createMap();
+      for (key in o1) {
+        if (key.charAt(0) === '$' || isFunction(o1[key])) continue;
+        if (!equals(o1[key], o2[key])) return false;
+        keySet[key] = true;
+      }
+      for (key in o2) {
+        if (!(key in keySet) &&
+            key.charAt(0) !== '$' &&
+            isDefined(o2[key]) &&
+            !isFunction(o2[key])) return false;
+      }
+      return true;
+    }
+  }
+  return false;
+}
+
+var csp = function() {
+  if (!isDefined(csp.rules)) {
+
+
+    var ngCspElement = (window.document.querySelector('[ng-csp]') ||
+                    window.document.querySelector('[data-ng-csp]'));
+
+    if (ngCspElement) {
+      var ngCspAttribute = ngCspElement.getAttribute('ng-csp') ||
+                    ngCspElement.getAttribute('data-ng-csp');
+      csp.rules = {
+        noUnsafeEval: !ngCspAttribute || (ngCspAttribute.indexOf('no-unsafe-eval') !== -1),
+        noInlineStyle: !ngCspAttribute || (ngCspAttribute.indexOf('no-inline-style') !== -1)
+      };
+    } else {
+      csp.rules = {
+        noUnsafeEval: noUnsafeEval(),
+        noInlineStyle: false
+      };
+    }
+  }
+
+  return csp.rules;
+
+  function noUnsafeEval() {
+    try {
+      /* jshint -W031, -W054 */
+      new Function('');
+      /* jshint +W031, +W054 */
+      return false;
+    } catch (e) {
+      return true;
+    }
+  }
+};
+
+/**
+ * @ngdoc directive
+ * @module ng
+ * @name ngJq
+ *
+ * @element ANY
+ * @param {string=} ngJq the name of the library available under `window`
+ * to be used for angular.element
+ * @description
+ * Use this directive to force the angular.element library.  This should be
+ * used to force either jqLite by leaving ng-jq blank or setting the name of
+ * the jquery variable under window (eg. jQuery).
+ *
+ * Since angular looks for this directive when it is loaded (doesn't wait for the
+ * DOMContentLoaded event), it must be placed on an element that comes before the script
+ * which loads angular. Also, only the first instance of `ng-jq` will be used and all
+ * others ignored.
+ *
+ * @example
+ * This example shows how to force jqLite using the `ngJq` directive to the `html` tag.
+ ```html
+ <!doctype html>
+ <html ng-app ng-jq>
+ ...
+ ...
+ </html>
+ ```
+ * @example
+ * This example shows how to use a jQuery based library of a different name.
+ * The library name must be available at the top most 'window'.
+ ```html
+ <!doctype html>
+ <html ng-app ng-jq="jQueryLib">
+ ...
+ ...
+ </html>
+ ```
+ */
+var jq = function() {
+  if (isDefined(jq.name_)) return jq.name_;
+  var el;
+  var i, ii = ngAttrPrefixes.length, prefix, name;
+  for (i = 0; i < ii; ++i) {
+    prefix = ngAttrPrefixes[i];
+    if (el = window.document.querySelector('[' + prefix.replace(':', '\\:') + 'jq]')) {
+      name = el.getAttribute(prefix + 'jq');
+      break;
+    }
+  }
+
+  return (jq.name_ = name);
+};
+
+function concat(array1, array2, index) {
+  return array1.concat(slice.call(array2, index));
+}
+
+function sliceArgs(args, startIndex) {
+  return slice.call(args, startIndex || 0);
+}
+
+
+/* jshint -W101 */
+/**
+ * @ngdoc function
+ * @name angular.bind
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Returns a function which calls function `fn` bound to `self` (`self` becomes the `this` for
+ * `fn`). You can supply optional `args` that are prebound to the function. This feature is also
+ * known as [partial application](http://en.wikipedia.org/wiki/Partial_application), as
+ * distinguished from [function currying](http://en.wikipedia.org/wiki/Currying#Contrast_with_partial_function_application).
+ *
+ * @param {Object} self Context which `fn` should be evaluated in.
+ * @param {function()} fn Function to be bound.
+ * @param {...*} args Optional arguments to be prebound to the `fn` function call.
+ * @returns {function()} Function that wraps the `fn` with all the specified bindings.
+ */
+/* jshint +W101 */
+function bind(self, fn) {
+  var curryArgs = arguments.length > 2 ? sliceArgs(arguments, 2) : [];
+  if (isFunction(fn) && !(fn instanceof RegExp)) {
+    return curryArgs.length
+      ? function() {
+          return arguments.length
+            ? fn.apply(self, concat(curryArgs, arguments, 0))
+            : fn.apply(self, curryArgs);
+        }
+      : function() {
+          return arguments.length
+            ? fn.apply(self, arguments)
+            : fn.call(self);
+        };
+  } else {
+    // In IE, native methods are not functions so they cannot be bound (note: they don't need to be).
+    return fn;
+  }
+}
+
+
+function toJsonReplacer(key, value) {
+  var val = value;
+
+  if (typeof key === 'string' && key.charAt(0) === '$' && key.charAt(1) === '$') {
+    val = undefined;
+  } else if (isWindow(value)) {
+    val = '$WINDOW';
+  } else if (value &&  window.document === value) {
+    val = '$DOCUMENT';
+  } else if (isScope(value)) {
+    val = '$SCOPE';
+  }
+
+  return val;
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.toJson
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Serializes input into a JSON-formatted string. Properties with leading $$ characters will be
+ * stripped since angular uses this notation internally.
+ *
+ * @param {Object|Array|Date|string|number} obj Input to be serialized into JSON.
+ * @param {boolean|number} [pretty=2] If set to true, the JSON output will contain newlines and whitespace.
+ *    If set to an integer, the JSON output will contain that many spaces per indentation.
+ * @returns {string|undefined} JSON-ified string representing `obj`.
+ * @knownIssue
+ *
+ * The Safari browser throws a `RangeError` instead of returning `null` when it tries to stringify a `Date`
+ * object with an invalid date value. The only reliable way to prevent this is to monkeypatch the
+ * `Date.prototype.toJSON` method as follows:
+ *
+ * ```
+ * var _DatetoJSON = Date.prototype.toJSON;
+ * Date.prototype.toJSON = function() {
+ *   try {
+ *     return _DatetoJSON.call(this);
+ *   } catch(e) {
+ *     if (e instanceof RangeError) {
+ *       return null;
+ *     }
+ *     throw e;
+ *   }
+ * };
+ * ```
+ *
+ * See https://github.com/angular/angular.js/pull/14221 for more information.
+ */
+function toJson(obj, pretty) {
+  if (isUndefined(obj)) return undefined;
+  if (!isNumber(pretty)) {
+    pretty = pretty ? 2 : null;
+  }
+  return JSON.stringify(obj, toJsonReplacer, pretty);
+}
+
+
+/**
+ * @ngdoc function
+ * @name angular.fromJson
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Deserializes a JSON string.
+ *
+ * @param {string} json JSON string to deserialize.
+ * @returns {Object|Array|string|number} Deserialized JSON string.
+ */
+function fromJson(json) {
+  return isString(json)
+      ? JSON.parse(json)
+      : json;
+}
+
+
+var ALL_COLONS = /:/g;
+function timezoneToOffset(timezone, fallback) {
+  // IE/Edge do not "understand" colon (`:`) in timezone
+  timezone = timezone.replace(ALL_COLONS, '');
+  var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
+  return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
+}
+
+
+function addDateMinutes(date, minutes) {
+  date = new Date(date.getTime());
+  date.setMinutes(date.getMinutes() + minutes);
+  return date;
+}
+
+
+function convertTimezoneToLocal(date, timezone, reverse) {
+  reverse = reverse ? -1 : 1;
+  var dateTimezoneOffset = date.getTimezoneOffset();
+  var timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
+  return addDateMinutes(date, reverse * (timezoneOffset - dateTimezoneOffset));
+}
+
+
+/**
+ * @returns {string} Returns the string representation of the element.
+ */
+function startingTag(element) {
+  element = jqLite(element).clone();
+  try {
+    // turns out IE does not let you set .html() on elements which
+    // are not allowed to have children. So we just ignore it.
+    element.empty();
+  } catch (e) {}
+  var elemHtml = jqLite('<div>').append(element).html();
+  try {
+    return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) :
+        elemHtml.
+          match(/^(<[^>]+>)/)[1].
+          replace(/^<([\w\-]+)/, function(match, nodeName) {return '<' + lowercase(nodeName);});
+  } catch (e) {
+    return lowercase(elemHtml);
+  }
+
+}
+
+
+/////////////////////////////////////////////////
+
+/**
+ * Tries to decode the URI component without throwing an exception.
+ *
+ * @private
+ * @param str value potential URI component to check.
+ * @returns {boolean} True if `value` can be decoded
+ * with the decodeURIComponent function.
+ */
+function tryDecodeURIComponent(value) {
+  try {
+    return decodeURIComponent(value);
+  } catch (e) {
+    // Ignore any invalid uri component.
+  }
+}
+
+
+/**
+ * Parses an escaped url query string into key-value pairs.
+ * @returns {Object.<string,boolean|Array>}
+ */
+function parseKeyValue(/**string*/keyValue) {
+  var obj = {};
+  forEach((keyValue || "").split('&'), function(keyValue) {
+    var splitPoint, key, val;
+    if (keyValue) {
+      key = keyValue = keyValue.replace(/\+/g,'%20');
+      splitPoint = keyValue.indexOf('=');
+      if (splitPoint !== -1) {
+        key = keyValue.substring(0, splitPoint);
+        val = keyValue.substring(splitPoint + 1);
+      }
+      key = tryDecodeURIComponent(key);
+      if (isDefined(key)) {
+        val = isDefined(val) ? tryDecodeURIComponent(val) : true;
+        if (!hasOwnProperty.call(obj, key)) {
+          obj[key] = val;
+        } else if (isArray(obj[key])) {
+          obj[key].push(val);
+        } else {
+          obj[key] = [obj[key],val];
+        }
+      }
+    }
+  });
+  return obj;
+}
+
+function toKeyValue(obj) {
+  var parts = [];
+  forEach(obj, function(value, key) {
+    if (isArray(value)) {
+      forEach(value, function(arrayValue) {
+        parts.push(encodeUriQuery(key, true) +
+                   (arrayValue === true ? '' : '=' + encodeUriQuery(arrayValue, true)));
+      });
+    } else {
+    parts.push(encodeUriQuery(key, true) +
+               (value === true ? '' : '=' + encodeUriQuery(value, true)));
+    }
+  });
+  return parts.length ? parts.join('&') : '';
+}
+
+
+/**
+ * We need our custom method because encodeURIComponent is too aggressive and doesn't follow
+ * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path
+ * segments:
+ *    segment       = *pchar
+ *    pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"
+ *    pct-encoded   = "%" HEXDIG HEXDIG
+ *    unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~"
+ *    sub-delims    = "!" / "$" / "&" / "'" / "(" / ")"
+ *                     / "*" / "+" / "," / ";" / "="
+ */
+function encodeUriSegment(val) {
+  return encodeUriQuery(val, true).
+             replace(/%26/gi, '&').
+             replace(/%3D/gi, '=').
+             replace(/%2B/gi, '+');
+}
+
+
+/**
+ * This method is intended for encoding *key* or *value* parts of query component. We need a custom
+ * method because encodeURIComponent is too aggressive and encodes stuff that doesn't have to be
+ * encoded per http://tools.ietf.org/html/rfc3986:
+ *    query       = *( pchar / "/" / "?" )
+ *    pchar         = unreserved / pct-encoded / sub-delims / ":" / "@"
+ *    unreserved    = ALPHA / DIGIT / "-" / "." / "_" / "~"
+ *    pct-encoded   = "%" HEXDIG HEXDIG
+ *    sub-delims    = "!" / "$" / "&" / "'" / "(" / ")"
+ *                     / "*" / "+" / "," / ";" / "="
+ */
+function encodeUriQuery(val, pctEncodeSpaces) {
+  return encodeURIComponent(val).
+             replace(/%40/gi, '@').
+             replace(/%3A/gi, ':').
+             replace(/%24/g, '$').
+             replace(/%2C/gi, ',').
+             replace(/%3B/gi, ';').
+             replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));
+}
+
+var ngAttrPrefixes = ['ng-', 'data-ng-', 'ng:', 'x-ng-'];
+
+function getNgAttribute(element, ngAttr) {
+  var attr, i, ii = ngAttrPrefixes.length;
+  for (i = 0; i < ii; ++i) {
+    attr = ngAttrPrefixes[i] + ngAttr;
+    if (isString(attr = element.getAttribute(attr))) {
+      return attr;
+    }
+  }
+  return null;
+}
+
+/**
+ * @ngdoc directive
+ * @name ngApp
+ * @module ng
+ *
+ * @element ANY
+ * @param {angular.Module} ngApp an optional application
+ *   {@link angular.module module} name to load.
+ * @param {boolean=} ngStrictDi if this attribute is present on the app element, the injector will be
+ *   created in "strict-di" mode. This means that the application will fail to invoke functions which
+ *   do not use explicit function annotation (and are thus unsuitable for minification), as described
+ *   in {@link guide/di the Dependency Injection guide}, and useful debugging info will assist in
+ *   tracking down the root of these bugs.
+ *
+ * @description
+ *
+ * Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive
+ * designates the **root element** of the application and is typically placed near the root element
+ * of the page - e.g. on the `<body>` or `<html>` tags.
+ *
+ * There are a few things to keep in mind when using `ngApp`:
+ * - only one AngularJS application can be auto-bootstrapped per HTML document. The first `ngApp`
+ *   found in the document will be used to define the root element to auto-bootstrap as an
+ *   application. To run multiple applications in an HTML document you must manually bootstrap them using
+ *   {@link angular.bootstrap} instead.
+ * - AngularJS applications cannot be nested within each other.
+ * - Do not use a directive that uses {@link ng.$compile#transclusion transclusion} on the same element as `ngApp`.
+ *   This includes directives such as {@link ng.ngIf `ngIf`}, {@link ng.ngInclude `ngInclude`} and
+ *   {@link ngRoute.ngView `ngView`}.
+ *   Doing this misplaces the app {@link ng.$rootElement `$rootElement`} and the app's {@link auto.$injector injector},
+ *   causing animations to stop working and making the injector inaccessible from outside the app.
+ *
+ * You can specify an **AngularJS module** to be used as the root module for the application.  This
+ * module will be loaded into the {@link auto.$injector} when the application is bootstrapped. It
+ * should contain the application code needed or have dependencies on other modules that will
+ * contain the code. See {@link angular.module} for more information.
+ *
+ * In the example below if the `ngApp` directive were not placed on the `html` element then the
+ * document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}`
+ * would not be resolved to `3`.
+ *
+ * `ngApp` is the easiest, and most common way to bootstrap an application.
+ *
+ <example module="ngAppDemo">
+   <file name="index.html">
+   <div ng-controller="ngAppDemoController">
+     I can add: {{a}} + {{b}} =  {{ a+b }}
+   </div>
+   </file>
+   <file name="script.js">
+   angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) {
+     $scope.a = 1;
+     $scope.b = 2;
+   });
+   </file>
+ </example>
+ *
+ * Using `ngStrictDi`, you would see something like this:
+ *
+ <example ng-app-included="true">
+   <file name="index.html">
+   <div ng-app="ngAppStrictDemo" ng-strict-di>
+       <div ng-controller="GoodController1">
+           I can add: {{a}} + {{b}} =  {{ a+b }}
+
+           <p>This renders because the controller does not fail to
+              instantiate, by using explicit annotation style (see
+              script.js for details)
+           </p>
+       </div>
+
+       <div ng-controller="GoodController2">
+           Name: <input ng-model="name"><br />
+           Hello, {{name}}!
+
+           <p>This renders because the controller does not fail to
+              instantiate, by using explicit annotation style
+              (see script.js for details)
+           </p>
+       </div>
+
+       <div ng-controller="BadController">
+           I can add: {{a}} + {{b}} =  {{ a+b }}
+
+           <p>The controller could not be instantiated, due to relying
+              on automatic function annotations (which are disabled in
+              strict mode). As such, the content of this section is not
+              interpolated, and there should be an error in your web console.
+           </p>
+       </div>
+   </div>
+   </file>
+   <file name="script.js">
+   angular.module('ngAppStrictDemo', [])
+     // BadController will fail to instantiate, due to relying on automatic function annotation,
+     // rather than an explicit annotation
+     .controller('BadController', function($scope) {
+       $scope.a = 1;
+       $scope.b = 2;
+     })
+     // Unlike BadController, GoodController1 and GoodController2 will not fail to be instantiated,
+     // due to using explicit annotations using the array style and $inject property, respectively.
+     .controller('GoodController1', ['$scope', function($scope) {
+       $scope.a = 1;
+       $scope.b = 2;
+     }])
+     .controller('GoodController2', GoodController2);
+     function GoodController2($scope) {
+       $scope.name = "World";
+     }
+     GoodController2.$inject = ['$scope'];
+   </file>
+   <file name="style.css">
+   div[ng-controller] {
+       margin-bottom: 1em;
+       -webkit-border-radius: 4px;
+       border-radius: 4px;
+       border: 1px solid;
+       padding: .5em;
+   }
+   div[ng-controller^=Good] {
+       border-color: #d6e9c6;
+       background-color: #dff0d8;
+       color: #3c763d;
+   }
+   div[ng-controller^=Bad] {
+       border-color: #ebccd1;
+       background-color: #f2dede;
+       color: #a94442;
+       margin-bottom: 0;
+   }
+   </file>
+ </example>
+ */
+function angularInit(element, bootstrap) {
+  var appElement,
+      module,
+      config = {};
+
+  // The element `element` has priority over any other element.
+  forEach(ngAttrPrefixes, function(prefix) {
+    var name = prefix + 'app';
+
+    if (!appElement && element.hasAttribute && element.hasAttribute(name)) {
+      appElement = element;
+      module = element.getAttribute(name);
+    }
+  });
+  forEach(ngAttrPrefixes, function(prefix) {
+    var name = prefix + 'app';
+    var candidate;
+
+    if (!appElement && (candidate = element.querySelector('[' + name.replace(':', '\\:') + ']'))) {
+      appElement = candidate;
+      module = candidate.getAttribute(name);
+    }
+  });
+  if (appElement) {
+    config.strictDi = getNgAttribute(appElement, "strict-di") !== null;
+    bootstrap(appElement, module ? [module] : [], config);
+  }
+}
+
+/**
+ * @ngdoc function
+ * @name angular.bootstrap
+ * @module ng
+ * @description
+ * Use this function to manually start up angular application.
+ *
+ * For more information, see the {@link guide/bootstrap Bootstrap guide}.
+ *
+ * Angular will detect if it has been loaded into the browser more than once and only allow the
+ * first loaded script to be bootstrapped and will report a warning to the browser console for
+ * each of the subsequent scripts. This prevents strange results in applications, where otherwise
+ * multiple instances of Angular try to work on the DOM.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Protractor based end-to-end tests cannot use this function to bootstrap manually.
+ * They must use {@link ng.directive:ngApp ngApp}.
+ * </div>
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Do not bootstrap the app on an element with a directive that uses {@link ng.$compile#transclusion transclusion},
+ * such as {@link ng.ngIf `ngIf`}, {@link ng.ngInclude `ngInclude`} and {@link ngRoute.ngView `ngView`}.
+ * Doing this misplaces the app {@link ng.$rootElement `$rootElement`} and the app's {@link auto.$injector injector},
+ * causing animations to stop working and making the injector inaccessible from outside the app.
+ * </div>
+ *
+ * ```html
+ * <!doctype html>
+ * <html>
+ * <body>
+ * <div ng-controller="WelcomeController">
+ *   {{greeting}}
+ * </div>
+ *
+ * <script src="angular.js"></script>
+ * <script>
+ *   var app = angular.module('demo', [])
+ *   .controller('WelcomeController', function($scope) {
+ *       $scope.greeting = 'Welcome!';
+ *   });
+ *   angular.bootstrap(document, ['demo']);
+ * </script>
+ * </body>
+ * </html>
+ * ```
+ *
+ * @param {DOMElement} element DOM element which is the root of angular application.
+ * @param {Array<String|Function|Array>=} modules an array of modules to load into the application.
+ *     Each item in the array should be the name of a predefined module or a (DI annotated)
+ *     function that will be invoked by the injector as a `config` block.
+ *     See: {@link angular.module modules}
+ * @param {Object=} config an object for defining configuration options for the application. The
+ *     following keys are supported:
+ *
+ * * `strictDi` - disable automatic function annotation for the application. This is meant to
+ *   assist in finding bugs which break minified code. Defaults to `false`.
+ *
+ * @returns {auto.$injector} Returns the newly created injector for this app.
+ */
+function bootstrap(element, modules, config) {
+  if (!isObject(config)) config = {};
+  var defaultConfig = {
+    strictDi: false
+  };
+  config = extend(defaultConfig, config);
+  var doBootstrap = function() {
+    element = jqLite(element);
+
+    if (element.injector()) {
+      var tag = (element[0] === window.document) ? 'document' : startingTag(element);
+      // Encode angle brackets to prevent input from being sanitized to empty string #8683.
+      throw ngMinErr(
+          'btstrpd',
+          "App already bootstrapped with this element '{0}'",
+          tag.replace(/</,'&lt;').replace(/>/,'&gt;'));
+    }
+
+    modules = modules || [];
+    modules.unshift(['$provide', function($provide) {
+      $provide.value('$rootElement', element);
+    }]);
+
+    if (config.debugInfoEnabled) {
+      // Pushing so that this overrides `debugInfoEnabled` setting defined in user's `modules`.
+      modules.push(['$compileProvider', function($compileProvider) {
+        $compileProvider.debugInfoEnabled(true);
+      }]);
+    }
+
+    modules.unshift('ng');
+    var injector = createInjector(modules, config.strictDi);
+    injector.invoke(['$rootScope', '$rootElement', '$compile', '$injector',
+       function bootstrapApply(scope, element, compile, injector) {
+        scope.$apply(function() {
+          element.data('$injector', injector);
+          compile(element)(scope);
+        });
+      }]
+    );
+    return injector;
+  };
+
+  var NG_ENABLE_DEBUG_INFO = /^NG_ENABLE_DEBUG_INFO!/;
+  var NG_DEFER_BOOTSTRAP = /^NG_DEFER_BOOTSTRAP!/;
+
+  if (window && NG_ENABLE_DEBUG_INFO.test(window.name)) {
+    config.debugInfoEnabled = true;
+    window.name = window.name.replace(NG_ENABLE_DEBUG_INFO, '');
+  }
+
+  if (window && !NG_DEFER_BOOTSTRAP.test(window.name)) {
+    return doBootstrap();
+  }
+
+  window.name = window.name.replace(NG_DEFER_BOOTSTRAP, '');
+  angular.resumeBootstrap = function(extraModules) {
+    forEach(extraModules, function(module) {
+      modules.push(module);
+    });
+    return doBootstrap();
+  };
+
+  if (isFunction(angular.resumeDeferredBootstrap)) {
+    angular.resumeDeferredBootstrap();
+  }
+}
+
+/**
+ * @ngdoc function
+ * @name angular.reloadWithDebugInfo
+ * @module ng
+ * @description
+ * Use this function to reload the current application with debug information turned on.
+ * This takes precedence over a call to `$compileProvider.debugInfoEnabled(false)`.
+ *
+ * See {@link ng.$compileProvider#debugInfoEnabled} for more.
+ */
+function reloadWithDebugInfo() {
+  window.name = 'NG_ENABLE_DEBUG_INFO!' + window.name;
+  window.location.reload();
+}
+
+/**
+ * @name angular.getTestability
+ * @module ng
+ * @description
+ * Get the testability service for the instance of Angular on the given
+ * element.
+ * @param {DOMElement} element DOM element which is the root of angular application.
+ */
+function getTestability(rootElement) {
+  var injector = angular.element(rootElement).injector();
+  if (!injector) {
+    throw ngMinErr('test',
+      'no injector found for element argument to getTestability');
+  }
+  return injector.get('$$testability');
+}
+
+var SNAKE_CASE_REGEXP = /[A-Z]/g;
+function snake_case(name, separator) {
+  separator = separator || '_';
+  return name.replace(SNAKE_CASE_REGEXP, function(letter, pos) {
+    return (pos ? separator : '') + letter.toLowerCase();
+  });
+}
+
+var bindJQueryFired = false;
+function bindJQuery() {
+  var originalCleanData;
+
+  if (bindJQueryFired) {
+    return;
+  }
+
+  // bind to jQuery if present;
+  var jqName = jq();
+  jQuery = isUndefined(jqName) ? window.jQuery :   // use jQuery (if present)
+           !jqName             ? undefined     :   // use jqLite
+                                 window[jqName];   // use jQuery specified by `ngJq`
+
+  // Use jQuery if it exists with proper functionality, otherwise default to us.
+  // Angular 1.2+ requires jQuery 1.7+ for on()/off() support.
+  // Angular 1.3+ technically requires at least jQuery 2.1+ but it may work with older
+  // versions. It will not work for sure with jQuery <1.7, though.
+  if (jQuery && jQuery.fn.on) {
+    jqLite = jQuery;
+    extend(jQuery.fn, {
+      scope: JQLitePrototype.scope,
+      isolateScope: JQLitePrototype.isolateScope,
+      controller: JQLitePrototype.controller,
+      injector: JQLitePrototype.injector,
+      inheritedData: JQLitePrototype.inheritedData
+    });
+
+    // All nodes removed from the DOM via various jQuery APIs like .remove()
+    // are passed through jQuery.cleanData. Monkey-patch this method to fire
+    // the $destroy event on all removed nodes.
+    originalCleanData = jQuery.cleanData;
+    jQuery.cleanData = function(elems) {
+      var events;
+      for (var i = 0, elem; (elem = elems[i]) != null; i++) {
+        events = jQuery._data(elem, "events");
+        if (events && events.$destroy) {
+          jQuery(elem).triggerHandler('$destroy');
+        }
+      }
+      originalCleanData(elems);
+    };
+  } else {
+    jqLite = JQLite;
+  }
+
+  angular.element = jqLite;
+
+  // Prevent double-proxying.
+  bindJQueryFired = true;
+}
+
+/**
+ * throw error if the argument is falsy.
+ */
+function assertArg(arg, name, reason) {
+  if (!arg) {
+    throw ngMinErr('areq', "Argument '{0}' is {1}", (name || '?'), (reason || "required"));
+  }
+  return arg;
+}
+
+function assertArgFn(arg, name, acceptArrayAnnotation) {
+  if (acceptArrayAnnotation && isArray(arg)) {
+      arg = arg[arg.length - 1];
+  }
+
+  assertArg(isFunction(arg), name, 'not a function, got ' +
+      (arg && typeof arg === 'object' ? arg.constructor.name || 'Object' : typeof arg));
+  return arg;
+}
+
+/**
+ * throw error if the name given is hasOwnProperty
+ * @param  {String} name    the name to test
+ * @param  {String} context the context in which the name is used, such as module or directive
+ */
+function assertNotHasOwnProperty(name, context) {
+  if (name === 'hasOwnProperty') {
+    throw ngMinErr('badname', "hasOwnProperty is not a valid {0} name", context);
+  }
+}
+
+/**
+ * Return the value accessible from the object by path. Any undefined traversals are ignored
+ * @param {Object} obj starting object
+ * @param {String} path path to traverse
+ * @param {boolean} [bindFnToScope=true]
+ * @returns {Object} value as accessible by path
+ */
+//TODO(misko): this function needs to be removed
+function getter(obj, path, bindFnToScope) {
+  if (!path) return obj;
+  var keys = path.split('.');
+  var key;
+  var lastInstance = obj;
+  var len = keys.length;
+
+  for (var i = 0; i < len; i++) {
+    key = keys[i];
+    if (obj) {
+      obj = (lastInstance = obj)[key];
+    }
+  }
+  if (!bindFnToScope && isFunction(obj)) {
+    return bind(lastInstance, obj);
+  }
+  return obj;
+}
+
+/**
+ * Return the DOM siblings between the first and last node in the given array.
+ * @param {Array} array like object
+ * @returns {Array} the inputted object or a jqLite collection containing the nodes
+ */
+function getBlockNodes(nodes) {
+  // TODO(perf): update `nodes` instead of creating a new object?
+  var node = nodes[0];
+  var endNode = nodes[nodes.length - 1];
+  var blockNodes;
+
+  for (var i = 1; node !== endNode && (node = node.nextSibling); i++) {
+    if (blockNodes || nodes[i] !== node) {
+      if (!blockNodes) {
+        blockNodes = jqLite(slice.call(nodes, 0, i));
+      }
+      blockNodes.push(node);
+    }
+  }
+
+  return blockNodes || nodes;
+}
+
+
+/**
+ * Creates a new object without a prototype. This object is useful for lookup without having to
+ * guard against prototypically inherited properties via hasOwnProperty.
+ *
+ * Related micro-benchmarks:
+ * - http://jsperf.com/object-create2
+ * - http://jsperf.com/proto-map-lookup/2
+ * - http://jsperf.com/for-in-vs-object-keys2
+ *
+ * @returns {Object}
+ */
+function createMap() {
+  return Object.create(null);
+}
+
+var NODE_TYPE_ELEMENT = 1;
+var NODE_TYPE_ATTRIBUTE = 2;
+var NODE_TYPE_TEXT = 3;
+var NODE_TYPE_COMMENT = 8;
+var NODE_TYPE_DOCUMENT = 9;
+var NODE_TYPE_DOCUMENT_FRAGMENT = 11;
+
+/**
+ * @ngdoc type
+ * @name angular.Module
+ * @module ng
+ * @description
+ *
+ * Interface for configuring angular {@link angular.module modules}.
+ */
+
+function setupModuleLoader(window) {
+
+  var $injectorMinErr = minErr('$injector');
+  var ngMinErr = minErr('ng');
+
+  function ensure(obj, name, factory) {
+    return obj[name] || (obj[name] = factory());
+  }
+
+  var angular = ensure(window, 'angular', Object);
+
+  // We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap
+  angular.$$minErr = angular.$$minErr || minErr;
+
+  return ensure(angular, 'module', function() {
+    /** @type {Object.<string, angular.Module>} */
+    var modules = {};
+
+    /**
+     * @ngdoc function
+     * @name angular.module
+     * @module ng
+     * @description
+     *
+     * The `angular.module` is a global place for creating, registering and retrieving Angular
+     * modules.
+     * All modules (angular core or 3rd party) that should be available to an application must be
+     * registered using this mechanism.
+     *
+     * Passing one argument retrieves an existing {@link angular.Module},
+     * whereas passing more than one argument creates a new {@link angular.Module}
+     *
+     *
+     * # Module
+     *
+     * A module is a collection of services, directives, controllers, filters, and configuration information.
+     * `angular.module` is used to configure the {@link auto.$injector $injector}.
+     *
+     * ```js
+     * // Create a new module
+     * var myModule = angular.module('myModule', []);
+     *
+     * // register a new service
+     * myModule.value('appName', 'MyCoolApp');
+     *
+     * // configure existing services inside initialization blocks.
+     * myModule.config(['$locationProvider', function($locationProvider) {
+     *   // Configure existing providers
+     *   $locationProvider.hashPrefix('!');
+     * }]);
+     * ```
+     *
+     * Then you can create an injector and load your modules like this:
+     *
+     * ```js
+     * var injector = angular.injector(['ng', 'myModule'])
+     * ```
+     *
+     * However it's more likely that you'll just use
+     * {@link ng.directive:ngApp ngApp} or
+     * {@link angular.bootstrap} to simplify this process for you.
+     *
+     * @param {!string} name The name of the module to create or retrieve.
+     * @param {!Array.<string>=} requires If specified then new module is being created. If
+     *        unspecified then the module is being retrieved for further configuration.
+     * @param {Function=} configFn Optional configuration function for the module. Same as
+     *        {@link angular.Module#config Module#config()}.
+     * @returns {angular.Module} new module with the {@link angular.Module} api.
+     */
+    return function module(name, requires, configFn) {
+      var assertNotHasOwnProperty = function(name, context) {
+        if (name === 'hasOwnProperty') {
+          throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
+        }
+      };
+
+      assertNotHasOwnProperty(name, 'module');
+      if (requires && modules.hasOwnProperty(name)) {
+        modules[name] = null;
+      }
+      return ensure(modules, name, function() {
+        if (!requires) {
+          throw $injectorMinErr('nomod', "Module '{0}' is not available! You either misspelled " +
+             "the module name or forgot to load it. If registering a module ensure that you " +
+             "specify the dependencies as the second argument.", name);
+        }
+
+        /** @type {!Array.<Array.<*>>} */
+        var invokeQueue = [];
+
+        /** @type {!Array.<Function>} */
+        var configBlocks = [];
+
+        /** @type {!Array.<Function>} */
+        var runBlocks = [];
+
+        var config = invokeLater('$injector', 'invoke', 'push', configBlocks);
+
+        /** @type {angular.Module} */
+        var moduleInstance = {
+          // Private state
+          _invokeQueue: invokeQueue,
+          _configBlocks: configBlocks,
+          _runBlocks: runBlocks,
+
+          /**
+           * @ngdoc property
+           * @name angular.Module#requires
+           * @module ng
+           *
+           * @description
+           * Holds the list of modules which the injector will load before the current module is
+           * loaded.
+           */
+          requires: requires,
+
+          /**
+           * @ngdoc property
+           * @name angular.Module#name
+           * @module ng
+           *
+           * @description
+           * Name of the module.
+           */
+          name: name,
+
+
+          /**
+           * @ngdoc method
+           * @name angular.Module#provider
+           * @module ng
+           * @param {string} name service name
+           * @param {Function} providerType Construction function for creating new instance of the
+           *                                service.
+           * @description
+           * See {@link auto.$provide#provider $provide.provider()}.
+           */
+          provider: invokeLaterAndSetModuleName('$provide', 'provider'),
+
+          /**
+           * @ngdoc method
+           * @name angular.Module#factory
+           * @module ng
+           * @param {string} name service name
+           * @param {Function} providerFunction Function for creating new instance of the service.
+           * @description
+           * See {@link auto.$provide#factory $provide.factory()}.
+           */
+          factory: invokeLaterAndSetModuleName('$provide', 'factory'),
+
+          /**
+           * @ngdoc method
+           * @name angular.Module#service
+           * @module ng
+           * @param {string} name service name
+           * @param {Function} constructor A constructor function that will be instantiated.
+           * @description
+           * See {@link auto.$provide#service $provide.service()}.
+           */
+          service: invokeLaterAndSetModuleName('$provide', 'service'),
+
+          /**
+           * @ngdoc method
+           * @name angular.Module#value
+           * @module ng
+           * @param {string} name service name
+           * @param {*} object Service instance object.
+           * @description
+           * See {@link auto.$provide#value $provide.value()}.
+           */
+          value: invokeLater('$provide', 'value'),
+
+          /**
+           * @ngdoc method
+           * @name angular.Module#constant
+           * @module ng
+           * @param {string} name constant name
+           * @param {*} object Constant value.
+           * @description
+           * Because the constants are fixed, they get applied before other provide methods.
+           * See {@link auto.$provide#constant $provide.constant()}.
+           */
+          constant: invokeLater('$provide', 'constant', 'unshift'),
+
+           /**
+           * @ngdoc method
+           * @name angular.Module#decorator
+           * @module ng
+           * @param {string} name The name of the service to decorate.
+           * @param {Function} decorFn This function will be invoked when the service needs to be
+           *                           instantiated and should return the decorated service instance.
+           * @description
+           * See {@link auto.$provide#decorator $provide.decorator()}.
+           */
+          decorator: invokeLaterAndSetModuleName('$provide', 'decorator'),
+
+          /**
+           * @ngdoc method
+           * @name angular.Module#animation
+           * @module ng
+           * @param {string} name animation name
+           * @param {Function} animationFactory Factory function for creating new instance of an
+           *                                    animation.
+           * @description
+           *
+           * **NOTE**: animations take effect only if the **ngAnimate** module is loaded.
+           *
+           *
+           * Defines an animation hook that can be later used with
+           * {@link $animate $animate} service and directives that use this service.
+           *
+           * ```js
+           * module.animation('.animation-name', function($inject1, $inject2) {
+           *   return {
+           *     eventName : function(element, done) {
+           *       //code to run the animation
+           *       //once complete, then run done()
+           *       return function cancellationFunction(element) {
+           *         //code to cancel the animation
+           *       }
+           *     }
+           *   }
+           * })
+           * ```
+           *
+           * See {@link ng.$animateProvider#register $animateProvider.register()} and
+           * {@link ngAnimate ngAnimate module} for more information.
+           */
+          animation: invokeLaterAndSetModuleName('$animateProvider', 'register'),
+
+          /**
+           * @ngdoc method
+           * @name angular.Module#filter
+           * @module ng
+           * @param {string} name Filter name - this must be a valid angular expression identifier
+           * @param {Function} filterFactory Factory function for creating new instance of filter.
+           * @description
+           * See {@link ng.$filterProvider#register $filterProvider.register()}.
+           *
+           * <div class="alert alert-warning">
+           * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.
+           * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace
+           * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores
+           * (`myapp_subsection_filterx`).
+           * </div>
+           */
+          filter: invokeLaterAndSetModuleName('$filterProvider', 'register'),
+
+          /**
+           * @ngdoc method
+           * @name angular.Module#controller
+           * @module ng
+           * @param {string|Object} name Controller name, or an object map of controllers where the
+           *    keys are the names and the values are the constructors.
+           * @param {Function} constructor Controller constructor function.
+           * @description
+           * See {@link ng.$controllerProvider#register $controllerProvider.register()}.
+           */
+          controller: invokeLaterAndSetModuleName('$controllerProvider', 'register'),
+
+          /**
+           * @ngdoc method
+           * @name angular.Module#directive
+           * @module ng
+           * @param {string|Object} name Directive name, or an object map of directives where the
+           *    keys are the names and the values are the factories.
+           * @param {Function} directiveFactory Factory function for creating new instance of
+           * directives.
+           * @description
+           * See {@link ng.$compileProvider#directive $compileProvider.directive()}.
+           */
+          directive: invokeLaterAndSetModuleName('$compileProvider', 'directive'),
+
+          /**
+           * @ngdoc method
+           * @name angular.Module#component
+           * @module ng
+           * @param {string} name Name of the component in camel-case (i.e. myComp which will match as my-comp)
+           * @param {Object} options Component definition object (a simplified
+           *    {@link ng.$compile#directive-definition-object directive definition object})
+           *
+           * @description
+           * See {@link ng.$compileProvider#component $compileProvider.component()}.
+           */
+          component: invokeLaterAndSetModuleName('$compileProvider', 'component'),
+
+          /**
+           * @ngdoc method
+           * @name angular.Module#config
+           * @module ng
+           * @param {Function} configFn Execute this function on module load. Useful for service
+           *    configuration.
+           * @description
+           * Use this method to register work which needs to be performed on module loading.
+           * For more about how to configure services, see
+           * {@link providers#provider-recipe Provider Recipe}.
+           */
+          config: config,
+
+          /**
+           * @ngdoc method
+           * @name angular.Module#run
+           * @module ng
+           * @param {Function} initializationFn Execute this function after injector creation.
+           *    Useful for application initialization.
+           * @description
+           * Use this method to register work which should be performed when the injector is done
+           * loading all modules.
+           */
+          run: function(block) {
+            runBlocks.push(block);
+            return this;
+          }
+        };
+
+        if (configFn) {
+          config(configFn);
+        }
+
+        return moduleInstance;
+
+        /**
+         * @param {string} provider
+         * @param {string} method
+         * @param {String=} insertMethod
+         * @returns {angular.Module}
+         */
+        function invokeLater(provider, method, insertMethod, queue) {
+          if (!queue) queue = invokeQueue;
+          return function() {
+            queue[insertMethod || 'push']([provider, method, arguments]);
+            return moduleInstance;
+          };
+        }
+
+        /**
+         * @param {string} provider
+         * @param {string} method
+         * @returns {angular.Module}
+         */
+        function invokeLaterAndSetModuleName(provider, method) {
+          return function(recipeName, factoryFunction) {
+            if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name;
+            invokeQueue.push([provider, method, arguments]);
+            return moduleInstance;
+          };
+        }
+      });
+    };
+  });
+
+}
+
+/* global shallowCopy: true */
+
+/**
+ * Creates a shallow copy of an object, an array or a primitive.
+ *
+ * Assumes that there are no proto properties for objects.
+ */
+function shallowCopy(src, dst) {
+  if (isArray(src)) {
+    dst = dst || [];
+
+    for (var i = 0, ii = src.length; i < ii; i++) {
+      dst[i] = src[i];
+    }
+  } else if (isObject(src)) {
+    dst = dst || {};
+
+    for (var key in src) {
+      if (!(key.charAt(0) === '$' && key.charAt(1) === '$')) {
+        dst[key] = src[key];
+      }
+    }
+  }
+
+  return dst || src;
+}
+
+/* global toDebugString: true */
+
+function serializeObject(obj) {
+  var seen = [];
+
+  return JSON.stringify(obj, function(key, val) {
+    val = toJsonReplacer(key, val);
+    if (isObject(val)) {
+
+      if (seen.indexOf(val) >= 0) return '...';
+
+      seen.push(val);
+    }
+    return val;
+  });
+}
+
+function toDebugString(obj) {
+  if (typeof obj === 'function') {
+    return obj.toString().replace(/ \{[\s\S]*$/, '');
+  } else if (isUndefined(obj)) {
+    return 'undefined';
+  } else if (typeof obj !== 'string') {
+    return serializeObject(obj);
+  }
+  return obj;
+}
+
+/* global angularModule: true,
+  version: true,
+
+  $CompileProvider,
+
+  htmlAnchorDirective,
+  inputDirective,
+  inputDirective,
+  formDirective,
+  scriptDirective,
+  selectDirective,
+  styleDirective,
+  optionDirective,
+  ngBindDirective,
+  ngBindHtmlDirective,
+  ngBindTemplateDirective,
+  ngClassDirective,
+  ngClassEvenDirective,
+  ngClassOddDirective,
+  ngCloakDirective,
+  ngControllerDirective,
+  ngFormDirective,
+  ngHideDirective,
+  ngIfDirective,
+  ngIncludeDirective,
+  ngIncludeFillContentDirective,
+  ngInitDirective,
+  ngNonBindableDirective,
+  ngPluralizeDirective,
+  ngRepeatDirective,
+  ngShowDirective,
+  ngStyleDirective,
+  ngSwitchDirective,
+  ngSwitchWhenDirective,
+  ngSwitchDefaultDirective,
+  ngOptionsDirective,
+  ngTranscludeDirective,
+  ngModelDirective,
+  ngListDirective,
+  ngChangeDirective,
+  patternDirective,
+  patternDirective,
+  requiredDirective,
+  requiredDirective,
+  minlengthDirective,
+  minlengthDirective,
+  maxlengthDirective,
+  maxlengthDirective,
+  ngValueDirective,
+  ngModelOptionsDirective,
+  ngAttributeAliasDirectives,
+  ngEventDirectives,
+
+  $AnchorScrollProvider,
+  $AnimateProvider,
+  $CoreAnimateCssProvider,
+  $$CoreAnimateJsProvider,
+  $$CoreAnimateQueueProvider,
+  $$AnimateRunnerFactoryProvider,
+  $$AnimateAsyncRunFactoryProvider,
+  $BrowserProvider,
+  $CacheFactoryProvider,
+  $ControllerProvider,
+  $DateProvider,
+  $DocumentProvider,
+  $ExceptionHandlerProvider,
+  $FilterProvider,
+  $$ForceReflowProvider,
+  $InterpolateProvider,
+  $IntervalProvider,
+  $$HashMapProvider,
+  $HttpProvider,
+  $HttpParamSerializerProvider,
+  $HttpParamSerializerJQLikeProvider,
+  $HttpBackendProvider,
+  $xhrFactoryProvider,
+  $jsonpCallbacksProvider,
+  $LocationProvider,
+  $LogProvider,
+  $ParseProvider,
+  $RootScopeProvider,
+  $QProvider,
+  $$QProvider,
+  $$SanitizeUriProvider,
+  $SceProvider,
+  $SceDelegateProvider,
+  $SnifferProvider,
+  $TemplateCacheProvider,
+  $TemplateRequestProvider,
+  $$TestabilityProvider,
+  $TimeoutProvider,
+  $$RAFProvider,
+  $WindowProvider,
+  $$jqLiteProvider,
+  $$CookieReaderProvider
+*/
+
+
+/**
+ * @ngdoc object
+ * @name angular.version
+ * @module ng
+ * @description
+ * An object that contains information about the current AngularJS version.
+ *
+ * This object has the following properties:
+ *
+ * - `full` – `{string}` – Full version string, such as "0.9.18".
+ * - `major` – `{number}` – Major version number, such as "0".
+ * - `minor` – `{number}` – Minor version number, such as "9".
+ * - `dot` – `{number}` – Dot version number, such as "18".
+ * - `codeName` – `{string}` – Code name of the release, such as "jiggling-armfat".
+ */
+var version = {
+  full: '1.5.8',    // all of these placeholder strings will be replaced by grunt's
+  major: 1,    // package task
+  minor: 5,
+  dot: 8,
+  codeName: 'arbitrary-fallbacks'
+};
+
+
+function publishExternalAPI(angular) {
+  extend(angular, {
+    'bootstrap': bootstrap,
+    'copy': copy,
+    'extend': extend,
+    'merge': merge,
+    'equals': equals,
+    'element': jqLite,
+    'forEach': forEach,
+    'injector': createInjector,
+    'noop': noop,
+    'bind': bind,
+    'toJson': toJson,
+    'fromJson': fromJson,
+    'identity': identity,
+    'isUndefined': isUndefined,
+    'isDefined': isDefined,
+    'isString': isString,
+    'isFunction': isFunction,
+    'isObject': isObject,
+    'isNumber': isNumber,
+    'isElement': isElement,
+    'isArray': isArray,
+    'version': version,
+    'isDate': isDate,
+    'lowercase': lowercase,
+    'uppercase': uppercase,
+    'callbacks': {$$counter: 0},
+    'getTestability': getTestability,
+    '$$minErr': minErr,
+    '$$csp': csp,
+    'reloadWithDebugInfo': reloadWithDebugInfo
+  });
+
+  angularModule = setupModuleLoader(window);
+
+  angularModule('ng', ['ngLocale'], ['$provide',
+    function ngModule($provide) {
+      // $$sanitizeUriProvider needs to be before $compileProvider as it is used by it.
+      $provide.provider({
+        $$sanitizeUri: $$SanitizeUriProvider
+      });
+      $provide.provider('$compile', $CompileProvider).
+        directive({
+            a: htmlAnchorDirective,
+            input: inputDirective,
+            textarea: inputDirective,
+            form: formDirective,
+            script: scriptDirective,
+            select: selectDirective,
+            style: styleDirective,
+            option: optionDirective,
+            ngBind: ngBindDirective,
+            ngBindHtml: ngBindHtmlDirective,
+            ngBindTemplate: ngBindTemplateDirective,
+            ngClass: ngClassDirective,
+            ngClassEven: ngClassEvenDirective,
+            ngClassOdd: ngClassOddDirective,
+            ngCloak: ngCloakDirective,
+            ngController: ngControllerDirective,
+            ngForm: ngFormDirective,
+            ngHide: ngHideDirective,
+            ngIf: ngIfDirective,
+            ngInclude: ngIncludeDirective,
+            ngInit: ngInitDirective,
+            ngNonBindable: ngNonBindableDirective,
+            ngPluralize: ngPluralizeDirective,
+            ngRepeat: ngRepeatDirective,
+            ngShow: ngShowDirective,
+            ngStyle: ngStyleDirective,
+            ngSwitch: ngSwitchDirective,
+            ngSwitchWhen: ngSwitchWhenDirective,
+            ngSwitchDefault: ngSwitchDefaultDirective,
+            ngOptions: ngOptionsDirective,
+            ngTransclude: ngTranscludeDirective,
+            ngModel: ngModelDirective,
+            ngList: ngListDirective,
+            ngChange: ngChangeDirective,
+            pattern: patternDirective,
+            ngPattern: patternDirective,
+            required: requiredDirective,
+            ngRequired: requiredDirective,
+            minlength: minlengthDirective,
+            ngMinlength: minlengthDirective,
+            maxlength: maxlengthDirective,
+            ngMaxlength: maxlengthDirective,
+            ngValue: ngValueDirective,
+            ngModelOptions: ngModelOptionsDirective
+        }).
+        directive({
+          ngInclude: ngIncludeFillContentDirective
+        }).
+        directive(ngAttributeAliasDirectives).
+        directive(ngEventDirectives);
+      $provide.provider({
+        $anchorScroll: $AnchorScrollProvider,
+        $animate: $AnimateProvider,
+        $animateCss: $CoreAnimateCssProvider,
+        $$animateJs: $$CoreAnimateJsProvider,
+        $$animateQueue: $$CoreAnimateQueueProvider,
+        $$AnimateRunner: $$AnimateRunnerFactoryProvider,
+        $$animateAsyncRun: $$AnimateAsyncRunFactoryProvider,
+        $browser: $BrowserProvider,
+        $cacheFactory: $CacheFactoryProvider,
+        $controller: $ControllerProvider,
+        $document: $DocumentProvider,
+        $exceptionHandler: $ExceptionHandlerProvider,
+        $filter: $FilterProvider,
+        $$forceReflow: $$ForceReflowProvider,
+        $interpolate: $InterpolateProvider,
+        $interval: $IntervalProvider,
+        $http: $HttpProvider,
+        $httpParamSerializer: $HttpParamSerializerProvider,
+        $httpParamSerializerJQLike: $HttpParamSerializerJQLikeProvider,
+        $httpBackend: $HttpBackendProvider,
+        $xhrFactory: $xhrFactoryProvider,
+        $jsonpCallbacks: $jsonpCallbacksProvider,
+        $location: $LocationProvider,
+        $log: $LogProvider,
+        $parse: $ParseProvider,
+        $rootScope: $RootScopeProvider,
+        $q: $QProvider,
+        $$q: $$QProvider,
+        $sce: $SceProvider,
+        $sceDelegate: $SceDelegateProvider,
+        $sniffer: $SnifferProvider,
+        $templateCache: $TemplateCacheProvider,
+        $templateRequest: $TemplateRequestProvider,
+        $$testability: $$TestabilityProvider,
+        $timeout: $TimeoutProvider,
+        $window: $WindowProvider,
+        $$rAF: $$RAFProvider,
+        $$jqLite: $$jqLiteProvider,
+        $$HashMap: $$HashMapProvider,
+        $$cookieReader: $$CookieReaderProvider
+      });
+    }
+  ]);
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *     Any commits to this file should be reviewed with security in mind.  *
+ *   Changes to this file can potentially create security vulnerabilities. *
+ *          An approval from 2 Core members with history of modifying      *
+ *                         this file is required.                          *
+ *                                                                         *
+ *  Does the change somehow allow for arbitrary javascript to be executed? *
+ *    Or allows for someone to change the prototype of built-in objects?   *
+ *     Or gives undesired access to variables likes document or window?    *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* global JQLitePrototype: true,
+  addEventListenerFn: true,
+  removeEventListenerFn: true,
+  BOOLEAN_ATTR: true,
+  ALIASED_ATTR: true,
+*/
+
+//////////////////////////////////
+//JQLite
+//////////////////////////////////
+
+/**
+ * @ngdoc function
+ * @name angular.element
+ * @module ng
+ * @kind function
+ *
+ * @description
+ * Wraps a raw DOM element or HTML string as a [jQuery](http://jquery.com) element.
+ *
+ * If jQuery is available, `angular.element` is an alias for the
+ * [jQuery](http://api.jquery.com/jQuery/) function. If jQuery is not available, `angular.element`
+ * delegates to Angular's built-in subset of jQuery, called "jQuery lite" or **jqLite**.
+ *
+ * jqLite is a tiny, API-compatible subset of jQuery that allows
+ * Angular to manipulate the DOM in a cross-browser compatible way. jqLite implements only the most
+ * commonly needed functionality with the goal of having a very small footprint.
+ *
+ * To use `jQuery`, simply ensure it is loaded before the `angular.js` file. You can also use the
+ * {@link ngJq `ngJq`} directive to specify that jqlite should be used over jQuery, or to use a
+ * specific version of jQuery if multiple versions exist on the page.
+ *
+ * <div class="alert alert-info">**Note:** All element references in Angular are always wrapped with jQuery or
+ * jqLite (such as the element argument in a directive's compile / link function). They are never raw DOM references.</div>
+ *
+ * <div class="alert alert-warning">**Note:** Keep in mind that this function will not find elements
+ * by tag name / CSS selector. For lookups by tag name, try instead `angular.element(document).find(...)`
+ * or `$document.find()`, or use the standard DOM APIs, e.g. `document.querySelectorAll()`.</div>
+ *
+ * ## Angular's jqLite
+ * jqLite provides only the following jQuery methods:
+ *
+ * - [`addClass()`](http://api.jquery.com/addClass/) - Does not support a function as first argument
+ * - [`after()`](http://api.jquery.com/after/)
+ * - [`append()`](http://api.jquery.com/append/)
+ * - [`attr()`](http://api.jquery.com/attr/) - Does not support functions as parameters
+ * - [`bind()`](http://api.jquery.com/bind/) - Does not support namespaces, selectors or eventData
+ * - [`children()`](http://api.jquery.com/children/) - Does not support selectors
+ * - [`clone()`](http://api.jquery.com/clone/)
+ * - [`contents()`](http://api.jquery.com/contents/)
+ * - [`css()`](http://api.jquery.com/css/) - Only retrieves inline-styles, does not call `getComputedStyle()`.
+ *   As a setter, does not convert numbers to strings or append 'px', and also does not have automatic property prefixing.
+ * - [`data()`](http://api.jquery.com/data/)
+ * - [`detach()`](http://api.jquery.com/detach/)
+ * - [`empty()`](http://api.jquery.com/empty/)
+ * - [`eq()`](http://api.jquery.com/eq/)
+ * - [`find()`](http://api.jquery.com/find/) - Limited to lookups by tag name
+ * - [`hasClass()`](http://api.jquery.com/hasClass/)
+ * - [`html()`](http://api.jquery.com/html/)
+ * - [`next()`](http://api.jquery.com/next/) - Does not support selectors
+ * - [`on()`](http://api.jquery.com/on/) - Does not support namespaces, selectors or eventData
+ * - [`off()`](http://api.jquery.com/off/) - Does not support namespaces, selectors or event object as parameter
+ * - [`one()`](http://api.jquery.com/one/) - Does not support namespaces or selectors
+ * - [`parent()`](http://api.jquery.com/parent/) - Does not support selectors
+ * - [`prepend()`](http://api.jquery.com/prepend/)
+ * - [`prop()`](http://api.jquery.com/prop/)
+ * - [`ready()`](http://api.jquery.com/ready/)
+ * - [`remove()`](http://api.jquery.com/remove/)
+ * - [`removeAttr()`](http://api.jquery.com/removeAttr/)
+ * - [`removeClass()`](http://api.jquery.com/removeClass/) - Does not support a function as first argument
+ * - [`removeData()`](http://api.jquery.com/removeData/)
+ * - [`replaceWith()`](http://api.jquery.com/replaceWith/)
+ * - [`text()`](http://api.jquery.com/text/)
+ * - [`toggleClass()`](http://api.jquery.com/toggleClass/) - Does not support a function as first argument
+ * - [`triggerHandler()`](http://api.jquery.com/triggerHandler/) - Passes a dummy event object to handlers
+ * - [`unbind()`](http://api.jquery.com/unbind/) - Does not support namespaces or event object as parameter
+ * - [`val()`](http://api.jquery.com/val/)
+ * - [`wrap()`](http://api.jquery.com/wrap/)
+ *
+ * ## jQuery/jqLite Extras
+ * Angular also provides the following additional methods and events to both jQuery and jqLite:
+ *
+ * ### Events
+ * - `$destroy` - AngularJS intercepts all jqLite/jQuery's DOM destruction apis and fires this event
+ *    on all DOM nodes being removed.  This can be used to clean up any 3rd party bindings to the DOM
+ *    element before it is removed.
+ *
+ * ### Methods
+ * - `controller(name)` - retrieves the controller of the current element or its parent. By default
+ *   retrieves controller associated with the `ngController` directive. If `name` is provided as
+ *   camelCase directive name, then the controller for this directive will be retrieved (e.g.
+ *   `'ngModel'`).
+ * - `injector()` - retrieves the injector of the current element or its parent.
+ * - `scope()` - retrieves the {@link ng.$rootScope.Scope scope} of the current
+ *   element or its parent. Requires {@link guide/production#disabling-debug-data Debug Data} to
+ *   be enabled.
+ * - `isolateScope()` - retrieves an isolate {@link ng.$rootScope.Scope scope} if one is attached directly to the
+ *   current element. This getter should be used only on elements that contain a directive which starts a new isolate
+ *   scope. Calling `scope()` on this element always returns the original non-isolate scope.
+ *   Requires {@link guide/production#disabling-debug-data Debug Data} to be enabled.
+ * - `inheritedData()` - same as `data()`, but walks up the DOM until a value is found or the top
+ *   parent element is reached.
+ *
+ * @knownIssue You cannot spy on `angular.element` if you are using Jasmine version 1.x. See
+ * https://github.com/angular/angular.js/issues/14251 for more information.
+ *
+ * @param {string|DOMElement} element HTML string or DOMElement to be wrapped into jQuery.
+ * @returns {Object} jQuery object.
+ */
+
+JQLite.expando = 'ng339';
+
+var jqCache = JQLite.cache = {},
+    jqId = 1,
+    addEventListenerFn = function(element, type, fn) {
+      element.addEventListener(type, fn, false);
+    },
+    removeEventListenerFn = function(element, type, fn) {
+      element.removeEventListener(type, fn, false);
+    };
+
+/*
+ * !!! This is an undocumented "private" function !!!
+ */
+JQLite._data = function(node) {
+  //jQuery always returns an object on cache miss
+  return this.cache[node[this.expando]] || {};
+};
+
+function jqNextId() { return ++jqId; }
+
+
+var SPECIAL_CHARS_REGEXP = /([\:\-\_]+(.))/g;
+var MOZ_HACK_REGEXP = /^moz([A-Z])/;
+var MOUSE_EVENT_MAP= { mouseleave: "mouseout", mouseenter: "mouseover"};
+var jqLiteMinErr = minErr('jqLite');
+
+/**
+ * Converts snake_case to camelCase.
+ * Also there is special case for Moz prefix starting with upper case letter.
+ * @param name Name to normalize
+ */
+function camelCase(name) {
+  return name.
+    replace(SPECIAL_CHARS_REGEXP, function(_, separator, letter, offset) {
+      return offset ? letter.toUpperCase() : letter;
+    }).
+    replace(MOZ_HACK_REGEXP, 'Moz$1');
+}
+
+var SINGLE_TAG_REGEXP = /^<([\w-]+)\s*\/?>(?:<\/\1>|)$/;
+var HTML_REGEXP = /<|&#?\w+;/;
+var TAG_NAME_REGEXP = /<([\w:-]+)/;
+var XHTML_TAG_REGEXP = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi;
+
+var wrapMap = {
+  'option': [1, '<select multiple="multiple">', '</select>'],
+
+  'thead': [1, '<table>', '</table>'],
+  'col': [2, '<table><colgroup>', '</colgroup></table>'],
+  'tr': [2, '<table><tbody>', '</tbody></table>'],
+  'td': [3, '<table><tbody><tr>', '</tr></tbody></table>'],
+  '_default': [0, "", ""]
+};
+
+wrapMap.optgroup = wrapMap.option;
+wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
+wrapMap.th = wrapMap.td;
+
+
+function jqLiteIsTextNode(html) {
+  return !HTML_REGEXP.test(html);
+}
+
+function jqLiteAcceptsData(node) {
+  // The window object can accept data but has no nodeType
+  // Otherwise we are only interested in elements (1) and documents (9)
+  var nodeType = node.nodeType;
+  return nodeType === NODE_TYPE_ELEMENT || !nodeType || nodeType === NODE_TYPE_DOCUMENT;
+}
+
+function jqLiteHasData(node) {
+  for (var key in jqCache[node.ng339]) {
+    return true;
+  }
+  return false;
+}
+
+function jqLiteCleanData(nodes) {
+  for (var i = 0, ii = nodes.length; i < ii; i++) {
+    jqLiteRemoveData(nodes[i]);
+  }
+}
+
+function jqLiteBuildFragment(html, context) {
+  var tmp, tag, wrap,
+      fragment = context.createDocumentFragment(),
+      nodes = [], i;
+
+  if (jqLiteIsTextNode(html)) {
+    // Convert non-html into a text node
+    nodes.push(context.createTextNode(html));
+  } else {
+    // Convert html into DOM nodes
+    tmp = fragment.appendChild(context.createElement("div"));
+    tag = (TAG_NAME_REGEXP.exec(html) || ["", ""])[1].toLowerCase();
+    wrap = wrapMap[tag] || wrapMap._default;
+    tmp.innerHTML = wrap[1] + html.replace(XHTML_TAG_REGEXP, "<$1></$2>") + wrap[2];
+
+    // Descend through wrappers to the right content
+    i = wrap[0];
+    while (i--) {
+      tmp = tmp.lastChild;
+    }
+
+    nodes = concat(nodes, tmp.childNodes);
+
+    tmp = fragment.firstChild;
+    tmp.textContent = "";
+  }
+
+  // Remove wrapper from fragment
+  fragment.textContent = "";
+  fragment.innerHTML = ""; // Clear inner HTML
+  forEach(nodes, function(node) {
+    fragment.appendChild(node);
+  });
+
+  return fragment;
+}
+
+function jqLiteParseHTML(html, context) {
+  context = context || window.document;
+  var parsed;
+
+  if ((parsed = SINGLE_TAG_REGEXP.exec(html))) {
+    return [context.createElement(parsed[1])];
+  }
+
+  if ((parsed = jqLiteBuildFragment(html, context))) {
+    return parsed.childNodes;
+  }
+
+  return [];
+}
+
+function jqLiteWrapNode(node, wrapper) {
+  var parent = node.parentNode;
+
+  if (parent) {
+    parent.replaceChild(wrapper, node);
+  }
+
+  wrapper.appendChild(node);
+}
+
+
+// IE9-11 has no method "contains" in SVG element and in Node.prototype. Bug #10259.
+var jqLiteContains = window.Node.prototype.contains || function(arg) {
+  // jshint bitwise: false
+  return !!(this.compareDocumentPosition(arg) & 16);
+  // jshint bitwise: true
+};
+
+/////////////////////////////////////////////
+function JQLite(element) {
+  if (element instanceof JQLite) {
+    return element;
+  }
+
+  var argIsString;
+
+  if (isString(element)) {
+    element = trim(element);
+    argIsString = true;
+  }
+  if (!(this instanceof JQLite)) {
+    if (argIsString && element.charAt(0) != '<') {
+      throw jqLiteMinErr('nosel', 'Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element');
+    }
+    return new JQLite(element);
+  }
+
+  if (argIsString) {
+    jqLiteAddNodes(this, jqLiteParseHTML(element));
+  } else {
+    jqLiteAddNodes(this, element);
+  }
+}
+
+function jqLiteClone(element) {
+  return element.cloneNode(true);
+}
+
+function jqLiteDealoc(element, onlyDescendants) {
+  if (!onlyDescendants) jqLiteRemoveData(element);
+
+  if (element.querySelectorAll) {
+    var descendants = element.querySelectorAll('*');
+    for (var i = 0, l = descendants.length; i < l; i++) {
+      jqLiteRemoveData(descendants[i]);
+    }
+  }
+}
+
+function jqLiteOff(element, type, fn, unsupported) {
+  if (isDefined(unsupported)) throw jqLiteMinErr('offargs', 'jqLite#off() does not support the `selector` argument');
+
+  var expandoStore = jqLiteExpandoStore(element);
+  var events = expandoStore && expandoStore.events;
+  var handle = expandoStore && expandoStore.handle;
+
+  if (!handle) return; //no listeners registered
+
+  if (!type) {
+    for (type in events) {
+      if (type !== '$destroy') {
+        removeEventListenerFn(element, type, handle);
+      }
+      delete events[type];
+    }
+  } else {
+
+    var removeHandler = function(type) {
+      var listenerFns = events[type];
+      if (isDefined(fn)) {
+        arrayRemove(listenerFns || [], fn);
+      }
+      if (!(isDefined(fn) && listenerFns && listenerFns.length > 0)) {
+        removeEventListenerFn(element, type, handle);
+        delete events[type];
+      }
+    };
+
+    forEach(type.split(' '), function(type) {
+      removeHandler(type);
+      if (MOUSE_EVENT_MAP[type]) {
+        removeHandler(MOUSE_EVENT_MAP[type]);
+      }
+    });
+  }
+}
+
+function jqLiteRemoveData(element, name) {
+  var expandoId = element.ng339;
+  var expandoStore = expandoId && jqCache[expandoId];
+
+  if (expandoStore) {
+    if (name) {
+      delete expandoStore.data[name];
+      return;
+    }
+
+    if (expandoStore.handle) {
+      if (expandoStore.events.$destroy) {
+        expandoStore.handle({}, '$destroy');
+      }
+      jqLiteOff(element);
+    }
+    delete jqCache[expandoId];
+    element.ng339 = undefined; // don't delete DOM expandos. IE and Chrome don't like it
+  }
+}
+
+
+function jqLiteExpandoStore(element, createIfNecessary) {
+  var expandoId = element.ng339,
+      expandoStore = expandoId && jqCache[expandoId];
+
+  if (createIfNecessary && !expandoStore) {
+    element.ng339 = expandoId = jqNextId();
+    expandoStore = jqCache[expandoId] = {events: {}, data: {}, handle: undefined};
+  }
+
+  return expandoStore;
+}
+
+
+function jqLiteData(element, key, value) {
+  if (jqLiteAcceptsData(element)) {
+
+    var isSimpleSetter = isDefined(value);
+    var isSimpleGetter = !isSimpleSetter && key && !isObject(key);
+    var massGetter = !key;
+    var expandoStore = jqLiteExpandoStore(element, !isSimpleGetter);
+    var data = expandoStore && expandoStore.data;
+
+    if (isSimpleSetter) { // data('key', value)
+      data[key] = value;
+    } else {
+      if (massGetter) {  // data()
+        return data;
+      } else {
+        if (isSimpleGetter) { // data('key')
+          // don't force creation of expandoStore if it doesn't exist yet
+          return data && data[key];
+        } else { // mass-setter: data({key1: val1, key2: val2})
+          extend(data, key);
+        }
+      }
+    }
+  }
+}
+
+function jqLiteHasClass(element, selector) {
+  if (!element.getAttribute) return false;
+  return ((" " + (element.getAttribute('class') || '') + " ").replace(/[\n\t]/g, " ").
+      indexOf(" " + selector + " ") > -1);
+}
+
+function jqLiteRemoveClass(element, cssClasses) {
+  if (cssClasses && element.setAttribute) {
+    forEach(cssClasses.split(' '), function(cssClass) {
+      element.setAttribute('class', trim(
+          (" " + (element.getAttribute('class') || '') + " ")
+          .replace(/[\n\t]/g, " ")
+          .replace(" " + trim(cssClass) + " ", " "))
+      );
+    });
+  }
+}
+
+function jqLiteAddClass(element, cssClasses) {
+  if (cssClasses && element.setAttribute) {
+    var existingClasses = (' ' + (element.getAttribute('class') || '') + ' ')
+                            .replace(/[\n\t]/g, " ");
+
+    forEach(cssClasses.split(' '), function(cssClass) {
+      cssClass = trim(cssClass);
+      if (existingClasses.indexOf(' ' + cssClass + ' ') === -1) {
+        existingClasses += cssClass + ' ';
+      }
+    });
+
+    element.setAttribute('class', trim(existingClasses));
+  }
+}
+
+
+function jqLiteAddNodes(root, elements) {
+  // THIS CODE IS VERY HOT. Don't make changes without benchmarking.
+
+  if (elements) {
+
+    // if a Node (the most common case)
+    if (elements.nodeType) {
+      root[root.length++] = elements;
+    } else {
+      var length = elements.length;
+
+      // if an Array or NodeList and not a Window
+      if (typeof length === 'number' && elements.window !== elements) {
+        if (length) {
+          for (var i = 0; i < length; i++) {
+            root[root.length++] = elements[i];
+          }
+        }
+      } else {
+        root[root.length++] = elements;
+      }
+    }
+  }
+}
+
+
+function jqLiteController(element, name) {
+  return jqLiteInheritedData(element, '$' + (name || 'ngController') + 'Controller');
+}
+
+function jqLiteInheritedData(element, name, value) {
+  // if element is the document object work with the html element instead
+  // this makes $(document).scope() possible
+  if (element.nodeType == NODE_TYPE_DOCUMENT) {
+    element = element.documentElement;
+  }
+  var names = isArray(name) ? name : [name];
+
+  while (element) {
+    for (var i = 0, ii = names.length; i < ii; i++) {
+      if (isDefined(value = jqLite.data(element, names[i]))) return value;
+    }
+
+    // If dealing with a document fragment node with a host element, and no parent, use the host
+    // element as the parent. This enables directives within a Shadow DOM or polyfilled Shadow DOM
+    // to lookup parent controllers.
+    element = element.parentNode || (element.nodeType === NODE_TYPE_DOCUMENT_FRAGMENT && element.host);
+  }
+}
+
+function jqLiteEmpty(element) {
+  jqLiteDealoc(element, true);
+  while (element.firstChild) {
+    element.removeChild(element.firstChild);
+  }
+}
+
+function jqLiteRemove(element, keepData) {
+  if (!keepData) jqLiteDealoc(element);
+  var parent = element.parentNode;
+  if (parent) parent.removeChild(element);
+}
+
+
+function jqLiteDocumentLoaded(action, win) {
+  win = win || window;
+  if (win.document.readyState === 'complete') {
+    // Force the action to be run async for consistent behavior
+    // from the action's point of view
+    // i.e. it will definitely not be in a $apply
+    win.setTimeout(action);
+  } else {
+    // No need to unbind this handler as load is only ever called once
+    jqLite(win).on('load', action);
+  }
+}
+
+//////////////////////////////////////////
+// Functions which are declared directly.
+//////////////////////////////////////////
+var JQLitePrototype = JQLite.prototype = {
+  ready: function(fn) {
+    var fired = false;
+
+    function trigger() {
+      if (fired) return;
+      fired = true;
+      fn();
+    }
+
+    // check if document is already loaded
+    if (window.document.readyState === 'complete') {
+      window.setTimeout(trigger);
+    } else {
+      this.on('DOMContentLoaded', trigger); // works for modern browsers and IE9
+      // we can not use jqLite since we are not done loading and jQuery could be loaded later.
+      // jshint -W064
+      JQLite(window).on('load', trigger); // fallback to window.onload for others
+      // jshint +W064
+    }
+  },
+  toString: function() {
+    var value = [];
+    forEach(this, function(e) { value.push('' + e);});
+    return '[' + value.join(', ') + ']';
+  },
+
+  eq: function(index) {
+      return (index >= 0) ? jqLite(this[index]) : jqLite(this[this.length + index]);
+  },
+
+  length: 0,
+  push: push,
+  sort: [].sort,
+  splice: [].splice
+};
+
+//////////////////////////////////////////
+// Functions iterating getter/setters.
+// these functions return self on setter and
+// value on get.
+//////////////////////////////////////////
+var BOOLEAN_ATTR = {};
+forEach('multiple,selected,checked,disabled,readOnly,required,open'.split(','), function(value) {
+  BOOLEAN_ATTR[lowercase(value)] = value;
+});
+var BOOLEAN_ELEMENTS = {};
+forEach('input,select,option,textarea,button,form,details'.split(','), function(value) {
+  BOOLEAN_ELEMENTS[value] = true;
+});
+var ALIASED_ATTR = {
+  'ngMinlength': 'minlength',
+  'ngMaxlength': 'maxlength',
+  'ngMin': 'min',
+  'ngMax': 'max',
+  'ngPattern': 'pattern'
+};
+
+function getBooleanAttrName(element, name) {
+  // check dom last since we will most likely fail on name
+  var booleanAttr = BOOLEAN_ATTR[name.toLowerCase()];
+
+  // booleanAttr is here twice to minimize DOM access
+  return booleanAttr && BOOLEAN_ELEMENTS[nodeName_(element)] && booleanAttr;
+}
+
+function getAliasedAttrName(name) {
+  return ALIASED_ATTR[name];
+}
+
+forEach({
+  data: jqLiteData,
+  removeData: jqLiteRemoveData,
+  hasData: jqLiteHasData,
+  cleanData: jqLiteCleanData
+}, function(fn, name) {
+  JQLite[name] = fn;
+});
+
+forEach({
+  data: jqLiteData,
+  inheritedData: jqLiteInheritedData,
+
+  scope: function(element) {
+    // Can't use jqLiteData here directly so we stay compatible with jQuery!
+    return jqLite.data(element, '$scope') || jqLiteInheritedData(element.parentNode || element, ['$isolateScope', '$scope']);
+  },
+
+  isolateScope: function(element) {
+    // Can't use jqLiteData here directly so we stay compatible with jQuery!
+    return jqLite.data(element, '$isolateScope') || jqLite.data(element, '$isolateScopeNoTemplate');
+  },
+
+  controller: jqLiteController,
+
+  injector: function(element) {
+    return jqLiteInheritedData(element, '$injector');
+  },
+
+  removeAttr: function(element, name) {
+    element.removeAttribute(name);
+  },
+
+  hasClass: jqLiteHasClass,
+
+  css: function(element, name, value) {
+    name = camelCase(name);
+
+    if (isDefined(value)) {
+      element.style[name] = value;
+    } else {
+      return element.style[name];
+    }
+  },
+
+  attr: function(element, name, value) {
+    var nodeType = element.nodeType;
+    if (nodeType === NODE_TYPE_TEXT || nodeType === NODE_TYPE_ATTRIBUTE || nodeType === NODE_TYPE_COMMENT) {
+      return;
+    }
+    var lowercasedName = lowercase(name);
+    if (BOOLEAN_ATTR[lowercasedName]) {
+      if (isDefined(value)) {
+        if (!!value) {
+          element[name] = true;
+          element.setAttribute(name, lowercasedName);
+        } else {
+          element[name] = false;
+          element.removeAttribute(lowercasedName);
+        }
+      } else {
+        return (element[name] ||
+                 (element.attributes.getNamedItem(name) || noop).specified)
+               ? lowercasedName
+               : undefined;
+      }
+    } else if (isDefined(value)) {
+      element.setAttribute(name, value);
+    } else if (element.getAttribute) {
+      // the extra argument "2" is to get the right thing for a.href in IE, see jQuery code
+      // some elements (e.g. Document) don't have get attribute, so return undefined
+      var ret = element.getAttribute(name, 2);
+      // normalize non-existing attributes to undefined (as jQuery)
+      return ret === null ? undefined : ret;
+    }
+  },
+
+  prop: function(element, name, value) {
+    if (isDefined(value)) {
+      element[name] = value;
+    } else {
+      return element[name];
+    }
+  },
+
+  text: (function() {
+    getText.$dv = '';
+    return getText;
+
+    function getText(element, value) {
+      if (isUndefined(value)) {
+        var nodeType = element.nodeType;
+        return (nodeType === NODE_TYPE_ELEMENT || nodeType === NODE_TYPE_TEXT) ? element.textContent : '';
+      }
+      element.textContent = value;
+    }
+  })(),
+
+  val: function(element, value) {
+    if (isUndefined(value)) {
+      if (element.multiple && nodeName_(element) === 'select') {
+        var result = [];
+        forEach(element.options, function(option) {
+          if (option.selected) {
+            result.push(option.value || option.text);
+          }
+        });
+        return result.length === 0 ? null : result;
+      }
+      return element.value;
+    }
+    element.value = value;
+  },
+
+  html: function(element, value) {
+    if (isUndefined(value)) {
+      return element.innerHTML;
+    }
+    jqLiteDealoc(element, true);
+    element.innerHTML = value;
+  },
+
+  empty: jqLiteEmpty
+}, function(fn, name) {
+  /**
+   * Properties: writes return selection, reads return first value
+   */
+  JQLite.prototype[name] = function(arg1, arg2) {
+    var i, key;
+    var nodeCount = this.length;
+
+    // jqLiteHasClass has only two arguments, but is a getter-only fn, so we need to special-case it
+    // in a way that survives minification.
+    // jqLiteEmpty takes no arguments but is a setter.
+    if (fn !== jqLiteEmpty &&
+        (isUndefined((fn.length == 2 && (fn !== jqLiteHasClass && fn !== jqLiteController)) ? arg1 : arg2))) {
+      if (isObject(arg1)) {
+
+        // we are a write, but the object properties are the key/values
+        for (i = 0; i < nodeCount; i++) {
+          if (fn === jqLiteData) {
+            // data() takes the whole object in jQuery
+            fn(this[i], arg1);
+          } else {
+            for (key in arg1) {
+              fn(this[i], key, arg1[key]);
+            }
+          }
+        }
+        // return self for chaining
+        return this;
+      } else {
+        // we are a read, so read the first child.
+        // TODO: do we still need this?
+        var value = fn.$dv;
+        // Only if we have $dv do we iterate over all, otherwise it is just the first element.
+        var jj = (isUndefined(value)) ? Math.min(nodeCount, 1) : nodeCount;
+        for (var j = 0; j < jj; j++) {
+          var nodeValue = fn(this[j], arg1, arg2);
+          value = value ? value + nodeValue : nodeValue;
+        }
+        return value;
+      }
+    } else {
+      // we are a write, so apply to all children
+      for (i = 0; i < nodeCount; i++) {
+        fn(this[i], arg1, arg2);
+      }
+      // return self for chaining
+      return this;
+    }
+  };
+});
+
+function createEventHandler(element, events) {
+  var eventHandler = function(event, type) {
+    // jQuery specific api
+    event.isDefaultPrevented = function() {
+      return event.defaultPrevented;
+    };
+
+    var eventFns = events[type || event.type];
+    var eventFnsLength = eventFns ? eventFns.length : 0;
+
+    if (!eventFnsLength) return;
+
+    if (isUndefined(event.immediatePropagationStopped)) {
+      var originalStopImmediatePropagation = event.stopImmediatePropagation;
+      event.stopImmediatePropagation = function() {
+        event.immediatePropagationStopped = true;
+
+        if (event.stopPropagation) {
+          event.stopPropagation();
+        }
+
+        if (originalStopImmediatePropagation) {
+          originalStopImmediatePropagation.call(event);
+        }
+      };
+    }
+
+    event.isImmediatePropagationStopped = function() {
+      return event.immediatePropagationStopped === true;
+    };
+
+    // Some events have special handlers that wrap the real handler
+    var handlerWrapper = eventFns.specialHandlerWrapper || defaultHandlerWrapper;
+
+    // Copy event handlers in case event handlers array is modified during execution.
+    if ((eventFnsLength > 1)) {
+      eventFns = shallowCopy(eventFns);
+    }
+
+    for (var i = 0; i < eventFnsLength; i++) {
+      if (!event.isImmediatePropagationStopped()) {
+        handlerWrapper(element, event, eventFns[i]);
+      }
+    }
+  };
+
+  // TODO: this is a hack for angularMocks/clearDataCache that makes it possible to deregister all
+  //       events on `element`
+  eventHandler.elem = element;
+  return eventHandler;
+}
+
+function defaultHandlerWrapper(element, event, handler) {
+  handler.call(element, event);
+}
+
+function specialMouseHandlerWrapper(target, event, handler) {
+  // Refer to jQuery's implementation of mouseenter & mouseleave
+  // Read about mouseenter and mouseleave:
+  // http://www.quirksmode.org/js/events_mouse.html#link8
+  var related = event.relatedTarget;
+  // For mousenter/leave call the handler if related is outside the target.
+  // NB: No relatedTarget if the mouse left/entered the browser window
+  if (!related || (related !== target && !jqLiteContains.call(target, related))) {
+    handler.call(target, event);
+  }
+}
+
+//////////////////////////////////////////
+// Functions iterating traversal.
+// These functions chain results into a single
+// selector.
+//////////////////////////////////////////
+forEach({
+  removeData: jqLiteRemoveData,
+
+  on: function jqLiteOn(element, type, fn, unsupported) {
+    if (isDefined(unsupported)) throw jqLiteMinErr('onargs', 'jqLite#on() does not support the `selector` or `eventData` parameters');
+
+    // Do not add event handlers to non-elements because they will not be cleaned up.
+    if (!jqLiteAcceptsData(element)) {
+      return;
+    }
+
+    var expandoStore = jqLiteExpandoStore(element, true);
+    var events = expandoStore.events;
+    var handle = expandoStore.handle;
+
+    if (!handle) {
+      handle = expandoStore.handle = createEventHandler(element, events);
+    }
+
+    // http://jsperf.com/string-indexof-vs-split
+    var types = type.indexOf(' ') >= 0 ? type.split(' ') : [type];
+    var i = types.length;
+
+    var addHandler = function(type, specialHandlerWrapper, noEventListener) {
+      var eventFns = events[type];
+
+      if (!eventFns) {
+        eventFns = events[type] = [];
+        eventFns.specialHandlerWrapper = specialHandlerWrapper;
+        if (type !== '$destroy' && !noEventListener) {
+          addEventListenerFn(element, type, handle);
+        }
+      }
+
+      eventFns.push(fn);
+    };
+
+    while (i--) {
+      type = types[i];
+      if (MOUSE_EVENT_MAP[type]) {
+        addHandler(MOUSE_EVENT_MAP[type], specialMouseHandlerWrapper);
+        addHandler(type, undefined, true);
+      } else {
+        addHandler(type);
+      }
+    }
+  },
+
+  off: jqLiteOff,
+
+  one: function(element, type, fn) {
+    element = jqLite(element);
+
+    //add the listener twice so that when it is called
+    //you can remove the original function and still be
+    //able to call element.off(ev, fn) normally
+    element.on(type, function onFn() {
+      element.off(type, fn);
+      element.off(type, onFn);
+    });
+    element.on(type, fn);
+  },
+
+  replaceWith: function(element, replaceNode) {
+    var index, parent = element.parentNode;
+    jqLiteDealoc(element);
+    forEach(new JQLite(replaceNode), function(node) {
+      if (index) {
+        parent.insertBefore(node, index.nextSibling);
+      } else {
+        parent.replaceChild(node, element);
+      }
+      index = node;
+    });
+  },
+
+  children: function(element) {
+    var children = [];
+    forEach(element.childNodes, function(element) {
+      if (element.nodeType === NODE_TYPE_ELEMENT) {
+        children.push(element);
+      }
+    });
+    return children;
+  },
+
+  contents: function(element) {
+    return element.contentDocument || element.childNodes || [];
+  },
+
+  append: function(element, node) {
+    var nodeType = element.nodeType;
+    if (nodeType !== NODE_TYPE_ELEMENT && nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT) return;
+
+    node = new JQLite(node);
+
+    for (var i = 0, ii = node.length; i < ii; i++) {
+      var child = node[i];
+      element.appendChild(child);
+    }
+  },
+
+  prepend: function(element, node) {
+    if (element.nodeType === NODE_TYPE_ELEMENT) {
+      var index = element.firstChild;
+      forEach(new JQLite(node), function(child) {
+        element.insertBefore(child, index);
+      });
+    }
+  },
+
+  wrap: function(element, wrapNode) {
+    jqLiteWrapNode(element, jqLite(wrapNode).eq(0).clone()[0]);
+  },
+
+  remove: jqLiteRemove,
+
+  detach: function(element) {
+    jqLiteRemove(element, true);
+  },
+
+  after: function(element, newElement) {
+    var index = element, parent = element.parentNode;
+    newElement = new JQLite(newElement);
+
+    for (var i = 0, ii = newElement.length; i < ii; i++) {
+      var node = newElement[i];
+      parent.insertBefore(node, index.nextSibling);
+      index = node;
+    }
+  },
+
+  addClass: jqLiteAddClass,
+  removeClass: jqLiteRemoveClass,
+
+  toggleClass: function(element, selector, condition) {
+    if (selector) {
+      forEach(selector.split(' '), function(className) {
+        var classCondition = condition;
+        if (isUndefined(classCondition)) {
+          classCondition = !jqLiteHasClass(element, className);
+        }
+        (classCondition ? jqLiteAddClass : jqLiteRemoveClass)(element, className);
+      });
+    }
+  },
+
+  parent: function(element) {
+    var parent = element.parentNode;
+    return parent && parent.nodeType !== NODE_TYPE_DOCUMENT_FRAGMENT ? parent : null;
+  },
+
+  next: function(element) {
+    return element.nextElementSibling;
+  },
+
+  find: function(element, selector) {
+    if (element.getElementsByTagName) {
+      return element.getElementsByTagName(selector);
+    } else {
+      return [];
+    }
+  },
+
+  clone: jqLiteClone,
+
+  triggerHandler: function(element, event, extraParameters) {
+
+    var dummyEvent, eventFnsCopy, handlerArgs;
+    var eventName = event.type || event;
+    var expandoStore = jqLiteExpandoStore(element);
+    var events = expandoStore && expandoStore.events;
+    var eventFns = events && events[eventName];
+
+    if (eventFns) {
+      // Create a dummy event to pass to the handlers
+      dummyEvent = {
+        preventDefault: function() { this.defaultPrevented = true; },
+        isDefaultPrevented: function() { return this.defaultPrevented === true; },
+        stopImmediatePropagation: function() { this.immediatePropagationStopped = true; },
+        isImmediatePropagationStopped: function() { return this.immediatePropagationStopped === true; },
+        stopPropagation: noop,
+        type: eventName,
+        target: element
+      };
+
+      // If a custom event was provided then extend our dummy event with it
+      if (event.type) {
+        dummyEvent = extend(dummyEvent, event);
+      }
+
+      // Copy event handlers in case event handlers array is modified during execution.
+      eventFnsCopy = shallowCopy(eventFns);
+      handlerArgs = extraParameters ? [dummyEvent].concat(extraParameters) : [dummyEvent];
+
+      forEach(eventFnsCopy, function(fn) {
+        if (!dummyEvent.isImmediatePropagationStopped()) {
+          fn.apply(element, handlerArgs);
+        }
+      });
+    }
+  }
+}, function(fn, name) {
+  /**
+   * chaining functions
+   */
+  JQLite.prototype[name] = function(arg1, arg2, arg3) {
+    var value;
+
+    for (var i = 0, ii = this.length; i < ii; i++) {
+      if (isUndefined(value)) {
+        value = fn(this[i], arg1, arg2, arg3);
+        if (isDefined(value)) {
+          // any function which returns a value needs to be wrapped
+          value = jqLite(value);
+        }
+      } else {
+        jqLiteAddNodes(value, fn(this[i], arg1, arg2, arg3));
+      }
+    }
+    return isDefined(value) ? value : this;
+  };
+
+  // bind legacy bind/unbind to on/off
+  JQLite.prototype.bind = JQLite.prototype.on;
+  JQLite.prototype.unbind = JQLite.prototype.off;
+});
+
+
+// Provider for private $$jqLite service
+function $$jqLiteProvider() {
+  this.$get = function $$jqLite() {
+    return extend(JQLite, {
+      hasClass: function(node, classes) {
+        if (node.attr) node = node[0];
+        return jqLiteHasClass(node, classes);
+      },
+      addClass: function(node, classes) {
+        if (node.attr) node = node[0];
+        return jqLiteAddClass(node, classes);
+      },
+      removeClass: function(node, classes) {
+        if (node.attr) node = node[0];
+        return jqLiteRemoveClass(node, classes);
+      }
+    });
+  };
+}
+
+/**
+ * Computes a hash of an 'obj'.
+ * Hash of a:
+ *  string is string
+ *  number is number as string
+ *  object is either result of calling $$hashKey function on the object or uniquely generated id,
+ *         that is also assigned to the $$hashKey property of the object.
+ *
+ * @param obj
+ * @returns {string} hash string such that the same input will have the same hash string.
+ *         The resulting string key is in 'type:hashKey' format.
+ */
+function hashKey(obj, nextUidFn) {
+  var key = obj && obj.$$hashKey;
+
+  if (key) {
+    if (typeof key === 'function') {
+      key = obj.$$hashKey();
+    }
+    return key;
+  }
+
+  var objType = typeof obj;
+  if (objType == 'function' || (objType == 'object' && obj !== null)) {
+    key = obj.$$hashKey = objType + ':' + (nextUidFn || nextUid)();
+  } else {
+    key = objType + ':' + obj;
+  }
+
+  return key;
+}
+
+/**
+ * HashMap which can use objects as keys
+ */
+function HashMap(array, isolatedUid) {
+  if (isolatedUid) {
+    var uid = 0;
+    this.nextUid = function() {
+      return ++uid;
+    };
+  }
+  forEach(array, this.put, this);
+}
+HashMap.prototype = {
+  /**
+   * Store key value pair
+   * @param key key to store can be any type
+   * @param value value to store can be any type
+   */
+  put: function(key, value) {
+    this[hashKey(key, this.nextUid)] = value;
+  },
+
+  /**
+   * @param key
+   * @returns {Object} the value for the key
+   */
+  get: function(key) {
+    return this[hashKey(key, this.nextUid)];
+  },
+
+  /**
+   * Remove the key/value pair
+   * @param key
+   */
+  remove: function(key) {
+    var value = this[key = hashKey(key, this.nextUid)];
+    delete this[key];
+    return value;
+  }
+};
+
+var $$HashMapProvider = [function() {
+  this.$get = [function() {
+    return HashMap;
+  }];
+}];
+
+/**
+ * @ngdoc function
+ * @module ng
+ * @name angular.injector
+ * @kind function
+ *
+ * @description
+ * Creates an injector object that can be used for retrieving services as well as for
+ * dependency injection (see {@link guide/di dependency injection}).
+ *
+ * @param {Array.<string|Function>} modules A list of module functions or their aliases. See
+ *     {@link angular.module}. The `ng` module must be explicitly added.
+ * @param {boolean=} [strictDi=false] Whether the injector should be in strict mode, which
+ *     disallows argument name annotation inference.
+ * @returns {injector} Injector object. See {@link auto.$injector $injector}.
+ *
+ * @example
+ * Typical usage
+ * ```js
+ *   // create an injector
+ *   var $injector = angular.injector(['ng']);
+ *
+ *   // use the injector to kick off your application
+ *   // use the type inference to auto inject arguments, or use implicit injection
+ *   $injector.invoke(function($rootScope, $compile, $document) {
+ *     $compile($document)($rootScope);
+ *     $rootScope.$digest();
+ *   });
+ * ```
+ *
+ * Sometimes you want to get access to the injector of a currently running Angular app
+ * from outside Angular. Perhaps, you want to inject and compile some markup after the
+ * application has been bootstrapped. You can do this using the extra `injector()` added
+ * to JQuery/jqLite elements. See {@link angular.element}.
+ *
+ * *This is fairly rare but could be the case if a third party library is injecting the
+ * markup.*
+ *
+ * In the following example a new block of HTML containing a `ng-controller`
+ * directive is added to the end of the document body by JQuery. We then compile and link
+ * it into the current AngularJS scope.
+ *
+ * ```js
+ * var $div = $('<div ng-controller="MyCtrl">{{content.label}}</div>');
+ * $(document.body).append($div);
+ *
+ * angular.element(document).injector().invoke(function($compile) {
+ *   var scope = angular.element($div).scope();
+ *   $compile($div)(scope);
+ * });
+ * ```
+ */
+
+
+/**
+ * @ngdoc module
+ * @name auto
+ * @installation
+ * @description
+ *
+ * Implicit module which gets automatically added to each {@link auto.$injector $injector}.
+ */
+
+var ARROW_ARG = /^([^\(]+?)=>/;
+var FN_ARGS = /^[^\(]*\(\s*([^\)]*)\)/m;
+var FN_ARG_SPLIT = /,/;
+var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/;
+var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
+var $injectorMinErr = minErr('$injector');
+
+function stringifyFn(fn) {
+  // Support: Chrome 50-51 only
+  // Creating a new string by adding `' '` at the end, to hack around some bug in Chrome v50/51
+  // (See https://github.com/angular/angular.js/issues/14487.)
+  // TODO (gkalpak): Remove workaround when Chrome v52 is released
+  return Function.prototype.toString.call(fn) + ' ';
+}
+
+function extractArgs(fn) {
+  var fnText = stringifyFn(fn).replace(STRIP_COMMENTS, ''),
+      args = fnText.match(ARROW_ARG) || fnText.match(FN_ARGS);
+  return args;
+}
+
+function anonFn(fn) {
+  // For anonymous functions, showing at the very least the function signature can help in
+  // debugging.
+  var args = extractArgs(fn);
+  if (args) {
+    return 'function(' + (args[1] || '').replace(/[\s\r\n]+/, ' ') + ')';
+  }
+  return 'fn';
+}
+
+function annotate(fn, strictDi, name) {
+  var $inject,
+      argDecl,
+      last;
+
+  if (typeof fn === 'function') {
+    if (!($inject = fn.$inject)) {
+      $inject = [];
+      if (fn.length) {
+        if (strictDi) {
+          if (!isString(name) || !name) {
+            name = fn.name || anonFn(fn);
+          }
+          throw $injectorMinErr('strictdi',
+            '{0} is not using explicit annotation and cannot be invoked in strict mode', name);
+        }
+        argDecl = extractArgs(fn);
+        forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg) {
+          arg.replace(FN_ARG, function(all, underscore, name) {
+            $inject.push(name);
+          });
+        });
+      }
+      fn.$inject = $inject;
+    }
+  } else if (isArray(fn)) {
+    last = fn.length - 1;
+    assertArgFn(fn[last], 'fn');
+    $inject = fn.slice(0, last);
+  } else {
+    assertArgFn(fn, 'fn', true);
+  }
+  return $inject;
+}
+
+///////////////////////////////////////
+
+/**
+ * @ngdoc service
+ * @name $injector
+ *
+ * @description
+ *
+ * `$injector` is used to retrieve object instances as defined by
+ * {@link auto.$provide provider}, instantiate types, invoke methods,
+ * and load modules.
+ *
+ * The following always holds true:
+ *
+ * ```js
+ *   var $injector = angular.injector();
+ *   expect($injector.get('$injector')).toBe($injector);
+ *   expect($injector.invoke(function($injector) {
+ *     return $injector;
+ *   })).toBe($injector);
+ * ```
+ *
+ * # Injection Function Annotation
+ *
+ * JavaScript does not have annotations, and annotations are needed for dependency injection. The
+ * following are all valid ways of annotating function with injection arguments and are equivalent.
+ *
+ * ```js
+ *   // inferred (only works if code not minified/obfuscated)
+ *   $injector.invoke(function(serviceA){});
+ *
+ *   // annotated
+ *   function explicit(serviceA) {};
+ *   explicit.$inject = ['serviceA'];
+ *   $injector.invoke(explicit);
+ *
+ *   // inline
+ *   $injector.invoke(['serviceA', function(serviceA){}]);
+ * ```
+ *
+ * ## Inference
+ *
+ * In JavaScript calling `toString()` on a function returns the function definition. The definition
+ * can then be parsed and the function arguments can be extracted. This method of discovering
+ * annotations is disallowed when the injector is in strict mode.
+ * *NOTE:* This does not work with minification, and obfuscation tools since these tools change the
+ * argument names.
+ *
+ * ## `$inject` Annotation
+ * By adding an `$inject` property onto a function the injection parameters can be specified.
+ *
+ * ## Inline
+ * As an array of injection names, where the last item in the array is the function to call.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#get
+ *
+ * @description
+ * Return an instance of the service.
+ *
+ * @param {string} name The name of the instance to retrieve.
+ * @param {string=} caller An optional string to provide the origin of the function call for error messages.
+ * @return {*} The instance.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#invoke
+ *
+ * @description
+ * Invoke the method and supply the method arguments from the `$injector`.
+ *
+ * @param {Function|Array.<string|Function>} fn The injectable function to invoke. Function parameters are
+ *   injected according to the {@link guide/di $inject Annotation} rules.
+ * @param {Object=} self The `this` for the invoked method.
+ * @param {Object=} locals Optional object. If preset then any argument names are read from this
+ *                         object first, before the `$injector` is consulted.
+ * @returns {*} the value returned by the invoked `fn` function.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#has
+ *
+ * @description
+ * Allows the user to query if the particular service exists.
+ *
+ * @param {string} name Name of the service to query.
+ * @returns {boolean} `true` if injector has given service.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#instantiate
+ * @description
+ * Create a new instance of JS type. The method takes a constructor function, invokes the new
+ * operator, and supplies all of the arguments to the constructor function as specified by the
+ * constructor annotation.
+ *
+ * @param {Function} Type Annotated constructor function.
+ * @param {Object=} locals Optional object. If preset then any argument names are read from this
+ * object first, before the `$injector` is consulted.
+ * @returns {Object} new instance of `Type`.
+ */
+
+/**
+ * @ngdoc method
+ * @name $injector#annotate
+ *
+ * @description
+ * Returns an array of service names which the function is requesting for injection. This API is
+ * used by the injector to determine which services need to be injected into the function when the
+ * function is invoked. There are three ways in which the function can be annotated with the needed
+ * dependencies.
+ *
+ * # Argument names
+ *
+ * The simplest form is to extract the dependencies from the arguments of the function. This is done
+ * by converting the function into a string using `toString()` method and extracting the argument
+ * names.
+ * ```js
+ *   // Given
+ *   function MyController($scope, $route) {
+ *     // ...
+ *   }
+ *
+ *   // Then
+ *   expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
+ * ```
+ *
+ * You can disallow this method by using strict injection mode.
+ *
+ * This method does not work with code minification / obfuscation. For this reason the following
+ * annotation strategies are supported.
+ *
+ * # The `$inject` property
+ *
+ * If a function has an `$inject` property and its value is an array of strings, then the strings
+ * represent names of services to be injected into the function.
+ * ```js
+ *   // Given
+ *   var MyController = function(obfuscatedScope, obfuscatedRoute) {
+ *     // ...
+ *   }
+ *   // Define function dependencies
+ *   MyController['$inject'] = ['$scope', '$route'];
+ *
+ *   // Then
+ *   expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
+ * ```
+ *
+ * # The array notation
+ *
+ * It is often desirable to inline Injected functions and that's when setting the `$inject` property
+ * is very inconvenient. In these situations using the array notation to specify the dependencies in
+ * a way that survives minification is a better choice:
+ *
+ * ```js
+ *   // We wish to write this (not minification / obfuscation safe)
+ *   injector.invoke(function($compile, $rootScope) {
+ *     // ...
+ *   });
+ *
+ *   // We are forced to write break inlining
+ *   var tmpFn = function(obfuscatedCompile, obfuscatedRootScope) {
+ *     // ...
+ *   };
+ *   tmpFn.$inject = ['$compile', '$rootScope'];
+ *   injector.invoke(tmpFn);
+ *
+ *   // To better support inline function the inline annotation is supported
+ *   injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) {
+ *     // ...
+ *   }]);
+ *
+ *   // Therefore
+ *   expect(injector.annotate(
+ *      ['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}])
+ *    ).toEqual(['$compile', '$rootScope']);
+ * ```
+ *
+ * @param {Function|Array.<string|Function>} fn Function for which dependent service names need to
+ * be retrieved as described above.
+ *
+ * @param {boolean=} [strictDi=false] Disallow argument name annotation inference.
+ *
+ * @returns {Array.<string>} The names of the services which the function requires.
+ */
+
+
+
+
+/**
+ * @ngdoc service
+ * @name $provide
+ *
+ * @description
+ *
+ * The {@link auto.$provide $provide} service has a number of methods for registering components
+ * with the {@link auto.$injector $injector}. Many of these functions are also exposed on
+ * {@link angular.Module}.
+ *
+ * An Angular **service** is a singleton object created by a **service factory**.  These **service
+ * factories** are functions which, in turn, are created by a **service provider**.
+ * The **service providers** are constructor functions. When instantiated they must contain a
+ * property called `$get`, which holds the **service factory** function.
+ *
+ * When you request a service, the {@link auto.$injector $injector} is responsible for finding the
+ * correct **service provider**, instantiating it and then calling its `$get` **service factory**
+ * function to get the instance of the **service**.
+ *
+ * Often services have no configuration options and there is no need to add methods to the service
+ * provider.  The provider will be no more than a constructor function with a `$get` property. For
+ * these cases the {@link auto.$provide $provide} service has additional helper methods to register
+ * services without specifying a provider.
+ *
+ * * {@link auto.$provide#provider provider(name, provider)} - registers a **service provider** with the
+ *     {@link auto.$injector $injector}
+ * * {@link auto.$provide#constant constant(name, obj)} - registers a value/object that can be accessed by
+ *     providers and services.
+ * * {@link auto.$provide#value value(name, obj)} - registers a value/object that can only be accessed by
+ *     services, not providers.
+ * * {@link auto.$provide#factory factory(name, fn)} - registers a service **factory function**
+ *     that will be wrapped in a **service provider** object, whose `$get` property will contain the
+ *     given factory function.
+ * * {@link auto.$provide#service service(name, Fn)} - registers a **constructor function**
+ *     that will be wrapped in a **service provider** object, whose `$get` property will instantiate
+ *      a new object using the given constructor function.
+ * * {@link auto.$provide#decorator decorator(name, decorFn)} - registers a **decorator function** that
+ *      will be able to modify or replace the implementation of another service.
+ *
+ * See the individual methods for more information and examples.
+ */
+
+/**
+ * @ngdoc method
+ * @name $provide#provider
+ * @description
+ *
+ * Register a **provider function** with the {@link auto.$injector $injector}. Provider functions
+ * are constructor functions, whose instances are responsible for "providing" a factory for a
+ * service.
+ *
+ * Service provider names start with the name of the service they provide followed by `Provider`.
+ * For example, the {@link ng.$log $log} service has a provider called
+ * {@link ng.$logProvider $logProvider}.
+ *
+ * Service provider objects can have additional methods which allow configuration of the provider
+ * and its service. Importantly, you can configure what kind of service is created by the `$get`
+ * method, or how that service will act. For example, the {@link ng.$logProvider $logProvider} has a
+ * method {@link ng.$logProvider#debugEnabled debugEnabled}
+ * which lets you specify whether the {@link ng.$log $log} service will log debug messages to the
+ * console or not.
+ *
+ * @param {string} name The name of the instance. NOTE: the provider will be available under `name +
+                        'Provider'` key.
+ * @param {(Object|function())} provider If the provider is:
+ *
+ *   - `Object`: then it should have a `$get` method. The `$get` method will be invoked using
+ *     {@link auto.$injector#invoke $injector.invoke()} when an instance needs to be created.
+ *   - `Constructor`: a new instance of the provider will be created using
+ *     {@link auto.$injector#instantiate $injector.instantiate()}, then treated as `object`.
+ *
+ * @returns {Object} registered provider instance
+
+ * @example
+ *
+ * The following example shows how to create a simple event tracking service and register it using
+ * {@link auto.$provide#provider $provide.provider()}.
+ *
+ * ```js
+ *  // Define the eventTracker provider
+ *  function EventTrackerProvider() {
+ *    var trackingUrl = '/track';
+ *
+ *    // A provider method for configuring where the tracked events should been saved
+ *    this.setTrackingUrl = function(url) {
+ *      trackingUrl = url;
+ *    };
+ *
+ *    // The service factory function
+ *    this.$get = ['$http', function($http) {
+ *      var trackedEvents = {};
+ *      return {
+ *        // Call this to track an event
+ *        event: function(event) {
+ *          var count = trackedEvents[event] || 0;
+ *          count += 1;
+ *          trackedEvents[event] = count;
+ *          return count;
+ *        },
+ *        // Call this to save the tracked events to the trackingUrl
+ *        save: function() {
+ *          $http.post(trackingUrl, trackedEvents);
+ *        }
+ *      };
+ *    }];
+ *  }
+ *
+ *  describe('eventTracker', function() {
+ *    var postSpy;
+ *
+ *    beforeEach(module(function($provide) {
+ *      // Register the eventTracker provider
+ *      $provide.provider('eventTracker', EventTrackerProvider);
+ *    }));
+ *
+ *    beforeEach(module(function(eventTrackerProvider) {
+ *      // Configure eventTracker provider
+ *      eventTrackerProvider.setTrackingUrl('/custom-track');
+ *    }));
+ *
+ *    it('tracks events', inject(function(eventTracker) {
+ *      expect(eventTracker.event('login')).toEqual(1);
+ *      expect(eventTracker.event('login')).toEqual(2);
+ *    }));
+ *
+ *    it('saves to the tracking url', inject(function(eventTracker, $http) {
+ *      postSpy = spyOn($http, 'post');
+ *      eventTracker.event('login');
+ *      eventTracker.save();
+ *      expect(postSpy).toHaveBeenCalled();
+ *      expect(postSpy.mostRecentCall.args[0]).not.toEqual('/track');
+ *      expect(postSpy.mostRecentCall.args[0]).toEqual('/custom-track');
+ *      expect(postSpy.mostRecentCall.args[1]).toEqual({ 'login': 1 });
+ *    }));
+ *  });
+ * ```
+ */
+
+/**
+ * @ngdoc method
+ * @name $provide#factory
+ * @description
+ *
+ * Register a **service factory**, which will be called to return the service instance.
+ * This is short for registering a service where its provider consists of only a `$get` property,
+ * which is the given service factory function.
+ * You should use {@link auto.$provide#factory $provide.factory(getFn)} if you do not need to
+ * configure your service in a provider.
+ *
+ * @param {string} name The name of the instance.
+ * @param {Function|Array.<string|Function>} $getFn The injectable $getFn for the instance creation.
+ *                      Internally this is a short hand for `$provide.provider(name, {$get: $getFn})`.
+ * @returns {Object} registered provider instance
+ *
+ * @example
+ * Here is an example of registering a service
+ * ```js
+ *   $provide.factory('ping', ['$http', function($http) {
+ *     return function ping() {
+ *       return $http.send('/ping');
+ *     };
+ *   }]);
+ * ```
+ * You would then inject and use this service like this:
+ * ```js
+ *   someModule.controller('Ctrl', ['ping', function(ping) {
+ *     ping();
+ *   }]);
+ * ```
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $provide#service
+ * @description
+ *
+ * Register a **service constructor**, which will be invoked with `new` to create the service
+ * instance.
+ * This is short for registering a service where its provider's `$get` property is a factory
+ * function that returns an instance instantiated by the injector from the service constructor
+ * function.
+ *
+ * Internally it looks a bit like this:
+ *
+ * ```
+ * {
+ *   $get: function() {
+ *     return $injector.instantiate(constructor);
+ *   }
+ * }
+ * ```
+ *
+ *
+ * You should use {@link auto.$provide#service $provide.service(class)} if you define your service
+ * as a type/class.
+ *
+ * @param {string} name The name of the instance.
+ * @param {Function|Array.<string|Function>} constructor An injectable class (constructor function)
+ *     that will be instantiated.
+ * @returns {Object} registered provider instance
+ *
+ * @example
+ * Here is an example of registering a service using
+ * {@link auto.$provide#service $provide.service(class)}.
+ * ```js
+ *   var Ping = function($http) {
+ *     this.$http = $http;
+ *   };
+ *
+ *   Ping.$inject = ['$http'];
+ *
+ *   Ping.prototype.send = function() {
+ *     return this.$http.get('/ping');
+ *   };
+ *   $provide.service('ping', Ping);
+ * ```
+ * You would then inject and use this service like this:
+ * ```js
+ *   someModule.controller('Ctrl', ['ping', function(ping) {
+ *     ping.send();
+ *   }]);
+ * ```
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $provide#value
+ * @description
+ *
+ * Register a **value service** with the {@link auto.$injector $injector}, such as a string, a
+ * number, an array, an object or a function. This is short for registering a service where its
+ * provider's `$get` property is a factory function that takes no arguments and returns the **value
+ * service**. That also means it is not possible to inject other services into a value service.
+ *
+ * Value services are similar to constant services, except that they cannot be injected into a
+ * module configuration function (see {@link angular.Module#config}) but they can be overridden by
+ * an Angular {@link auto.$provide#decorator decorator}.
+ *
+ * @param {string} name The name of the instance.
+ * @param {*} value The value.
+ * @returns {Object} registered provider instance
+ *
+ * @example
+ * Here are some examples of creating value services.
+ * ```js
+ *   $provide.value('ADMIN_USER', 'admin');
+ *
+ *   $provide.value('RoleLookup', { admin: 0, writer: 1, reader: 2 });
+ *
+ *   $provide.value('halfOf', function(value) {
+ *     return value / 2;
+ *   });
+ * ```
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $provide#constant
+ * @description
+ *
+ * Register a **constant service** with the {@link auto.$injector $injector}, such as a string,
+ * a number, an array, an object or a function. Like the {@link auto.$provide#value value}, it is not
+ * possible to inject other services into a constant.
+ *
+ * But unlike {@link auto.$provide#value value}, a constant can be
+ * injected into a module configuration function (see {@link angular.Module#config}) and it cannot
+ * be overridden by an Angular {@link auto.$provide#decorator decorator}.
+ *
+ * @param {string} name The name of the constant.
+ * @param {*} value The constant value.
+ * @returns {Object} registered instance
+ *
+ * @example
+ * Here a some examples of creating constants:
+ * ```js
+ *   $provide.constant('SHARD_HEIGHT', 306);
+ *
+ *   $provide.constant('MY_COLOURS', ['red', 'blue', 'grey']);
+ *
+ *   $provide.constant('double', function(value) {
+ *     return value * 2;
+ *   });
+ * ```
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $provide#decorator
+ * @description
+ *
+ * Register a **decorator function** with the {@link auto.$injector $injector}. A decorator function
+ * intercepts the creation of a service, allowing it to override or modify the behavior of the
+ * service. The return value of the decorator function may be the original service, or a new service
+ * that replaces (or wraps and delegates to) the original service.
+ *
+ * You can find out more about using decorators in the {@link guide/decorators} guide.
+ *
+ * @param {string} name The name of the service to decorate.
+ * @param {Function|Array.<string|Function>} decorator This function will be invoked when the service needs to be
+ *    provided and should return the decorated service instance. The function is called using
+ *    the {@link auto.$injector#invoke injector.invoke} method and is therefore fully injectable.
+ *    Local injection arguments:
+ *
+ *    * `$delegate` - The original service instance, which can be replaced, monkey patched, configured,
+ *      decorated or delegated to.
+ *
+ * @example
+ * Here we decorate the {@link ng.$log $log} service to convert warnings to errors by intercepting
+ * calls to {@link ng.$log#error $log.warn()}.
+ * ```js
+ *   $provide.decorator('$log', ['$delegate', function($delegate) {
+ *     $delegate.warn = $delegate.error;
+ *     return $delegate;
+ *   }]);
+ * ```
+ */
+
+
+function createInjector(modulesToLoad, strictDi) {
+  strictDi = (strictDi === true);
+  var INSTANTIATING = {},
+      providerSuffix = 'Provider',
+      path = [],
+      loadedModules = new HashMap([], true),
+      providerCache = {
+        $provide: {
+            provider: supportObject(provider),
+            factory: supportObject(factory),
+            service: supportObject(service),
+            value: supportObject(value),
+            constant: supportObject(constant),
+            decorator: decorator
+          }
+      },
+      providerInjector = (providerCache.$injector =
+          createInternalInjector(providerCache, function(serviceName, caller) {
+            if (angular.isString(caller)) {
+              path.push(caller);
+            }
+            throw $injectorMinErr('unpr', "Unknown provider: {0}", path.join(' <- '));
+          })),
+      instanceCache = {},
+      protoInstanceInjector =
+          createInternalInjector(instanceCache, function(serviceName, caller) {
+            var provider = providerInjector.get(serviceName + providerSuffix, caller);
+            return instanceInjector.invoke(
+                provider.$get, provider, undefined, serviceName);
+          }),
+      instanceInjector = protoInstanceInjector;
+
+  providerCache['$injector' + providerSuffix] = { $get: valueFn(protoInstanceInjector) };
+  var runBlocks = loadModules(modulesToLoad);
+  instanceInjector = protoInstanceInjector.get('$injector');
+  instanceInjector.strictDi = strictDi;
+  forEach(runBlocks, function(fn) { if (fn) instanceInjector.invoke(fn); });
+
+  return instanceInjector;
+
+  ////////////////////////////////////
+  // $provider
+  ////////////////////////////////////
+
+  function supportObject(delegate) {
+    return function(key, value) {
+      if (isObject(key)) {
+        forEach(key, reverseParams(delegate));
+      } else {
+        return delegate(key, value);
+      }
+    };
+  }
+
+  function provider(name, provider_) {
+    assertNotHasOwnProperty(name, 'service');
+    if (isFunction(provider_) || isArray(provider_)) {
+      provider_ = providerInjector.instantiate(provider_);
+    }
+    if (!provider_.$get) {
+      throw $injectorMinErr('pget', "Provider '{0}' must define $get factory method.", name);
+    }
+    return providerCache[name + providerSuffix] = provider_;
+  }
+
+  function enforceReturnValue(name, factory) {
+    return function enforcedReturnValue() {
+      var result = instanceInjector.invoke(factory, this);
+      if (isUndefined(result)) {
+        throw $injectorMinErr('undef', "Provider '{0}' must return a value from $get factory method.", name);
+      }
+      return result;
+    };
+  }
+
+  function factory(name, factoryFn, enforce) {
+    return provider(name, {
+      $get: enforce !== false ? enforceReturnValue(name, factoryFn) : factoryFn
+    });
+  }
+
+  function service(name, constructor) {
+    return factory(name, ['$injector', function($injector) {
+      return $injector.instantiate(constructor);
+    }]);
+  }
+
+  function value(name, val) { return factory(name, valueFn(val), false); }
+
+  function constant(name, value) {
+    assertNotHasOwnProperty(name, 'constant');
+    providerCache[name] = value;
+    instanceCache[name] = value;
+  }
+
+  function decorator(serviceName, decorFn) {
+    var origProvider = providerInjector.get(serviceName + providerSuffix),
+        orig$get = origProvider.$get;
+
+    origProvider.$get = function() {
+      var origInstance = instanceInjector.invoke(orig$get, origProvider);
+      return instanceInjector.invoke(decorFn, null, {$delegate: origInstance});
+    };
+  }
+
+  ////////////////////////////////////
+  // Module Loading
+  ////////////////////////////////////
+  function loadModules(modulesToLoad) {
+    assertArg(isUndefined(modulesToLoad) || isArray(modulesToLoad), 'modulesToLoad', 'not an array');
+    var runBlocks = [], moduleFn;
+    forEach(modulesToLoad, function(module) {
+      if (loadedModules.get(module)) return;
+      loadedModules.put(module, true);
+
+      function runInvokeQueue(queue) {
+        var i, ii;
+        for (i = 0, ii = queue.length; i < ii; i++) {
+          var invokeArgs = queue[i],
+              provider = providerInjector.get(invokeArgs[0]);
+
+          provider[invokeArgs[1]].apply(provider, invokeArgs[2]);
+        }
+      }
+
+      try {
+        if (isString(module)) {
+          moduleFn = angularModule(module);
+          runBlocks = runBlocks.concat(loadModules(moduleFn.requires)).concat(moduleFn._runBlocks);
+          runInvokeQueue(moduleFn._invokeQueue);
+          runInvokeQueue(moduleFn._configBlocks);
+        } else if (isFunction(module)) {
+            runBlocks.push(providerInjector.invoke(module));
+        } else if (isArray(module)) {
+            runBlocks.push(providerInjector.invoke(module));
+        } else {
+          assertArgFn(module, 'module');
+        }
+      } catch (e) {
+        if (isArray(module)) {
+          module = module[module.length - 1];
+        }
+        if (e.message && e.stack && e.stack.indexOf(e.message) == -1) {
+          // Safari & FF's stack traces don't contain error.message content
+          // unlike those of Chrome and IE
+          // So if stack doesn't contain message, we create a new string that contains both.
+          // Since error.stack is read-only in Safari, I'm overriding e and not e.stack here.
+          /* jshint -W022 */
+          e = e.message + '\n' + e.stack;
+        }
+        throw $injectorMinErr('modulerr', "Failed to instantiate module {0} due to:\n{1}",
+                  module, e.stack || e.message || e);
+      }
+    });
+    return runBlocks;
+  }
+
+  ////////////////////////////////////
+  // internal Injector
+  ////////////////////////////////////
+
+  function createInternalInjector(cache, factory) {
+
+    function getService(serviceName, caller) {
+      if (cache.hasOwnProperty(serviceName)) {
+        if (cache[serviceName] === INSTANTIATING) {
+          throw $injectorMinErr('cdep', 'Circular dependency found: {0}',
+                    serviceName + ' <- ' + path.join(' <- '));
+        }
+        return cache[serviceName];
+      } else {
+        try {
+          path.unshift(serviceName);
+          cache[serviceName] = INSTANTIATING;
+          return cache[serviceName] = factory(serviceName, caller);
+        } catch (err) {
+          if (cache[serviceName] === INSTANTIATING) {
+            delete cache[serviceName];
+          }
+          throw err;
+        } finally {
+          path.shift();
+        }
+      }
+    }
+
+
+    function injectionArgs(fn, locals, serviceName) {
+      var args = [],
+          $inject = createInjector.$$annotate(fn, strictDi, serviceName);
+
+      for (var i = 0, length = $inject.length; i < length; i++) {
+        var key = $inject[i];
+        if (typeof key !== 'string') {
+          throw $injectorMinErr('itkn',
+                  'Incorrect injection token! Expected service name as string, got {0}', key);
+        }
+        args.push(locals && locals.hasOwnProperty(key) ? locals[key] :
+                                                         getService(key, serviceName));
+      }
+      return args;
+    }
+
+    function isClass(func) {
+      // IE 9-11 do not support classes and IE9 leaks with the code below.
+      if (msie <= 11) {
+        return false;
+      }
+      // Support: Edge 12-13 only
+      // See: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/6156135/
+      return typeof func === 'function'
+        && /^(?:class\b|constructor\()/.test(stringifyFn(func));
+    }
+
+    function invoke(fn, self, locals, serviceName) {
+      if (typeof locals === 'string') {
+        serviceName = locals;
+        locals = null;
+      }
+
+      var args = injectionArgs(fn, locals, serviceName);
+      if (isArray(fn)) {
+        fn = fn[fn.length - 1];
+      }
+
+      if (!isClass(fn)) {
+        // http://jsperf.com/angularjs-invoke-apply-vs-switch
+        // #5388
+        return fn.apply(self, args);
+      } else {
+        args.unshift(null);
+        return new (Function.prototype.bind.apply(fn, args))();
+      }
+    }
+
+
+    function instantiate(Type, locals, serviceName) {
+      // Check if Type is annotated and use just the given function at n-1 as parameter
+      // e.g. someModule.factory('greeter', ['$window', function(renamed$window) {}]);
+      var ctor = (isArray(Type) ? Type[Type.length - 1] : Type);
+      var args = injectionArgs(Type, locals, serviceName);
+      // Empty object at position 0 is ignored for invocation with `new`, but required.
+      args.unshift(null);
+      return new (Function.prototype.bind.apply(ctor, args))();
+    }
+
+
+    return {
+      invoke: invoke,
+      instantiate: instantiate,
+      get: getService,
+      annotate: createInjector.$$annotate,
+      has: function(name) {
+        return providerCache.hasOwnProperty(name + providerSuffix) || cache.hasOwnProperty(name);
+      }
+    };
+  }
+}
+
+createInjector.$$annotate = annotate;
+
+/**
+ * @ngdoc provider
+ * @name $anchorScrollProvider
+ *
+ * @description
+ * Use `$anchorScrollProvider` to disable automatic scrolling whenever
+ * {@link ng.$location#hash $location.hash()} changes.
+ */
+function $AnchorScrollProvider() {
+
+  var autoScrollingEnabled = true;
+
+  /**
+   * @ngdoc method
+   * @name $anchorScrollProvider#disableAutoScrolling
+   *
+   * @description
+   * By default, {@link ng.$anchorScroll $anchorScroll()} will automatically detect changes to
+   * {@link ng.$location#hash $location.hash()} and scroll to the element matching the new hash.<br />
+   * Use this method to disable automatic scrolling.
+   *
+   * If automatic scrolling is disabled, one must explicitly call
+   * {@link ng.$anchorScroll $anchorScroll()} in order to scroll to the element related to the
+   * current hash.
+   */
+  this.disableAutoScrolling = function() {
+    autoScrollingEnabled = false;
+  };
+
+  /**
+   * @ngdoc service
+   * @name $anchorScroll
+   * @kind function
+   * @requires $window
+   * @requires $location
+   * @requires $rootScope
+   *
+   * @description
+   * When called, it scrolls to the element related to the specified `hash` or (if omitted) to the
+   * current value of {@link ng.$location#hash $location.hash()}, according to the rules specified
+   * in the
+   * [HTML5 spec](http://www.w3.org/html/wg/drafts/html/master/browsers.html#an-indicated-part-of-the-document).
+   *
+   * It also watches the {@link ng.$location#hash $location.hash()} and automatically scrolls to
+   * match any anchor whenever it changes. This can be disabled by calling
+   * {@link ng.$anchorScrollProvider#disableAutoScrolling $anchorScrollProvider.disableAutoScrolling()}.
+   *
+   * Additionally, you can use its {@link ng.$anchorScroll#yOffset yOffset} property to specify a
+   * vertical scroll-offset (either fixed or dynamic).
+   *
+   * @param {string=} hash The hash specifying the element to scroll to. If omitted, the value of
+   *                       {@link ng.$location#hash $location.hash()} will be used.
+   *
+   * @property {(number|function|jqLite)} yOffset
+   * If set, specifies a vertical scroll-offset. This is often useful when there are fixed
+   * positioned elements at the top of the page, such as navbars, headers etc.
+   *
+   * `yOffset` can be specified in various ways:
+   * - **number**: A fixed number of pixels to be used as offset.<br /><br />
+   * - **function**: A getter function called everytime `$anchorScroll()` is executed. Must return
+   *   a number representing the offset (in pixels).<br /><br />
+   * - **jqLite**: A jqLite/jQuery element to be used for specifying the offset. The distance from
+   *   the top of the page to the element's bottom will be used as offset.<br />
+   *   **Note**: The element will be taken into account only as long as its `position` is set to
+   *   `fixed`. This option is useful, when dealing with responsive navbars/headers that adjust
+   *   their height and/or positioning according to the viewport's size.
+   *
+   * <br />
+   * <div class="alert alert-warning">
+   * In order for `yOffset` to work properly, scrolling should take place on the document's root and
+   * not some child element.
+   * </div>
+   *
+   * @example
+     <example module="anchorScrollExample">
+       <file name="index.html">
+         <div id="scrollArea" ng-controller="ScrollController">
+           <a ng-click="gotoBottom()">Go to bottom</a>
+           <a id="bottom"></a> You're at the bottom!
+         </div>
+       </file>
+       <file name="script.js">
+         angular.module('anchorScrollExample', [])
+           .controller('ScrollController', ['$scope', '$location', '$anchorScroll',
+             function ($scope, $location, $anchorScroll) {
+               $scope.gotoBottom = function() {
+                 // set the location.hash to the id of
+                 // the element you wish to scroll to.
+                 $location.hash('bottom');
+
+                 // call $anchorScroll()
+                 $anchorScroll();
+               };
+             }]);
+       </file>
+       <file name="style.css">
+         #scrollArea {
+           height: 280px;
+           overflow: auto;
+         }
+
+         #bottom {
+           display: block;
+           margin-top: 2000px;
+         }
+       </file>
+     </example>
+   *
+   * <hr />
+   * The example below illustrates the use of a vertical scroll-offset (specified as a fixed value).
+   * See {@link ng.$anchorScroll#yOffset $anchorScroll.yOffset} for more details.
+   *
+   * @example
+     <example module="anchorScrollOffsetExample">
+       <file name="index.html">
+         <div class="fixed-header" ng-controller="headerCtrl">
+           <a href="" ng-click="gotoAnchor(x)" ng-repeat="x in [1,2,3,4,5]">
+             Go to anchor {{x}}
+           </a>
+         </div>
+         <div id="anchor{{x}}" class="anchor" ng-repeat="x in [1,2,3,4,5]">
+           Anchor {{x}} of 5
+         </div>
+       </file>
+       <file name="script.js">
+         angular.module('anchorScrollOffsetExample', [])
+           .run(['$anchorScroll', function($anchorScroll) {
+             $anchorScroll.yOffset = 50;   // always scroll by 50 extra pixels
+           }])
+           .controller('headerCtrl', ['$anchorScroll', '$location', '$scope',
+             function ($anchorScroll, $location, $scope) {
+               $scope.gotoAnchor = function(x) {
+                 var newHash = 'anchor' + x;
+                 if ($location.hash() !== newHash) {
+                   // set the $location.hash to `newHash` and
+                   // $anchorScroll will automatically scroll to it
+                   $location.hash('anchor' + x);
+                 } else {
+                   // call $anchorScroll() explicitly,
+                   // since $location.hash hasn't changed
+                   $anchorScroll();
+                 }
+               };
+             }
+           ]);
+       </file>
+       <file name="style.css">
+         body {
+           padding-top: 50px;
+         }
+
+         .anchor {
+           border: 2px dashed DarkOrchid;
+           padding: 10px 10px 200px 10px;
+         }
+
+         .fixed-header {
+           background-color: rgba(0, 0, 0, 0.2);
+           height: 50px;
+           position: fixed;
+           top: 0; left: 0; right: 0;
+         }
+
+         .fixed-header > a {
+           display: inline-block;
+           margin: 5px 15px;
+         }
+       </file>
+     </example>
+   */
+  this.$get = ['$window', '$location', '$rootScope', function($window, $location, $rootScope) {
+    var document = $window.document;
+
+    // Helper function to get first anchor from a NodeList
+    // (using `Array#some()` instead of `angular#forEach()` since it's more performant
+    //  and working in all supported browsers.)
+    function getFirstAnchor(list) {
+      var result = null;
+      Array.prototype.some.call(list, function(element) {
+        if (nodeName_(element) === 'a') {
+          result = element;
+          return true;
+        }
+      });
+      return result;
+    }
+
+    function getYOffset() {
+
+      var offset = scroll.yOffset;
+
+      if (isFunction(offset)) {
+        offset = offset();
+      } else if (isElement(offset)) {
+        var elem = offset[0];
+        var style = $window.getComputedStyle(elem);
+        if (style.position !== 'fixed') {
+          offset = 0;
+        } else {
+          offset = elem.getBoundingClientRect().bottom;
+        }
+      } else if (!isNumber(offset)) {
+        offset = 0;
+      }
+
+      return offset;
+    }
+
+    function scrollTo(elem) {
+      if (elem) {
+        elem.scrollIntoView();
+
+        var offset = getYOffset();
+
+        if (offset) {
+          // `offset` is the number of pixels we should scroll UP in order to align `elem` properly.
+          // This is true ONLY if the call to `elem.scrollIntoView()` initially aligns `elem` at the
+          // top of the viewport.
+          //
+          // IF the number of pixels from the top of `elem` to the end of the page's content is less
+          // than the height of the viewport, then `elem.scrollIntoView()` will align the `elem` some
+          // way down the page.
+          //
+          // This is often the case for elements near the bottom of the page.
+          //
+          // In such cases we do not need to scroll the whole `offset` up, just the difference between
+          // the top of the element and the offset, which is enough to align the top of `elem` at the
+          // desired position.
+          var elemTop = elem.getBoundingClientRect().top;
+          $window.scrollBy(0, elemTop - offset);
+        }
+      } else {
+        $window.scrollTo(0, 0);
+      }
+    }
+
+    function scroll(hash) {
+      hash = isString(hash) ? hash : $location.hash();
+      var elm;
+
+      // empty hash, scroll to the top of the page
+      if (!hash) scrollTo(null);
+
+      // element with given id
+      else if ((elm = document.getElementById(hash))) scrollTo(elm);
+
+      // first anchor with given name :-D
+      else if ((elm = getFirstAnchor(document.getElementsByName(hash)))) scrollTo(elm);
+
+      // no element and hash == 'top', scroll to the top of the page
+      else if (hash === 'top') scrollTo(null);
+    }
+
+    // does not scroll when user clicks on anchor link that is currently on
+    // (no url change, no $location.hash() change), browser native does scroll
+    if (autoScrollingEnabled) {
+      $rootScope.$watch(function autoScrollWatch() {return $location.hash();},
+        function autoScrollWatchAction(newVal, oldVal) {
+          // skip the initial scroll if $location.hash is empty
+          if (newVal === oldVal && newVal === '') return;
+
+          jqLiteDocumentLoaded(function() {
+            $rootScope.$evalAsync(scroll);
+          });
+        });
+    }
+
+    return scroll;
+  }];
+}
+
+var $animateMinErr = minErr('$animate');
+var ELEMENT_NODE = 1;
+var NG_ANIMATE_CLASSNAME = 'ng-animate';
+
+function mergeClasses(a,b) {
+  if (!a && !b) return '';
+  if (!a) return b;
+  if (!b) return a;
+  if (isArray(a)) a = a.join(' ');
+  if (isArray(b)) b = b.join(' ');
+  return a + ' ' + b;
+}
+
+function extractElementNode(element) {
+  for (var i = 0; i < element.length; i++) {
+    var elm = element[i];
+    if (elm.nodeType === ELEMENT_NODE) {
+      return elm;
+    }
+  }
+}
+
+function splitClasses(classes) {
+  if (isString(classes)) {
+    classes = classes.split(' ');
+  }
+
+  // Use createMap() to prevent class assumptions involving property names in
+  // Object.prototype
+  var obj = createMap();
+  forEach(classes, function(klass) {
+    // sometimes the split leaves empty string values
+    // incase extra spaces were applied to the options
+    if (klass.length) {
+      obj[klass] = true;
+    }
+  });
+  return obj;
+}
+
+// if any other type of options value besides an Object value is
+// passed into the $animate.method() animation then this helper code
+// will be run which will ignore it. While this patch is not the
+// greatest solution to this, a lot of existing plugins depend on
+// $animate to either call the callback (< 1.2) or return a promise
+// that can be changed. This helper function ensures that the options
+// are wiped clean incase a callback function is provided.
+function prepareAnimateOptions(options) {
+  return isObject(options)
+      ? options
+      : {};
+}
+
+var $$CoreAnimateJsProvider = function() {
+  this.$get = noop;
+};
+
+// this is prefixed with Core since it conflicts with
+// the animateQueueProvider defined in ngAnimate/animateQueue.js
+var $$CoreAnimateQueueProvider = function() {
+  var postDigestQueue = new HashMap();
+  var postDigestElements = [];
+
+  this.$get = ['$$AnimateRunner', '$rootScope',
+       function($$AnimateRunner,   $rootScope) {
+    return {
+      enabled: noop,
+      on: noop,
+      off: noop,
+      pin: noop,
+
+      push: function(element, event, options, domOperation) {
+        domOperation        && domOperation();
+
+        options = options || {};
+        options.from        && element.css(options.from);
+        options.to          && element.css(options.to);
+
+        if (options.addClass || options.removeClass) {
+          addRemoveClassesPostDigest(element, options.addClass, options.removeClass);
+        }
+
+        var runner = new $$AnimateRunner(); // jshint ignore:line
+
+        // since there are no animations to run the runner needs to be
+        // notified that the animation call is complete.
+        runner.complete();
+        return runner;
+      }
+    };
+
+
+    function updateData(data, classes, value) {
+      var changed = false;
+      if (classes) {
+        classes = isString(classes) ? classes.split(' ') :
+                  isArray(classes) ? classes : [];
+        forEach(classes, function(className) {
+          if (className) {
+            changed = true;
+            data[className] = value;
+          }
+        });
+      }
+      return changed;
+    }
+
+    function handleCSSClassChanges() {
+      forEach(postDigestElements, function(element) {
+        var data = postDigestQueue.get(element);
+        if (data) {
+          var existing = splitClasses(element.attr('class'));
+          var toAdd = '';
+          var toRemove = '';
+          forEach(data, function(status, className) {
+            var hasClass = !!existing[className];
+            if (status !== hasClass) {
+              if (status) {
+                toAdd += (toAdd.length ? ' ' : '') + className;
+              } else {
+                toRemove += (toRemove.length ? ' ' : '') + className;
+              }
+            }
+          });
+
+          forEach(element, function(elm) {
+            toAdd    && jqLiteAddClass(elm, toAdd);
+            toRemove && jqLiteRemoveClass(elm, toRemove);
+          });
+          postDigestQueue.remove(element);
+        }
+      });
+      postDigestElements.length = 0;
+    }
+
+
+    function addRemoveClassesPostDigest(element, add, remove) {
+      var data = postDigestQueue.get(element) || {};
+
+      var classesAdded = updateData(data, add, true);
+      var classesRemoved = updateData(data, remove, false);
+
+      if (classesAdded || classesRemoved) {
+
+        postDigestQueue.put(element, data);
+        postDigestElements.push(element);
+
+        if (postDigestElements.length === 1) {
+          $rootScope.$$postDigest(handleCSSClassChanges);
+        }
+      }
+    }
+  }];
+};
+
+/**
+ * @ngdoc provider
+ * @name $animateProvider
+ *
+ * @description
+ * Default implementation of $animate that doesn't perform any animations, instead just
+ * synchronously performs DOM updates and resolves the returned runner promise.
+ *
+ * In order to enable animations the `ngAnimate` module has to be loaded.
+ *
+ * To see the functional implementation check out `src/ngAnimate/animate.js`.
+ */
+var $AnimateProvider = ['$provide', function($provide) {
+  var provider = this;
+
+  this.$$registeredAnimations = Object.create(null);
+
+   /**
+   * @ngdoc method
+   * @name $animateProvider#register
+   *
+   * @description
+   * Registers a new injectable animation factory function. The factory function produces the
+   * animation object which contains callback functions for each event that is expected to be
+   * animated.
+   *
+   *   * `eventFn`: `function(element, ... , doneFunction, options)`
+   *   The element to animate, the `doneFunction` and the options fed into the animation. Depending
+   *   on the type of animation additional arguments will be injected into the animation function. The
+   *   list below explains the function signatures for the different animation methods:
+   *
+   *   - setClass: function(element, addedClasses, removedClasses, doneFunction, options)
+   *   - addClass: function(element, addedClasses, doneFunction, options)
+   *   - removeClass: function(element, removedClasses, doneFunction, options)
+   *   - enter, leave, move: function(element, doneFunction, options)
+   *   - animate: function(element, fromStyles, toStyles, doneFunction, options)
+   *
+   *   Make sure to trigger the `doneFunction` once the animation is fully complete.
+   *
+   * ```js
+   *   return {
+   *     //enter, leave, move signature
+   *     eventFn : function(element, done, options) {
+   *       //code to run the animation
+   *       //once complete, then run done()
+   *       return function endFunction(wasCancelled) {
+   *         //code to cancel the animation
+   *       }
+   *     }
+   *   }
+   * ```
+   *
+   * @param {string} name The name of the animation (this is what the class-based CSS value will be compared to).
+   * @param {Function} factory The factory function that will be executed to return the animation
+   *                           object.
+   */
+  this.register = function(name, factory) {
+    if (name && name.charAt(0) !== '.') {
+      throw $animateMinErr('notcsel', "Expecting class selector starting with '.' got '{0}'.", name);
+    }
+
+    var key = name + '-animation';
+    provider.$$registeredAnimations[name.substr(1)] = key;
+    $provide.factory(key, factory);
+  };
+
+  /**
+   * @ngdoc method
+   * @name $animateProvider#classNameFilter
+   *
+   * @description
+   * Sets and/or returns the CSS class regular expression that is checked when performing
+   * an animation. Upon bootstrap the classNameFilter value is not set at all and will
+   * therefore enable $animate to attempt to perform an animation on any element that is triggered.
+   * When setting the `classNameFilter` value, animations will only be performed on elements
+   * that successfully match the filter expression. This in turn can boost performance
+   * for low-powered devices as well as applications containing a lot of structural operations.
+   * @param {RegExp=} expression The className expression which will be checked against all animations
+   * @return {RegExp} The current CSS className expression value. If null then there is no expression value
+   */
+  this.classNameFilter = function(expression) {
+    if (arguments.length === 1) {
+      this.$$classNameFilter = (expression instanceof RegExp) ? expression : null;
+      if (this.$$classNameFilter) {
+        var reservedRegex = new RegExp("(\\s+|\\/)" + NG_ANIMATE_CLASSNAME + "(\\s+|\\/)");
+        if (reservedRegex.test(this.$$classNameFilter.toString())) {
+          throw $animateMinErr('nongcls','$animateProvider.classNameFilter(regex) prohibits accepting a regex value which matches/contains the "{0}" CSS class.', NG_ANIMATE_CLASSNAME);
+
+        }
+      }
+    }
+    return this.$$classNameFilter;
+  };
+
+  this.$get = ['$$animateQueue', function($$animateQueue) {
+    function domInsert(element, parentElement, afterElement) {
+      // if for some reason the previous element was removed
+      // from the dom sometime before this code runs then let's
+      // just stick to using the parent element as the anchor
+      if (afterElement) {
+        var afterNode = extractElementNode(afterElement);
+        if (afterNode && !afterNode.parentNode && !afterNode.previousElementSibling) {
+          afterElement = null;
+        }
+      }
+      afterElement ? afterElement.after(element) : parentElement.prepend(element);
+    }
+
+    /**
+     * @ngdoc service
+     * @name $animate
+     * @description The $animate service exposes a series of DOM utility methods that provide support
+     * for animation hooks. The default behavior is the application of DOM operations, however,
+     * when an animation is detected (and animations are enabled), $animate will do the heavy lifting
+     * to ensure that animation runs with the triggered DOM operation.
+     *
+     * By default $animate doesn't trigger any animations. This is because the `ngAnimate` module isn't
+     * included and only when it is active then the animation hooks that `$animate` triggers will be
+     * functional. Once active then all structural `ng-` directives will trigger animations as they perform
+     * their DOM-related operations (enter, leave and move). Other directives such as `ngClass`,
+     * `ngShow`, `ngHide` and `ngMessages` also provide support for animations.
+     *
+     * It is recommended that the`$animate` service is always used when executing DOM-related procedures within directives.
+     *
+     * To learn more about enabling animation support, click here to visit the
+     * {@link ngAnimate ngAnimate module page}.
+     */
+    return {
+      // we don't call it directly since non-existant arguments may
+      // be interpreted as null within the sub enabled function
+
+      /**
+       *
+       * @ngdoc method
+       * @name $animate#on
+       * @kind function
+       * @description Sets up an event listener to fire whenever the animation event (enter, leave, move, etc...)
+       *    has fired on the given element or among any of its children. Once the listener is fired, the provided callback
+       *    is fired with the following params:
+       *
+       * ```js
+       * $animate.on('enter', container,
+       *    function callback(element, phase) {
+       *      // cool we detected an enter animation within the container
+       *    }
+       * );
+       * ```
+       *
+       * @param {string} event the animation event that will be captured (e.g. enter, leave, move, addClass, removeClass, etc...)
+       * @param {DOMElement} container the container element that will capture each of the animation events that are fired on itself
+       *     as well as among its children
+       * @param {Function} callback the callback function that will be fired when the listener is triggered
+       *
+       * The arguments present in the callback function are:
+       * * `element` - The captured DOM element that the animation was fired on.
+       * * `phase` - The phase of the animation. The two possible phases are **start** (when the animation starts) and **close** (when it ends).
+       */
+      on: $$animateQueue.on,
+
+      /**
+       *
+       * @ngdoc method
+       * @name $animate#off
+       * @kind function
+       * @description Deregisters an event listener based on the event which has been associated with the provided element. This method
+       * can be used in three different ways depending on the arguments:
+       *
+       * ```js
+       * // remove all the animation event listeners listening for `enter`
+       * $animate.off('enter');
+       *
+       * // remove listeners for all animation events from the container element
+       * $animate.off(container);
+       *
+       * // remove all the animation event listeners listening for `enter` on the given element and its children
+       * $animate.off('enter', container);
+       *
+       * // remove the event listener function provided by `callback` that is set
+       * // to listen for `enter` on the given `container` as well as its children
+       * $animate.off('enter', container, callback);
+       * ```
+       *
+       * @param {string|DOMElement} event|container the animation event (e.g. enter, leave, move,
+       * addClass, removeClass, etc...), or the container element. If it is the element, all other
+       * arguments are ignored.
+       * @param {DOMElement=} container the container element the event listener was placed on
+       * @param {Function=} callback the callback function that was registered as the listener
+       */
+      off: $$animateQueue.off,
+
+      /**
+       * @ngdoc method
+       * @name $animate#pin
+       * @kind function
+       * @description Associates the provided element with a host parent element to allow the element to be animated even if it exists
+       *    outside of the DOM structure of the Angular application. By doing so, any animation triggered via `$animate` can be issued on the
+       *    element despite being outside the realm of the application or within another application. Say for example if the application
+       *    was bootstrapped on an element that is somewhere inside of the `<body>` tag, but we wanted to allow for an element to be situated
+       *    as a direct child of `document.body`, then this can be achieved by pinning the element via `$animate.pin(element)`. Keep in mind
+       *    that calling `$animate.pin(element, parentElement)` will not actually insert into the DOM anywhere; it will just create the association.
+       *
+       *    Note that this feature is only active when the `ngAnimate` module is used.
+       *
+       * @param {DOMElement} element the external element that will be pinned
+       * @param {DOMElement} parentElement the host parent element that will be associated with the external element
+       */
+      pin: $$animateQueue.pin,
+
+      /**
+       *
+       * @ngdoc method
+       * @name $animate#enabled
+       * @kind function
+       * @description Used to get and set whether animations are enabled or not on the entire application or on an element and its children. This
+       * function can be called in four ways:
+       *
+       * ```js
+       * // returns true or false
+       * $animate.enabled();
+       *
+       * // changes the enabled state for all animations
+       * $animate.enabled(false);
+       * $animate.enabled(true);
+       *
+       * // returns true or false if animations are enabled for an element
+       * $animate.enabled(element);
+       *
+       * // changes the enabled state for an element and its children
+       * $animate.enabled(element, true);
+       * $animate.enabled(element, false);
+       * ```
+       *
+       * @param {DOMElement=} element the element that will be considered for checking/setting the enabled state
+       * @param {boolean=} enabled whether or not the animations will be enabled for the element
+       *
+       * @return {boolean} whether or not animations are enabled
+       */
+      enabled: $$animateQueue.enabled,
+
+      /**
+       * @ngdoc method
+       * @name $animate#cancel
+       * @kind function
+       * @description Cancels the provided animation.
+       *
+       * @param {Promise} animationPromise The animation promise that is returned when an animation is started.
+       */
+      cancel: function(runner) {
+        runner.end && runner.end();
+      },
+
+      /**
+       *
+       * @ngdoc method
+       * @name $animate#enter
+       * @kind function
+       * @description Inserts the element into the DOM either after the `after` element (if provided) or
+       *   as the first child within the `parent` element and then triggers an animation.
+       *   A promise is returned that will be resolved during the next digest once the animation
+       *   has completed.
+       *
+       * @param {DOMElement} element the element which will be inserted into the DOM
+       * @param {DOMElement} parent the parent element which will append the element as
+       *   a child (so long as the after element is not present)
+       * @param {DOMElement=} after the sibling element after which the element will be appended
+       * @param {object=} options an optional collection of options/styles that will be applied to the element.
+       *   The object can have the following properties:
+       *
+       *   - **addClass** - `{string}` - space-separated CSS classes to add to element
+       *   - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to`
+       *   - **removeClass** - `{string}` - space-separated CSS classes to remove from element
+       *   - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from`
+       *
+       * @return {Promise} the animation callback promise
+       */
+      enter: function(element, parent, after, options) {
+        parent = parent && jqLite(parent);
+        after = after && jqLite(after);
+        parent = parent || after.parent();
+        domInsert(element, parent, after);
+        return $$animateQueue.push(element, 'enter', prepareAnimateOptions(options));
+      },
+
+      /**
+       *
+       * @ngdoc method
+       * @name $animate#move
+       * @kind function
+       * @description Inserts (moves) the element into its new position in the DOM either after
+       *   the `after` element (if provided) or as the first child within the `parent` element
+       *   and then triggers an animation. A promise is returned that will be resolved
+       *   during the next digest once the animation has completed.
+       *
+       * @param {DOMElement} element the element which will be moved into the new DOM position
+       * @param {DOMElement} parent the parent element which will append the element as
+       *   a child (so long as the after element is not present)
+       * @param {DOMElement=} after the sibling element after which the element will be appended
+       * @param {object=} options an optional collection of options/styles that will be applied to the element.
+       *   The object can have the following properties:
+       *
+       *   - **addClass** - `{string}` - space-separated CSS classes to add to element
+       *   - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to`
+       *   - **removeClass** - `{string}` - space-separated CSS classes to remove from element
+       *   - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from`
+       *
+       * @return {Promise} the animation callback promise
+       */
+      move: function(element, parent, after, options) {
+        parent = parent && jqLite(parent);
+        after = after && jqLite(after);
+        parent = parent || after.parent();
+        domInsert(element, parent, after);
+        return $$animateQueue.push(element, 'move', prepareAnimateOptions(options));
+      },
+
+      /**
+       * @ngdoc method
+       * @name $animate#leave
+       * @kind function
+       * @description Triggers an animation and then removes the element from the DOM.
+       * When the function is called a promise is returned that will be resolved during the next
+       * digest once the animation has completed.
+       *
+       * @param {DOMElement} element the element which will be removed from the DOM
+       * @param {object=} options an optional collection of options/styles that will be applied to the element.
+       *   The object can have the following properties:
+       *
+       *   - **addClass** - `{string}` - space-separated CSS classes to add to element
+       *   - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to`
+       *   - **removeClass** - `{string}` - space-separated CSS classes to remove from element
+       *   - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from`
+       *
+       * @return {Promise} the animation callback promise
+       */
+      leave: function(element, options) {
+        return $$animateQueue.push(element, 'leave', prepareAnimateOptions(options), function() {
+          element.remove();
+        });
+      },
+
+      /**
+       * @ngdoc method
+       * @name $animate#addClass
+       * @kind function
+       *
+       * @description Triggers an addClass animation surrounding the addition of the provided CSS class(es). Upon
+       *   execution, the addClass operation will only be handled after the next digest and it will not trigger an
+       *   animation if element already contains the CSS class or if the class is removed at a later step.
+       *   Note that class-based animations are treated differently compared to structural animations
+       *   (like enter, move and leave) since the CSS classes may be added/removed at different points
+       *   depending if CSS or JavaScript animations are used.
+       *
+       * @param {DOMElement} element the element which the CSS classes will be applied to
+       * @param {string} className the CSS class(es) that will be added (multiple classes are separated via spaces)
+       * @param {object=} options an optional collection of options/styles that will be applied to the element.
+       *   The object can have the following properties:
+       *
+       *   - **addClass** - `{string}` - space-separated CSS classes to add to element
+       *   - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to`
+       *   - **removeClass** - `{string}` - space-separated CSS classes to remove from element
+       *   - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from`
+       *
+       * @return {Promise} the animation callback promise
+       */
+      addClass: function(element, className, options) {
+        options = prepareAnimateOptions(options);
+        options.addClass = mergeClasses(options.addclass, className);
+        return $$animateQueue.push(element, 'addClass', options);
+      },
+
+      /**
+       * @ngdoc method
+       * @name $animate#removeClass
+       * @kind function
+       *
+       * @description Triggers a removeClass animation surrounding the removal of the provided CSS class(es). Upon
+       *   execution, the removeClass operation will only be handled after the next digest and it will not trigger an
+       *   animation if element does not contain the CSS class or if the class is added at a later step.
+       *   Note that class-based animations are treated differently compared to structural animations
+       *   (like enter, move and leave) since the CSS classes may be added/removed at different points
+       *   depending if CSS or JavaScript animations are used.
+       *
+       * @param {DOMElement} element the element which the CSS classes will be applied to
+       * @param {string} className the CSS class(es) that will be removed (multiple classes are separated via spaces)
+       * @param {object=} options an optional collection of options/styles that will be applied to the element.
+       *   The object can have the following properties:
+       *
+       *   - **addClass** - `{string}` - space-separated CSS classes to add to element
+       *   - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to`
+       *   - **removeClass** - `{string}` - space-separated CSS classes to remove from element
+       *   - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from`
+       *
+       * @return {Promise} the animation callback promise
+       */
+      removeClass: function(element, className, options) {
+        options = prepareAnimateOptions(options);
+        options.removeClass = mergeClasses(options.removeClass, className);
+        return $$animateQueue.push(element, 'removeClass', options);
+      },
+
+      /**
+       * @ngdoc method
+       * @name $animate#setClass
+       * @kind function
+       *
+       * @description Performs both the addition and removal of a CSS classes on an element and (during the process)
+       *    triggers an animation surrounding the class addition/removal. Much like `$animate.addClass` and
+       *    `$animate.removeClass`, `setClass` will only evaluate the classes being added/removed once a digest has
+       *    passed. Note that class-based animations are treated differently compared to structural animations
+       *    (like enter, move and leave) since the CSS classes may be added/removed at different points
+       *    depending if CSS or JavaScript animations are used.
+       *
+       * @param {DOMElement} element the element which the CSS classes will be applied to
+       * @param {string} add the CSS class(es) that will be added (multiple classes are separated via spaces)
+       * @param {string} remove the CSS class(es) that will be removed (multiple classes are separated via spaces)
+       * @param {object=} options an optional collection of options/styles that will be applied to the element.
+       *   The object can have the following properties:
+       *
+       *   - **addClass** - `{string}` - space-separated CSS classes to add to element
+       *   - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to`
+       *   - **removeClass** - `{string}` - space-separated CSS classes to remove from element
+       *   - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from`
+       *
+       * @return {Promise} the animation callback promise
+       */
+      setClass: function(element, add, remove, options) {
+        options = prepareAnimateOptions(options);
+        options.addClass = mergeClasses(options.addClass, add);
+        options.removeClass = mergeClasses(options.removeClass, remove);
+        return $$animateQueue.push(element, 'setClass', options);
+      },
+
+      /**
+       * @ngdoc method
+       * @name $animate#animate
+       * @kind function
+       *
+       * @description Performs an inline animation on the element which applies the provided to and from CSS styles to the element.
+       * If any detected CSS transition, keyframe or JavaScript matches the provided className value, then the animation will take
+       * on the provided styles. For example, if a transition animation is set for the given classNamem, then the provided `from` and
+       * `to` styles will be applied alongside the given transition. If the CSS style provided in `from` does not have a corresponding
+       * style in `to`, the style in `from` is applied immediately, and no animation is run.
+       * If a JavaScript animation is detected then the provided styles will be given in as function parameters into the `animate`
+       * method (or as part of the `options` parameter):
+       *
+       * ```js
+       * ngModule.animation('.my-inline-animation', function() {
+       *   return {
+       *     animate : function(element, from, to, done, options) {
+       *       //animation
+       *       done();
+       *     }
+       *   }
+       * });
+       * ```
+       *
+       * @param {DOMElement} element the element which the CSS styles will be applied to
+       * @param {object} from the from (starting) CSS styles that will be applied to the element and across the animation.
+       * @param {object} to the to (destination) CSS styles that will be applied to the element and across the animation.
+       * @param {string=} className an optional CSS class that will be applied to the element for the duration of the animation. If
+       *    this value is left as empty then a CSS class of `ng-inline-animate` will be applied to the element.
+       *    (Note that if no animation is detected then this value will not be applied to the element.)
+       * @param {object=} options an optional collection of options/styles that will be applied to the element.
+       *   The object can have the following properties:
+       *
+       *   - **addClass** - `{string}` - space-separated CSS classes to add to element
+       *   - **from** - `{Object}` - CSS properties & values at the beginning of animation. Must have matching `to`
+       *   - **removeClass** - `{string}` - space-separated CSS classes to remove from element
+       *   - **to** - `{Object}` - CSS properties & values at end of animation. Must have matching `from`
+       *
+       * @return {Promise} the animation callback promise
+       */
+      animate: function(element, from, to, className, options) {
+        options = prepareAnimateOptions(options);
+        options.from = options.from ? extend(options.from, from) : from;
+        options.to   = options.to   ? extend(options.to, to)     : to;
+
+        className = className || 'ng-inline-animate';
+        options.tempClasses = mergeClasses(options.tempClasses, className);
+        return $$animateQueue.push(element, 'animate', options);
+      }
+    };
+  }];
+}];
+
+var $$AnimateAsyncRunFactoryProvider = function() {
+  this.$get = ['$$rAF', function($$rAF) {
+    var waitQueue = [];
+
+    function waitForTick(fn) {
+      waitQueue.push(fn);
+      if (waitQueue.length > 1) return;
+      $$rAF(function() {
+        for (var i = 0; i < waitQueue.length; i++) {
+          waitQueue[i]();
+        }
+        waitQueue = [];
+      });
+    }
+
+    return function() {
+      var passed = false;
+      waitForTick(function() {
+        passed = true;
+      });
+      return function(callback) {
+        passed ? callback() : waitForTick(callback);
+      };
+    };
+  }];
+};
+
+var $$AnimateRunnerFactoryProvider = function() {
+  this.$get = ['$q', '$sniffer', '$$animateAsyncRun', '$document', '$timeout',
+       function($q,   $sniffer,   $$animateAsyncRun,   $document,   $timeout) {
+
+    var INITIAL_STATE = 0;
+    var DONE_PENDING_STATE = 1;
+    var DONE_COMPLETE_STATE = 2;
+
+    AnimateRunner.chain = function(chain, callback) {
+      var index = 0;
+
+      next();
+      function next() {
+        if (index === chain.length) {
+          callback(true);
+          return;
+        }
+
+        chain[index](function(response) {
+          if (response === false) {
+            callback(false);
+            return;
+          }
+          index++;
+          next();
+        });
+      }
+    };
+
+    AnimateRunner.all = function(runners, callback) {
+      var count = 0;
+      var status = true;
+      forEach(runners, function(runner) {
+        runner.done(onProgress);
+      });
+
+      function onProgress(response) {
+        status = status && response;
+        if (++count === runners.length) {
+          callback(status);
+        }
+      }
+    };
+
+    function AnimateRunner(host) {
+      this.setHost(host);
+
+      var rafTick = $$animateAsyncRun();
+      var timeoutTick = function(fn) {
+        $timeout(fn, 0, false);
+      };
+
+      this._doneCallbacks = [];
+      this._tick = function(fn) {
+        var doc = $document[0];
+
+        // the document may not be ready or attached
+        // to the module for some internal tests
+        if (doc && doc.hidden) {
+          timeoutTick(fn);
+        } else {
+          rafTick(fn);
+        }
+      };
+      this._state = 0;
+    }
+
+    AnimateRunner.prototype = {
+      setHost: function(host) {
+        this.host = host || {};
+      },
+
+      done: function(fn) {
+        if (this._state === DONE_COMPLETE_STATE) {
+          fn();
+        } else {
+          this._doneCallbacks.push(fn);
+        }
+      },
+
+      progress: noop,
+
+      getPromise: function() {
+        if (!this.promise) {
+          var self = this;
+          this.promise = $q(function(resolve, reject) {
+            self.done(function(status) {
+              status === false ? reject() : resolve();
+            });
+          });
+        }
+        return this.promise;
+      },
+
+      then: function(resolveHandler, rejectHandler) {
+        return this.getPromise().then(resolveHandler, rejectHandler);
+      },
+
+      'catch': function(handler) {
+        return this.getPromise()['catch'](handler);
+      },
+
+      'finally': function(handler) {
+        return this.getPromise()['finally'](handler);
+      },
+
+      pause: function() {
+        if (this.host.pause) {
+          this.host.pause();
+        }
+      },
+
+      resume: function() {
+        if (this.host.resume) {
+          this.host.resume();
+        }
+      },
+
+      end: function() {
+        if (this.host.end) {
+          this.host.end();
+        }
+        this._resolve(true);
+      },
+
+      cancel: function() {
+        if (this.host.cancel) {
+          this.host.cancel();
+        }
+        this._resolve(false);
+      },
+
+      complete: function(response) {
+        var self = this;
+        if (self._state === INITIAL_STATE) {
+          self._state = DONE_PENDING_STATE;
+          self._tick(function() {
+            self._resolve(response);
+          });
+        }
+      },
+
+      _resolve: function(response) {
+        if (this._state !== DONE_COMPLETE_STATE) {
+          forEach(this._doneCallbacks, function(fn) {
+            fn(response);
+          });
+          this._doneCallbacks.length = 0;
+          this._state = DONE_COMPLETE_STATE;
+        }
+      }
+    };
+
+    return AnimateRunner;
+  }];
+};
+
+/**
+ * @ngdoc service
+ * @name $animateCss
+ * @kind object
+ *
+ * @description
+ * This is the core version of `$animateCss`. By default, only when the `ngAnimate` is included,
+ * then the `$animateCss` service will actually perform animations.
+ *
+ * Click here {@link ngAnimate.$animateCss to read the documentation for $animateCss}.
+ */
+var $CoreAnimateCssProvider = function() {
+  this.$get = ['$$rAF', '$q', '$$AnimateRunner', function($$rAF, $q, $$AnimateRunner) {
+
+    return function(element, initialOptions) {
+      // all of the animation functions should create
+      // a copy of the options data, however, if a
+      // parent service has already created a copy then
+      // we should stick to using that
+      var options = initialOptions || {};
+      if (!options.$$prepared) {
+        options = copy(options);
+      }
+
+      // there is no point in applying the styles since
+      // there is no animation that goes on at all in
+      // this version of $animateCss.
+      if (options.cleanupStyles) {
+        options.from = options.to = null;
+      }
+
+      if (options.from) {
+        element.css(options.from);
+        options.from = null;
+      }
+
+      /* jshint newcap: false */
+      var closed, runner = new $$AnimateRunner();
+      return {
+        start: run,
+        end: run
+      };
+
+      function run() {
+        $$rAF(function() {
+          applyAnimationContents();
+          if (!closed) {
+            runner.complete();
+          }
+          closed = true;
+        });
+        return runner;
+      }
+
+      function applyAnimationContents() {
+        if (options.addClass) {
+          element.addClass(options.addClass);
+          options.addClass = null;
+        }
+        if (options.removeClass) {
+          element.removeClass(options.removeClass);
+          options.removeClass = null;
+        }
+        if (options.to) {
+          element.css(options.to);
+          options.to = null;
+        }
+      }
+    };
+  }];
+};
+
+/* global stripHash: true */
+
+/**
+ * ! This is a private undocumented service !
+ *
+ * @name $browser
+ * @requires $log
+ * @description
+ * This object has two goals:
+ *
+ * - hide all the global state in the browser caused by the window object
+ * - abstract away all the browser specific features and inconsistencies
+ *
+ * For tests we provide {@link ngMock.$browser mock implementation} of the `$browser`
+ * service, which can be used for convenient testing of the application without the interaction with
+ * the real browser apis.
+ */
+/**
+ * @param {object} window The global window object.
+ * @param {object} document jQuery wrapped document.
+ * @param {object} $log window.console or an object with the same interface.
+ * @param {object} $sniffer $sniffer service
+ */
+function Browser(window, document, $log, $sniffer) {
+  var self = this,
+      location = window.location,
+      history = window.history,
+      setTimeout = window.setTimeout,
+      clearTimeout = window.clearTimeout,
+      pendingDeferIds = {};
+
+  self.isMock = false;
+
+  var outstandingRequestCount = 0;
+  var outstandingRequestCallbacks = [];
+
+  // TODO(vojta): remove this temporary api
+  self.$$completeOutstandingRequest = completeOutstandingRequest;
+  self.$$incOutstandingRequestCount = function() { outstandingRequestCount++; };
+
+  /**
+   * Executes the `fn` function(supports currying) and decrements the `outstandingRequestCallbacks`
+   * counter. If the counter reaches 0, all the `outstandingRequestCallbacks` are executed.
+   */
+  function completeOutstandingRequest(fn) {
+    try {
+      fn.apply(null, sliceArgs(arguments, 1));
+    } finally {
+      outstandingRequestCount--;
+      if (outstandingRequestCount === 0) {
+        while (outstandingRequestCallbacks.length) {
+          try {
+            outstandingRequestCallbacks.pop()();
+          } catch (e) {
+            $log.error(e);
+          }
+        }
+      }
+    }
+  }
+
+  function getHash(url) {
+    var index = url.indexOf('#');
+    return index === -1 ? '' : url.substr(index);
+  }
+
+  /**
+   * @private
+   * Note: this method is used only by scenario runner
+   * TODO(vojta): prefix this method with $$ ?
+   * @param {function()} callback Function that will be called when no outstanding request
+   */
+  self.notifyWhenNoOutstandingRequests = function(callback) {
+    if (outstandingRequestCount === 0) {
+      callback();
+    } else {
+      outstandingRequestCallbacks.push(callback);
+    }
+  };
+
+  //////////////////////////////////////////////////////////////
+  // URL API
+  //////////////////////////////////////////////////////////////
+
+  var cachedState, lastHistoryState,
+      lastBrowserUrl = location.href,
+      baseElement = document.find('base'),
+      pendingLocation = null,
+      getCurrentState = !$sniffer.history ? noop : function getCurrentState() {
+        try {
+          return history.state;
+        } catch (e) {
+          // MSIE can reportedly throw when there is no state (UNCONFIRMED).
+        }
+      };
+
+  cacheState();
+  lastHistoryState = cachedState;
+
+  /**
+   * @name $browser#url
+   *
+   * @description
+   * GETTER:
+   * Without any argument, this method just returns current value of location.href.
+   *
+   * SETTER:
+   * With at least one argument, this method sets url to new value.
+   * If html5 history api supported, pushState/replaceState is used, otherwise
+   * location.href/location.replace is used.
+   * Returns its own instance to allow chaining
+   *
+   * NOTE: this api is intended for use only by the $location service. Please use the
+   * {@link ng.$location $location service} to change url.
+   *
+   * @param {string} url New url (when used as setter)
+   * @param {boolean=} replace Should new url replace current history record?
+   * @param {object=} state object to use with pushState/replaceState
+   */
+  self.url = function(url, replace, state) {
+    // In modern browsers `history.state` is `null` by default; treating it separately
+    // from `undefined` would cause `$browser.url('/foo')` to change `history.state`
+    // to undefined via `pushState`. Instead, let's change `undefined` to `null` here.
+    if (isUndefined(state)) {
+      state = null;
+    }
+
+    // Android Browser BFCache causes location, history reference to become stale.
+    if (location !== window.location) location = window.location;
+    if (history !== window.history) history = window.history;
+
+    // setter
+    if (url) {
+      var sameState = lastHistoryState === state;
+
+      // Don't change anything if previous and current URLs and states match. This also prevents
+      // IE<10 from getting into redirect loop when in LocationHashbangInHtml5Url mode.
+      // See https://github.com/angular/angular.js/commit/ffb2701
+      if (lastBrowserUrl === url && (!$sniffer.history || sameState)) {
+        return self;
+      }
+      var sameBase = lastBrowserUrl && stripHash(lastBrowserUrl) === stripHash(url);
+      lastBrowserUrl = url;
+      lastHistoryState = state;
+      // Don't use history API if only the hash changed
+      // due to a bug in IE10/IE11 which leads
+      // to not firing a `hashchange` nor `popstate` event
+      // in some cases (see #9143).
+      if ($sniffer.history && (!sameBase || !sameState)) {
+        history[replace ? 'replaceState' : 'pushState'](state, '', url);
+        cacheState();
+        // Do the assignment again so that those two variables are referentially identical.
+        lastHistoryState = cachedState;
+      } else {
+        if (!sameBase) {
+          pendingLocation = url;
+        }
+        if (replace) {
+          location.replace(url);
+        } else if (!sameBase) {
+          location.href = url;
+        } else {
+          location.hash = getHash(url);
+        }
+        if (location.href !== url) {
+          pendingLocation = url;
+        }
+      }
+      if (pendingLocation) {
+        pendingLocation = url;
+      }
+      return self;
+    // getter
+    } else {
+      // - pendingLocation is needed as browsers don't allow to read out
+      //   the new location.href if a reload happened or if there is a bug like in iOS 9 (see
+      //   https://openradar.appspot.com/22186109).
+      // - the replacement is a workaround for https://bugzilla.mozilla.org/show_bug.cgi?id=407172
+      return pendingLocation || location.href.replace(/%27/g,"'");
+    }
+  };
+
+  /**
+   * @name $browser#state
+   *
+   * @description
+   * This method is a getter.
+   *
+   * Return history.state or null if history.state is undefined.
+   *
+   * @returns {object} state
+   */
+  self.state = function() {
+    return cachedState;
+  };
+
+  var urlChangeListeners = [],
+      urlChangeInit = false;
+
+  function cacheStateAndFireUrlChange() {
+    pendingLocation = null;
+    cacheState();
+    fireUrlChange();
+  }
+
+  // This variable should be used *only* inside the cacheState function.
+  var lastCachedState = null;
+  function cacheState() {
+    // This should be the only place in $browser where `history.state` is read.
+    cachedState = getCurrentState();
+    cachedState = isUndefined(cachedState) ? null : cachedState;
+
+    // Prevent callbacks fo fire twice if both hashchange & popstate were fired.
+    if (equals(cachedState, lastCachedState)) {
+      cachedState = lastCachedState;
+    }
+    lastCachedState = cachedState;
+  }
+
+  function fireUrlChange() {
+    if (lastBrowserUrl === self.url() && lastHistoryState === cachedState) {
+      return;
+    }
+
+    lastBrowserUrl = self.url();
+    lastHistoryState = cachedState;
+    forEach(urlChangeListeners, function(listener) {
+      listener(self.url(), cachedState);
+    });
+  }
+
+  /**
+   * @name $browser#onUrlChange
+   *
+   * @description
+   * Register callback function that will be called, when url changes.
+   *
+   * It's only called when the url is changed from outside of angular:
+   * - user types different url into address bar
+   * - user clicks on history (forward/back) button
+   * - user clicks on a link
+   *
+   * It's not called when url is changed by $browser.url() method
+   *
+   * The listener gets called with new url as parameter.
+   *
+   * NOTE: this api is intended for use only by the $location service. Please use the
+   * {@link ng.$location $location service} to monitor url changes in angular apps.
+   *
+   * @param {function(string)} listener Listener function to be called when url changes.
+   * @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous.
+   */
+  self.onUrlChange = function(callback) {
+    // TODO(vojta): refactor to use node's syntax for events
+    if (!urlChangeInit) {
+      // We listen on both (hashchange/popstate) when available, as some browsers (e.g. Opera)
+      // don't fire popstate when user change the address bar and don't fire hashchange when url
+      // changed by push/replaceState
+
+      // html5 history api - popstate event
+      if ($sniffer.history) jqLite(window).on('popstate', cacheStateAndFireUrlChange);
+      // hashchange event
+      jqLite(window).on('hashchange', cacheStateAndFireUrlChange);
+
+      urlChangeInit = true;
+    }
+
+    urlChangeListeners.push(callback);
+    return callback;
+  };
+
+  /**
+   * @private
+   * Remove popstate and hashchange handler from window.
+   *
+   * NOTE: this api is intended for use only by $rootScope.
+   */
+  self.$$applicationDestroyed = function() {
+    jqLite(window).off('hashchange popstate', cacheStateAndFireUrlChange);
+  };
+
+  /**
+   * Checks whether the url has changed outside of Angular.
+   * Needs to be exported to be able to check for changes that have been done in sync,
+   * as hashchange/popstate events fire in async.
+   */
+  self.$$checkUrlChange = fireUrlChange;
+
+  //////////////////////////////////////////////////////////////
+  // Misc API
+  //////////////////////////////////////////////////////////////
+
+  /**
+   * @name $browser#baseHref
+   *
+   * @description
+   * Returns current <base href>
+   * (always relative - without domain)
+   *
+   * @returns {string} The current base href
+   */
+  self.baseHref = function() {
+    var href = baseElement.attr('href');
+    return href ? href.replace(/^(https?\:)?\/\/[^\/]*/, '') : '';
+  };
+
+  /**
+   * @name $browser#defer
+   * @param {function()} fn A function, who's execution should be deferred.
+   * @param {number=} [delay=0] of milliseconds to defer the function execution.
+   * @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`.
+   *
+   * @description
+   * Executes a fn asynchronously via `setTimeout(fn, delay)`.
+   *
+   * Unlike when calling `setTimeout` directly, in test this function is mocked and instead of using
+   * `setTimeout` in tests, the fns are queued in an array, which can be programmatically flushed
+   * via `$browser.defer.flush()`.
+   *
+   */
+  self.defer = function(fn, delay) {
+    var timeoutId;
+    outstandingRequestCount++;
+    timeoutId = setTimeout(function() {
+      delete pendingDeferIds[timeoutId];
+      completeOutstandingRequest(fn);
+    }, delay || 0);
+    pendingDeferIds[timeoutId] = true;
+    return timeoutId;
+  };
+
+
+  /**
+   * @name $browser#defer.cancel
+   *
+   * @description
+   * Cancels a deferred task identified with `deferId`.
+   *
+   * @param {*} deferId Token returned by the `$browser.defer` function.
+   * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully
+   *                    canceled.
+   */
+  self.defer.cancel = function(deferId) {
+    if (pendingDeferIds[deferId]) {
+      delete pendingDeferIds[deferId];
+      clearTimeout(deferId);
+      completeOutstandingRequest(noop);
+      return true;
+    }
+    return false;
+  };
+
+}
+
+function $BrowserProvider() {
+  this.$get = ['$window', '$log', '$sniffer', '$document',
+      function($window, $log, $sniffer, $document) {
+        return new Browser($window, $document, $log, $sniffer);
+      }];
+}
+
+/**
+ * @ngdoc service
+ * @name $cacheFactory
+ *
+ * @description
+ * Factory that constructs {@link $cacheFactory.Cache Cache} objects and gives access to
+ * them.
+ *
+ * ```js
+ *
+ *  var cache = $cacheFactory('cacheId');
+ *  expect($cacheFactory.get('cacheId')).toBe(cache);
+ *  expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();
+ *
+ *  cache.put("key", "value");
+ *  cache.put("another key", "another value");
+ *
+ *  // We've specified no options on creation
+ *  expect(cache.info()).toEqual({id: 'cacheId', size: 2});
+ *
+ * ```
+ *
+ *
+ * @param {string} cacheId Name or id of the newly created cache.
+ * @param {object=} options Options object that specifies the cache behavior. Properties:
+ *
+ *   - `{number=}` `capacity` — turns the cache into LRU cache.
+ *
+ * @returns {object} Newly created cache object with the following set of methods:
+ *
+ * - `{object}` `info()` — Returns id, size, and options of cache.
+ * - `{{*}}` `put({string} key, {*} value)` — Puts a new key-value pair into the cache and returns
+ *   it.
+ * - `{{*}}` `get({string} key)` — Returns cached value for `key` or undefined for cache miss.
+ * - `{void}` `remove({string} key)` — Removes a key-value pair from the cache.
+ * - `{void}` `removeAll()` — Removes all cached values.
+ * - `{void}` `destroy()` — Removes references to this cache from $cacheFactory.
+ *
+ * @example
+   <example module="cacheExampleApp">
+     <file name="index.html">
+       <div ng-controller="CacheController">
+         <input ng-model="newCacheKey" placeholder="Key">
+         <input ng-model="newCacheValue" placeholder="Value">
+         <button ng-click="put(newCacheKey, newCacheValue)">Cache</button>
+
+         <p ng-if="keys.length">Cached Values</p>
+         <div ng-repeat="key in keys">
+           <span ng-bind="key"></span>
+           <span>: </span>
+           <b ng-bind="cache.get(key)"></b>
+         </div>
+
+         <p>Cache Info</p>
+         <div ng-repeat="(key, value) in cache.info()">
+           <span ng-bind="key"></span>
+           <span>: </span>
+           <b ng-bind="value"></b>
+         </div>
+       </div>
+     </file>
+     <file name="script.js">
+       angular.module('cacheExampleApp', []).
+         controller('CacheController', ['$scope', '$cacheFactory', function($scope, $cacheFactory) {
+           $scope.keys = [];
+           $scope.cache = $cacheFactory('cacheId');
+           $scope.put = function(key, value) {
+             if (angular.isUndefined($scope.cache.get(key))) {
+               $scope.keys.push(key);
+             }
+             $scope.cache.put(key, angular.isUndefined(value) ? null : value);
+           };
+         }]);
+     </file>
+     <file name="style.css">
+       p {
+         margin: 10px 0 3px;
+       }
+     </file>
+   </example>
+ */
+function $CacheFactoryProvider() {
+
+  this.$get = function() {
+    var caches = {};
+
+    function cacheFactory(cacheId, options) {
+      if (cacheId in caches) {
+        throw minErr('$cacheFactory')('iid', "CacheId '{0}' is already taken!", cacheId);
+      }
+
+      var size = 0,
+          stats = extend({}, options, {id: cacheId}),
+          data = createMap(),
+          capacity = (options && options.capacity) || Number.MAX_VALUE,
+          lruHash = createMap(),
+          freshEnd = null,
+          staleEnd = null;
+
+      /**
+       * @ngdoc type
+       * @name $cacheFactory.Cache
+       *
+       * @description
+       * A cache object used to store and retrieve data, primarily used by
+       * {@link $http $http} and the {@link ng.directive:script script} directive to cache
+       * templates and other data.
+       *
+       * ```js
+       *  angular.module('superCache')
+       *    .factory('superCache', ['$cacheFactory', function($cacheFactory) {
+       *      return $cacheFactory('super-cache');
+       *    }]);
+       * ```
+       *
+       * Example test:
+       *
+       * ```js
+       *  it('should behave like a cache', inject(function(superCache) {
+       *    superCache.put('key', 'value');
+       *    superCache.put('another key', 'another value');
+       *
+       *    expect(superCache.info()).toEqual({
+       *      id: 'super-cache',
+       *      size: 2
+       *    });
+       *
+       *    superCache.remove('another key');
+       *    expect(superCache.get('another key')).toBeUndefined();
+       *
+       *    superCache.removeAll();
+       *    expect(superCache.info()).toEqual({
+       *      id: 'super-cache',
+       *      size: 0
+       *    });
+       *  }));
+       * ```
+       */
+      return caches[cacheId] = {
+
+        /**
+         * @ngdoc method
+         * @name $cacheFactory.Cache#put
+         * @kind function
+         *
+         * @description
+         * Inserts a named entry into the {@link $cacheFactory.Cache Cache} object to be
+         * retrieved later, and incrementing the size of the cache if the key was not already
+         * present in the cache. If behaving like an LRU cache, it will also remove stale
+         * entries from the set.
+         *
+         * It will not insert undefined values into the cache.
+         *
+         * @param {string} key the key under which the cached data is stored.
+         * @param {*} value the value to store alongside the key. If it is undefined, the key
+         *    will not be stored.
+         * @returns {*} the value stored.
+         */
+        put: function(key, value) {
+          if (isUndefined(value)) return;
+          if (capacity < Number.MAX_VALUE) {
+            var lruEntry = lruHash[key] || (lruHash[key] = {key: key});
+
+            refresh(lruEntry);
+          }
+
+          if (!(key in data)) size++;
+          data[key] = value;
+
+          if (size > capacity) {
+            this.remove(staleEnd.key);
+          }
+
+          return value;
+        },
+
+        /**
+         * @ngdoc method
+         * @name $cacheFactory.Cache#get
+         * @kind function
+         *
+         * @description
+         * Retrieves named data stored in the {@link $cacheFactory.Cache Cache} object.
+         *
+         * @param {string} key the key of the data to be retrieved
+         * @returns {*} the value stored.
+         */
+        get: function(key) {
+          if (capacity < Number.MAX_VALUE) {
+            var lruEntry = lruHash[key];
+
+            if (!lruEntry) return;
+
+            refresh(lruEntry);
+          }
+
+          return data[key];
+        },
+
+
+        /**
+         * @ngdoc method
+         * @name $cacheFactory.Cache#remove
+         * @kind function
+         *
+         * @description
+         * Removes an entry from the {@link $cacheFactory.Cache Cache} object.
+         *
+         * @param {string} key the key of the entry to be removed
+         */
+        remove: function(key) {
+          if (capacity < Number.MAX_VALUE) {
+            var lruEntry = lruHash[key];
+
+            if (!lruEntry) return;
+
+            if (lruEntry == freshEnd) freshEnd = lruEntry.p;
+            if (lruEntry == staleEnd) staleEnd = lruEntry.n;
+            link(lruEntry.n,lruEntry.p);
+
+            delete lruHash[key];
+          }
+
+          if (!(key in data)) return;
+
+          delete data[key];
+          size--;
+        },
+
+
+        /**
+         * @ngdoc method
+         * @name $cacheFactory.Cache#removeAll
+         * @kind function
+         *
+         * @description
+         * Clears the cache object of any entries.
+         */
+        removeAll: function() {
+          data = createMap();
+          size = 0;
+          lruHash = createMap();
+          freshEnd = staleEnd = null;
+        },
+
+
+        /**
+         * @ngdoc method
+         * @name $cacheFactory.Cache#destroy
+         * @kind function
+         *
+         * @description
+         * Destroys the {@link $cacheFactory.Cache Cache} object entirely,
+         * removing it from the {@link $cacheFactory $cacheFactory} set.
+         */
+        destroy: function() {
+          data = null;
+          stats = null;
+          lruHash = null;
+          delete caches[cacheId];
+        },
+
+
+        /**
+         * @ngdoc method
+         * @name $cacheFactory.Cache#info
+         * @kind function
+         *
+         * @description
+         * Retrieve information regarding a particular {@link $cacheFactory.Cache Cache}.
+         *
+         * @returns {object} an object with the following properties:
+         *   <ul>
+         *     <li>**id**: the id of the cache instance</li>
+         *     <li>**size**: the number of entries kept in the cache instance</li>
+         *     <li>**...**: any additional properties from the options object when creating the
+         *       cache.</li>
+         *   </ul>
+         */
+        info: function() {
+          return extend({}, stats, {size: size});
+        }
+      };
+
+
+      /**
+       * makes the `entry` the freshEnd of the LRU linked list
+       */
+      function refresh(entry) {
+        if (entry != freshEnd) {
+          if (!staleEnd) {
+            staleEnd = entry;
+          } else if (staleEnd == entry) {
+            staleEnd = entry.n;
+          }
+
+          link(entry.n, entry.p);
+          link(entry, freshEnd);
+          freshEnd = entry;
+          freshEnd.n = null;
+        }
+      }
+
+
+      /**
+       * bidirectionally links two entries of the LRU linked list
+       */
+      function link(nextEntry, prevEntry) {
+        if (nextEntry != prevEntry) {
+          if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify
+          if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify
+        }
+      }
+    }
+
+
+  /**
+   * @ngdoc method
+   * @name $cacheFactory#info
+   *
+   * @description
+   * Get information about all the caches that have been created
+   *
+   * @returns {Object} - key-value map of `cacheId` to the result of calling `cache#info`
+   */
+    cacheFactory.info = function() {
+      var info = {};
+      forEach(caches, function(cache, cacheId) {
+        info[cacheId] = cache.info();
+      });
+      return info;
+    };
+
+
+  /**
+   * @ngdoc method
+   * @name $cacheFactory#get
+   *
+   * @description
+   * Get access to a cache object by the `cacheId` used when it was created.
+   *
+   * @param {string} cacheId Name or id of a cache to access.
+   * @returns {object} Cache object identified by the cacheId or undefined if no such cache.
+   */
+    cacheFactory.get = function(cacheId) {
+      return caches[cacheId];
+    };
+
+
+    return cacheFactory;
+  };
+}
+
+/**
+ * @ngdoc service
+ * @name $templateCache
+ *
+ * @description
+ * The first time a template is used, it is loaded in the template cache for quick retrieval. You
+ * can load templates directly into the cache in a `script` tag, or by consuming the
+ * `$templateCache` service directly.
+ *
+ * Adding via the `script` tag:
+ *
+ * ```html
+ *   <script type="text/ng-template" id="templateId.html">
+ *     <p>This is the content of the template</p>
+ *   </script>
+ * ```
+ *
+ * **Note:** the `script` tag containing the template does not need to be included in the `head` of
+ * the document, but it must be a descendent of the {@link ng.$rootElement $rootElement} (IE,
+ * element with ng-app attribute), otherwise the template will be ignored.
+ *
+ * Adding via the `$templateCache` service:
+ *
+ * ```js
+ * var myApp = angular.module('myApp', []);
+ * myApp.run(function($templateCache) {
+ *   $templateCache.put('templateId.html', 'This is the content of the template');
+ * });
+ * ```
+ *
+ * To retrieve the template later, simply use it in your HTML:
+ * ```html
+ * <div ng-include=" 'templateId.html' "></div>
+ * ```
+ *
+ * or get it via Javascript:
+ * ```js
+ * $templateCache.get('templateId.html')
+ * ```
+ *
+ * See {@link ng.$cacheFactory $cacheFactory}.
+ *
+ */
+function $TemplateCacheProvider() {
+  this.$get = ['$cacheFactory', function($cacheFactory) {
+    return $cacheFactory('templates');
+  }];
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *     Any commits to this file should be reviewed with security in mind.  *
+ *   Changes to this file can potentially create security vulnerabilities. *
+ *          An approval from 2 Core members with history of modifying      *
+ *                         this file is required.                          *
+ *                                                                         *
+ *  Does the change somehow allow for arbitrary javascript to be executed? *
+ *    Or allows for someone to change the prototype of built-in objects?   *
+ *     Or gives undesired access to variables likes document or window?    *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/* ! VARIABLE/FUNCTION NAMING CONVENTIONS THAT APPLY TO THIS FILE!
+ *
+ * DOM-related variables:
+ *
+ * - "node" - DOM Node
+ * - "element" - DOM Element or Node
+ * - "$node" or "$element" - jqLite-wrapped node or element
+ *
+ *
+ * Compiler related stuff:
+ *
+ * - "linkFn" - linking fn of a single directive
+ * - "nodeLinkFn" - function that aggregates all linking fns for a particular node
+ * - "childLinkFn" -  function that aggregates all linking fns for child nodes of a particular node
+ * - "compositeLinkFn" - function that aggregates all linking fns for a compilation root (nodeList)
+ */
+
+
+/**
+ * @ngdoc service
+ * @name $compile
+ * @kind function
+ *
+ * @description
+ * Compiles an HTML string or DOM into a template and produces a template function, which
+ * can then be used to link {@link ng.$rootScope.Scope `scope`} and the template together.
+ *
+ * The compilation is a process of walking the DOM tree and matching DOM elements to
+ * {@link ng.$compileProvider#directive directives}.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** This document is an in-depth reference of all directive options.
+ * For a gentle introduction to directives with examples of common use cases,
+ * see the {@link guide/directive directive guide}.
+ * </div>
+ *
+ * ## Comprehensive Directive API
+ *
+ * There are many different options for a directive.
+ *
+ * The difference resides in the return value of the factory function.
+ * You can either return a {@link $compile#directive-definition-object Directive Definition Object (see below)}
+ * that defines the directive properties, or just the `postLink` function (all other properties will have
+ * the default values).
+ *
+ * <div class="alert alert-success">
+ * **Best Practice:** It's recommended to use the "directive definition object" form.
+ * </div>
+ *
+ * Here's an example directive declared with a Directive Definition Object:
+ *
+ * ```js
+ *   var myModule = angular.module(...);
+ *
+ *   myModule.directive('directiveName', function factory(injectables) {
+ *     var directiveDefinitionObject = {
+ *       priority: 0,
+ *       template: '<div></div>', // or // function(tElement, tAttrs) { ... },
+ *       // or
+ *       // templateUrl: 'directive.html', // or // function(tElement, tAttrs) { ... },
+ *       transclude: false,
+ *       restrict: 'A',
+ *       templateNamespace: 'html',
+ *       scope: false,
+ *       controller: function($scope, $element, $attrs, $transclude, otherInjectables) { ... },
+ *       controllerAs: 'stringIdentifier',
+ *       bindToController: false,
+ *       require: 'siblingDirectiveName', // or // ['^parentDirectiveName', '?optionalDirectiveName', '?^optionalParent'],
+ *       compile: function compile(tElement, tAttrs, transclude) {
+ *         return {
+ *           pre: function preLink(scope, iElement, iAttrs, controller) { ... },
+ *           post: function postLink(scope, iElement, iAttrs, controller) { ... }
+ *         }
+ *         // or
+ *         // return function postLink( ... ) { ... }
+ *       },
+ *       // or
+ *       // link: {
+ *       //  pre: function preLink(scope, iElement, iAttrs, controller) { ... },
+ *       //  post: function postLink(scope, iElement, iAttrs, controller) { ... }
+ *       // }
+ *       // or
+ *       // link: function postLink( ... ) { ... }
+ *     };
+ *     return directiveDefinitionObject;
+ *   });
+ * ```
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Any unspecified options will use the default value. You can see the default values below.
+ * </div>
+ *
+ * Therefore the above can be simplified as:
+ *
+ * ```js
+ *   var myModule = angular.module(...);
+ *
+ *   myModule.directive('directiveName', function factory(injectables) {
+ *     var directiveDefinitionObject = {
+ *       link: function postLink(scope, iElement, iAttrs) { ... }
+ *     };
+ *     return directiveDefinitionObject;
+ *     // or
+ *     // return function postLink(scope, iElement, iAttrs) { ... }
+ *   });
+ * ```
+ *
+ * ### Life-cycle hooks
+ * Directive controllers can provide the following methods that are called by Angular at points in the life-cycle of the
+ * directive:
+ * * `$onInit()` - Called on each controller after all the controllers on an element have been constructed and
+ *   had their bindings initialized (and before the pre &amp; post linking functions for the directives on
+ *   this element). This is a good place to put initialization code for your controller.
+ * * `$onChanges(changesObj)` - Called whenever one-way (`<`) or interpolation (`@`) bindings are updated. The
+ *   `changesObj` is a hash whose keys are the names of the bound properties that have changed, and the values are an
+ *   object of the form `{ currentValue, previousValue, isFirstChange() }`. Use this hook to trigger updates within a
+ *   component such as cloning the bound value to prevent accidental mutation of the outer value.
+ * * `$doCheck()` - Called on each turn of the digest cycle. Provides an opportunity to detect and act on
+ *   changes. Any actions that you wish to take in response to the changes that you detect must be
+ *   invoked from this hook; implementing this has no effect on when `$onChanges` is called. For example, this hook
+ *   could be useful if you wish to perform a deep equality check, or to check a Date object, changes to which would not
+ *   be detected by Angular's change detector and thus not trigger `$onChanges`. This hook is invoked with no arguments;
+ *   if detecting changes, you must store the previous value(s) for comparison to the current values.
+ * * `$onDestroy()` - Called on a controller when its containing scope is destroyed. Use this hook for releasing
+ *   external resources, watches and event handlers. Note that components have their `$onDestroy()` hooks called in
+ *   the same order as the `$scope.$broadcast` events are triggered, which is top down. This means that parent
+ *   components will have their `$onDestroy()` hook called before child components.
+ * * `$postLink()` - Called after this controller's element and its children have been linked. Similar to the post-link
+ *   function this hook can be used to set up DOM event handlers and do direct DOM manipulation.
+ *   Note that child elements that contain `templateUrl` directives will not have been compiled and linked since
+ *   they are waiting for their template to load asynchronously and their own compilation and linking has been
+ *   suspended until that occurs.
+ *
+ * #### Comparison with Angular 2 life-cycle hooks
+ * Angular 2 also uses life-cycle hooks for its components. While the Angular 1 life-cycle hooks are similar there are
+ * some differences that you should be aware of, especially when it comes to moving your code from Angular 1 to Angular 2:
+ *
+ * * Angular 1 hooks are prefixed with `$`, such as `$onInit`. Angular 2 hooks are prefixed with `ng`, such as `ngOnInit`.
+ * * Angular 1 hooks can be defined on the controller prototype or added to the controller inside its constructor.
+ *   In Angular 2 you can only define hooks on the prototype of the Component class.
+ * * Due to the differences in change-detection, you may get many more calls to `$doCheck` in Angular 1 than you would to
+ *   `ngDoCheck` in Angular 2
+ * * Changes to the model inside `$doCheck` will trigger new turns of the digest loop, which will cause the changes to be
+ *   propagated throughout the application.
+ *   Angular 2 does not allow the `ngDoCheck` hook to trigger a change outside of the component. It will either throw an
+ *   error or do nothing depending upon the state of `enableProdMode()`.
+ *
+ * #### Life-cycle hook examples
+ *
+ * This example shows how you can check for mutations to a Date object even though the identity of the object
+ * has not changed.
+ *
+ * <example name="doCheckDateExample" module="do-check-module">
+ *   <file name="app.js">
+ *     angular.module('do-check-module', [])
+ *       .component('app', {
+ *         template:
+ *           'Month: <input ng-model="$ctrl.month" ng-change="$ctrl.updateDate()">' +
+ *           'Date: {{ $ctrl.date }}' +
+ *           '<test date="$ctrl.date"></test>',
+ *         controller: function() {
+ *           this.date = new Date();
+ *           this.month = this.date.getMonth();
+ *           this.updateDate = function() {
+ *             this.date.setMonth(this.month);
+ *           };
+ *         }
+ *       })
+ *       .component('test', {
+ *         bindings: { date: '<' },
+ *         template:
+ *           '<pre>{{ $ctrl.log | json }}</pre>',
+ *         controller: function() {
+ *           var previousValue;
+ *           this.log = [];
+ *           this.$doCheck = function() {
+ *             var currentValue = this.date && this.date.valueOf();
+ *             if (previousValue !== currentValue) {
+ *               this.log.push('doCheck: date mutated: ' + this.date);
+ *               previousValue = currentValue;
+ *             }
+ *           };
+ *         }
+ *       });
+ *   </file>
+ *   <file name="index.html">
+ *     <app></app>
+ *   </file>
+ * </example>
+ *
+ * This example show how you might use `$doCheck` to trigger changes in your component's inputs even if the
+ * actual identity of the component doesn't change. (Be aware that cloning and deep equality checks on large
+ * arrays or objects can have a negative impact on your application performance)
+ *
+ * <example name="doCheckArrayExample" module="do-check-module">
+ *   <file name="index.html">
+ *     <div ng-init="items = []">
+ *       <button ng-click="items.push(items.length)">Add Item</button>
+ *       <button ng-click="items = []">Reset Items</button>
+ *       <pre>{{ items }}</pre>
+ *       <test items="items"></test>
+ *     </div>
+ *   </file>
+ *   <file name="app.js">
+ *      angular.module('do-check-module', [])
+ *        .component('test', {
+ *          bindings: { items: '<' },
+ *          template:
+ *            '<pre>{{ $ctrl.log | json }}</pre>',
+ *          controller: function() {
+ *            this.log = [];
+ *
+ *            this.$doCheck = function() {
+ *              if (this.items_ref !== this.items) {
+ *                this.log.push('doCheck: items changed');
+ *                this.items_ref = this.items;
+ *              }
+ *              if (!angular.equals(this.items_clone, this.items)) {
+ *                this.log.push('doCheck: items mutated');
+ *                this.items_clone = angular.copy(this.items);
+ *              }
+ *            };
+ *          }
+ *        });
+ *   </file>
+ * </example>
+ *
+ *
+ * ### Directive Definition Object
+ *
+ * The directive definition object provides instructions to the {@link ng.$compile
+ * compiler}. The attributes are:
+ *
+ * #### `multiElement`
+ * When this property is set to true, the HTML compiler will collect DOM nodes between
+ * nodes with the attributes `directive-name-start` and `directive-name-end`, and group them
+ * together as the directive elements. It is recommended that this feature be used on directives
+ * which are not strictly behavioral (such as {@link ngClick}), and which
+ * do not manipulate or replace child nodes (such as {@link ngInclude}).
+ *
+ * #### `priority`
+ * When there are multiple directives defined on a single DOM element, sometimes it
+ * is necessary to specify the order in which the directives are applied. The `priority` is used
+ * to sort the directives before their `compile` functions get called. Priority is defined as a
+ * number. Directives with greater numerical `priority` are compiled first. Pre-link functions
+ * are also run in priority order, but post-link functions are run in reverse order. The order
+ * of directives with the same priority is undefined. The default priority is `0`.
+ *
+ * #### `terminal`
+ * If set to true then the current `priority` will be the last set of directives
+ * which will execute (any directives at the current priority will still execute
+ * as the order of execution on same `priority` is undefined). Note that expressions
+ * and other directives used in the directive's template will also be excluded from execution.
+ *
+ * #### `scope`
+ * The scope property can be `true`, an object or a falsy value:
+ *
+ * * **falsy:** No scope will be created for the directive. The directive will use its parent's scope.
+ *
+ * * **`true`:** A new child scope that prototypically inherits from its parent will be created for
+ * the directive's element. If multiple directives on the same element request a new scope,
+ * only one new scope is created. The new scope rule does not apply for the root of the template
+ * since the root of the template always gets a new scope.
+ *
+ * * **`{...}` (an object hash):** A new "isolate" scope is created for the directive's element. The
+ * 'isolate' scope differs from normal scope in that it does not prototypically inherit from its parent
+ * scope. This is useful when creating reusable components, which should not accidentally read or modify
+ * data in the parent scope.
+ *
+ * The 'isolate' scope object hash defines a set of local scope properties derived from attributes on the
+ * directive's element. These local properties are useful for aliasing values for templates. The keys in
+ * the object hash map to the name of the property on the isolate scope; the values define how the property
+ * is bound to the parent scope, via matching attributes on the directive's element:
+ *
+ * * `@` or `@attr` - bind a local scope property to the value of DOM attribute. The result is
+ *   always a string since DOM attributes are strings. If no `attr` name is specified then the
+ *   attribute name is assumed to be the same as the local name. Given `<my-component
+ *   my-attr="hello {{name}}">` and the isolate scope definition `scope: { localName:'@myAttr' }`,
+ *   the directive's scope property `localName` will reflect the interpolated value of `hello
+ *   {{name}}`. As the `name` attribute changes so will the `localName` property on the directive's
+ *   scope. The `name` is read from the parent scope (not the directive's scope).
+ *
+ * * `=` or `=attr` - set up a bidirectional binding between a local scope property and an expression
+ *   passed via the attribute `attr`. The expression is evaluated in the context of the parent scope.
+ *   If no `attr` name is specified then the attribute name is assumed to be the same as the local
+ *   name. Given `<my-component my-attr="parentModel">` and the isolate scope definition `scope: {
+ *   localModel: '=myAttr' }`, the property `localModel` on the directive's scope will reflect the
+ *   value of `parentModel` on the parent scope. Changes to `parentModel` will be reflected in
+ *   `localModel` and vice versa. Optional attributes should be marked as such with a question mark:
+ *   `=?` or `=?attr`. If the binding expression is non-assignable, or if the attribute isn't
+ *   optional and doesn't exist, an exception ({@link error/$compile/nonassign `$compile:nonassign`})
+ *   will be thrown upon discovering changes to the local value, since it will be impossible to sync
+ *   them back to the parent scope. By default, the {@link ng.$rootScope.Scope#$watch `$watch`}
+ *   method is used for tracking changes, and the equality check is based on object identity.
+ *   However, if an object literal or an array literal is passed as the binding expression, the
+ *   equality check is done by value (using the {@link angular.equals} function). It's also possible
+ *   to watch the evaluated value shallowly with {@link ng.$rootScope.Scope#$watchCollection
+ *   `$watchCollection`}: use `=*` or `=*attr` (`=*?` or `=*?attr` if the attribute is optional).
+ *
+  * * `<` or `<attr` - set up a one-way (one-directional) binding between a local scope property and an
+ *   expression passed via the attribute `attr`. The expression is evaluated in the context of the
+ *   parent scope. If no `attr` name is specified then the attribute name is assumed to be the same as the
+ *   local name. You can also make the binding optional by adding `?`: `<?` or `<?attr`.
+ *
+ *   For example, given `<my-component my-attr="parentModel">` and directive definition of
+ *   `scope: { localModel:'<myAttr' }`, then the isolated scope property `localModel` will reflect the
+ *   value of `parentModel` on the parent scope. Any changes to `parentModel` will be reflected
+ *   in `localModel`, but changes in `localModel` will not reflect in `parentModel`. There are however
+ *   two caveats:
+ *     1. one-way binding does not copy the value from the parent to the isolate scope, it simply
+ *     sets the same value. That means if your bound value is an object, changes to its properties
+ *     in the isolated scope will be reflected in the parent scope (because both reference the same object).
+ *     2. one-way binding watches changes to the **identity** of the parent value. That means the
+ *     {@link ng.$rootScope.Scope#$watch `$watch`} on the parent value only fires if the reference
+ *     to the value has changed. In most cases, this should not be of concern, but can be important
+ *     to know if you one-way bind to an object, and then replace that object in the isolated scope.
+ *     If you now change a property of the object in your parent scope, the change will not be
+ *     propagated to the isolated scope, because the identity of the object on the parent scope
+ *     has not changed. Instead you must assign a new object.
+ *
+ *   One-way binding is useful if you do not plan to propagate changes to your isolated scope bindings
+ *   back to the parent. However, it does not make this completely impossible.
+ *
+ * * `&` or `&attr` - provides a way to execute an expression in the context of the parent scope. If
+ *   no `attr` name is specified then the attribute name is assumed to be the same as the local name.
+ *   Given `<my-component my-attr="count = count + value">` and the isolate scope definition `scope: {
+ *   localFn:'&myAttr' }`, the isolate scope property `localFn` will point to a function wrapper for
+ *   the `count = count + value` expression. Often it's desirable to pass data from the isolated scope
+ *   via an expression to the parent scope. This can be done by passing a map of local variable names
+ *   and values into the expression wrapper fn. For example, if the expression is `increment(amount)`
+ *   then we can specify the amount value by calling the `localFn` as `localFn({amount: 22})`.
+ *
+ * In general it's possible to apply more than one directive to one element, but there might be limitations
+ * depending on the type of scope required by the directives. The following points will help explain these limitations.
+ * For simplicity only two directives are taken into account, but it is also applicable for several directives:
+ *
+ * * **no scope** + **no scope** => Two directives which don't require their own scope will use their parent's scope
+ * * **child scope** + **no scope** =>  Both directives will share one single child scope
+ * * **child scope** + **child scope** =>  Both directives will share one single child scope
+ * * **isolated scope** + **no scope** =>  The isolated directive will use it's own created isolated scope. The other directive will use
+ * its parent's scope
+ * * **isolated scope** + **child scope** =>  **Won't work!** Only one scope can be related to one element. Therefore these directives cannot
+ * be applied to the same element.
+ * * **isolated scope** + **isolated scope**  =>  **Won't work!** Only one scope can be related to one element. Therefore these directives
+ * cannot be applied to the same element.
+ *
+ *
+ * #### `bindToController`
+ * This property is used to bind scope properties directly to the controller. It can be either
+ * `true` or an object hash with the same format as the `scope` property. Additionally, a controller
+ * alias must be set, either by using `controllerAs: 'myAlias'` or by specifying the alias in the controller
+ * definition: `controller: 'myCtrl as myAlias'`.
+ *
+ * When an isolate scope is used for a directive (see above), `bindToController: true` will
+ * allow a component to have its properties bound to the controller, rather than to scope.
+ *
+ * After the controller is instantiated, the initial values of the isolate scope bindings will be bound to the controller
+ * properties. You can access these bindings once they have been initialized by providing a controller method called
+ * `$onInit`, which is called after all the controllers on an element have been constructed and had their bindings
+ * initialized.
+ *
+ * <div class="alert alert-warning">
+ * **Deprecation warning:** although bindings for non-ES6 class controllers are currently
+ * bound to `this` before the controller constructor is called, this use is now deprecated. Please place initialization
+ * code that relies upon bindings inside a `$onInit` method on the controller, instead.
+ * </div>
+ *
+ * It is also possible to set `bindToController` to an object hash with the same format as the `scope` property.
+ * This will set up the scope bindings to the controller directly. Note that `scope` can still be used
+ * to define which kind of scope is created. By default, no scope is created. Use `scope: {}` to create an isolate
+ * scope (useful for component directives).
+ *
+ * If both `bindToController` and `scope` are defined and have object hashes, `bindToController` overrides `scope`.
+ *
+ *
+ * #### `controller`
+ * Controller constructor function. The controller is instantiated before the
+ * pre-linking phase and can be accessed by other directives (see
+ * `require` attribute). This allows the directives to communicate with each other and augment
+ * each other's behavior. The controller is injectable (and supports bracket notation) with the following locals:
+ *
+ * * `$scope` - Current scope associated with the element
+ * * `$element` - Current element
+ * * `$attrs` - Current attributes object for the element
+ * * `$transclude` - A transclude linking function pre-bound to the correct transclusion scope:
+ *   `function([scope], cloneLinkingFn, futureParentElement, slotName)`:
+ *    * `scope`: (optional) override the scope.
+ *    * `cloneLinkingFn`: (optional) argument to create clones of the original transcluded content.
+ *    * `futureParentElement` (optional):
+ *        * defines the parent to which the `cloneLinkingFn` will add the cloned elements.
+ *        * default: `$element.parent()` resp. `$element` for `transclude:'element'` resp. `transclude:true`.
+ *        * only needed for transcludes that are allowed to contain non html elements (e.g. SVG elements)
+ *          and when the `cloneLinkinFn` is passed,
+ *          as those elements need to created and cloned in a special way when they are defined outside their
+ *          usual containers (e.g. like `<svg>`).
+ *        * See also the `directive.templateNamespace` property.
+ *    * `slotName`: (optional) the name of the slot to transclude. If falsy (e.g. `null`, `undefined` or `''`)
+ *      then the default translusion is provided.
+ *    The `$transclude` function also has a method on it, `$transclude.isSlotFilled(slotName)`, which returns
+ *    `true` if the specified slot contains content (i.e. one or more DOM nodes).
+ *
+ * #### `require`
+ * Require another directive and inject its controller as the fourth argument to the linking function. The
+ * `require` property can be a string, an array or an object:
+ * * a **string** containing the name of the directive to pass to the linking function
+ * * an **array** containing the names of directives to pass to the linking function. The argument passed to the
+ * linking function will be an array of controllers in the same order as the names in the `require` property
+ * * an **object** whose property values are the names of the directives to pass to the linking function. The argument
+ * passed to the linking function will also be an object with matching keys, whose values will hold the corresponding
+ * controllers.
+ *
+ * If the `require` property is an object and `bindToController` is truthy, then the required controllers are
+ * bound to the controller using the keys of the `require` property. This binding occurs after all the controllers
+ * have been constructed but before `$onInit` is called.
+ * If the name of the required controller is the same as the local name (the key), the name can be
+ * omitted. For example, `{parentDir: '^^'}` is equivalent to `{parentDir: '^^parentDir'}`.
+ * See the {@link $compileProvider#component} helper for an example of how this can be used.
+ * If no such required directive(s) can be found, or if the directive does not have a controller, then an error is
+ * raised (unless no link function is specified and the required controllers are not being bound to the directive
+ * controller, in which case error checking is skipped). The name can be prefixed with:
+ *
+ * * (no prefix) - Locate the required controller on the current element. Throw an error if not found.
+ * * `?` - Attempt to locate the required controller or pass `null` to the `link` fn if not found.
+ * * `^` - Locate the required controller by searching the element and its parents. Throw an error if not found.
+ * * `^^` - Locate the required controller by searching the element's parents. Throw an error if not found.
+ * * `?^` - Attempt to locate the required controller by searching the element and its parents or pass
+ *   `null` to the `link` fn if not found.
+ * * `?^^` - Attempt to locate the required controller by searching the element's parents, or pass
+ *   `null` to the `link` fn if not found.
+ *
+ *
+ * #### `controllerAs`
+ * Identifier name for a reference to the controller in the directive's scope.
+ * This allows the controller to be referenced from the directive template. This is especially
+ * useful when a directive is used as component, i.e. with an `isolate` scope. It's also possible
+ * to use it in a directive without an `isolate` / `new` scope, but you need to be aware that the
+ * `controllerAs` reference might overwrite a property that already exists on the parent scope.
+ *
+ *
+ * #### `restrict`
+ * String of subset of `EACM` which restricts the directive to a specific directive
+ * declaration style. If omitted, the defaults (elements and attributes) are used.
+ *
+ * * `E` - Element name (default): `<my-directive></my-directive>`
+ * * `A` - Attribute (default): `<div my-directive="exp"></div>`
+ * * `C` - Class: `<div class="my-directive: exp;"></div>`
+ * * `M` - Comment: `<!-- directive: my-directive exp -->`
+ *
+ *
+ * #### `templateNamespace`
+ * String representing the document type used by the markup in the template.
+ * AngularJS needs this information as those elements need to be created and cloned
+ * in a special way when they are defined outside their usual containers like `<svg>` and `<math>`.
+ *
+ * * `html` - All root nodes in the template are HTML. Root nodes may also be
+ *   top-level elements such as `<svg>` or `<math>`.
+ * * `svg` - The root nodes in the template are SVG elements (excluding `<math>`).
+ * * `math` - The root nodes in the template are MathML elements (excluding `<svg>`).
+ *
+ * If no `templateNamespace` is specified, then the namespace is considered to be `html`.
+ *
+ * #### `template`
+ * HTML markup that may:
+ * * Replace the contents of the directive's element (default).
+ * * Replace the directive's element itself (if `replace` is true - DEPRECATED).
+ * * Wrap the contents of the directive's element (if `transclude` is true).
+ *
+ * Value may be:
+ *
+ * * A string. For example `<div red-on-hover>{{delete_str}}</div>`.
+ * * A function which takes two arguments `tElement` and `tAttrs` (described in the `compile`
+ *   function api below) and returns a string value.
+ *
+ *
+ * #### `templateUrl`
+ * This is similar to `template` but the template is loaded from the specified URL, asynchronously.
+ *
+ * Because template loading is asynchronous the compiler will suspend compilation of directives on that element
+ * for later when the template has been resolved.  In the meantime it will continue to compile and link
+ * sibling and parent elements as though this element had not contained any directives.
+ *
+ * The compiler does not suspend the entire compilation to wait for templates to be loaded because this
+ * would result in the whole app "stalling" until all templates are loaded asynchronously - even in the
+ * case when only one deeply nested directive has `templateUrl`.
+ *
+ * Template loading is asynchronous even if the template has been preloaded into the {@link $templateCache}
+ *
+ * You can specify `templateUrl` as a string representing the URL or as a function which takes two
+ * arguments `tElement` and `tAttrs` (described in the `compile` function api below) and returns
+ * a string value representing the url.  In either case, the template URL is passed through {@link
+ * $sce#getTrustedResourceUrl $sce.getTrustedResourceUrl}.
+ *
+ *
+ * #### `replace` ([*DEPRECATED*!], will be removed in next major release - i.e. v2.0)
+ * specify what the template should replace. Defaults to `false`.
+ *
+ * * `true` - the template will replace the directive's element.
+ * * `false` - the template will replace the contents of the directive's element.
+ *
+ * The replacement process migrates all of the attributes / classes from the old element to the new
+ * one. See the {@link guide/directive#template-expanding-directive
+ * Directives Guide} for an example.
+ *
+ * There are very few scenarios where element replacement is required for the application function,
+ * the main one being reusable custom components that are used within SVG contexts
+ * (because SVG doesn't work with custom elements in the DOM tree).
+ *
+ * #### `transclude`
+ * Extract the contents of the element where the directive appears and make it available to the directive.
+ * The contents are compiled and provided to the directive as a **transclusion function**. See the
+ * {@link $compile#transclusion Transclusion} section below.
+ *
+ *
+ * #### `compile`
+ *
+ * ```js
+ *   function compile(tElement, tAttrs, transclude) { ... }
+ * ```
+ *
+ * The compile function deals with transforming the template DOM. Since most directives do not do
+ * template transformation, it is not used often. The compile function takes the following arguments:
+ *
+ *   * `tElement` - template element - The element where the directive has been declared. It is
+ *     safe to do template transformation on the element and child elements only.
+ *
+ *   * `tAttrs` - template attributes - Normalized list of attributes declared on this element shared
+ *     between all directive compile functions.
+ *
+ *   * `transclude` -  [*DEPRECATED*!] A transclude linking function: `function(scope, cloneLinkingFn)`
+ *
+ * <div class="alert alert-warning">
+ * **Note:** The template instance and the link instance may be different objects if the template has
+ * been cloned. For this reason it is **not** safe to do anything other than DOM transformations that
+ * apply to all cloned DOM nodes within the compile function. Specifically, DOM listener registration
+ * should be done in a linking function rather than in a compile function.
+ * </div>
+
+ * <div class="alert alert-warning">
+ * **Note:** The compile function cannot handle directives that recursively use themselves in their
+ * own templates or compile functions. Compiling these directives results in an infinite loop and
+ * stack overflow errors.
+ *
+ * This can be avoided by manually using $compile in the postLink function to imperatively compile
+ * a directive's template instead of relying on automatic template compilation via `template` or
+ * `templateUrl` declaration or manual compilation inside the compile function.
+ * </div>
+ *
+ * <div class="alert alert-danger">
+ * **Note:** The `transclude` function that is passed to the compile function is deprecated, as it
+ *   e.g. does not know about the right outer scope. Please use the transclude function that is passed
+ *   to the link function instead.
+ * </div>
+
+ * A compile function can have a return value which can be either a function or an object.
+ *
+ * * returning a (post-link) function - is equivalent to registering the linking function via the
+ *   `link` property of the config object when the compile function is empty.
+ *
+ * * returning an object with function(s) registered via `pre` and `post` properties - allows you to
+ *   control when a linking function should be called during the linking phase. See info about
+ *   pre-linking and post-linking functions below.
+ *
+ *
+ * #### `link`
+ * This property is used only if the `compile` property is not defined.
+ *
+ * ```js
+ *   function link(scope, iElement, iAttrs, controller, transcludeFn) { ... }
+ * ```
+ *
+ * The link function is responsible for registering DOM listeners as well as updating the DOM. It is
+ * executed after the template has been cloned. This is where most of the directive logic will be
+ * put.
+ *
+ *   * `scope` - {@link ng.$rootScope.Scope Scope} - The scope to be used by the
+ *     directive for registering {@link ng.$rootScope.Scope#$watch watches}.
+ *
+ *   * `iElement` - instance element - The element where the directive is to be used. It is safe to
+ *     manipulate the children of the element only in `postLink` function since the children have
+ *     already been linked.
+ *
+ *   * `iAttrs` - instance attributes - Normalized list of attributes declared on this element shared
+ *     between all directive linking functions.
+ *
+ *   * `controller` - the directive's required controller instance(s) - Instances are shared
+ *     among all directives, which allows the directives to use the controllers as a communication
+ *     channel. The exact value depends on the directive's `require` property:
+ *       * no controller(s) required: the directive's own controller, or `undefined` if it doesn't have one
+ *       * `string`: the controller instance
+ *       * `array`: array of controller instances
+ *
+ *     If a required controller cannot be found, and it is optional, the instance is `null`,
+ *     otherwise the {@link error:$compile:ctreq Missing Required Controller} error is thrown.
+ *
+ *     Note that you can also require the directive's own controller - it will be made available like
+ *     any other controller.
+ *
+ *   * `transcludeFn` - A transclude linking function pre-bound to the correct transclusion scope.
+ *     This is the same as the `$transclude` parameter of directive controllers,
+ *     see {@link ng.$compile#-controller- the controller section for details}.
+ *     `function([scope], cloneLinkingFn, futureParentElement)`.
+ *
+ * #### Pre-linking function
+ *
+ * Executed before the child elements are linked. Not safe to do DOM transformation since the
+ * compiler linking function will fail to locate the correct elements for linking.
+ *
+ * #### Post-linking function
+ *
+ * Executed after the child elements are linked.
+ *
+ * Note that child elements that contain `templateUrl` directives will not have been compiled
+ * and linked since they are waiting for their template to load asynchronously and their own
+ * compilation and linking has been suspended until that occurs.
+ *
+ * It is safe to do DOM transformation in the post-linking function on elements that are not waiting
+ * for their async templates to be resolved.
+ *
+ *
+ * ### Transclusion
+ *
+ * Transclusion is the process of extracting a collection of DOM elements from one part of the DOM and
+ * copying them to another part of the DOM, while maintaining their connection to the original AngularJS
+ * scope from where they were taken.
+ *
+ * Transclusion is used (often with {@link ngTransclude}) to insert the
+ * original contents of a directive's element into a specified place in the template of the directive.
+ * The benefit of transclusion, over simply moving the DOM elements manually, is that the transcluded
+ * content has access to the properties on the scope from which it was taken, even if the directive
+ * has isolated scope.
+ * See the {@link guide/directive#creating-a-directive-that-wraps-other-elements Directives Guide}.
+ *
+ * This makes it possible for the widget to have private state for its template, while the transcluded
+ * content has access to its originating scope.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** When testing an element transclude directive you must not place the directive at the root of the
+ * DOM fragment that is being compiled. See {@link guide/unit-testing#testing-transclusion-directives
+ * Testing Transclusion Directives}.
+ * </div>
+ *
+ * There are three kinds of transclusion depending upon whether you want to transclude just the contents of the
+ * directive's element, the entire element or multiple parts of the element contents:
+ *
+ * * `true` - transclude the content (i.e. the child nodes) of the directive's element.
+ * * `'element'` - transclude the whole of the directive's element including any directives on this
+ *   element that defined at a lower priority than this directive. When used, the `template`
+ *   property is ignored.
+ * * **`{...}` (an object hash):** - map elements of the content onto transclusion "slots" in the template.
+ *
+ * **Mult-slot transclusion** is declared by providing an object for the `transclude` property.
+ *
+ * This object is a map where the keys are the name of the slot to fill and the value is an element selector
+ * used to match the HTML to the slot. The element selector should be in normalized form (e.g. `myElement`)
+ * and will match the standard element variants (e.g. `my-element`, `my:element`, `data-my-element`, etc).
+ *
+ * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}
+ *
+ * If the element selector is prefixed with a `?` then that slot is optional.
+ *
+ * For example, the transclude object `{ slotA: '?myCustomElement' }` maps `<my-custom-element>` elements to
+ * the `slotA` slot, which can be accessed via the `$transclude` function or via the {@link ngTransclude} directive.
+ *
+ * Slots that are not marked as optional (`?`) will trigger a compile time error if there are no matching elements
+ * in the transclude content. If you wish to know if an optional slot was filled with content, then you can call
+ * `$transclude.isSlotFilled(slotName)` on the transclude function passed to the directive's link function and
+ * injectable into the directive's controller.
+ *
+ *
+ * #### Transclusion Functions
+ *
+ * When a directive requests transclusion, the compiler extracts its contents and provides a **transclusion
+ * function** to the directive's `link` function and `controller`. This transclusion function is a special
+ * **linking function** that will return the compiled contents linked to a new transclusion scope.
+ *
+ * <div class="alert alert-info">
+ * If you are just using {@link ngTransclude} then you don't need to worry about this function, since
+ * ngTransclude will deal with it for us.
+ * </div>
+ *
+ * If you want to manually control the insertion and removal of the transcluded content in your directive
+ * then you must use this transclude function. When you call a transclude function it returns a a jqLite/JQuery
+ * object that contains the compiled DOM, which is linked to the correct transclusion scope.
+ *
+ * When you call a transclusion function you can pass in a **clone attach function**. This function accepts
+ * two parameters, `function(clone, scope) { ... }`, where the `clone` is a fresh compiled copy of your transcluded
+ * content and the `scope` is the newly created transclusion scope, to which the clone is bound.
+ *
+ * <div class="alert alert-info">
+ * **Best Practice**: Always provide a `cloneFn` (clone attach function) when you call a transclude function
+ * since you then get a fresh clone of the original DOM and also have access to the new transclusion scope.
+ * </div>
+ *
+ * It is normal practice to attach your transcluded content (`clone`) to the DOM inside your **clone
+ * attach function**:
+ *
+ * ```js
+ * var transcludedContent, transclusionScope;
+ *
+ * $transclude(function(clone, scope) {
+ *   element.append(clone);
+ *   transcludedContent = clone;
+ *   transclusionScope = scope;
+ * });
+ * ```
+ *
+ * Later, if you want to remove the transcluded content from your DOM then you should also destroy the
+ * associated transclusion scope:
+ *
+ * ```js
+ * transcludedContent.remove();
+ * transclusionScope.$destroy();
+ * ```
+ *
+ * <div class="alert alert-info">
+ * **Best Practice**: if you intend to add and remove transcluded content manually in your directive
+ * (by calling the transclude function to get the DOM and calling `element.remove()` to remove it),
+ * then you are also responsible for calling `$destroy` on the transclusion scope.
+ * </div>
+ *
+ * The built-in DOM manipulation directives, such as {@link ngIf}, {@link ngSwitch} and {@link ngRepeat}
+ * automatically destroy their transcluded clones as necessary so you do not need to worry about this if
+ * you are simply using {@link ngTransclude} to inject the transclusion into your directive.
+ *
+ *
+ * #### Transclusion Scopes
+ *
+ * When you call a transclude function it returns a DOM fragment that is pre-bound to a **transclusion
+ * scope**. This scope is special, in that it is a child of the directive's scope (and so gets destroyed
+ * when the directive's scope gets destroyed) but it inherits the properties of the scope from which it
+ * was taken.
+ *
+ * For example consider a directive that uses transclusion and isolated scope. The DOM hierarchy might look
+ * like this:
+ *
+ * ```html
+ * <div ng-app>
+ *   <div isolate>
+ *     <div transclusion>
+ *     </div>
+ *   </div>
+ * </div>
+ * ```
+ *
+ * The `$parent` scope hierarchy will look like this:
+ *
+   ```
+   - $rootScope
+     - isolate
+       - transclusion
+   ```
+ *
+ * but the scopes will inherit prototypically from different scopes to their `$parent`.
+ *
+   ```
+   - $rootScope
+     - transclusion
+   - isolate
+   ```
+ *
+ *
+ * ### Attributes
+ *
+ * The {@link ng.$compile.directive.Attributes Attributes} object - passed as a parameter in the
+ * `link()` or `compile()` functions. It has a variety of uses.
+ *
+ * * *Accessing normalized attribute names:* Directives like 'ngBind' can be expressed in many ways:
+ *   'ng:bind', `data-ng-bind`, or 'x-ng-bind'. The attributes object allows for normalized access
+ *   to the attributes.
+ *
+ * * *Directive inter-communication:* All directives share the same instance of the attributes
+ *   object which allows the directives to use the attributes object as inter directive
+ *   communication.
+ *
+ * * *Supports interpolation:* Interpolation attributes are assigned to the attribute object
+ *   allowing other directives to read the interpolated value.
+ *
+ * * *Observing interpolated attributes:* Use `$observe` to observe the value changes of attributes
+ *   that contain interpolation (e.g. `src="{{bar}}"`). Not only is this very efficient but it's also
+ *   the only way to easily get the actual value because during the linking phase the interpolation
+ *   hasn't been evaluated yet and so the value is at this time set to `undefined`.
+ *
+ * ```js
+ * function linkingFn(scope, elm, attrs, ctrl) {
+ *   // get the attribute value
+ *   console.log(attrs.ngModel);
+ *
+ *   // change the attribute
+ *   attrs.$set('ngModel', 'new value');
+ *
+ *   // observe changes to interpolated attribute
+ *   attrs.$observe('ngModel', function(value) {
+ *     console.log('ngModel has changed value to ' + value);
+ *   });
+ * }
+ * ```
+ *
+ * ## Example
+ *
+ * <div class="alert alert-warning">
+ * **Note**: Typically directives are registered with `module.directive`. The example below is
+ * to illustrate how `$compile` works.
+ * </div>
+ *
+ <example module="compileExample">
+   <file name="index.html">
+    <script>
+      angular.module('compileExample', [], function($compileProvider) {
+        // configure new 'compile' directive by passing a directive
+        // factory function. The factory function injects the '$compile'
+        $compileProvider.directive('compile', function($compile) {
+          // directive factory creates a link function
+          return function(scope, element, attrs) {
+            scope.$watch(
+              function(scope) {
+                 // watch the 'compile' expression for changes
+                return scope.$eval(attrs.compile);
+              },
+              function(value) {
+                // when the 'compile' expression changes
+                // assign it into the current DOM
+                element.html(value);
+
+                // compile the new DOM and link it to the current
+                // scope.
+                // NOTE: we only compile .childNodes so that
+                // we don't get into infinite loop compiling ourselves
+                $compile(element.contents())(scope);
+              }
+            );
+          };
+        });
+      })
+      .controller('GreeterController', ['$scope', function($scope) {
+        $scope.name = 'Angular';
+        $scope.html = 'Hello {{name}}';
+      }]);
+    </script>
+    <div ng-controller="GreeterController">
+      <input ng-model="name"> <br/>
+      <textarea ng-model="html"></textarea> <br/>
+      <div compile="html"></div>
+    </div>
+   </file>
+   <file name="protractor.js" type="protractor">
+     it('should auto compile', function() {
+       var textarea = $('textarea');
+       var output = $('div[compile]');
+       // The initial state reads 'Hello Angular'.
+       expect(output.getText()).toBe('Hello Angular');
+       textarea.clear();
+       textarea.sendKeys('{{name}}!');
+       expect(output.getText()).toBe('Angular!');
+     });
+   </file>
+ </example>
+
+ *
+ *
+ * @param {string|DOMElement} element Element or HTML string to compile into a template function.
+ * @param {function(angular.Scope, cloneAttachFn=)} transclude function available to directives - DEPRECATED.
+ *
+ * <div class="alert alert-danger">
+ * **Note:** Passing a `transclude` function to the $compile function is deprecated, as it
+ *   e.g. will not use the right outer scope. Please pass the transclude function as a
+ *   `parentBoundTranscludeFn` to the link function instead.
+ * </div>
+ *
+ * @param {number} maxPriority only apply directives lower than given priority (Only effects the
+ *                 root element(s), not their children)
+ * @returns {function(scope, cloneAttachFn=, options=)} a link function which is used to bind template
+ * (a DOM element/tree) to a scope. Where:
+ *
+ *  * `scope` - A {@link ng.$rootScope.Scope Scope} to bind to.
+ *  * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the
+ *  `template` and call the `cloneAttachFn` function allowing the caller to attach the
+ *  cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is
+ *  called as: <br/> `cloneAttachFn(clonedElement, scope)` where:
+ *
+ *      * `clonedElement` - is a clone of the original `element` passed into the compiler.
+ *      * `scope` - is the current scope with which the linking function is working with.
+ *
+ *  * `options` - An optional object hash with linking options. If `options` is provided, then the following
+ *  keys may be used to control linking behavior:
+ *
+ *      * `parentBoundTranscludeFn` - the transclude function made available to
+ *        directives; if given, it will be passed through to the link functions of
+ *        directives found in `element` during compilation.
+ *      * `transcludeControllers` - an object hash with keys that map controller names
+ *        to a hash with the key `instance`, which maps to the controller instance;
+ *        if given, it will make the controllers available to directives on the compileNode:
+ *        ```
+ *        {
+ *          parent: {
+ *            instance: parentControllerInstance
+ *          }
+ *        }
+ *        ```
+ *      * `futureParentElement` - defines the parent to which the `cloneAttachFn` will add
+ *        the cloned elements; only needed for transcludes that are allowed to contain non html
+ *        elements (e.g. SVG elements). See also the directive.controller property.
+ *
+ * Calling the linking function returns the element of the template. It is either the original
+ * element passed in, or the clone of the element if the `cloneAttachFn` is provided.
+ *
+ * After linking the view is not updated until after a call to $digest which typically is done by
+ * Angular automatically.
+ *
+ * If you need access to the bound view, there are two ways to do it:
+ *
+ * - If you are not asking the linking function to clone the template, create the DOM element(s)
+ *   before you send them to the compiler and keep this reference around.
+ *   ```js
+ *     var element = $compile('<p>{{total}}</p>')(scope);
+ *   ```
+ *
+ * - if on the other hand, you need the element to be cloned, the view reference from the original
+ *   example would not point to the clone, but rather to the original template that was cloned. In
+ *   this case, you can access the clone via the cloneAttachFn:
+ *   ```js
+ *     var templateElement = angular.element('<p>{{total}}</p>'),
+ *         scope = ....;
+ *
+ *     var clonedElement = $compile(templateElement)(scope, function(clonedElement, scope) {
+ *       //attach the clone to DOM document at the right place
+ *     });
+ *
+ *     //now we have reference to the cloned DOM via `clonedElement`
+ *   ```
+ *
+ *
+ * For information on how the compiler works, see the
+ * {@link guide/compiler Angular HTML Compiler} section of the Developer Guide.
+ */
+
+var $compileMinErr = minErr('$compile');
+
+function UNINITIALIZED_VALUE() {}
+var _UNINITIALIZED_VALUE = new UNINITIALIZED_VALUE();
+
+/**
+ * @ngdoc provider
+ * @name $compileProvider
+ *
+ * @description
+ */
+$CompileProvider.$inject = ['$provide', '$$sanitizeUriProvider'];
+function $CompileProvider($provide, $$sanitizeUriProvider) {
+  var hasDirectives = {},
+      Suffix = 'Directive',
+      COMMENT_DIRECTIVE_REGEXP = /^\s*directive\:\s*([\w\-]+)\s+(.*)$/,
+      CLASS_DIRECTIVE_REGEXP = /(([\w\-]+)(?:\:([^;]+))?;?)/,
+      ALL_OR_NOTHING_ATTRS = makeMap('ngSrc,ngSrcset,src,srcset'),
+      REQUIRE_PREFIX_REGEXP = /^(?:(\^\^?)?(\?)?(\^\^?)?)?/;
+
+  // Ref: http://developers.whatwg.org/webappapis.html#event-handler-idl-attributes
+  // The assumption is that future DOM event attribute names will begin with
+  // 'on' and be composed of only English letters.
+  var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/;
+  var bindingCache = createMap();
+
+  function parseIsolateBindings(scope, directiveName, isController) {
+    var LOCAL_REGEXP = /^\s*([@&<]|=(\*?))(\??)\s*(\w*)\s*$/;
+
+    var bindings = createMap();
+
+    forEach(scope, function(definition, scopeName) {
+      if (definition in bindingCache) {
+        bindings[scopeName] = bindingCache[definition];
+        return;
+      }
+      var match = definition.match(LOCAL_REGEXP);
+
+      if (!match) {
+        throw $compileMinErr('iscp',
+            "Invalid {3} for directive '{0}'." +
+            " Definition: {... {1}: '{2}' ...}",
+            directiveName, scopeName, definition,
+            (isController ? "controller bindings definition" :
+            "isolate scope definition"));
+      }
+
+      bindings[scopeName] = {
+        mode: match[1][0],
+        collection: match[2] === '*',
+        optional: match[3] === '?',
+        attrName: match[4] || scopeName
+      };
+      if (match[4]) {
+        bindingCache[definition] = bindings[scopeName];
+      }
+    });
+
+    return bindings;
+  }
+
+  function parseDirectiveBindings(directive, directiveName) {
+    var bindings = {
+      isolateScope: null,
+      bindToController: null
+    };
+    if (isObject(directive.scope)) {
+      if (directive.bindToController === true) {
+        bindings.bindToController = parseIsolateBindings(directive.scope,
+                                                         directiveName, true);
+        bindings.isolateScope = {};
+      } else {
+        bindings.isolateScope = parseIsolateBindings(directive.scope,
+                                                     directiveName, false);
+      }
+    }
+    if (isObject(directive.bindToController)) {
+      bindings.bindToController =
+          parseIsolateBindings(directive.bindToController, directiveName, true);
+    }
+    if (isObject(bindings.bindToController)) {
+      var controller = directive.controller;
+      var controllerAs = directive.controllerAs;
+      if (!controller) {
+        // There is no controller, there may or may not be a controllerAs property
+        throw $compileMinErr('noctrl',
+              "Cannot bind to controller without directive '{0}'s controller.",
+              directiveName);
+      } else if (!identifierForController(controller, controllerAs)) {
+        // There is a controller, but no identifier or controllerAs property
+        throw $compileMinErr('noident',
+              "Cannot bind to controller without identifier for directive '{0}'.",
+              directiveName);
+      }
+    }
+    return bindings;
+  }
+
+  function assertValidDirectiveName(name) {
+    var letter = name.charAt(0);
+    if (!letter || letter !== lowercase(letter)) {
+      throw $compileMinErr('baddir', "Directive/Component name '{0}' is invalid. The first character must be a lowercase letter", name);
+    }
+    if (name !== name.trim()) {
+      throw $compileMinErr('baddir',
+            "Directive/Component name '{0}' is invalid. The name should not contain leading or trailing whitespaces",
+            name);
+    }
+  }
+
+  function getDirectiveRequire(directive) {
+    var require = directive.require || (directive.controller && directive.name);
+
+    if (!isArray(require) && isObject(require)) {
+      forEach(require, function(value, key) {
+        var match = value.match(REQUIRE_PREFIX_REGEXP);
+        var name = value.substring(match[0].length);
+        if (!name) require[key] = match[0] + key;
+      });
+    }
+
+    return require;
+  }
+
+  /**
+   * @ngdoc method
+   * @name $compileProvider#directive
+   * @kind function
+   *
+   * @description
+   * Register a new directive with the compiler.
+   *
+   * @param {string|Object} name Name of the directive in camel-case (i.e. <code>ngBind</code> which
+   *    will match as <code>ng-bind</code>), or an object map of directives where the keys are the
+   *    names and the values are the factories.
+   * @param {Function|Array} directiveFactory An injectable directive factory function. See the
+   *    {@link guide/directive directive guide} and the {@link $compile compile API} for more info.
+   * @returns {ng.$compileProvider} Self for chaining.
+   */
+  this.directive = function registerDirective(name, directiveFactory) {
+    assertNotHasOwnProperty(name, 'directive');
+    if (isString(name)) {
+      assertValidDirectiveName(name);
+      assertArg(directiveFactory, 'directiveFactory');
+      if (!hasDirectives.hasOwnProperty(name)) {
+        hasDirectives[name] = [];
+        $provide.factory(name + Suffix, ['$injector', '$exceptionHandler',
+          function($injector, $exceptionHandler) {
+            var directives = [];
+            forEach(hasDirectives[name], function(directiveFactory, index) {
+              try {
+                var directive = $injector.invoke(directiveFactory);
+                if (isFunction(directive)) {
+                  directive = { compile: valueFn(directive) };
+                } else if (!directive.compile && directive.link) {
+                  directive.compile = valueFn(directive.link);
+                }
+                directive.priority = directive.priority || 0;
+                directive.index = index;
+                directive.name = directive.name || name;
+                directive.require = getDirectiveRequire(directive);
+                directive.restrict = directive.restrict || 'EA';
+                directive.$$moduleName = directiveFactory.$$moduleName;
+                directives.push(directive);
+              } catch (e) {
+                $exceptionHandler(e);
+              }
+            });
+            return directives;
+          }]);
+      }
+      hasDirectives[name].push(directiveFactory);
+    } else {
+      forEach(name, reverseParams(registerDirective));
+    }
+    return this;
+  };
+
+  /**
+   * @ngdoc method
+   * @name $compileProvider#component
+   * @module ng
+   * @param {string} name Name of the component in camelCase (i.e. `myComp` which will match `<my-comp>`)
+   * @param {Object} options Component definition object (a simplified
+   *    {@link ng.$compile#directive-definition-object directive definition object}),
+   *    with the following properties (all optional):
+   *
+   *    - `controller` – `{(string|function()=}` – controller constructor function that should be
+   *      associated with newly created scope or the name of a {@link ng.$compile#-controller-
+   *      registered controller} if passed as a string. An empty `noop` function by default.
+   *    - `controllerAs` – `{string=}` – identifier name for to reference the controller in the component's scope.
+   *      If present, the controller will be published to scope under the `controllerAs` name.
+   *      If not present, this will default to be `$ctrl`.
+   *    - `template` – `{string=|function()=}` – html template as a string or a function that
+   *      returns an html template as a string which should be used as the contents of this component.
+   *      Empty string by default.
+   *
+   *      If `template` is a function, then it is {@link auto.$injector#invoke injected} with
+   *      the following locals:
+   *
+   *      - `$element` - Current element
+   *      - `$attrs` - Current attributes object for the element
+   *
+   *    - `templateUrl` – `{string=|function()=}` – path or function that returns a path to an html
+   *      template that should be used  as the contents of this component.
+   *
+   *      If `templateUrl` is a function, then it is {@link auto.$injector#invoke injected} with
+   *      the following locals:
+   *
+   *      - `$element` - Current element
+   *      - `$attrs` - Current attributes object for the element
+   *
+   *    - `bindings` – `{object=}` – defines bindings between DOM attributes and component properties.
+   *      Component properties are always bound to the component controller and not to the scope.
+   *      See {@link ng.$compile#-bindtocontroller- `bindToController`}.
+   *    - `transclude` – `{boolean=}` – whether {@link $compile#transclusion content transclusion} is enabled.
+   *      Disabled by default.
+   *    - `require` - `{Object<string, string>=}` - requires the controllers of other directives and binds them to
+   *      this component's controller. The object keys specify the property names under which the required
+   *      controllers (object values) will be bound. See {@link ng.$compile#-require- `require`}.
+   *    - `$...` – additional properties to attach to the directive factory function and the controller
+   *      constructor function. (This is used by the component router to annotate)
+   *
+   * @returns {ng.$compileProvider} the compile provider itself, for chaining of function calls.
+   * @description
+   * Register a **component definition** with the compiler. This is a shorthand for registering a special
+   * type of directive, which represents a self-contained UI component in your application. Such components
+   * are always isolated (i.e. `scope: {}`) and are always restricted to elements (i.e. `restrict: 'E'`).
+   *
+   * Component definitions are very simple and do not require as much configuration as defining general
+   * directives. Component definitions usually consist only of a template and a controller backing it.
+   *
+   * In order to make the definition easier, components enforce best practices like use of `controllerAs`,
+   * `bindToController`. They always have **isolate scope** and are restricted to elements.
+   *
+   * Here are a few examples of how you would usually define components:
+   *
+   * ```js
+   *   var myMod = angular.module(...);
+   *   myMod.component('myComp', {
+   *     template: '<div>My name is {{$ctrl.name}}</div>',
+   *     controller: function() {
+   *       this.name = 'shahar';
+   *     }
+   *   });
+   *
+   *   myMod.component('myComp', {
+   *     template: '<div>My name is {{$ctrl.name}}</div>',
+   *     bindings: {name: '@'}
+   *   });
+   *
+   *   myMod.component('myComp', {
+   *     templateUrl: 'views/my-comp.html',
+   *     controller: 'MyCtrl',
+   *     controllerAs: 'ctrl',
+   *     bindings: {name: '@'}
+   *   });
+   *
+   * ```
+   * For more examples, and an in-depth guide, see the {@link guide/component component guide}.
+   *
+   * <br />
+   * See also {@link ng.$compileProvider#directive $compileProvider.directive()}.
+   */
+  this.component = function registerComponent(name, options) {
+    var controller = options.controller || function() {};
+
+    function factory($injector) {
+      function makeInjectable(fn) {
+        if (isFunction(fn) || isArray(fn)) {
+          return function(tElement, tAttrs) {
+            return $injector.invoke(fn, this, {$element: tElement, $attrs: tAttrs});
+          };
+        } else {
+          return fn;
+        }
+      }
+
+      var template = (!options.template && !options.templateUrl ? '' : options.template);
+      var ddo = {
+        controller: controller,
+        controllerAs: identifierForController(options.controller) || options.controllerAs || '$ctrl',
+        template: makeInjectable(template),
+        templateUrl: makeInjectable(options.templateUrl),
+        transclude: options.transclude,
+        scope: {},
+        bindToController: options.bindings || {},
+        restrict: 'E',
+        require: options.require
+      };
+
+      // Copy annotations (starting with $) over to the DDO
+      forEach(options, function(val, key) {
+        if (key.charAt(0) === '$') ddo[key] = val;
+      });
+
+      return ddo;
+    }
+
+    // TODO(pete) remove the following `forEach` before we release 1.6.0
+    // The component-router@0.2.0 looks for the annotations on the controller constructor
+    // Nothing in Angular looks for annotations on the factory function but we can't remove
+    // it from 1.5.x yet.
+
+    // Copy any annotation properties (starting with $) over to the factory and controller constructor functions
+    // These could be used by libraries such as the new component router
+    forEach(options, function(val, key) {
+      if (key.charAt(0) === '$') {
+        factory[key] = val;
+        // Don't try to copy over annotations to named controller
+        if (isFunction(controller)) controller[key] = val;
+      }
+    });
+
+    factory.$inject = ['$injector'];
+
+    return this.directive(name, factory);
+  };
+
+
+  /**
+   * @ngdoc method
+   * @name $compileProvider#aHrefSanitizationWhitelist
+   * @kind function
+   *
+   * @description
+   * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+   * urls during a[href] sanitization.
+   *
+   * The sanitization is a security measure aimed at preventing XSS attacks via html links.
+   *
+   * Any url about to be assigned to a[href] via data-binding is first normalized and turned into
+   * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`
+   * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+   *
+   * @param {RegExp=} regexp New regexp to whitelist urls with.
+   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+   *    chaining otherwise.
+   */
+  this.aHrefSanitizationWhitelist = function(regexp) {
+    if (isDefined(regexp)) {
+      $$sanitizeUriProvider.aHrefSanitizationWhitelist(regexp);
+      return this;
+    } else {
+      return $$sanitizeUriProvider.aHrefSanitizationWhitelist();
+    }
+  };
+
+
+  /**
+   * @ngdoc method
+   * @name $compileProvider#imgSrcSanitizationWhitelist
+   * @kind function
+   *
+   * @description
+   * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+   * urls during img[src] sanitization.
+   *
+   * The sanitization is a security measure aimed at prevent XSS attacks via html links.
+   *
+   * Any url about to be assigned to img[src] via data-binding is first normalized and turned into
+   * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`
+   * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+   *
+   * @param {RegExp=} regexp New regexp to whitelist urls with.
+   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+   *    chaining otherwise.
+   */
+  this.imgSrcSanitizationWhitelist = function(regexp) {
+    if (isDefined(regexp)) {
+      $$sanitizeUriProvider.imgSrcSanitizationWhitelist(regexp);
+      return this;
+    } else {
+      return $$sanitizeUriProvider.imgSrcSanitizationWhitelist();
+    }
+  };
+
+  /**
+   * @ngdoc method
+   * @name  $compileProvider#debugInfoEnabled
+   *
+   * @param {boolean=} enabled update the debugInfoEnabled state if provided, otherwise just return the
+   * current debugInfoEnabled state
+   * @returns {*} current value if used as getter or itself (chaining) if used as setter
+   *
+   * @kind function
+   *
+   * @description
+   * Call this method to enable/disable various debug runtime information in the compiler such as adding
+   * binding information and a reference to the current scope on to DOM elements.
+   * If enabled, the compiler will add the following to DOM elements that have been bound to the scope
+   * * `ng-binding` CSS class
+   * * `$binding` data property containing an array of the binding expressions
+   *
+   * You may want to disable this in production for a significant performance boost. See
+   * {@link guide/production#disabling-debug-data Disabling Debug Data} for more.
+   *
+   * The default value is true.
+   */
+  var debugInfoEnabled = true;
+  this.debugInfoEnabled = function(enabled) {
+    if (isDefined(enabled)) {
+      debugInfoEnabled = enabled;
+      return this;
+    }
+    return debugInfoEnabled;
+  };
+
+
+  var TTL = 10;
+  /**
+   * @ngdoc method
+   * @name $compileProvider#onChangesTtl
+   * @description
+   *
+   * Sets the number of times `$onChanges` hooks can trigger new changes before giving up and
+   * assuming that the model is unstable.
+   *
+   * The current default is 10 iterations.
+   *
+   * In complex applications it's possible that dependencies between `$onChanges` hooks and bindings will result
+   * in several iterations of calls to these hooks. However if an application needs more than the default 10
+   * iterations to stabilize then you should investigate what is causing the model to continuously change during
+   * the `$onChanges` hook execution.
+   *
+   * Increasing the TTL could have performance implications, so you should not change it without proper justification.
+   *
+   * @param {number} limit The number of `$onChanges` hook iterations.
+   * @returns {number|object} the current limit (or `this` if called as a setter for chaining)
+   */
+  this.onChangesTtl = function(value) {
+    if (arguments.length) {
+      TTL = value;
+      return this;
+    }
+    return TTL;
+  };
+
+  this.$get = [
+            '$injector', '$interpolate', '$exceptionHandler', '$templateRequest', '$parse',
+            '$controller', '$rootScope', '$sce', '$animate', '$$sanitizeUri',
+    function($injector,   $interpolate,   $exceptionHandler,   $templateRequest,   $parse,
+             $controller,   $rootScope,   $sce,   $animate,   $$sanitizeUri) {
+
+    var SIMPLE_ATTR_NAME = /^\w/;
+    var specialAttrHolder = window.document.createElement('div');
+
+
+
+    var onChangesTtl = TTL;
+    // The onChanges hooks should all be run together in a single digest
+    // When changes occur, the call to trigger their hooks will be added to this queue
+    var onChangesQueue;
+
+    // This function is called in a $$postDigest to trigger all the onChanges hooks in a single digest
+    function flushOnChangesQueue() {
+      try {
+        if (!(--onChangesTtl)) {
+          // We have hit the TTL limit so reset everything
+          onChangesQueue = undefined;
+          throw $compileMinErr('infchng', '{0} $onChanges() iterations reached. Aborting!\n', TTL);
+        }
+        // We must run this hook in an apply since the $$postDigest runs outside apply
+        $rootScope.$apply(function() {
+          var errors = [];
+          for (var i = 0, ii = onChangesQueue.length; i < ii; ++i) {
+            try {
+              onChangesQueue[i]();
+            } catch (e) {
+              errors.push(e);
+            }
+          }
+          // Reset the queue to trigger a new schedule next time there is a change
+          onChangesQueue = undefined;
+          if (errors.length) {
+            throw errors;
+          }
+        });
+      } finally {
+        onChangesTtl++;
+      }
+    }
+
+
+    function Attributes(element, attributesToCopy) {
+      if (attributesToCopy) {
+        var keys = Object.keys(attributesToCopy);
+        var i, l, key;
+
+        for (i = 0, l = keys.length; i < l; i++) {
+          key = keys[i];
+          this[key] = attributesToCopy[key];
+        }
+      } else {
+        this.$attr = {};
+      }
+
+      this.$$element = element;
+    }
+
+    Attributes.prototype = {
+      /**
+       * @ngdoc method
+       * @name $compile.directive.Attributes#$normalize
+       * @kind function
+       *
+       * @description
+       * Converts an attribute name (e.g. dash/colon/underscore-delimited string, optionally prefixed with `x-` or
+       * `data-`) to its normalized, camelCase form.
+       *
+       * Also there is special case for Moz prefix starting with upper case letter.
+       *
+       * For further information check out the guide on {@link guide/directive#matching-directives Matching Directives}
+       *
+       * @param {string} name Name to normalize
+       */
+      $normalize: directiveNormalize,
+
+
+      /**
+       * @ngdoc method
+       * @name $compile.directive.Attributes#$addClass
+       * @kind function
+       *
+       * @description
+       * Adds the CSS class value specified by the classVal parameter to the element. If animations
+       * are enabled then an animation will be triggered for the class addition.
+       *
+       * @param {string} classVal The className value that will be added to the element
+       */
+      $addClass: function(classVal) {
+        if (classVal && classVal.length > 0) {
+          $animate.addClass(this.$$element, classVal);
+        }
+      },
+
+      /**
+       * @ngdoc method
+       * @name $compile.directive.Attributes#$removeClass
+       * @kind function
+       *
+       * @description
+       * Removes the CSS class value specified by the classVal parameter from the element. If
+       * animations are enabled then an animation will be triggered for the class removal.
+       *
+       * @param {string} classVal The className value that will be removed from the element
+       */
+      $removeClass: function(classVal) {
+        if (classVal && classVal.length > 0) {
+          $animate.removeClass(this.$$element, classVal);
+        }
+      },
+
+      /**
+       * @ngdoc method
+       * @name $compile.directive.Attributes#$updateClass
+       * @kind function
+       *
+       * @description
+       * Adds and removes the appropriate CSS class values to the element based on the difference
+       * between the new and old CSS class values (specified as newClasses and oldClasses).
+       *
+       * @param {string} newClasses The current CSS className value
+       * @param {string} oldClasses The former CSS className value
+       */
+      $updateClass: function(newClasses, oldClasses) {
+        var toAdd = tokenDifference(newClasses, oldClasses);
+        if (toAdd && toAdd.length) {
+          $animate.addClass(this.$$element, toAdd);
+        }
+
+        var toRemove = tokenDifference(oldClasses, newClasses);
+        if (toRemove && toRemove.length) {
+          $animate.removeClass(this.$$element, toRemove);
+        }
+      },
+
+      /**
+       * Set a normalized attribute on the element in a way such that all directives
+       * can share the attribute. This function properly handles boolean attributes.
+       * @param {string} key Normalized key. (ie ngAttribute)
+       * @param {string|boolean} value The value to set. If `null` attribute will be deleted.
+       * @param {boolean=} writeAttr If false, does not write the value to DOM element attribute.
+       *     Defaults to true.
+       * @param {string=} attrName Optional none normalized name. Defaults to key.
+       */
+      $set: function(key, value, writeAttr, attrName) {
+        // TODO: decide whether or not to throw an error if "class"
+        //is set through this function since it may cause $updateClass to
+        //become unstable.
+
+        var node = this.$$element[0],
+            booleanKey = getBooleanAttrName(node, key),
+            aliasedKey = getAliasedAttrName(key),
+            observer = key,
+            nodeName;
+
+        if (booleanKey) {
+          this.$$element.prop(key, value);
+          attrName = booleanKey;
+        } else if (aliasedKey) {
+          this[aliasedKey] = value;
+          observer = aliasedKey;
+        }
+
+        this[key] = value;
+
+        // translate normalized key to actual key
+        if (attrName) {
+          this.$attr[key] = attrName;
+        } else {
+          attrName = this.$attr[key];
+          if (!attrName) {
+            this.$attr[key] = attrName = snake_case(key, '-');
+          }
+        }
+
+        nodeName = nodeName_(this.$$element);
+
+        if ((nodeName === 'a' && (key === 'href' || key === 'xlinkHref')) ||
+            (nodeName === 'img' && key === 'src')) {
+          // sanitize a[href] and img[src] values
+          this[key] = value = $$sanitizeUri(value, key === 'src');
+        } else if (nodeName === 'img' && key === 'srcset' && isDefined(value)) {
+          // sanitize img[srcset] values
+          var result = "";
+
+          // first check if there are spaces because it's not the same pattern
+          var trimmedSrcset = trim(value);
+          //                (   999x   ,|   999w   ,|   ,|,   )
+          var srcPattern = /(\s+\d+x\s*,|\s+\d+w\s*,|\s+,|,\s+)/;
+          var pattern = /\s/.test(trimmedSrcset) ? srcPattern : /(,)/;
+
+          // split srcset into tuple of uri and descriptor except for the last item
+          var rawUris = trimmedSrcset.split(pattern);
+
+          // for each tuples
+          var nbrUrisWith2parts = Math.floor(rawUris.length / 2);
+          for (var i = 0; i < nbrUrisWith2parts; i++) {
+            var innerIdx = i * 2;
+            // sanitize the uri
+            result += $$sanitizeUri(trim(rawUris[innerIdx]), true);
+            // add the descriptor
+            result += (" " + trim(rawUris[innerIdx + 1]));
+          }
+
+          // split the last item into uri and descriptor
+          var lastTuple = trim(rawUris[i * 2]).split(/\s/);
+
+          // sanitize the last uri
+          result += $$sanitizeUri(trim(lastTuple[0]), true);
+
+          // and add the last descriptor if any
+          if (lastTuple.length === 2) {
+            result += (" " + trim(lastTuple[1]));
+          }
+          this[key] = value = result;
+        }
+
+        if (writeAttr !== false) {
+          if (value === null || isUndefined(value)) {
+            this.$$element.removeAttr(attrName);
+          } else {
+            if (SIMPLE_ATTR_NAME.test(attrName)) {
+              this.$$element.attr(attrName, value);
+            } else {
+              setSpecialAttr(this.$$element[0], attrName, value);
+            }
+          }
+        }
+
+        // fire observers
+        var $$observers = this.$$observers;
+        $$observers && forEach($$observers[observer], function(fn) {
+          try {
+            fn(value);
+          } catch (e) {
+            $exceptionHandler(e);
+          }
+        });
+      },
+
+
+      /**
+       * @ngdoc method
+       * @name $compile.directive.Attributes#$observe
+       * @kind function
+       *
+       * @description
+       * Observes an interpolated attribute.
+       *
+       * The observer function will be invoked once during the next `$digest` following
+       * compilation. The observer is then invoked whenever the interpolated value
+       * changes.
+       *
+       * @param {string} key Normalized key. (ie ngAttribute) .
+       * @param {function(interpolatedValue)} fn Function that will be called whenever
+                the interpolated value of the attribute changes.
+       *        See the {@link guide/interpolation#how-text-and-attribute-bindings-work Interpolation
+       *        guide} for more info.
+       * @returns {function()} Returns a deregistration function for this observer.
+       */
+      $observe: function(key, fn) {
+        var attrs = this,
+            $$observers = (attrs.$$observers || (attrs.$$observers = createMap())),
+            listeners = ($$observers[key] || ($$observers[key] = []));
+
+        listeners.push(fn);
+        $rootScope.$evalAsync(function() {
+          if (!listeners.$$inter && attrs.hasOwnProperty(key) && !isUndefined(attrs[key])) {
+            // no one registered attribute interpolation function, so lets call it manually
+            fn(attrs[key]);
+          }
+        });
+
+        return function() {
+          arrayRemove(listeners, fn);
+        };
+      }
+    };
+
+    function setSpecialAttr(element, attrName, value) {
+      // Attributes names that do not start with letters (such as `(click)`) cannot be set using `setAttribute`
+      // so we have to jump through some hoops to get such an attribute
+      // https://github.com/angular/angular.js/pull/13318
+      specialAttrHolder.innerHTML = "<span " + attrName + ">";
+      var attributes = specialAttrHolder.firstChild.attributes;
+      var attribute = attributes[0];
+      // We have to remove the attribute from its container element before we can add it to the destination element
+      attributes.removeNamedItem(attribute.name);
+      attribute.value = value;
+      element.attributes.setNamedItem(attribute);
+    }
+
+    function safeAddClass($element, className) {
+      try {
+        $element.addClass(className);
+      } catch (e) {
+        // ignore, since it means that we are trying to set class on
+        // SVG element, where class name is read-only.
+      }
+    }
+
+
+    var startSymbol = $interpolate.startSymbol(),
+        endSymbol = $interpolate.endSymbol(),
+        denormalizeTemplate = (startSymbol == '{{' && endSymbol  == '}}')
+            ? identity
+            : function denormalizeTemplate(template) {
+              return template.replace(/\{\{/g, startSymbol).replace(/}}/g, endSymbol);
+        },
+        NG_ATTR_BINDING = /^ngAttr[A-Z]/;
+    var MULTI_ELEMENT_DIR_RE = /^(.+)Start$/;
+
+    compile.$$addBindingInfo = debugInfoEnabled ? function $$addBindingInfo($element, binding) {
+      var bindings = $element.data('$binding') || [];
+
+      if (isArray(binding)) {
+        bindings = bindings.concat(binding);
+      } else {
+        bindings.push(binding);
+      }
+
+      $element.data('$binding', bindings);
+    } : noop;
+
+    compile.$$addBindingClass = debugInfoEnabled ? function $$addBindingClass($element) {
+      safeAddClass($element, 'ng-binding');
+    } : noop;
+
+    compile.$$addScopeInfo = debugInfoEnabled ? function $$addScopeInfo($element, scope, isolated, noTemplate) {
+      var dataName = isolated ? (noTemplate ? '$isolateScopeNoTemplate' : '$isolateScope') : '$scope';
+      $element.data(dataName, scope);
+    } : noop;
+
+    compile.$$addScopeClass = debugInfoEnabled ? function $$addScopeClass($element, isolated) {
+      safeAddClass($element, isolated ? 'ng-isolate-scope' : 'ng-scope');
+    } : noop;
+
+    compile.$$createComment = function(directiveName, comment) {
+      var content = '';
+      if (debugInfoEnabled) {
+        content = ' ' + (directiveName || '') + ': ';
+        if (comment) content += comment + ' ';
+      }
+      return window.document.createComment(content);
+    };
+
+    return compile;
+
+    //================================
+
+    function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective,
+                        previousCompileContext) {
+      if (!($compileNodes instanceof jqLite)) {
+        // jquery always rewraps, whereas we need to preserve the original selector so that we can
+        // modify it.
+        $compileNodes = jqLite($compileNodes);
+      }
+
+      var NOT_EMPTY = /\S+/;
+
+      // We can not compile top level text elements since text nodes can be merged and we will
+      // not be able to attach scope data to them, so we will wrap them in <span>
+      for (var i = 0, len = $compileNodes.length; i < len; i++) {
+        var domNode = $compileNodes[i];
+
+        if (domNode.nodeType === NODE_TYPE_TEXT && domNode.nodeValue.match(NOT_EMPTY) /* non-empty */) {
+          jqLiteWrapNode(domNode, $compileNodes[i] = window.document.createElement('span'));
+        }
+      }
+
+      var compositeLinkFn =
+              compileNodes($compileNodes, transcludeFn, $compileNodes,
+                           maxPriority, ignoreDirective, previousCompileContext);
+      compile.$$addScopeClass($compileNodes);
+      var namespace = null;
+      return function publicLinkFn(scope, cloneConnectFn, options) {
+        assertArg(scope, 'scope');
+
+        if (previousCompileContext && previousCompileContext.needsNewScope) {
+          // A parent directive did a replace and a directive on this element asked
+          // for transclusion, which caused us to lose a layer of element on which
+          // we could hold the new transclusion scope, so we will create it manually
+          // here.
+          scope = scope.$parent.$new();
+        }
+
+        options = options || {};
+        var parentBoundTranscludeFn = options.parentBoundTranscludeFn,
+          transcludeControllers = options.transcludeControllers,
+          futureParentElement = options.futureParentElement;
+
+        // When `parentBoundTranscludeFn` is passed, it is a
+        // `controllersBoundTransclude` function (it was previously passed
+        // as `transclude` to directive.link) so we must unwrap it to get
+        // its `boundTranscludeFn`
+        if (parentBoundTranscludeFn && parentBoundTranscludeFn.$$boundTransclude) {
+          parentBoundTranscludeFn = parentBoundTranscludeFn.$$boundTransclude;
+        }
+
+        if (!namespace) {
+          namespace = detectNamespaceForChildElements(futureParentElement);
+        }
+        var $linkNode;
+        if (namespace !== 'html') {
+          // When using a directive with replace:true and templateUrl the $compileNodes
+          // (or a child element inside of them)
+          // might change, so we need to recreate the namespace adapted compileNodes
+          // for call to the link function.
+          // Note: This will already clone the nodes...
+          $linkNode = jqLite(
+            wrapTemplate(namespace, jqLite('<div>').append($compileNodes).html())
+          );
+        } else if (cloneConnectFn) {
+          // important!!: we must call our jqLite.clone() since the jQuery one is trying to be smart
+          // and sometimes changes the structure of the DOM.
+          $linkNode = JQLitePrototype.clone.call($compileNodes);
+        } else {
+          $linkNode = $compileNodes;
+        }
+
+        if (transcludeControllers) {
+          for (var controllerName in transcludeControllers) {
+            $linkNode.data('$' + controllerName + 'Controller', transcludeControllers[controllerName].instance);
+          }
+        }
+
+        compile.$$addScopeInfo($linkNode, scope);
+
+        if (cloneConnectFn) cloneConnectFn($linkNode, scope);
+        if (compositeLinkFn) compositeLinkFn(scope, $linkNode, $linkNode, parentBoundTranscludeFn);
+        return $linkNode;
+      };
+    }
+
+    function detectNamespaceForChildElements(parentElement) {
+      // TODO: Make this detect MathML as well...
+      var node = parentElement && parentElement[0];
+      if (!node) {
+        return 'html';
+      } else {
+        return nodeName_(node) !== 'foreignobject' && toString.call(node).match(/SVG/) ? 'svg' : 'html';
+      }
+    }
+
+    /**
+     * Compile function matches each node in nodeList against the directives. Once all directives
+     * for a particular node are collected their compile functions are executed. The compile
+     * functions return values - the linking functions - are combined into a composite linking
+     * function, which is the a linking function for the node.
+     *
+     * @param {NodeList} nodeList an array of nodes or NodeList to compile
+     * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the
+     *        scope argument is auto-generated to the new child of the transcluded parent scope.
+     * @param {DOMElement=} $rootElement If the nodeList is the root of the compilation tree then
+     *        the rootElement must be set the jqLite collection of the compile root. This is
+     *        needed so that the jqLite collection items can be replaced with widgets.
+     * @param {number=} maxPriority Max directive priority.
+     * @returns {Function} A composite linking function of all of the matched directives or null.
+     */
+    function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective,
+                            previousCompileContext) {
+      var linkFns = [],
+          attrs, directives, nodeLinkFn, childNodes, childLinkFn, linkFnFound, nodeLinkFnFound;
+
+      for (var i = 0; i < nodeList.length; i++) {
+        attrs = new Attributes();
+
+        // we must always refer to nodeList[i] since the nodes can be replaced underneath us.
+        directives = collectDirectives(nodeList[i], [], attrs, i === 0 ? maxPriority : undefined,
+                                        ignoreDirective);
+
+        nodeLinkFn = (directives.length)
+            ? applyDirectivesToNode(directives, nodeList[i], attrs, transcludeFn, $rootElement,
+                                      null, [], [], previousCompileContext)
+            : null;
+
+        if (nodeLinkFn && nodeLinkFn.scope) {
+          compile.$$addScopeClass(attrs.$$element);
+        }
+
+        childLinkFn = (nodeLinkFn && nodeLinkFn.terminal ||
+                      !(childNodes = nodeList[i].childNodes) ||
+                      !childNodes.length)
+            ? null
+            : compileNodes(childNodes,
+                 nodeLinkFn ? (
+                  (nodeLinkFn.transcludeOnThisElement || !nodeLinkFn.templateOnThisElement)
+                     && nodeLinkFn.transclude) : transcludeFn);
+
+        if (nodeLinkFn || childLinkFn) {
+          linkFns.push(i, nodeLinkFn, childLinkFn);
+          linkFnFound = true;
+          nodeLinkFnFound = nodeLinkFnFound || nodeLinkFn;
+        }
+
+        //use the previous context only for the first element in the virtual group
+        previousCompileContext = null;
+      }
+
+      // return a linking function if we have found anything, null otherwise
+      return linkFnFound ? compositeLinkFn : null;
+
+      function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) {
+        var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn;
+        var stableNodeList;
+
+
+        if (nodeLinkFnFound) {
+          // copy nodeList so that if a nodeLinkFn removes or adds an element at this DOM level our
+          // offsets don't get screwed up
+          var nodeListLength = nodeList.length;
+          stableNodeList = new Array(nodeListLength);
+
+          // create a sparse array by only copying the elements which have a linkFn
+          for (i = 0; i < linkFns.length; i+=3) {
+            idx = linkFns[i];
+            stableNodeList[idx] = nodeList[idx];
+          }
+        } else {
+          stableNodeList = nodeList;
+        }
+
+        for (i = 0, ii = linkFns.length; i < ii;) {
+          node = stableNodeList[linkFns[i++]];
+          nodeLinkFn = linkFns[i++];
+          childLinkFn = linkFns[i++];
+
+          if (nodeLinkFn) {
+            if (nodeLinkFn.scope) {
+              childScope = scope.$new();
+              compile.$$addScopeInfo(jqLite(node), childScope);
+            } else {
+              childScope = scope;
+            }
+
+            if (nodeLinkFn.transcludeOnThisElement) {
+              childBoundTranscludeFn = createBoundTranscludeFn(
+                  scope, nodeLinkFn.transclude, parentBoundTranscludeFn);
+
+            } else if (!nodeLinkFn.templateOnThisElement && parentBoundTranscludeFn) {
+              childBoundTranscludeFn = parentBoundTranscludeFn;
+
+            } else if (!parentBoundTranscludeFn && transcludeFn) {
+              childBoundTranscludeFn = createBoundTranscludeFn(scope, transcludeFn);
+
+            } else {
+              childBoundTranscludeFn = null;
+            }
+
+            nodeLinkFn(childLinkFn, childScope, node, $rootElement, childBoundTranscludeFn);
+
+          } else if (childLinkFn) {
+            childLinkFn(scope, node.childNodes, undefined, parentBoundTranscludeFn);
+          }
+        }
+      }
+    }
+
+    function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn) {
+      function boundTranscludeFn(transcludedScope, cloneFn, controllers, futureParentElement, containingScope) {
+
+        if (!transcludedScope) {
+          transcludedScope = scope.$new(false, containingScope);
+          transcludedScope.$$transcluded = true;
+        }
+
+        return transcludeFn(transcludedScope, cloneFn, {
+          parentBoundTranscludeFn: previousBoundTranscludeFn,
+          transcludeControllers: controllers,
+          futureParentElement: futureParentElement
+        });
+      }
+
+      // We need  to attach the transclusion slots onto the `boundTranscludeFn`
+      // so that they are available inside the `controllersBoundTransclude` function
+      var boundSlots = boundTranscludeFn.$$slots = createMap();
+      for (var slotName in transcludeFn.$$slots) {
+        if (transcludeFn.$$slots[slotName]) {
+          boundSlots[slotName] = createBoundTranscludeFn(scope, transcludeFn.$$slots[slotName], previousBoundTranscludeFn);
+        } else {
+          boundSlots[slotName] = null;
+        }
+      }
+
+      return boundTranscludeFn;
+    }
+
+    /**
+     * Looks for directives on the given node and adds them to the directive collection which is
+     * sorted.
+     *
+     * @param node Node to search.
+     * @param directives An array to which the directives are added to. This array is sorted before
+     *        the function returns.
+     * @param attrs The shared attrs object which is used to populate the normalized attributes.
+     * @param {number=} maxPriority Max directive priority.
+     */
+    function collectDirectives(node, directives, attrs, maxPriority, ignoreDirective) {
+      var nodeType = node.nodeType,
+          attrsMap = attrs.$attr,
+          match,
+          className;
+
+      switch (nodeType) {
+        case NODE_TYPE_ELEMENT: /* Element */
+          // use the node name: <directive>
+          addDirective(directives,
+              directiveNormalize(nodeName_(node)), 'E', maxPriority, ignoreDirective);
+
+          // iterate over the attributes
+          for (var attr, name, nName, ngAttrName, value, isNgAttr, nAttrs = node.attributes,
+                   j = 0, jj = nAttrs && nAttrs.length; j < jj; j++) {
+            var attrStartName = false;
+            var attrEndName = false;
+
+            attr = nAttrs[j];
+            name = attr.name;
+            value = trim(attr.value);
+
+            // support ngAttr attribute binding
+            ngAttrName = directiveNormalize(name);
+            if (isNgAttr = NG_ATTR_BINDING.test(ngAttrName)) {
+              name = name.replace(PREFIX_REGEXP, '')
+                .substr(8).replace(/_(.)/g, function(match, letter) {
+                  return letter.toUpperCase();
+                });
+            }
+
+            var multiElementMatch = ngAttrName.match(MULTI_ELEMENT_DIR_RE);
+            if (multiElementMatch && directiveIsMultiElement(multiElementMatch[1])) {
+              attrStartName = name;
+              attrEndName = name.substr(0, name.length - 5) + 'end';
+              name = name.substr(0, name.length - 6);
+            }
+
+            nName = directiveNormalize(name.toLowerCase());
+            attrsMap[nName] = name;
+            if (isNgAttr || !attrs.hasOwnProperty(nName)) {
+                attrs[nName] = value;
+                if (getBooleanAttrName(node, nName)) {
+                  attrs[nName] = true; // presence means true
+                }
+            }
+            addAttrInterpolateDirective(node, directives, value, nName, isNgAttr);
+            addDirective(directives, nName, 'A', maxPriority, ignoreDirective, attrStartName,
+                          attrEndName);
+          }
+
+          // use class as directive
+          className = node.className;
+          if (isObject(className)) {
+              // Maybe SVGAnimatedString
+              className = className.animVal;
+          }
+          if (isString(className) && className !== '') {
+            while (match = CLASS_DIRECTIVE_REGEXP.exec(className)) {
+              nName = directiveNormalize(match[2]);
+              if (addDirective(directives, nName, 'C', maxPriority, ignoreDirective)) {
+                attrs[nName] = trim(match[3]);
+              }
+              className = className.substr(match.index + match[0].length);
+            }
+          }
+          break;
+        case NODE_TYPE_TEXT: /* Text Node */
+          if (msie === 11) {
+            // Workaround for #11781
+            while (node.parentNode && node.nextSibling && node.nextSibling.nodeType === NODE_TYPE_TEXT) {
+              node.nodeValue = node.nodeValue + node.nextSibling.nodeValue;
+              node.parentNode.removeChild(node.nextSibling);
+            }
+          }
+          addTextInterpolateDirective(directives, node.nodeValue);
+          break;
+        case NODE_TYPE_COMMENT: /* Comment */
+          collectCommentDirectives(node, directives, attrs, maxPriority, ignoreDirective);
+          break;
+      }
+
+      directives.sort(byPriority);
+      return directives;
+    }
+
+    function collectCommentDirectives(node, directives, attrs, maxPriority, ignoreDirective) {
+      // function created because of performance, try/catch disables
+      // the optimization of the whole function #14848
+      try {
+        var match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);
+        if (match) {
+          var nName = directiveNormalize(match[1]);
+          if (addDirective(directives, nName, 'M', maxPriority, ignoreDirective)) {
+            attrs[nName] = trim(match[2]);
+          }
+        }
+      } catch (e) {
+        // turns out that under some circumstances IE9 throws errors when one attempts to read
+        // comment's node value.
+        // Just ignore it and continue. (Can't seem to reproduce in test case.)
+      }
+    }
+
+    /**
+     * Given a node with an directive-start it collects all of the siblings until it finds
+     * directive-end.
+     * @param node
+     * @param attrStart
+     * @param attrEnd
+     * @returns {*}
+     */
+    function groupScan(node, attrStart, attrEnd) {
+      var nodes = [];
+      var depth = 0;
+      if (attrStart && node.hasAttribute && node.hasAttribute(attrStart)) {
+        do {
+          if (!node) {
+            throw $compileMinErr('uterdir',
+                      "Unterminated attribute, found '{0}' but no matching '{1}' found.",
+                      attrStart, attrEnd);
+          }
+          if (node.nodeType == NODE_TYPE_ELEMENT) {
+            if (node.hasAttribute(attrStart)) depth++;
+            if (node.hasAttribute(attrEnd)) depth--;
+          }
+          nodes.push(node);
+          node = node.nextSibling;
+        } while (depth > 0);
+      } else {
+        nodes.push(node);
+      }
+
+      return jqLite(nodes);
+    }
+
+    /**
+     * Wrapper for linking function which converts normal linking function into a grouped
+     * linking function.
+     * @param linkFn
+     * @param attrStart
+     * @param attrEnd
+     * @returns {Function}
+     */
+    function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) {
+      return function groupedElementsLink(scope, element, attrs, controllers, transcludeFn) {
+        element = groupScan(element[0], attrStart, attrEnd);
+        return linkFn(scope, element, attrs, controllers, transcludeFn);
+      };
+    }
+
+    /**
+     * A function generator that is used to support both eager and lazy compilation
+     * linking function.
+     * @param eager
+     * @param $compileNodes
+     * @param transcludeFn
+     * @param maxPriority
+     * @param ignoreDirective
+     * @param previousCompileContext
+     * @returns {Function}
+     */
+    function compilationGenerator(eager, $compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext) {
+      var compiled;
+
+      if (eager) {
+        return compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext);
+      }
+      return function lazyCompilation() {
+        if (!compiled) {
+          compiled = compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext);
+
+          // Null out all of these references in order to make them eligible for garbage collection
+          // since this is a potentially long lived closure
+          $compileNodes = transcludeFn = previousCompileContext = null;
+        }
+        return compiled.apply(this, arguments);
+      };
+    }
+
+    /**
+     * Once the directives have been collected, their compile functions are executed. This method
+     * is responsible for inlining directive templates as well as terminating the application
+     * of the directives if the terminal directive has been reached.
+     *
+     * @param {Array} directives Array of collected directives to execute their compile function.
+     *        this needs to be pre-sorted by priority order.
+     * @param {Node} compileNode The raw DOM node to apply the compile functions to
+     * @param {Object} templateAttrs The shared attribute function
+     * @param {function(angular.Scope, cloneAttachFn=)} transcludeFn A linking function, where the
+     *                                                  scope argument is auto-generated to the new
+     *                                                  child of the transcluded parent scope.
+     * @param {JQLite} jqCollection If we are working on the root of the compile tree then this
+     *                              argument has the root jqLite array so that we can replace nodes
+     *                              on it.
+     * @param {Object=} originalReplaceDirective An optional directive that will be ignored when
+     *                                           compiling the transclusion.
+     * @param {Array.<Function>} preLinkFns
+     * @param {Array.<Function>} postLinkFns
+     * @param {Object} previousCompileContext Context used for previous compilation of the current
+     *                                        node
+     * @returns {Function} linkFn
+     */
+    function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,
+                                   jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,
+                                   previousCompileContext) {
+      previousCompileContext = previousCompileContext || {};
+
+      var terminalPriority = -Number.MAX_VALUE,
+          newScopeDirective = previousCompileContext.newScopeDirective,
+          controllerDirectives = previousCompileContext.controllerDirectives,
+          newIsolateScopeDirective = previousCompileContext.newIsolateScopeDirective,
+          templateDirective = previousCompileContext.templateDirective,
+          nonTlbTranscludeDirective = previousCompileContext.nonTlbTranscludeDirective,
+          hasTranscludeDirective = false,
+          hasTemplate = false,
+          hasElementTranscludeDirective = previousCompileContext.hasElementTranscludeDirective,
+          $compileNode = templateAttrs.$$element = jqLite(compileNode),
+          directive,
+          directiveName,
+          $template,
+          replaceDirective = originalReplaceDirective,
+          childTranscludeFn = transcludeFn,
+          linkFn,
+          didScanForMultipleTransclusion = false,
+          mightHaveMultipleTransclusionError = false,
+          directiveValue;
+
+      // executes all directives on the current element
+      for (var i = 0, ii = directives.length; i < ii; i++) {
+        directive = directives[i];
+        var attrStart = directive.$$start;
+        var attrEnd = directive.$$end;
+
+        // collect multiblock sections
+        if (attrStart) {
+          $compileNode = groupScan(compileNode, attrStart, attrEnd);
+        }
+        $template = undefined;
+
+        if (terminalPriority > directive.priority) {
+          break; // prevent further processing of directives
+        }
+
+        if (directiveValue = directive.scope) {
+
+          // skip the check for directives with async templates, we'll check the derived sync
+          // directive when the template arrives
+          if (!directive.templateUrl) {
+            if (isObject(directiveValue)) {
+              // This directive is trying to add an isolated scope.
+              // Check that there is no scope of any kind already
+              assertNoDuplicate('new/isolated scope', newIsolateScopeDirective || newScopeDirective,
+                                directive, $compileNode);
+              newIsolateScopeDirective = directive;
+            } else {
+              // This directive is trying to add a child scope.
+              // Check that there is no isolated scope already
+              assertNoDuplicate('new/isolated scope', newIsolateScopeDirective, directive,
+                                $compileNode);
+            }
+          }
+
+          newScopeDirective = newScopeDirective || directive;
+        }
+
+        directiveName = directive.name;
+
+        // If we encounter a condition that can result in transclusion on the directive,
+        // then scan ahead in the remaining directives for others that may cause a multiple
+        // transclusion error to be thrown during the compilation process.  If a matching directive
+        // is found, then we know that when we encounter a transcluded directive, we need to eagerly
+        // compile the `transclude` function rather than doing it lazily in order to throw
+        // exceptions at the correct time
+        if (!didScanForMultipleTransclusion && ((directive.replace && (directive.templateUrl || directive.template))
+            || (directive.transclude && !directive.$$tlb))) {
+                var candidateDirective;
+
+                for (var scanningIndex = i + 1; candidateDirective = directives[scanningIndex++];) {
+                    if ((candidateDirective.transclude && !candidateDirective.$$tlb)
+                        || (candidateDirective.replace && (candidateDirective.templateUrl || candidateDirective.template))) {
+                        mightHaveMultipleTransclusionError = true;
+                        break;
+                    }
+                }
+
+                didScanForMultipleTransclusion = true;
+        }
+
+        if (!directive.templateUrl && directive.controller) {
+          directiveValue = directive.controller;
+          controllerDirectives = controllerDirectives || createMap();
+          assertNoDuplicate("'" + directiveName + "' controller",
+              controllerDirectives[directiveName], directive, $compileNode);
+          controllerDirectives[directiveName] = directive;
+        }
+
+        if (directiveValue = directive.transclude) {
+          hasTranscludeDirective = true;
+
+          // Special case ngIf and ngRepeat so that we don't complain about duplicate transclusion.
+          // This option should only be used by directives that know how to safely handle element transclusion,
+          // where the transcluded nodes are added or replaced after linking.
+          if (!directive.$$tlb) {
+            assertNoDuplicate('transclusion', nonTlbTranscludeDirective, directive, $compileNode);
+            nonTlbTranscludeDirective = directive;
+          }
+
+          if (directiveValue == 'element') {
+            hasElementTranscludeDirective = true;
+            terminalPriority = directive.priority;
+            $template = $compileNode;
+            $compileNode = templateAttrs.$$element =
+                jqLite(compile.$$createComment(directiveName, templateAttrs[directiveName]));
+            compileNode = $compileNode[0];
+            replaceWith(jqCollection, sliceArgs($template), compileNode);
+
+            // Support: Chrome < 50
+            // https://github.com/angular/angular.js/issues/14041
+
+            // In the versions of V8 prior to Chrome 50, the document fragment that is created
+            // in the `replaceWith` function is improperly garbage collected despite still
+            // being referenced by the `parentNode` property of all of the child nodes.  By adding
+            // a reference to the fragment via a different property, we can avoid that incorrect
+            // behavior.
+            // TODO: remove this line after Chrome 50 has been released
+            $template[0].$$parentNode = $template[0].parentNode;
+
+            childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, terminalPriority,
+                                        replaceDirective && replaceDirective.name, {
+                                          // Don't pass in:
+                                          // - controllerDirectives - otherwise we'll create duplicates controllers
+                                          // - newIsolateScopeDirective or templateDirective - combining templates with
+                                          //   element transclusion doesn't make sense.
+                                          //
+                                          // We need only nonTlbTranscludeDirective so that we prevent putting transclusion
+                                          // on the same element more than once.
+                                          nonTlbTranscludeDirective: nonTlbTranscludeDirective
+                                        });
+          } else {
+
+            var slots = createMap();
+
+            $template = jqLite(jqLiteClone(compileNode)).contents();
+
+            if (isObject(directiveValue)) {
+
+              // We have transclusion slots,
+              // collect them up, compile them and store their transclusion functions
+              $template = [];
+
+              var slotMap = createMap();
+              var filledSlots = createMap();
+
+              // Parse the element selectors
+              forEach(directiveValue, function(elementSelector, slotName) {
+                // If an element selector starts with a ? then it is optional
+                var optional = (elementSelector.charAt(0) === '?');
+                elementSelector = optional ? elementSelector.substring(1) : elementSelector;
+
+                slotMap[elementSelector] = slotName;
+
+                // We explicitly assign `null` since this implies that a slot was defined but not filled.
+                // Later when calling boundTransclusion functions with a slot name we only error if the
+                // slot is `undefined`
+                slots[slotName] = null;
+
+                // filledSlots contains `true` for all slots that are either optional or have been
+                // filled. This is used to check that we have not missed any required slots
+                filledSlots[slotName] = optional;
+              });
+
+              // Add the matching elements into their slot
+              forEach($compileNode.contents(), function(node) {
+                var slotName = slotMap[directiveNormalize(nodeName_(node))];
+                if (slotName) {
+                  filledSlots[slotName] = true;
+                  slots[slotName] = slots[slotName] || [];
+                  slots[slotName].push(node);
+                } else {
+                  $template.push(node);
+                }
+              });
+
+              // Check for required slots that were not filled
+              forEach(filledSlots, function(filled, slotName) {
+                if (!filled) {
+                  throw $compileMinErr('reqslot', 'Required transclusion slot `{0}` was not filled.', slotName);
+                }
+              });
+
+              for (var slotName in slots) {
+                if (slots[slotName]) {
+                  // Only define a transclusion function if the slot was filled
+                  slots[slotName] = compilationGenerator(mightHaveMultipleTransclusionError, slots[slotName], transcludeFn);
+                }
+              }
+            }
+
+            $compileNode.empty(); // clear contents
+            childTranscludeFn = compilationGenerator(mightHaveMultipleTransclusionError, $template, transcludeFn, undefined,
+                undefined, { needsNewScope: directive.$$isolateScope || directive.$$newScope});
+            childTranscludeFn.$$slots = slots;
+          }
+        }
+
+        if (directive.template) {
+          hasTemplate = true;
+          assertNoDuplicate('template', templateDirective, directive, $compileNode);
+          templateDirective = directive;
+
+          directiveValue = (isFunction(directive.template))
+              ? directive.template($compileNode, templateAttrs)
+              : directive.template;
+
+          directiveValue = denormalizeTemplate(directiveValue);
+
+          if (directive.replace) {
+            replaceDirective = directive;
+            if (jqLiteIsTextNode(directiveValue)) {
+              $template = [];
+            } else {
+              $template = removeComments(wrapTemplate(directive.templateNamespace, trim(directiveValue)));
+            }
+            compileNode = $template[0];
+
+            if ($template.length != 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {
+              throw $compileMinErr('tplrt',
+                  "Template for directive '{0}' must have exactly one root element. {1}",
+                  directiveName, '');
+            }
+
+            replaceWith(jqCollection, $compileNode, compileNode);
+
+            var newTemplateAttrs = {$attr: {}};
+
+            // combine directives from the original node and from the template:
+            // - take the array of directives for this element
+            // - split it into two parts, those that already applied (processed) and those that weren't (unprocessed)
+            // - collect directives from the template and sort them by priority
+            // - combine directives as: processed + template + unprocessed
+            var templateDirectives = collectDirectives(compileNode, [], newTemplateAttrs);
+            var unprocessedDirectives = directives.splice(i + 1, directives.length - (i + 1));
+
+            if (newIsolateScopeDirective || newScopeDirective) {
+              // The original directive caused the current element to be replaced but this element
+              // also needs to have a new scope, so we need to tell the template directives
+              // that they would need to get their scope from further up, if they require transclusion
+              markDirectiveScope(templateDirectives, newIsolateScopeDirective, newScopeDirective);
+            }
+            directives = directives.concat(templateDirectives).concat(unprocessedDirectives);
+            mergeTemplateAttributes(templateAttrs, newTemplateAttrs);
+
+            ii = directives.length;
+          } else {
+            $compileNode.html(directiveValue);
+          }
+        }
+
+        if (directive.templateUrl) {
+          hasTemplate = true;
+          assertNoDuplicate('template', templateDirective, directive, $compileNode);
+          templateDirective = directive;
+
+          if (directive.replace) {
+            replaceDirective = directive;
+          }
+
+          /* jshint -W021 */
+          nodeLinkFn = compileTemplateUrl(directives.splice(i, directives.length - i), $compileNode,
+          /* jshint +W021 */
+              templateAttrs, jqCollection, hasTranscludeDirective && childTranscludeFn, preLinkFns, postLinkFns, {
+                controllerDirectives: controllerDirectives,
+                newScopeDirective: (newScopeDirective !== directive) && newScopeDirective,
+                newIsolateScopeDirective: newIsolateScopeDirective,
+                templateDirective: templateDirective,
+                nonTlbTranscludeDirective: nonTlbTranscludeDirective
+              });
+          ii = directives.length;
+        } else if (directive.compile) {
+          try {
+            linkFn = directive.compile($compileNode, templateAttrs, childTranscludeFn);
+            var context = directive.$$originalDirective || directive;
+            if (isFunction(linkFn)) {
+              addLinkFns(null, bind(context, linkFn), attrStart, attrEnd);
+            } else if (linkFn) {
+              addLinkFns(bind(context, linkFn.pre), bind(context, linkFn.post), attrStart, attrEnd);
+            }
+          } catch (e) {
+            $exceptionHandler(e, startingTag($compileNode));
+          }
+        }
+
+        if (directive.terminal) {
+          nodeLinkFn.terminal = true;
+          terminalPriority = Math.max(terminalPriority, directive.priority);
+        }
+
+      }
+
+      nodeLinkFn.scope = newScopeDirective && newScopeDirective.scope === true;
+      nodeLinkFn.transcludeOnThisElement = hasTranscludeDirective;
+      nodeLinkFn.templateOnThisElement = hasTemplate;
+      nodeLinkFn.transclude = childTranscludeFn;
+
+      previousCompileContext.hasElementTranscludeDirective = hasElementTranscludeDirective;
+
+      // might be normal or delayed nodeLinkFn depending on if templateUrl is present
+      return nodeLinkFn;
+
+      ////////////////////
+
+      function addLinkFns(pre, post, attrStart, attrEnd) {
+        if (pre) {
+          if (attrStart) pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd);
+          pre.require = directive.require;
+          pre.directiveName = directiveName;
+          if (newIsolateScopeDirective === directive || directive.$$isolateScope) {
+            pre = cloneAndAnnotateFn(pre, {isolateScope: true});
+          }
+          preLinkFns.push(pre);
+        }
+        if (post) {
+          if (attrStart) post = groupElementsLinkFnWrapper(post, attrStart, attrEnd);
+          post.require = directive.require;
+          post.directiveName = directiveName;
+          if (newIsolateScopeDirective === directive || directive.$$isolateScope) {
+            post = cloneAndAnnotateFn(post, {isolateScope: true});
+          }
+          postLinkFns.push(post);
+        }
+      }
+
+      function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {
+        var i, ii, linkFn, isolateScope, controllerScope, elementControllers, transcludeFn, $element,
+            attrs, scopeBindingInfo;
+
+        if (compileNode === linkNode) {
+          attrs = templateAttrs;
+          $element = templateAttrs.$$element;
+        } else {
+          $element = jqLite(linkNode);
+          attrs = new Attributes($element, templateAttrs);
+        }
+
+        controllerScope = scope;
+        if (newIsolateScopeDirective) {
+          isolateScope = scope.$new(true);
+        } else if (newScopeDirective) {
+          controllerScope = scope.$parent;
+        }
+
+        if (boundTranscludeFn) {
+          // track `boundTranscludeFn` so it can be unwrapped if `transcludeFn`
+          // is later passed as `parentBoundTranscludeFn` to `publicLinkFn`
+          transcludeFn = controllersBoundTransclude;
+          transcludeFn.$$boundTransclude = boundTranscludeFn;
+          // expose the slots on the `$transclude` function
+          transcludeFn.isSlotFilled = function(slotName) {
+            return !!boundTranscludeFn.$$slots[slotName];
+          };
+        }
+
+        if (controllerDirectives) {
+          elementControllers = setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective);
+        }
+
+        if (newIsolateScopeDirective) {
+          // Initialize isolate scope bindings for new isolate scope directive.
+          compile.$$addScopeInfo($element, isolateScope, true, !(templateDirective && (templateDirective === newIsolateScopeDirective ||
+              templateDirective === newIsolateScopeDirective.$$originalDirective)));
+          compile.$$addScopeClass($element, true);
+          isolateScope.$$isolateBindings =
+              newIsolateScopeDirective.$$isolateBindings;
+          scopeBindingInfo = initializeDirectiveBindings(scope, attrs, isolateScope,
+                                        isolateScope.$$isolateBindings,
+                                        newIsolateScopeDirective);
+          if (scopeBindingInfo.removeWatches) {
+            isolateScope.$on('$destroy', scopeBindingInfo.removeWatches);
+          }
+        }
+
+        // Initialize bindToController bindings
+        for (var name in elementControllers) {
+          var controllerDirective = controllerDirectives[name];
+          var controller = elementControllers[name];
+          var bindings = controllerDirective.$$bindings.bindToController;
+
+          if (controller.identifier && bindings) {
+            controller.bindingInfo =
+              initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);
+          } else {
+            controller.bindingInfo = {};
+          }
+
+          var controllerResult = controller();
+          if (controllerResult !== controller.instance) {
+            // If the controller constructor has a return value, overwrite the instance
+            // from setupControllers
+            controller.instance = controllerResult;
+            $element.data('$' + controllerDirective.name + 'Controller', controllerResult);
+            controller.bindingInfo.removeWatches && controller.bindingInfo.removeWatches();
+            controller.bindingInfo =
+              initializeDirectiveBindings(controllerScope, attrs, controller.instance, bindings, controllerDirective);
+          }
+        }
+
+        // Bind the required controllers to the controller, if `require` is an object and `bindToController` is truthy
+        forEach(controllerDirectives, function(controllerDirective, name) {
+          var require = controllerDirective.require;
+          if (controllerDirective.bindToController && !isArray(require) && isObject(require)) {
+            extend(elementControllers[name].instance, getControllers(name, require, $element, elementControllers));
+          }
+        });
+
+        // Handle the init and destroy lifecycle hooks on all controllers that have them
+        forEach(elementControllers, function(controller) {
+          var controllerInstance = controller.instance;
+          if (isFunction(controllerInstance.$onChanges)) {
+            try {
+              controllerInstance.$onChanges(controller.bindingInfo.initialChanges);
+            } catch (e) {
+              $exceptionHandler(e);
+            }
+          }
+          if (isFunction(controllerInstance.$onInit)) {
+            try {
+              controllerInstance.$onInit();
+            } catch (e) {
+              $exceptionHandler(e);
+            }
+          }
+          if (isFunction(controllerInstance.$doCheck)) {
+            controllerScope.$watch(function() { controllerInstance.$doCheck(); });
+            controllerInstance.$doCheck();
+          }
+          if (isFunction(controllerInstance.$onDestroy)) {
+            controllerScope.$on('$destroy', function callOnDestroyHook() {
+              controllerInstance.$onDestroy();
+            });
+          }
+        });
+
+        // PRELINKING
+        for (i = 0, ii = preLinkFns.length; i < ii; i++) {
+          linkFn = preLinkFns[i];
+          invokeLinkFn(linkFn,
+              linkFn.isolateScope ? isolateScope : scope,
+              $element,
+              attrs,
+              linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers),
+              transcludeFn
+          );
+        }
+
+        // RECURSION
+        // We only pass the isolate scope, if the isolate directive has a template,
+        // otherwise the child elements do not belong to the isolate directive.
+        var scopeToChild = scope;
+        if (newIsolateScopeDirective && (newIsolateScopeDirective.template || newIsolateScopeDirective.templateUrl === null)) {
+          scopeToChild = isolateScope;
+        }
+        childLinkFn && childLinkFn(scopeToChild, linkNode.childNodes, undefined, boundTranscludeFn);
+
+        // POSTLINKING
+        for (i = postLinkFns.length - 1; i >= 0; i--) {
+          linkFn = postLinkFns[i];
+          invokeLinkFn(linkFn,
+              linkFn.isolateScope ? isolateScope : scope,
+              $element,
+              attrs,
+              linkFn.require && getControllers(linkFn.directiveName, linkFn.require, $element, elementControllers),
+              transcludeFn
+          );
+        }
+
+        // Trigger $postLink lifecycle hooks
+        forEach(elementControllers, function(controller) {
+          var controllerInstance = controller.instance;
+          if (isFunction(controllerInstance.$postLink)) {
+            controllerInstance.$postLink();
+          }
+        });
+
+        // This is the function that is injected as `$transclude`.
+        // Note: all arguments are optional!
+        function controllersBoundTransclude(scope, cloneAttachFn, futureParentElement, slotName) {
+          var transcludeControllers;
+          // No scope passed in:
+          if (!isScope(scope)) {
+            slotName = futureParentElement;
+            futureParentElement = cloneAttachFn;
+            cloneAttachFn = scope;
+            scope = undefined;
+          }
+
+          if (hasElementTranscludeDirective) {
+            transcludeControllers = elementControllers;
+          }
+          if (!futureParentElement) {
+            futureParentElement = hasElementTranscludeDirective ? $element.parent() : $element;
+          }
+          if (slotName) {
+            // slotTranscludeFn can be one of three things:
+            //  * a transclude function - a filled slot
+            //  * `null` - an optional slot that was not filled
+            //  * `undefined` - a slot that was not declared (i.e. invalid)
+            var slotTranscludeFn = boundTranscludeFn.$$slots[slotName];
+            if (slotTranscludeFn) {
+              return slotTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild);
+            } else if (isUndefined(slotTranscludeFn)) {
+              throw $compileMinErr('noslot',
+               'No parent directive that requires a transclusion with slot name "{0}". ' +
+               'Element: {1}',
+               slotName, startingTag($element));
+            }
+          } else {
+            return boundTranscludeFn(scope, cloneAttachFn, transcludeControllers, futureParentElement, scopeToChild);
+          }
+        }
+      }
+    }
+
+    function getControllers(directiveName, require, $element, elementControllers) {
+      var value;
+
+      if (isString(require)) {
+        var match = require.match(REQUIRE_PREFIX_REGEXP);
+        var name = require.substring(match[0].length);
+        var inheritType = match[1] || match[3];
+        var optional = match[2] === '?';
+
+        //If only parents then start at the parent element
+        if (inheritType === '^^') {
+          $element = $element.parent();
+        //Otherwise attempt getting the controller from elementControllers in case
+        //the element is transcluded (and has no data) and to avoid .data if possible
+        } else {
+          value = elementControllers && elementControllers[name];
+          value = value && value.instance;
+        }
+
+        if (!value) {
+          var dataName = '$' + name + 'Controller';
+          value = inheritType ? $element.inheritedData(dataName) : $element.data(dataName);
+        }
+
+        if (!value && !optional) {
+          throw $compileMinErr('ctreq',
+              "Controller '{0}', required by directive '{1}', can't be found!",
+              name, directiveName);
+        }
+      } else if (isArray(require)) {
+        value = [];
+        for (var i = 0, ii = require.length; i < ii; i++) {
+          value[i] = getControllers(directiveName, require[i], $element, elementControllers);
+        }
+      } else if (isObject(require)) {
+        value = {};
+        forEach(require, function(controller, property) {
+          value[property] = getControllers(directiveName, controller, $element, elementControllers);
+        });
+      }
+
+      return value || null;
+    }
+
+    function setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective) {
+      var elementControllers = createMap();
+      for (var controllerKey in controllerDirectives) {
+        var directive = controllerDirectives[controllerKey];
+        var locals = {
+          $scope: directive === newIsolateScopeDirective || directive.$$isolateScope ? isolateScope : scope,
+          $element: $element,
+          $attrs: attrs,
+          $transclude: transcludeFn
+        };
+
+        var controller = directive.controller;
+        if (controller == '@') {
+          controller = attrs[directive.name];
+        }
+
+        var controllerInstance = $controller(controller, locals, true, directive.controllerAs);
+
+        // For directives with element transclusion the element is a comment.
+        // In this case .data will not attach any data.
+        // Instead, we save the controllers for the element in a local hash and attach to .data
+        // later, once we have the actual element.
+        elementControllers[directive.name] = controllerInstance;
+        $element.data('$' + directive.name + 'Controller', controllerInstance.instance);
+      }
+      return elementControllers;
+    }
+
+    // Depending upon the context in which a directive finds itself it might need to have a new isolated
+    // or child scope created. For instance:
+    // * if the directive has been pulled into a template because another directive with a higher priority
+    // asked for element transclusion
+    // * if the directive itself asks for transclusion but it is at the root of a template and the original
+    // element was replaced. See https://github.com/angular/angular.js/issues/12936
+    function markDirectiveScope(directives, isolateScope, newScope) {
+      for (var j = 0, jj = directives.length; j < jj; j++) {
+        directives[j] = inherit(directives[j], {$$isolateScope: isolateScope, $$newScope: newScope});
+      }
+    }
+
+    /**
+     * looks up the directive and decorates it with exception handling and proper parameters. We
+     * call this the boundDirective.
+     *
+     * @param {string} name name of the directive to look up.
+     * @param {string} location The directive must be found in specific format.
+     *   String containing any of theses characters:
+     *
+     *   * `E`: element name
+     *   * `A': attribute
+     *   * `C`: class
+     *   * `M`: comment
+     * @returns {boolean} true if directive was added.
+     */
+    function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName,
+                          endAttrName) {
+      if (name === ignoreDirective) return null;
+      var match = null;
+      if (hasDirectives.hasOwnProperty(name)) {
+        for (var directive, directives = $injector.get(name + Suffix),
+            i = 0, ii = directives.length; i < ii; i++) {
+          try {
+            directive = directives[i];
+            if ((isUndefined(maxPriority) || maxPriority > directive.priority) &&
+                 directive.restrict.indexOf(location) != -1) {
+              if (startAttrName) {
+                directive = inherit(directive, {$$start: startAttrName, $$end: endAttrName});
+              }
+              if (!directive.$$bindings) {
+                var bindings = directive.$$bindings =
+                    parseDirectiveBindings(directive, directive.name);
+                if (isObject(bindings.isolateScope)) {
+                  directive.$$isolateBindings = bindings.isolateScope;
+                }
+              }
+              tDirectives.push(directive);
+              match = directive;
+            }
+          } catch (e) { $exceptionHandler(e); }
+        }
+      }
+      return match;
+    }
+
+
+    /**
+     * looks up the directive and returns true if it is a multi-element directive,
+     * and therefore requires DOM nodes between -start and -end markers to be grouped
+     * together.
+     *
+     * @param {string} name name of the directive to look up.
+     * @returns true if directive was registered as multi-element.
+     */
+    function directiveIsMultiElement(name) {
+      if (hasDirectives.hasOwnProperty(name)) {
+        for (var directive, directives = $injector.get(name + Suffix),
+            i = 0, ii = directives.length; i < ii; i++) {
+          directive = directives[i];
+          if (directive.multiElement) {
+            return true;
+          }
+        }
+      }
+      return false;
+    }
+
+    /**
+     * When the element is replaced with HTML template then the new attributes
+     * on the template need to be merged with the existing attributes in the DOM.
+     * The desired effect is to have both of the attributes present.
+     *
+     * @param {object} dst destination attributes (original DOM)
+     * @param {object} src source attributes (from the directive template)
+     */
+    function mergeTemplateAttributes(dst, src) {
+      var srcAttr = src.$attr,
+          dstAttr = dst.$attr,
+          $element = dst.$$element;
+
+      // reapply the old attributes to the new element
+      forEach(dst, function(value, key) {
+        if (key.charAt(0) != '$') {
+          if (src[key] && src[key] !== value) {
+            value += (key === 'style' ? ';' : ' ') + src[key];
+          }
+          dst.$set(key, value, true, srcAttr[key]);
+        }
+      });
+
+      // copy the new attributes on the old attrs object
+      forEach(src, function(value, key) {
+        // Check if we already set this attribute in the loop above.
+        // `dst` will never contain hasOwnProperty as DOM parser won't let it.
+        // You will get an "InvalidCharacterError: DOM Exception 5" error if you
+        // have an attribute like "has-own-property" or "data-has-own-property", etc.
+        if (!dst.hasOwnProperty(key) && key.charAt(0) !== '$') {
+          dst[key] = value;
+
+          if (key !== 'class' && key !== 'style') {
+            dstAttr[key] = srcAttr[key];
+          }
+        }
+      });
+    }
+
+
+    function compileTemplateUrl(directives, $compileNode, tAttrs,
+        $rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) {
+      var linkQueue = [],
+          afterTemplateNodeLinkFn,
+          afterTemplateChildLinkFn,
+          beforeTemplateCompileNode = $compileNode[0],
+          origAsyncDirective = directives.shift(),
+          derivedSyncDirective = inherit(origAsyncDirective, {
+            templateUrl: null, transclude: null, replace: null, $$originalDirective: origAsyncDirective
+          }),
+          templateUrl = (isFunction(origAsyncDirective.templateUrl))
+              ? origAsyncDirective.templateUrl($compileNode, tAttrs)
+              : origAsyncDirective.templateUrl,
+          templateNamespace = origAsyncDirective.templateNamespace;
+
+      $compileNode.empty();
+
+      $templateRequest(templateUrl)
+        .then(function(content) {
+          var compileNode, tempTemplateAttrs, $template, childBoundTranscludeFn;
+
+          content = denormalizeTemplate(content);
+
+          if (origAsyncDirective.replace) {
+            if (jqLiteIsTextNode(content)) {
+              $template = [];
+            } else {
+              $template = removeComments(wrapTemplate(templateNamespace, trim(content)));
+            }
+            compileNode = $template[0];
+
+            if ($template.length != 1 || compileNode.nodeType !== NODE_TYPE_ELEMENT) {
+              throw $compileMinErr('tplrt',
+                  "Template for directive '{0}' must have exactly one root element. {1}",
+                  origAsyncDirective.name, templateUrl);
+            }
+
+            tempTemplateAttrs = {$attr: {}};
+            replaceWith($rootElement, $compileNode, compileNode);
+            var templateDirectives = collectDirectives(compileNode, [], tempTemplateAttrs);
+
+            if (isObject(origAsyncDirective.scope)) {
+              // the original directive that caused the template to be loaded async required
+              // an isolate scope
+              markDirectiveScope(templateDirectives, true);
+            }
+            directives = templateDirectives.concat(directives);
+            mergeTemplateAttributes(tAttrs, tempTemplateAttrs);
+          } else {
+            compileNode = beforeTemplateCompileNode;
+            $compileNode.html(content);
+          }
+
+          directives.unshift(derivedSyncDirective);
+
+          afterTemplateNodeLinkFn = applyDirectivesToNode(directives, compileNode, tAttrs,
+              childTranscludeFn, $compileNode, origAsyncDirective, preLinkFns, postLinkFns,
+              previousCompileContext);
+          forEach($rootElement, function(node, i) {
+            if (node == compileNode) {
+              $rootElement[i] = $compileNode[0];
+            }
+          });
+          afterTemplateChildLinkFn = compileNodes($compileNode[0].childNodes, childTranscludeFn);
+
+          while (linkQueue.length) {
+            var scope = linkQueue.shift(),
+                beforeTemplateLinkNode = linkQueue.shift(),
+                linkRootElement = linkQueue.shift(),
+                boundTranscludeFn = linkQueue.shift(),
+                linkNode = $compileNode[0];
+
+            if (scope.$$destroyed) continue;
+
+            if (beforeTemplateLinkNode !== beforeTemplateCompileNode) {
+              var oldClasses = beforeTemplateLinkNode.className;
+
+              if (!(previousCompileContext.hasElementTranscludeDirective &&
+                  origAsyncDirective.replace)) {
+                // it was cloned therefore we have to clone as well.
+                linkNode = jqLiteClone(compileNode);
+              }
+              replaceWith(linkRootElement, jqLite(beforeTemplateLinkNode), linkNode);
+
+              // Copy in CSS classes from original node
+              safeAddClass(jqLite(linkNode), oldClasses);
+            }
+            if (afterTemplateNodeLinkFn.transcludeOnThisElement) {
+              childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);
+            } else {
+              childBoundTranscludeFn = boundTranscludeFn;
+            }
+            afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, linkNode, $rootElement,
+              childBoundTranscludeFn);
+          }
+          linkQueue = null;
+        });
+
+      return function delayedNodeLinkFn(ignoreChildLinkFn, scope, node, rootElement, boundTranscludeFn) {
+        var childBoundTranscludeFn = boundTranscludeFn;
+        if (scope.$$destroyed) return;
+        if (linkQueue) {
+          linkQueue.push(scope,
+                         node,
+                         rootElement,
+                         childBoundTranscludeFn);
+        } else {
+          if (afterTemplateNodeLinkFn.transcludeOnThisElement) {
+            childBoundTranscludeFn = createBoundTranscludeFn(scope, afterTemplateNodeLinkFn.transclude, boundTranscludeFn);
+          }
+          afterTemplateNodeLinkFn(afterTemplateChildLinkFn, scope, node, rootElement, childBoundTranscludeFn);
+        }
+      };
+    }
+
+
+    /**
+     * Sorting function for bound directives.
+     */
+    function byPriority(a, b) {
+      var diff = b.priority - a.priority;
+      if (diff !== 0) return diff;
+      if (a.name !== b.name) return (a.name < b.name) ? -1 : 1;
+      return a.index - b.index;
+    }
+
+    function assertNoDuplicate(what, previousDirective, directive, element) {
+
+      function wrapModuleNameIfDefined(moduleName) {
+        return moduleName ?
+          (' (module: ' + moduleName + ')') :
+          '';
+      }
+
+      if (previousDirective) {
+        throw $compileMinErr('multidir', 'Multiple directives [{0}{1}, {2}{3}] asking for {4} on: {5}',
+            previousDirective.name, wrapModuleNameIfDefined(previousDirective.$$moduleName),
+            directive.name, wrapModuleNameIfDefined(directive.$$moduleName), what, startingTag(element));
+      }
+    }
+
+
+    function addTextInterpolateDirective(directives, text) {
+      var interpolateFn = $interpolate(text, true);
+      if (interpolateFn) {
+        directives.push({
+          priority: 0,
+          compile: function textInterpolateCompileFn(templateNode) {
+            var templateNodeParent = templateNode.parent(),
+                hasCompileParent = !!templateNodeParent.length;
+
+            // When transcluding a template that has bindings in the root
+            // we don't have a parent and thus need to add the class during linking fn.
+            if (hasCompileParent) compile.$$addBindingClass(templateNodeParent);
+
+            return function textInterpolateLinkFn(scope, node) {
+              var parent = node.parent();
+              if (!hasCompileParent) compile.$$addBindingClass(parent);
+              compile.$$addBindingInfo(parent, interpolateFn.expressions);
+              scope.$watch(interpolateFn, function interpolateFnWatchAction(value) {
+                node[0].nodeValue = value;
+              });
+            };
+          }
+        });
+      }
+    }
+
+
+    function wrapTemplate(type, template) {
+      type = lowercase(type || 'html');
+      switch (type) {
+      case 'svg':
+      case 'math':
+        var wrapper = window.document.createElement('div');
+        wrapper.innerHTML = '<' + type + '>' + template + '</' + type + '>';
+        return wrapper.childNodes[0].childNodes;
+      default:
+        return template;
+      }
+    }
+
+
+    function getTrustedContext(node, attrNormalizedName) {
+      if (attrNormalizedName == "srcdoc") {
+        return $sce.HTML;
+      }
+      var tag = nodeName_(node);
+      // maction[xlink:href] can source SVG.  It's not limited to <maction>.
+      if (attrNormalizedName == "xlinkHref" ||
+          (tag == "form" && attrNormalizedName == "action") ||
+          (tag != "img" && (attrNormalizedName == "src" ||
+                            attrNormalizedName == "ngSrc"))) {
+        return $sce.RESOURCE_URL;
+      }
+    }
+
+
+    function addAttrInterpolateDirective(node, directives, value, name, allOrNothing) {
+      var trustedContext = getTrustedContext(node, name);
+      allOrNothing = ALL_OR_NOTHING_ATTRS[name] || allOrNothing;
+
+      var interpolateFn = $interpolate(value, true, trustedContext, allOrNothing);
+
+      // no interpolation found -> ignore
+      if (!interpolateFn) return;
+
+
+      if (name === "multiple" && nodeName_(node) === "select") {
+        throw $compileMinErr("selmulti",
+            "Binding to the 'multiple' attribute is not supported. Element: {0}",
+            startingTag(node));
+      }
+
+      directives.push({
+        priority: 100,
+        compile: function() {
+            return {
+              pre: function attrInterpolatePreLinkFn(scope, element, attr) {
+                var $$observers = (attr.$$observers || (attr.$$observers = createMap()));
+
+                if (EVENT_HANDLER_ATTR_REGEXP.test(name)) {
+                  throw $compileMinErr('nodomevents',
+                      "Interpolations for HTML DOM event attributes are disallowed.  Please use the " +
+                          "ng- versions (such as ng-click instead of onclick) instead.");
+                }
+
+                // If the attribute has changed since last $interpolate()ed
+                var newValue = attr[name];
+                if (newValue !== value) {
+                  // we need to interpolate again since the attribute value has been updated
+                  // (e.g. by another directive's compile function)
+                  // ensure unset/empty values make interpolateFn falsy
+                  interpolateFn = newValue && $interpolate(newValue, true, trustedContext, allOrNothing);
+                  value = newValue;
+                }
+
+                // if attribute was updated so that there is no interpolation going on we don't want to
+                // register any observers
+                if (!interpolateFn) return;
+
+                // initialize attr object so that it's ready in case we need the value for isolate
+                // scope initialization, otherwise the value would not be available from isolate
+                // directive's linking fn during linking phase
+                attr[name] = interpolateFn(scope);
+
+                ($$observers[name] || ($$observers[name] = [])).$$inter = true;
+                (attr.$$observers && attr.$$observers[name].$$scope || scope).
+                  $watch(interpolateFn, function interpolateFnWatchAction(newValue, oldValue) {
+                    //special case for class attribute addition + removal
+                    //so that class changes can tap into the animation
+                    //hooks provided by the $animate service. Be sure to
+                    //skip animations when the first digest occurs (when
+                    //both the new and the old values are the same) since
+                    //the CSS classes are the non-interpolated values
+                    if (name === 'class' && newValue != oldValue) {
+                      attr.$updateClass(newValue, oldValue);
+                    } else {
+                      attr.$set(name, newValue);
+                    }
+                  });
+              }
+            };
+          }
+      });
+    }
+
+
+    /**
+     * This is a special jqLite.replaceWith, which can replace items which
+     * have no parents, provided that the containing jqLite collection is provided.
+     *
+     * @param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes
+     *                               in the root of the tree.
+     * @param {JqLite} elementsToRemove The jqLite element which we are going to replace. We keep
+     *                                  the shell, but replace its DOM node reference.
+     * @param {Node} newNode The new DOM node.
+     */
+    function replaceWith($rootElement, elementsToRemove, newNode) {
+      var firstElementToRemove = elementsToRemove[0],
+          removeCount = elementsToRemove.length,
+          parent = firstElementToRemove.parentNode,
+          i, ii;
+
+      if ($rootElement) {
+        for (i = 0, ii = $rootElement.length; i < ii; i++) {
+          if ($rootElement[i] == firstElementToRemove) {
+            $rootElement[i++] = newNode;
+            for (var j = i, j2 = j + removeCount - 1,
+                     jj = $rootElement.length;
+                 j < jj; j++, j2++) {
+              if (j2 < jj) {
+                $rootElement[j] = $rootElement[j2];
+              } else {
+                delete $rootElement[j];
+              }
+            }
+            $rootElement.length -= removeCount - 1;
+
+            // If the replaced element is also the jQuery .context then replace it
+            // .context is a deprecated jQuery api, so we should set it only when jQuery set it
+            // http://api.jquery.com/context/
+            if ($rootElement.context === firstElementToRemove) {
+              $rootElement.context = newNode;
+            }
+            break;
+          }
+        }
+      }
+
+      if (parent) {
+        parent.replaceChild(newNode, firstElementToRemove);
+      }
+
+      // Append all the `elementsToRemove` to a fragment. This will...
+      // - remove them from the DOM
+      // - allow them to still be traversed with .nextSibling
+      // - allow a single fragment.qSA to fetch all elements being removed
+      var fragment = window.document.createDocumentFragment();
+      for (i = 0; i < removeCount; i++) {
+        fragment.appendChild(elementsToRemove[i]);
+      }
+
+      if (jqLite.hasData(firstElementToRemove)) {
+        // Copy over user data (that includes Angular's $scope etc.). Don't copy private
+        // data here because there's no public interface in jQuery to do that and copying over
+        // event listeners (which is the main use of private data) wouldn't work anyway.
+        jqLite.data(newNode, jqLite.data(firstElementToRemove));
+
+        // Remove $destroy event listeners from `firstElementToRemove`
+        jqLite(firstElementToRemove).off('$destroy');
+      }
+
+      // Cleanup any data/listeners on the elements and children.
+      // This includes invoking the $destroy event on any elements with listeners.
+      jqLite.cleanData(fragment.querySelectorAll('*'));
+
+      // Update the jqLite collection to only contain the `newNode`
+      for (i = 1; i < removeCount; i++) {
+        delete elementsToRemove[i];
+      }
+      elementsToRemove[0] = newNode;
+      elementsToRemove.length = 1;
+    }
+
+
+    function cloneAndAnnotateFn(fn, annotation) {
+      return extend(function() { return fn.apply(null, arguments); }, fn, annotation);
+    }
+
+
+    function invokeLinkFn(linkFn, scope, $element, attrs, controllers, transcludeFn) {
+      try {
+        linkFn(scope, $element, attrs, controllers, transcludeFn);
+      } catch (e) {
+        $exceptionHandler(e, startingTag($element));
+      }
+    }
+
+
+    // Set up $watches for isolate scope and controller bindings. This process
+    // only occurs for isolate scopes and new scopes with controllerAs.
+    function initializeDirectiveBindings(scope, attrs, destination, bindings, directive) {
+      var removeWatchCollection = [];
+      var initialChanges = {};
+      var changes;
+      forEach(bindings, function initializeBinding(definition, scopeName) {
+        var attrName = definition.attrName,
+        optional = definition.optional,
+        mode = definition.mode, // @, =, <, or &
+        lastValue,
+        parentGet, parentSet, compare, removeWatch;
+
+        switch (mode) {
+
+          case '@':
+            if (!optional && !hasOwnProperty.call(attrs, attrName)) {
+              destination[scopeName] = attrs[attrName] = void 0;
+            }
+            attrs.$observe(attrName, function(value) {
+              if (isString(value) || isBoolean(value)) {
+                var oldValue = destination[scopeName];
+                recordChanges(scopeName, value, oldValue);
+                destination[scopeName] = value;
+              }
+            });
+            attrs.$$observers[attrName].$$scope = scope;
+            lastValue = attrs[attrName];
+            if (isString(lastValue)) {
+              // If the attribute has been provided then we trigger an interpolation to ensure
+              // the value is there for use in the link fn
+              destination[scopeName] = $interpolate(lastValue)(scope);
+            } else if (isBoolean(lastValue)) {
+              // If the attributes is one of the BOOLEAN_ATTR then Angular will have converted
+              // the value to boolean rather than a string, so we special case this situation
+              destination[scopeName] = lastValue;
+            }
+            initialChanges[scopeName] = new SimpleChange(_UNINITIALIZED_VALUE, destination[scopeName]);
+            break;
+
+          case '=':
+            if (!hasOwnProperty.call(attrs, attrName)) {
+              if (optional) break;
+              attrs[attrName] = void 0;
+            }
+            if (optional && !attrs[attrName]) break;
+
+            parentGet = $parse(attrs[attrName]);
+            if (parentGet.literal) {
+              compare = equals;
+            } else {
+              compare = function simpleCompare(a, b) { return a === b || (a !== a && b !== b); };
+            }
+            parentSet = parentGet.assign || function() {
+              // reset the change, or we will throw this exception on every $digest
+              lastValue = destination[scopeName] = parentGet(scope);
+              throw $compileMinErr('nonassign',
+                  "Expression '{0}' in attribute '{1}' used with directive '{2}' is non-assignable!",
+                  attrs[attrName], attrName, directive.name);
+            };
+            lastValue = destination[scopeName] = parentGet(scope);
+            var parentValueWatch = function parentValueWatch(parentValue) {
+              if (!compare(parentValue, destination[scopeName])) {
+                // we are out of sync and need to copy
+                if (!compare(parentValue, lastValue)) {
+                  // parent changed and it has precedence
+                  destination[scopeName] = parentValue;
+                } else {
+                  // if the parent can be assigned then do so
+                  parentSet(scope, parentValue = destination[scopeName]);
+                }
+              }
+              return lastValue = parentValue;
+            };
+            parentValueWatch.$stateful = true;
+            if (definition.collection) {
+              removeWatch = scope.$watchCollection(attrs[attrName], parentValueWatch);
+            } else {
+              removeWatch = scope.$watch($parse(attrs[attrName], parentValueWatch), null, parentGet.literal);
+            }
+            removeWatchCollection.push(removeWatch);
+            break;
+
+          case '<':
+            if (!hasOwnProperty.call(attrs, attrName)) {
+              if (optional) break;
+              attrs[attrName] = void 0;
+            }
+            if (optional && !attrs[attrName]) break;
+
+            parentGet = $parse(attrs[attrName]);
+
+            var initialValue = destination[scopeName] = parentGet(scope);
+            initialChanges[scopeName] = new SimpleChange(_UNINITIALIZED_VALUE, destination[scopeName]);
+
+            removeWatch = scope.$watch(parentGet, function parentValueWatchAction(newValue, oldValue) {
+              if (oldValue === newValue) {
+                if (oldValue === initialValue) return;
+                oldValue = initialValue;
+              }
+              recordChanges(scopeName, newValue, oldValue);
+              destination[scopeName] = newValue;
+            }, parentGet.literal);
+
+            removeWatchCollection.push(removeWatch);
+            break;
+
+          case '&':
+            // Don't assign Object.prototype method to scope
+            parentGet = attrs.hasOwnProperty(attrName) ? $parse(attrs[attrName]) : noop;
+
+            // Don't assign noop to destination if expression is not valid
+            if (parentGet === noop && optional) break;
+
+            destination[scopeName] = function(locals) {
+              return parentGet(scope, locals);
+            };
+            break;
+        }
+      });
+
+      function recordChanges(key, currentValue, previousValue) {
+        if (isFunction(destination.$onChanges) && currentValue !== previousValue) {
+          // If we have not already scheduled the top level onChangesQueue handler then do so now
+          if (!onChangesQueue) {
+            scope.$$postDigest(flushOnChangesQueue);
+            onChangesQueue = [];
+          }
+          // If we have not already queued a trigger of onChanges for this controller then do so now
+          if (!changes) {
+            changes = {};
+            onChangesQueue.push(triggerOnChangesHook);
+          }
+          // If the has been a change on this property already then we need to reuse the previous value
+          if (changes[key]) {
+            previousValue = changes[key].previousValue;
+          }
+          // Store this change
+          changes[key] = new SimpleChange(previousValue, currentValue);
+        }
+      }
+
+      function triggerOnChangesHook() {
+        destination.$onChanges(changes);
+        // Now clear the changes so that we schedule onChanges when more changes arrive
+        changes = undefined;
+      }
+
+      return {
+        initialChanges: initialChanges,
+        removeWatches: removeWatchCollection.length && function removeWatches() {
+          for (var i = 0, ii = removeWatchCollection.length; i < ii; ++i) {
+            removeWatchCollection[i]();
+          }
+        }
+      };
+    }
+  }];
+}
+
+function SimpleChange(previous, current) {
+  this.previousValue = previous;
+  this.currentValue = current;
+}
+SimpleChange.prototype.isFirstChange = function() { return this.previousValue === _UNINITIALIZED_VALUE; };
+
+
+var PREFIX_REGEXP = /^((?:x|data)[\:\-_])/i;
+/**
+ * Converts all accepted directives format into proper directive name.
+ * @param name Name to normalize
+ */
+function directiveNormalize(name) {
+  return camelCase(name.replace(PREFIX_REGEXP, ''));
+}
+
+/**
+ * @ngdoc type
+ * @name $compile.directive.Attributes
+ *
+ * @description
+ * A shared object between directive compile / linking functions which contains normalized DOM
+ * element attributes. The values reflect current binding state `{{ }}`. The normalization is
+ * needed since all of these are treated as equivalent in Angular:
+ *
+ * ```
+ *    <span ng:bind="a" ng-bind="a" data-ng-bind="a" x-ng-bind="a">
+ * ```
+ */
+
+/**
+ * @ngdoc property
+ * @name $compile.directive.Attributes#$attr
+ *
+ * @description
+ * A map of DOM element attribute names to the normalized name. This is
+ * needed to do reverse lookup from normalized name back to actual name.
+ */
+
+
+/**
+ * @ngdoc method
+ * @name $compile.directive.Attributes#$set
+ * @kind function
+ *
+ * @description
+ * Set DOM element attribute value.
+ *
+ *
+ * @param {string} name Normalized element attribute name of the property to modify. The name is
+ *          reverse-translated using the {@link ng.$compile.directive.Attributes#$attr $attr}
+ *          property to the original name.
+ * @param {string} value Value to set the attribute to. The value can be an interpolated string.
+ */
+
+
+
+/**
+ * Closure compiler type information
+ */
+
+function nodesetLinkingFn(
+  /* angular.Scope */ scope,
+  /* NodeList */ nodeList,
+  /* Element */ rootElement,
+  /* function(Function) */ boundTranscludeFn
+) {}
+
+function directiveLinkingFn(
+  /* nodesetLinkingFn */ nodesetLinkingFn,
+  /* angular.Scope */ scope,
+  /* Node */ node,
+  /* Element */ rootElement,
+  /* function(Function) */ boundTranscludeFn
+) {}
+
+function tokenDifference(str1, str2) {
+  var values = '',
+      tokens1 = str1.split(/\s+/),
+      tokens2 = str2.split(/\s+/);
+
+  outer:
+  for (var i = 0; i < tokens1.length; i++) {
+    var token = tokens1[i];
+    for (var j = 0; j < tokens2.length; j++) {
+      if (token == tokens2[j]) continue outer;
+    }
+    values += (values.length > 0 ? ' ' : '') + token;
+  }
+  return values;
+}
+
+function removeComments(jqNodes) {
+  jqNodes = jqLite(jqNodes);
+  var i = jqNodes.length;
+
+  if (i <= 1) {
+    return jqNodes;
+  }
+
+  while (i--) {
+    var node = jqNodes[i];
+    if (node.nodeType === NODE_TYPE_COMMENT) {
+      splice.call(jqNodes, i, 1);
+    }
+  }
+  return jqNodes;
+}
+
+var $controllerMinErr = minErr('$controller');
+
+
+var CNTRL_REG = /^(\S+)(\s+as\s+([\w$]+))?$/;
+function identifierForController(controller, ident) {
+  if (ident && isString(ident)) return ident;
+  if (isString(controller)) {
+    var match = CNTRL_REG.exec(controller);
+    if (match) return match[3];
+  }
+}
+
+
+/**
+ * @ngdoc provider
+ * @name $controllerProvider
+ * @description
+ * The {@link ng.$controller $controller service} is used by Angular to create new
+ * controllers.
+ *
+ * This provider allows controller registration via the
+ * {@link ng.$controllerProvider#register register} method.
+ */
+function $ControllerProvider() {
+  var controllers = {},
+      globals = false;
+
+  /**
+   * @ngdoc method
+   * @name $controllerProvider#has
+   * @param {string} name Controller name to check.
+   */
+  this.has = function(name) {
+    return controllers.hasOwnProperty(name);
+  };
+
+  /**
+   * @ngdoc method
+   * @name $controllerProvider#register
+   * @param {string|Object} name Controller name, or an object map of controllers where the keys are
+   *    the names and the values are the constructors.
+   * @param {Function|Array} constructor Controller constructor fn (optionally decorated with DI
+   *    annotations in the array notation).
+   */
+  this.register = function(name, constructor) {
+    assertNotHasOwnProperty(name, 'controller');
+    if (isObject(name)) {
+      extend(controllers, name);
+    } else {
+      controllers[name] = constructor;
+    }
+  };
+
+  /**
+   * @ngdoc method
+   * @name $controllerProvider#allowGlobals
+   * @description If called, allows `$controller` to find controller constructors on `window`
+   */
+  this.allowGlobals = function() {
+    globals = true;
+  };
+
+
+  this.$get = ['$injector', '$window', function($injector, $window) {
+
+    /**
+     * @ngdoc service
+     * @name $controller
+     * @requires $injector
+     *
+     * @param {Function|string} constructor If called with a function then it's considered to be the
+     *    controller constructor function. Otherwise it's considered to be a string which is used
+     *    to retrieve the controller constructor using the following steps:
+     *
+     *    * check if a controller with given name is registered via `$controllerProvider`
+     *    * check if evaluating the string on the current scope returns a constructor
+     *    * if $controllerProvider#allowGlobals, check `window[constructor]` on the global
+     *      `window` object (not recommended)
+     *
+     *    The string can use the `controller as property` syntax, where the controller instance is published
+     *    as the specified property on the `scope`; the `scope` must be injected into `locals` param for this
+     *    to work correctly.
+     *
+     * @param {Object} locals Injection locals for Controller.
+     * @return {Object} Instance of given controller.
+     *
+     * @description
+     * `$controller` service is responsible for instantiating controllers.
+     *
+     * It's just a simple call to {@link auto.$injector $injector}, but extracted into
+     * a service, so that one can override this service with [BC version](https://gist.github.com/1649788).
+     */
+    return function $controller(expression, locals, later, ident) {
+      // PRIVATE API:
+      //   param `later` --- indicates that the controller's constructor is invoked at a later time.
+      //                     If true, $controller will allocate the object with the correct
+      //                     prototype chain, but will not invoke the controller until a returned
+      //                     callback is invoked.
+      //   param `ident` --- An optional label which overrides the label parsed from the controller
+      //                     expression, if any.
+      var instance, match, constructor, identifier;
+      later = later === true;
+      if (ident && isString(ident)) {
+        identifier = ident;
+      }
+
+      if (isString(expression)) {
+        match = expression.match(CNTRL_REG);
+        if (!match) {
+          throw $controllerMinErr('ctrlfmt',
+            "Badly formed controller string '{0}'. " +
+            "Must match `__name__ as __id__` or `__name__`.", expression);
+        }
+        constructor = match[1],
+        identifier = identifier || match[3];
+        expression = controllers.hasOwnProperty(constructor)
+            ? controllers[constructor]
+            : getter(locals.$scope, constructor, true) ||
+                (globals ? getter($window, constructor, true) : undefined);
+
+        assertArgFn(expression, constructor, true);
+      }
+
+      if (later) {
+        // Instantiate controller later:
+        // This machinery is used to create an instance of the object before calling the
+        // controller's constructor itself.
+        //
+        // This allows properties to be added to the controller before the constructor is
+        // invoked. Primarily, this is used for isolate scope bindings in $compile.
+        //
+        // This feature is not intended for use by applications, and is thus not documented
+        // publicly.
+        // Object creation: http://jsperf.com/create-constructor/2
+        var controllerPrototype = (isArray(expression) ?
+          expression[expression.length - 1] : expression).prototype;
+        instance = Object.create(controllerPrototype || null);
+
+        if (identifier) {
+          addIdentifier(locals, identifier, instance, constructor || expression.name);
+        }
+
+        var instantiate;
+        return instantiate = extend(function $controllerInit() {
+          var result = $injector.invoke(expression, instance, locals, constructor);
+          if (result !== instance && (isObject(result) || isFunction(result))) {
+            instance = result;
+            if (identifier) {
+              // If result changed, re-assign controllerAs value to scope.
+              addIdentifier(locals, identifier, instance, constructor || expression.name);
+            }
+          }
+          return instance;
+        }, {
+          instance: instance,
+          identifier: identifier
+        });
+      }
+
+      instance = $injector.instantiate(expression, locals, constructor);
+
+      if (identifier) {
+        addIdentifier(locals, identifier, instance, constructor || expression.name);
+      }
+
+      return instance;
+    };
+
+    function addIdentifier(locals, identifier, instance, name) {
+      if (!(locals && isObject(locals.$scope))) {
+        throw minErr('$controller')('noscp',
+          "Cannot export controller '{0}' as '{1}'! No $scope object provided via `locals`.",
+          name, identifier);
+      }
+
+      locals.$scope[identifier] = instance;
+    }
+  }];
+}
+
+/**
+ * @ngdoc service
+ * @name $document
+ * @requires $window
+ *
+ * @description
+ * A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object.
+ *
+ * @example
+   <example module="documentExample">
+     <file name="index.html">
+       <div ng-controller="ExampleController">
+         <p>$document title: <b ng-bind="title"></b></p>
+         <p>window.document title: <b ng-bind="windowTitle"></b></p>
+       </div>
+     </file>
+     <file name="script.js">
+       angular.module('documentExample', [])
+         .controller('ExampleController', ['$scope', '$document', function($scope, $document) {
+           $scope.title = $document[0].title;
+           $scope.windowTitle = angular.element(window.document)[0].title;
+         }]);
+     </file>
+   </example>
+ */
+function $DocumentProvider() {
+  this.$get = ['$window', function(window) {
+    return jqLite(window.document);
+  }];
+}
+
+/**
+ * @ngdoc service
+ * @name $exceptionHandler
+ * @requires ng.$log
+ *
+ * @description
+ * Any uncaught exception in angular expressions is delegated to this service.
+ * The default implementation simply delegates to `$log.error` which logs it into
+ * the browser console.
+ *
+ * In unit tests, if `angular-mocks.js` is loaded, this service is overridden by
+ * {@link ngMock.$exceptionHandler mock $exceptionHandler} which aids in testing.
+ *
+ * ## Example:
+ *
+ * The example below will overwrite the default `$exceptionHandler` in order to (a) log uncaught
+ * errors to the backend for later inspection by the developers and (b) to use `$log.warn()` instead
+ * of `$log.error()`.
+ *
+ * ```js
+ *   angular.
+ *     module('exceptionOverwrite', []).
+ *     factory('$exceptionHandler', ['$log', 'logErrorsToBackend', function($log, logErrorsToBackend) {
+ *       return function myExceptionHandler(exception, cause) {
+ *         logErrorsToBackend(exception, cause);
+ *         $log.warn(exception, cause);
+ *       };
+ *     }]);
+ * ```
+ *
+ * <hr />
+ * Note, that code executed in event-listeners (even those registered using jqLite's `on`/`bind`
+ * methods) does not delegate exceptions to the {@link ng.$exceptionHandler $exceptionHandler}
+ * (unless executed during a digest).
+ *
+ * If you wish, you can manually delegate exceptions, e.g.
+ * `try { ... } catch(e) { $exceptionHandler(e); }`
+ *
+ * @param {Error} exception Exception associated with the error.
+ * @param {string=} cause Optional information about the context in which
+ *       the error was thrown.
+ *
+ */
+function $ExceptionHandlerProvider() {
+  this.$get = ['$log', function($log) {
+    return function(exception, cause) {
+      $log.error.apply($log, arguments);
+    };
+  }];
+}
+
+var $$ForceReflowProvider = function() {
+  this.$get = ['$document', function($document) {
+    return function(domNode) {
+      //the line below will force the browser to perform a repaint so
+      //that all the animated elements within the animation frame will
+      //be properly updated and drawn on screen. This is required to
+      //ensure that the preparation animation is properly flushed so that
+      //the active state picks up from there. DO NOT REMOVE THIS LINE.
+      //DO NOT OPTIMIZE THIS LINE. THE MINIFIER WILL REMOVE IT OTHERWISE WHICH
+      //WILL RESULT IN AN UNPREDICTABLE BUG THAT IS VERY HARD TO TRACK DOWN AND
+      //WILL TAKE YEARS AWAY FROM YOUR LIFE.
+      if (domNode) {
+        if (!domNode.nodeType && domNode instanceof jqLite) {
+          domNode = domNode[0];
+        }
+      } else {
+        domNode = $document[0].body;
+      }
+      return domNode.offsetWidth + 1;
+    };
+  }];
+};
+
+var APPLICATION_JSON = 'application/json';
+var CONTENT_TYPE_APPLICATION_JSON = {'Content-Type': APPLICATION_JSON + ';charset=utf-8'};
+var JSON_START = /^\[|^\{(?!\{)/;
+var JSON_ENDS = {
+  '[': /]$/,
+  '{': /}$/
+};
+var JSON_PROTECTION_PREFIX = /^\)\]\}',?\n/;
+var $httpMinErr = minErr('$http');
+var $httpMinErrLegacyFn = function(method) {
+  return function() {
+    throw $httpMinErr('legacy', 'The method `{0}` on the promise returned from `$http` has been disabled.', method);
+  };
+};
+
+function serializeValue(v) {
+  if (isObject(v)) {
+    return isDate(v) ? v.toISOString() : toJson(v);
+  }
+  return v;
+}
+
+
+function $HttpParamSerializerProvider() {
+  /**
+   * @ngdoc service
+   * @name $httpParamSerializer
+   * @description
+   *
+   * Default {@link $http `$http`} params serializer that converts objects to strings
+   * according to the following rules:
+   *
+   * * `{'foo': 'bar'}` results in `foo=bar`
+   * * `{'foo': Date.now()}` results in `foo=2015-04-01T09%3A50%3A49.262Z` (`toISOString()` and encoded representation of a Date object)
+   * * `{'foo': ['bar', 'baz']}` results in `foo=bar&foo=baz` (repeated key for each array element)
+   * * `{'foo': {'bar':'baz'}}` results in `foo=%7B%22bar%22%3A%22baz%22%7D` (stringified and encoded representation of an object)
+   *
+   * Note that serializer will sort the request parameters alphabetically.
+   * */
+
+  this.$get = function() {
+    return function ngParamSerializer(params) {
+      if (!params) return '';
+      var parts = [];
+      forEachSorted(params, function(value, key) {
+        if (value === null || isUndefined(value)) return;
+        if (isArray(value)) {
+          forEach(value, function(v) {
+            parts.push(encodeUriQuery(key)  + '=' + encodeUriQuery(serializeValue(v)));
+          });
+        } else {
+          parts.push(encodeUriQuery(key) + '=' + encodeUriQuery(serializeValue(value)));
+        }
+      });
+
+      return parts.join('&');
+    };
+  };
+}
+
+function $HttpParamSerializerJQLikeProvider() {
+  /**
+   * @ngdoc service
+   * @name $httpParamSerializerJQLike
+   * @description
+   *
+   * Alternative {@link $http `$http`} params serializer that follows
+   * jQuery's [`param()`](http://api.jquery.com/jquery.param/) method logic.
+   * The serializer will also sort the params alphabetically.
+   *
+   * To use it for serializing `$http` request parameters, set it as the `paramSerializer` property:
+   *
+   * ```js
+   * $http({
+   *   url: myUrl,
+   *   method: 'GET',
+   *   params: myParams,
+   *   paramSerializer: '$httpParamSerializerJQLike'
+   * });
+   * ```
+   *
+   * It is also possible to set it as the default `paramSerializer` in the
+   * {@link $httpProvider#defaults `$httpProvider`}.
+   *
+   * Additionally, you can inject the serializer and use it explicitly, for example to serialize
+   * form data for submission:
+   *
+   * ```js
+   * .controller(function($http, $httpParamSerializerJQLike) {
+   *   //...
+   *
+   *   $http({
+   *     url: myUrl,
+   *     method: 'POST',
+   *     data: $httpParamSerializerJQLike(myData),
+   *     headers: {
+   *       'Content-Type': 'application/x-www-form-urlencoded'
+   *     }
+   *   });
+   *
+   * });
+   * ```
+   *
+   * */
+  this.$get = function() {
+    return function jQueryLikeParamSerializer(params) {
+      if (!params) return '';
+      var parts = [];
+      serialize(params, '', true);
+      return parts.join('&');
+
+      function serialize(toSerialize, prefix, topLevel) {
+        if (toSerialize === null || isUndefined(toSerialize)) return;
+        if (isArray(toSerialize)) {
+          forEach(toSerialize, function(value, index) {
+            serialize(value, prefix + '[' + (isObject(value) ? index : '') + ']');
+          });
+        } else if (isObject(toSerialize) && !isDate(toSerialize)) {
+          forEachSorted(toSerialize, function(value, key) {
+            serialize(value, prefix +
+                (topLevel ? '' : '[') +
+                key +
+                (topLevel ? '' : ']'));
+          });
+        } else {
+          parts.push(encodeUriQuery(prefix) + '=' + encodeUriQuery(serializeValue(toSerialize)));
+        }
+      }
+    };
+  };
+}
+
+function defaultHttpResponseTransform(data, headers) {
+  if (isString(data)) {
+    // Strip json vulnerability protection prefix and trim whitespace
+    var tempData = data.replace(JSON_PROTECTION_PREFIX, '').trim();
+
+    if (tempData) {
+      var contentType = headers('Content-Type');
+      if ((contentType && (contentType.indexOf(APPLICATION_JSON) === 0)) || isJsonLike(tempData)) {
+        data = fromJson(tempData);
+      }
+    }
+  }
+
+  return data;
+}
+
+function isJsonLike(str) {
+    var jsonStart = str.match(JSON_START);
+    return jsonStart && JSON_ENDS[jsonStart[0]].test(str);
+}
+
+/**
+ * Parse headers into key value object
+ *
+ * @param {string} headers Raw headers as a string
+ * @returns {Object} Parsed headers as key value object
+ */
+function parseHeaders(headers) {
+  var parsed = createMap(), i;
+
+  function fillInParsed(key, val) {
+    if (key) {
+      parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
+    }
+  }
+
+  if (isString(headers)) {
+    forEach(headers.split('\n'), function(line) {
+      i = line.indexOf(':');
+      fillInParsed(lowercase(trim(line.substr(0, i))), trim(line.substr(i + 1)));
+    });
+  } else if (isObject(headers)) {
+    forEach(headers, function(headerVal, headerKey) {
+      fillInParsed(lowercase(headerKey), trim(headerVal));
+    });
+  }
+
+  return parsed;
+}
+
+
+/**
+ * Returns a function that provides access to parsed headers.
+ *
+ * Headers are lazy parsed when first requested.
+ * @see parseHeaders
+ *
+ * @param {(string|Object)} headers Headers to provide access to.
+ * @returns {function(string=)} Returns a getter function which if called with:
+ *
+ *   - if called with single an argument returns a single header value or null
+ *   - if called with no arguments returns an object containing all headers.
+ */
+function headersGetter(headers) {
+  var headersObj;
+
+  return function(name) {
+    if (!headersObj) headersObj =  parseHeaders(headers);
+
+    if (name) {
+      var value = headersObj[lowercase(name)];
+      if (value === void 0) {
+        value = null;
+      }
+      return value;
+    }
+
+    return headersObj;
+  };
+}
+
+
+/**
+ * Chain all given functions
+ *
+ * This function is used for both request and response transforming
+ *
+ * @param {*} data Data to transform.
+ * @param {function(string=)} headers HTTP headers getter fn.
+ * @param {number} status HTTP status code of the response.
+ * @param {(Function|Array.<Function>)} fns Function or an array of functions.
+ * @returns {*} Transformed data.
+ */
+function transformData(data, headers, status, fns) {
+  if (isFunction(fns)) {
+    return fns(data, headers, status);
+  }
+
+  forEach(fns, function(fn) {
+    data = fn(data, headers, status);
+  });
+
+  return data;
+}
+
+
+function isSuccess(status) {
+  return 200 <= status && status < 300;
+}
+
+
+/**
+ * @ngdoc provider
+ * @name $httpProvider
+ * @description
+ * Use `$httpProvider` to change the default behavior of the {@link ng.$http $http} service.
+ * */
+function $HttpProvider() {
+  /**
+   * @ngdoc property
+   * @name $httpProvider#defaults
+   * @description
+   *
+   * Object containing default values for all {@link ng.$http $http} requests.
+   *
+   * - **`defaults.cache`** - {boolean|Object} - A boolean value or object created with
+   * {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of HTTP responses
+   * by default. See {@link $http#caching $http Caching} for more information.
+   *
+   * - **`defaults.xsrfCookieName`** - {string} - Name of cookie containing the XSRF token.
+   * Defaults value is `'XSRF-TOKEN'`.
+   *
+   * - **`defaults.xsrfHeaderName`** - {string} - Name of HTTP header to populate with the
+   * XSRF token. Defaults value is `'X-XSRF-TOKEN'`.
+   *
+   * - **`defaults.headers`** - {Object} - Default headers for all $http requests.
+   * Refer to {@link ng.$http#setting-http-headers $http} for documentation on
+   * setting default headers.
+   *     - **`defaults.headers.common`**
+   *     - **`defaults.headers.post`**
+   *     - **`defaults.headers.put`**
+   *     - **`defaults.headers.patch`**
+   *
+   *
+   * - **`defaults.paramSerializer`** - `{string|function(Object<string,string>):string}` - A function
+   *  used to the prepare string representation of request parameters (specified as an object).
+   *  If specified as string, it is interpreted as a function registered with the {@link auto.$injector $injector}.
+   *  Defaults to {@link ng.$httpParamSerializer $httpParamSerializer}.
+   *
+   **/
+  var defaults = this.defaults = {
+    // transform incoming response data
+    transformResponse: [defaultHttpResponseTransform],
+
+    // transform outgoing request data
+    transformRequest: [function(d) {
+      return isObject(d) && !isFile(d) && !isBlob(d) && !isFormData(d) ? toJson(d) : d;
+    }],
+
+    // default headers
+    headers: {
+      common: {
+        'Accept': 'application/json, text/plain, */*'
+      },
+      post:   shallowCopy(CONTENT_TYPE_APPLICATION_JSON),
+      put:    shallowCopy(CONTENT_TYPE_APPLICATION_JSON),
+      patch:  shallowCopy(CONTENT_TYPE_APPLICATION_JSON)
+    },
+
+    xsrfCookieName: 'XSRF-TOKEN',
+    xsrfHeaderName: 'X-XSRF-TOKEN',
+
+    paramSerializer: '$httpParamSerializer'
+  };
+
+  var useApplyAsync = false;
+  /**
+   * @ngdoc method
+   * @name $httpProvider#useApplyAsync
+   * @description
+   *
+   * Configure $http service to combine processing of multiple http responses received at around
+   * the same time via {@link ng.$rootScope.Scope#$applyAsync $rootScope.$applyAsync}. This can result in
+   * significant performance improvement for bigger applications that make many HTTP requests
+   * concurrently (common during application bootstrap).
+   *
+   * Defaults to false. If no value is specified, returns the current configured value.
+   *
+   * @param {boolean=} value If true, when requests are loaded, they will schedule a deferred
+   *    "apply" on the next tick, giving time for subsequent requests in a roughly ~10ms window
+   *    to load and share the same digest cycle.
+   *
+   * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining.
+   *    otherwise, returns the current configured value.
+   **/
+  this.useApplyAsync = function(value) {
+    if (isDefined(value)) {
+      useApplyAsync = !!value;
+      return this;
+    }
+    return useApplyAsync;
+  };
+
+  var useLegacyPromise = true;
+  /**
+   * @ngdoc method
+   * @name $httpProvider#useLegacyPromiseExtensions
+   * @description
+   *
+   * Configure `$http` service to return promises without the shorthand methods `success` and `error`.
+   * This should be used to make sure that applications work without these methods.
+   *
+   * Defaults to true. If no value is specified, returns the current configured value.
+   *
+   * @param {boolean=} value If true, `$http` will return a promise with the deprecated legacy `success` and `error` methods.
+   *
+   * @returns {boolean|Object} If a value is specified, returns the $httpProvider for chaining.
+   *    otherwise, returns the current configured value.
+   **/
+  this.useLegacyPromiseExtensions = function(value) {
+    if (isDefined(value)) {
+      useLegacyPromise = !!value;
+      return this;
+    }
+    return useLegacyPromise;
+  };
+
+  /**
+   * @ngdoc property
+   * @name $httpProvider#interceptors
+   * @description
+   *
+   * Array containing service factories for all synchronous or asynchronous {@link ng.$http $http}
+   * pre-processing of request or postprocessing of responses.
+   *
+   * These service factories are ordered by request, i.e. they are applied in the same order as the
+   * array, on request, but reverse order, on response.
+   *
+   * {@link ng.$http#interceptors Interceptors detailed info}
+   **/
+  var interceptorFactories = this.interceptors = [];
+
+  this.$get = ['$httpBackend', '$$cookieReader', '$cacheFactory', '$rootScope', '$q', '$injector',
+      function($httpBackend, $$cookieReader, $cacheFactory, $rootScope, $q, $injector) {
+
+    var defaultCache = $cacheFactory('$http');
+
+    /**
+     * Make sure that default param serializer is exposed as a function
+     */
+    defaults.paramSerializer = isString(defaults.paramSerializer) ?
+      $injector.get(defaults.paramSerializer) : defaults.paramSerializer;
+
+    /**
+     * Interceptors stored in reverse order. Inner interceptors before outer interceptors.
+     * The reversal is needed so that we can build up the interception chain around the
+     * server request.
+     */
+    var reversedInterceptors = [];
+
+    forEach(interceptorFactories, function(interceptorFactory) {
+      reversedInterceptors.unshift(isString(interceptorFactory)
+          ? $injector.get(interceptorFactory) : $injector.invoke(interceptorFactory));
+    });
+
+    /**
+     * @ngdoc service
+     * @kind function
+     * @name $http
+     * @requires ng.$httpBackend
+     * @requires $cacheFactory
+     * @requires $rootScope
+     * @requires $q
+     * @requires $injector
+     *
+     * @description
+     * The `$http` service is a core Angular service that facilitates communication with the remote
+     * HTTP servers via the browser's [XMLHttpRequest](https://developer.mozilla.org/en/xmlhttprequest)
+     * object or via [JSONP](http://en.wikipedia.org/wiki/JSONP).
+     *
+     * For unit testing applications that use `$http` service, see
+     * {@link ngMock.$httpBackend $httpBackend mock}.
+     *
+     * For a higher level of abstraction, please check out the {@link ngResource.$resource
+     * $resource} service.
+     *
+     * The $http API is based on the {@link ng.$q deferred/promise APIs} exposed by
+     * the $q service. While for simple usage patterns this doesn't matter much, for advanced usage
+     * it is important to familiarize yourself with these APIs and the guarantees they provide.
+     *
+     *
+     * ## General usage
+     * The `$http` service is a function which takes a single argument — a {@link $http#usage configuration object} —
+     * that is used to generate an HTTP request and returns  a {@link ng.$q promise}.
+     *
+     * ```js
+     *   // Simple GET request example:
+     *   $http({
+     *     method: 'GET',
+     *     url: '/someUrl'
+     *   }).then(function successCallback(response) {
+     *       // this callback will be called asynchronously
+     *       // when the response is available
+     *     }, function errorCallback(response) {
+     *       // called asynchronously if an error occurs
+     *       // or server returns response with an error status.
+     *     });
+     * ```
+     *
+     * The response object has these properties:
+     *
+     *   - **data** – `{string|Object}` – The response body transformed with the transform
+     *     functions.
+     *   - **status** – `{number}` – HTTP status code of the response.
+     *   - **headers** – `{function([headerName])}` – Header getter function.
+     *   - **config** – `{Object}` – The configuration object that was used to generate the request.
+     *   - **statusText** – `{string}` – HTTP status text of the response.
+     *
+     * A response status code between 200 and 299 is considered a success status and will result in
+     * the success callback being called. Any response status code outside of that range is
+     * considered an error status and will result in the error callback being called.
+     * Also, status codes less than -1 are normalized to zero. -1 usually means the request was
+     * aborted, e.g. using a `config.timeout`.
+     * Note that if the response is a redirect, XMLHttpRequest will transparently follow it, meaning
+     * that the outcome (success or error) will be determined by the final response status code.
+     *
+     *
+     * ## Shortcut methods
+     *
+     * Shortcut methods are also available. All shortcut methods require passing in the URL, and
+     * request data must be passed in for POST/PUT requests. An optional config can be passed as the
+     * last argument.
+     *
+     * ```js
+     *   $http.get('/someUrl', config).then(successCallback, errorCallback);
+     *   $http.post('/someUrl', data, config).then(successCallback, errorCallback);
+     * ```
+     *
+     * Complete list of shortcut methods:
+     *
+     * - {@link ng.$http#get $http.get}
+     * - {@link ng.$http#head $http.head}
+     * - {@link ng.$http#post $http.post}
+     * - {@link ng.$http#put $http.put}
+     * - {@link ng.$http#delete $http.delete}
+     * - {@link ng.$http#jsonp $http.jsonp}
+     * - {@link ng.$http#patch $http.patch}
+     *
+     *
+     * ## Writing Unit Tests that use $http
+     * When unit testing (using {@link ngMock ngMock}), it is necessary to call
+     * {@link ngMock.$httpBackend#flush $httpBackend.flush()} to flush each pending
+     * request using trained responses.
+     *
+     * ```
+     * $httpBackend.expectGET(...);
+     * $http.get(...);
+     * $httpBackend.flush();
+     * ```
+     *
+     * ## Deprecation Notice
+     * <div class="alert alert-danger">
+     *   The `$http` legacy promise methods `success` and `error` have been deprecated.
+     *   Use the standard `then` method instead.
+     *   If {@link $httpProvider#useLegacyPromiseExtensions `$httpProvider.useLegacyPromiseExtensions`} is set to
+     *   `false` then these methods will throw {@link $http:legacy `$http/legacy`} error.
+     * </div>
+     *
+     * ## Setting HTTP Headers
+     *
+     * The $http service will automatically add certain HTTP headers to all requests. These defaults
+     * can be fully configured by accessing the `$httpProvider.defaults.headers` configuration
+     * object, which currently contains this default configuration:
+     *
+     * - `$httpProvider.defaults.headers.common` (headers that are common for all requests):
+     *   - `Accept: application/json, text/plain, * / *`
+     * - `$httpProvider.defaults.headers.post`: (header defaults for POST requests)
+     *   - `Content-Type: application/json`
+     * - `$httpProvider.defaults.headers.put` (header defaults for PUT requests)
+     *   - `Content-Type: application/json`
+     *
+     * To add or overwrite these defaults, simply add or remove a property from these configuration
+     * objects. To add headers for an HTTP method other than POST or PUT, simply add a new object
+     * with the lowercased HTTP method name as the key, e.g.
+     * `$httpProvider.defaults.headers.get = { 'My-Header' : 'value' }`.
+     *
+     * The defaults can also be set at runtime via the `$http.defaults` object in the same
+     * fashion. For example:
+     *
+     * ```
+     * module.run(function($http) {
+     *   $http.defaults.headers.common.Authorization = 'Basic YmVlcDpib29w';
+     * });
+     * ```
+     *
+     * In addition, you can supply a `headers` property in the config object passed when
+     * calling `$http(config)`, which overrides the defaults without changing them globally.
+     *
+     * To explicitly remove a header automatically added via $httpProvider.defaults.headers on a per request basis,
+     * Use the `headers` property, setting the desired header to `undefined`. For example:
+     *
+     * ```js
+     * var req = {
+     *  method: 'POST',
+     *  url: 'http://example.com',
+     *  headers: {
+     *    'Content-Type': undefined
+     *  },
+     *  data: { test: 'test' }
+     * }
+     *
+     * $http(req).then(function(){...}, function(){...});
+     * ```
+     *
+     * ## Transforming Requests and Responses
+     *
+     * Both requests and responses can be transformed using transformation functions: `transformRequest`
+     * and `transformResponse`. These properties can be a single function that returns
+     * the transformed value (`function(data, headersGetter, status)`) or an array of such transformation functions,
+     * which allows you to `push` or `unshift` a new transformation function into the transformation chain.
+     *
+     * <div class="alert alert-warning">
+     * **Note:** Angular does not make a copy of the `data` parameter before it is passed into the `transformRequest` pipeline.
+     * That means changes to the properties of `data` are not local to the transform function (since Javascript passes objects by reference).
+     * For example, when calling `$http.get(url, $scope.myObject)`, modifications to the object's properties in a transformRequest
+     * function will be reflected on the scope and in any templates where the object is data-bound.
+     * To prevent this, transform functions should have no side-effects.
+     * If you need to modify properties, it is recommended to make a copy of the data, or create new object to return.
+     * </div>
+     *
+     * ### Default Transformations
+     *
+     * The `$httpProvider` provider and `$http` service expose `defaults.transformRequest` and
+     * `defaults.transformResponse` properties. If a request does not provide its own transformations
+     * then these will be applied.
+     *
+     * You can augment or replace the default transformations by modifying these properties by adding to or
+     * replacing the array.
+     *
+     * Angular provides the following default transformations:
+     *
+     * Request transformations (`$httpProvider.defaults.transformRequest` and `$http.defaults.transformRequest`):
+     *
+     * - If the `data` property of the request configuration object contains an object, serialize it
+     *   into JSON format.
+     *
+     * Response transformations (`$httpProvider.defaults.transformResponse` and `$http.defaults.transformResponse`):
+     *
+     *  - If XSRF prefix is detected, strip it (see Security Considerations section below).
+     *  - If JSON response is detected, deserialize it using a JSON parser.
+     *
+     *
+     * ### Overriding the Default Transformations Per Request
+     *
+     * If you wish to override the request/response transformations only for a single request then provide
+     * `transformRequest` and/or `transformResponse` properties on the configuration object passed
+     * into `$http`.
+     *
+     * Note that if you provide these properties on the config object the default transformations will be
+     * overwritten. If you wish to augment the default transformations then you must include them in your
+     * local transformation array.
+     *
+     * The following code demonstrates adding a new response transformation to be run after the default response
+     * transformations have been run.
+     *
+     * ```js
+     * function appendTransform(defaults, transform) {
+     *
+     *   // We can't guarantee that the default transformation is an array
+     *   defaults = angular.isArray(defaults) ? defaults : [defaults];
+     *
+     *   // Append the new transformation to the defaults
+     *   return defaults.concat(transform);
+     * }
+     *
+     * $http({
+     *   url: '...',
+     *   method: 'GET',
+     *   transformResponse: appendTransform($http.defaults.transformResponse, function(value) {
+     *     return doTransform(value);
+     *   })
+     * });
+     * ```
+     *
+     *
+     * ## Caching
+     *
+     * {@link ng.$http `$http`} responses are not cached by default. To enable caching, you must
+     * set the config.cache value or the default cache value to TRUE or to a cache object (created
+     * with {@link ng.$cacheFactory `$cacheFactory`}). If defined, the value of config.cache takes
+     * precedence over the default cache value.
+     *
+     * In order to:
+     *   * cache all responses - set the default cache value to TRUE or to a cache object
+     *   * cache a specific response - set config.cache value to TRUE or to a cache object
+     *
+     * If caching is enabled, but neither the default cache nor config.cache are set to a cache object,
+     * then the default `$cacheFactory("$http")` object is used.
+     *
+     * The default cache value can be set by updating the
+     * {@link ng.$http#defaults `$http.defaults.cache`} property or the
+     * {@link $httpProvider#defaults `$httpProvider.defaults.cache`} property.
+     *
+     * When caching is enabled, {@link ng.$http `$http`} stores the response from the server using
+     * the relevant cache object. The next time the same request is made, the response is returned
+     * from the cache without sending a request to the server.
+     *
+     * Take note that:
+     *
+     *   * Only GET and JSONP requests are cached.
+     *   * The cache key is the request URL including search parameters; headers are not considered.
+     *   * Cached responses are returned asynchronously, in the same way as responses from the server.
+     *   * If multiple identical requests are made using the same cache, which is not yet populated,
+     *     one request will be made to the server and remaining requests will return the same response.
+     *   * A cache-control header on the response does not affect if or how responses are cached.
+     *
+     *
+     * ## Interceptors
+     *
+     * Before you start creating interceptors, be sure to understand the
+     * {@link ng.$q $q and deferred/promise APIs}.
+     *
+     * For purposes of global error handling, authentication, or any kind of synchronous or
+     * asynchronous pre-processing of request or postprocessing of responses, it is desirable to be
+     * able to intercept requests before they are handed to the server and
+     * responses before they are handed over to the application code that
+     * initiated these requests. The interceptors leverage the {@link ng.$q
+     * promise APIs} to fulfill this need for both synchronous and asynchronous pre-processing.
+     *
+     * The interceptors are service factories that are registered with the `$httpProvider` by
+     * adding them to the `$httpProvider.interceptors` array. The factory is called and
+     * injected with dependencies (if specified) and returns the interceptor.
+     *
+     * There are two kinds of interceptors (and two kinds of rejection interceptors):
+     *
+     *   * `request`: interceptors get called with a http {@link $http#usage config} object. The function is free to
+     *     modify the `config` object or create a new one. The function needs to return the `config`
+     *     object directly, or a promise containing the `config` or a new `config` object.
+     *   * `requestError`: interceptor gets called when a previous interceptor threw an error or
+     *     resolved with a rejection.
+     *   * `response`: interceptors get called with http `response` object. The function is free to
+     *     modify the `response` object or create a new one. The function needs to return the `response`
+     *     object directly, or as a promise containing the `response` or a new `response` object.
+     *   * `responseError`: interceptor gets called when a previous interceptor threw an error or
+     *     resolved with a rejection.
+     *
+     *
+     * ```js
+     *   // register the interceptor as a service
+     *   $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {
+     *     return {
+     *       // optional method
+     *       'request': function(config) {
+     *         // do something on success
+     *         return config;
+     *       },
+     *
+     *       // optional method
+     *      'requestError': function(rejection) {
+     *         // do something on error
+     *         if (canRecover(rejection)) {
+     *           return responseOrNewPromise
+     *         }
+     *         return $q.reject(rejection);
+     *       },
+     *
+     *
+     *
+     *       // optional method
+     *       'response': function(response) {
+     *         // do something on success
+     *         return response;
+     *       },
+     *
+     *       // optional method
+     *      'responseError': function(rejection) {
+     *         // do something on error
+     *         if (canRecover(rejection)) {
+     *           return responseOrNewPromise
+     *         }
+     *         return $q.reject(rejection);
+     *       }
+     *     };
+     *   });
+     *
+     *   $httpProvider.interceptors.push('myHttpInterceptor');
+     *
+     *
+     *   // alternatively, register the interceptor via an anonymous factory
+     *   $httpProvider.interceptors.push(function($q, dependency1, dependency2) {
+     *     return {
+     *      'request': function(config) {
+     *          // same as above
+     *       },
+     *
+     *       'response': function(response) {
+     *          // same as above
+     *       }
+     *     };
+     *   });
+     * ```
+     *
+     * ## Security Considerations
+     *
+     * When designing web applications, consider security threats from:
+     *
+     * - [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)
+     * - [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery)
+     *
+     * Both server and the client must cooperate in order to eliminate these threats. Angular comes
+     * pre-configured with strategies that address these issues, but for this to work backend server
+     * cooperation is required.
+     *
+     * ### JSON Vulnerability Protection
+     *
+     * A [JSON vulnerability](http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx)
+     * allows third party website to turn your JSON resource URL into
+     * [JSONP](http://en.wikipedia.org/wiki/JSONP) request under some conditions. To
+     * counter this your server can prefix all JSON requests with following string `")]}',\n"`.
+     * Angular will automatically strip the prefix before processing it as JSON.
+     *
+     * For example if your server needs to return:
+     * ```js
+     * ['one','two']
+     * ```
+     *
+     * which is vulnerable to attack, your server can return:
+     * ```js
+     * )]}',
+     * ['one','two']
+     * ```
+     *
+     * Angular will strip the prefix, before processing the JSON.
+     *
+     *
+     * ### Cross Site Request Forgery (XSRF) Protection
+     *
+     * [XSRF](http://en.wikipedia.org/wiki/Cross-site_request_forgery) is an attack technique by
+     * which the attacker can trick an authenticated user into unknowingly executing actions on your
+     * website. Angular provides a mechanism to counter XSRF. When performing XHR requests, the
+     * $http service reads a token from a cookie (by default, `XSRF-TOKEN`) and sets it as an HTTP
+     * header (`X-XSRF-TOKEN`). Since only JavaScript that runs on your domain could read the
+     * cookie, your server can be assured that the XHR came from JavaScript running on your domain.
+     * The header will not be set for cross-domain requests.
+     *
+     * To take advantage of this, your server needs to set a token in a JavaScript readable session
+     * cookie called `XSRF-TOKEN` on the first HTTP GET request. On subsequent XHR requests the
+     * server can verify that the cookie matches `X-XSRF-TOKEN` HTTP header, and therefore be sure
+     * that only JavaScript running on your domain could have sent the request. The token must be
+     * unique for each user and must be verifiable by the server (to prevent the JavaScript from
+     * making up its own tokens). We recommend that the token is a digest of your site's
+     * authentication cookie with a [salt](https://en.wikipedia.org/wiki/Salt_(cryptography&#41;)
+     * for added security.
+     *
+     * The name of the headers can be specified using the xsrfHeaderName and xsrfCookieName
+     * properties of either $httpProvider.defaults at config-time, $http.defaults at run-time,
+     * or the per-request config object.
+     *
+     * In order to prevent collisions in environments where multiple Angular apps share the
+     * same domain or subdomain, we recommend that each application uses unique cookie name.
+     *
+     * @param {object} config Object describing the request to be made and how it should be
+     *    processed. The object has following properties:
+     *
+     *    - **method** – `{string}` – HTTP method (e.g. 'GET', 'POST', etc)
+     *    - **url** – `{string}` – Absolute or relative URL of the resource that is being requested.
+     *    - **params** – `{Object.<string|Object>}` – Map of strings or objects which will be serialized
+     *      with the `paramSerializer` and appended as GET parameters.
+     *    - **data** – `{string|Object}` – Data to be sent as the request message data.
+     *    - **headers** – `{Object}` – Map of strings or functions which return strings representing
+     *      HTTP headers to send to the server. If the return value of a function is null, the
+     *      header will not be sent. Functions accept a config object as an argument.
+     *    - **eventHandlers** - `{Object}` - Event listeners to be bound to the XMLHttpRequest object.
+     *      To bind events to the XMLHttpRequest upload object, use `uploadEventHandlers`.
+     *      The handler will be called in the context of a `$apply` block.
+     *    - **uploadEventHandlers** - `{Object}` - Event listeners to be bound to the XMLHttpRequest upload
+     *      object. To bind events to the XMLHttpRequest object, use `eventHandlers`.
+     *      The handler will be called in the context of a `$apply` block.
+     *    - **xsrfHeaderName** – `{string}` – Name of HTTP header to populate with the XSRF token.
+     *    - **xsrfCookieName** – `{string}` – Name of cookie containing the XSRF token.
+     *    - **transformRequest** –
+     *      `{function(data, headersGetter)|Array.<function(data, headersGetter)>}` –
+     *      transform function or an array of such functions. The transform function takes the http
+     *      request body and headers and returns its transformed (typically serialized) version.
+     *      See {@link ng.$http#overriding-the-default-transformations-per-request
+     *      Overriding the Default Transformations}
+     *    - **transformResponse** –
+     *      `{function(data, headersGetter, status)|Array.<function(data, headersGetter, status)>}` –
+     *      transform function or an array of such functions. The transform function takes the http
+     *      response body, headers and status and returns its transformed (typically deserialized) version.
+     *      See {@link ng.$http#overriding-the-default-transformations-per-request
+     *      Overriding the Default Transformations}
+     *    - **paramSerializer** - `{string|function(Object<string,string>):string}` - A function used to
+     *      prepare the string representation of request parameters (specified as an object).
+     *      If specified as string, it is interpreted as function registered with the
+     *      {@link $injector $injector}, which means you can create your own serializer
+     *      by registering it as a {@link auto.$provide#service service}.
+     *      The default serializer is the {@link $httpParamSerializer $httpParamSerializer};
+     *      alternatively, you can use the {@link $httpParamSerializerJQLike $httpParamSerializerJQLike}
+     *    - **cache** – `{boolean|Object}` – A boolean value or object created with
+     *      {@link ng.$cacheFactory `$cacheFactory`} to enable or disable caching of the HTTP response.
+     *      See {@link $http#caching $http Caching} for more information.
+     *    - **timeout** – `{number|Promise}` – timeout in milliseconds, or {@link ng.$q promise}
+     *      that should abort the request when resolved.
+     *    - **withCredentials** - `{boolean}` - whether to set the `withCredentials` flag on the
+     *      XHR object. See [requests with credentials](https://developer.mozilla.org/docs/Web/HTTP/Access_control_CORS#Requests_with_credentials)
+     *      for more information.
+     *    - **responseType** - `{string}` - see
+     *      [XMLHttpRequest.responseType](https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest#xmlhttprequest-responsetype).
+     *
+     * @returns {HttpPromise} Returns a {@link ng.$q `Promise}` that will be resolved to a response object
+     *                        when the request succeeds or fails.
+     *
+     *
+     * @property {Array.<Object>} pendingRequests Array of config objects for currently pending
+     *   requests. This is primarily meant to be used for debugging purposes.
+     *
+     *
+     * @example
+<example module="httpExample">
+<file name="index.html">
+  <div ng-controller="FetchController">
+    <select ng-model="method" aria-label="Request method">
+      <option>GET</option>
+      <option>JSONP</option>
+    </select>
+    <input type="text" ng-model="url" size="80" aria-label="URL" />
+    <button id="fetchbtn" ng-click="fetch()">fetch</button><br>
+    <button id="samplegetbtn" ng-click="updateModel('GET', 'http-hello.html')">Sample GET</button>
+    <button id="samplejsonpbtn"
+      ng-click="updateModel('JSONP',
+                    'https://angularjs.org/greet.php?callback=JSON_CALLBACK&name=Super%20Hero')">
+      Sample JSONP
+    </button>
+    <button id="invalidjsonpbtn"
+      ng-click="updateModel('JSONP', 'https://angularjs.org/doesntexist&callback=JSON_CALLBACK')">
+        Invalid JSONP
+      </button>
+    <pre>http status code: {{status}}</pre>
+    <pre>http response data: {{data}}</pre>
+  </div>
+</file>
+<file name="script.js">
+  angular.module('httpExample', [])
+    .controller('FetchController', ['$scope', '$http', '$templateCache',
+      function($scope, $http, $templateCache) {
+        $scope.method = 'GET';
+        $scope.url = 'http-hello.html';
+
+        $scope.fetch = function() {
+          $scope.code = null;
+          $scope.response = null;
+
+          $http({method: $scope.method, url: $scope.url, cache: $templateCache}).
+            then(function(response) {
+              $scope.status = response.status;
+              $scope.data = response.data;
+            }, function(response) {
+              $scope.data = response.data || "Request failed";
+              $scope.status = response.status;
+          });
+        };
+
+        $scope.updateModel = function(method, url) {
+          $scope.method = method;
+          $scope.url = url;
+        };
+      }]);
+</file>
+<file name="http-hello.html">
+  Hello, $http!
+</file>
+<file name="protractor.js" type="protractor">
+  var status = element(by.binding('status'));
+  var data = element(by.binding('data'));
+  var fetchBtn = element(by.id('fetchbtn'));
+  var sampleGetBtn = element(by.id('samplegetbtn'));
+  var sampleJsonpBtn = element(by.id('samplejsonpbtn'));
+  var invalidJsonpBtn = element(by.id('invalidjsonpbtn'));
+
+  it('should make an xhr GET request', function() {
+    sampleGetBtn.click();
+    fetchBtn.click();
+    expect(status.getText()).toMatch('200');
+    expect(data.getText()).toMatch(/Hello, \$http!/);
+  });
+
+// Commented out due to flakes. See https://github.com/angular/angular.js/issues/9185
+// it('should make a JSONP request to angularjs.org', function() {
+//   sampleJsonpBtn.click();
+//   fetchBtn.click();
+//   expect(status.getText()).toMatch('200');
+//   expect(data.getText()).toMatch(/Super Hero!/);
+// });
+
+  it('should make JSONP request to invalid URL and invoke the error handler',
+      function() {
+    invalidJsonpBtn.click();
+    fetchBtn.click();
+    expect(status.getText()).toMatch('0');
+    expect(data.getText()).toMatch('Request failed');
+  });
+</file>
+</example>
+     */
+    function $http(requestConfig) {
+
+      if (!isObject(requestConfig)) {
+        throw minErr('$http')('badreq', 'Http request configuration must be an object.  Received: {0}', requestConfig);
+      }
+
+      if (!isString(requestConfig.url)) {
+        throw minErr('$http')('badreq', 'Http request configuration url must be a string.  Received: {0}', requestConfig.url);
+      }
+
+      var config = extend({
+        method: 'get',
+        transformRequest: defaults.transformRequest,
+        transformResponse: defaults.transformResponse,
+        paramSerializer: defaults.paramSerializer
+      }, requestConfig);
+
+      config.headers = mergeHeaders(requestConfig);
+      config.method = uppercase(config.method);
+      config.paramSerializer = isString(config.paramSerializer) ?
+          $injector.get(config.paramSerializer) : config.paramSerializer;
+
+      var requestInterceptors = [];
+      var responseInterceptors = [];
+      var promise = $q.when(config);
+
+      // apply interceptors
+      forEach(reversedInterceptors, function(interceptor) {
+        if (interceptor.request || interceptor.requestError) {
+          requestInterceptors.unshift(interceptor.request, interceptor.requestError);
+        }
+        if (interceptor.response || interceptor.responseError) {
+          responseInterceptors.push(interceptor.response, interceptor.responseError);
+        }
+      });
+
+      promise = chainInterceptors(promise, requestInterceptors);
+      promise = promise.then(serverRequest);
+      promise = chainInterceptors(promise, responseInterceptors);
+
+      if (useLegacyPromise) {
+        promise.success = function(fn) {
+          assertArgFn(fn, 'fn');
+
+          promise.then(function(response) {
+            fn(response.data, response.status, response.headers, config);
+          });
+          return promise;
+        };
+
+        promise.error = function(fn) {
+          assertArgFn(fn, 'fn');
+
+          promise.then(null, function(response) {
+            fn(response.data, response.status, response.headers, config);
+          });
+          return promise;
+        };
+      } else {
+        promise.success = $httpMinErrLegacyFn('success');
+        promise.error = $httpMinErrLegacyFn('error');
+      }
+
+      return promise;
+
+
+      function chainInterceptors(promise, interceptors) {
+        for (var i = 0, ii = interceptors.length; i < ii;) {
+          var thenFn = interceptors[i++];
+          var rejectFn = interceptors[i++];
+
+          promise = promise.then(thenFn, rejectFn);
+        }
+
+        interceptors.length = 0;
+
+        return promise;
+      }
+
+      function executeHeaderFns(headers, config) {
+        var headerContent, processedHeaders = {};
+
+        forEach(headers, function(headerFn, header) {
+          if (isFunction(headerFn)) {
+            headerContent = headerFn(config);
+            if (headerContent != null) {
+              processedHeaders[header] = headerContent;
+            }
+          } else {
+            processedHeaders[header] = headerFn;
+          }
+        });
+
+        return processedHeaders;
+      }
+
+      function mergeHeaders(config) {
+        var defHeaders = defaults.headers,
+            reqHeaders = extend({}, config.headers),
+            defHeaderName, lowercaseDefHeaderName, reqHeaderName;
+
+        defHeaders = extend({}, defHeaders.common, defHeaders[lowercase(config.method)]);
+
+        // using for-in instead of forEach to avoid unnecessary iteration after header has been found
+        defaultHeadersIteration:
+        for (defHeaderName in defHeaders) {
+          lowercaseDefHeaderName = lowercase(defHeaderName);
+
+          for (reqHeaderName in reqHeaders) {
+            if (lowercase(reqHeaderName) === lowercaseDefHeaderName) {
+              continue defaultHeadersIteration;
+            }
+          }
+
+          reqHeaders[defHeaderName] = defHeaders[defHeaderName];
+        }
+
+        // execute if header value is a function for merged headers
+        return executeHeaderFns(reqHeaders, shallowCopy(config));
+      }
+
+      function serverRequest(config) {
+        var headers = config.headers;
+        var reqData = transformData(config.data, headersGetter(headers), undefined, config.transformRequest);
+
+        // strip content-type if data is undefined
+        if (isUndefined(reqData)) {
+          forEach(headers, function(value, header) {
+            if (lowercase(header) === 'content-type') {
+              delete headers[header];
+            }
+          });
+        }
+
+        if (isUndefined(config.withCredentials) && !isUndefined(defaults.withCredentials)) {
+          config.withCredentials = defaults.withCredentials;
+        }
+
+        // send request
+        return sendReq(config, reqData).then(transformResponse, transformResponse);
+      }
+
+      function transformResponse(response) {
+        // make a copy since the response must be cacheable
+        var resp = extend({}, response);
+        resp.data = transformData(response.data, response.headers, response.status,
+                                  config.transformResponse);
+        return (isSuccess(response.status))
+          ? resp
+          : $q.reject(resp);
+      }
+    }
+
+    $http.pendingRequests = [];
+
+    /**
+     * @ngdoc method
+     * @name $http#get
+     *
+     * @description
+     * Shortcut method to perform `GET` request.
+     *
+     * @param {string} url Relative or absolute URL specifying the destination of the request
+     * @param {Object=} config Optional configuration object
+     * @returns {HttpPromise} Future object
+     */
+
+    /**
+     * @ngdoc method
+     * @name $http#delete
+     *
+     * @description
+     * Shortcut method to perform `DELETE` request.
+     *
+     * @param {string} url Relative or absolute URL specifying the destination of the request
+     * @param {Object=} config Optional configuration object
+     * @returns {HttpPromise} Future object
+     */
+
+    /**
+     * @ngdoc method
+     * @name $http#head
+     *
+     * @description
+     * Shortcut method to perform `HEAD` request.
+     *
+     * @param {string} url Relative or absolute URL specifying the destination of the request
+     * @param {Object=} config Optional configuration object
+     * @returns {HttpPromise} Future object
+     */
+
+    /**
+     * @ngdoc method
+     * @name $http#jsonp
+     *
+     * @description
+     * Shortcut method to perform `JSONP` request.
+     * If you would like to customise where and how the callbacks are stored then try overriding
+     * or decorating the {@link $jsonpCallbacks} service.
+     *
+     * @param {string} url Relative or absolute URL specifying the destination of the request.
+     *                     The name of the callback should be the string `JSON_CALLBACK`.
+     * @param {Object=} config Optional configuration object
+     * @returns {HttpPromise} Future object
+     */
+    createShortMethods('get', 'delete', 'head', 'jsonp');
+
+    /**
+     * @ngdoc method
+     * @name $http#post
+     *
+     * @description
+     * Shortcut method to perform `POST` request.
+     *
+     * @param {string} url Relative or absolute URL specifying the destination of the request
+     * @param {*} data Request content
+     * @param {Object=} config Optional configuration object
+     * @returns {HttpPromise} Future object
+     */
+
+    /**
+     * @ngdoc method
+     * @name $http#put
+     *
+     * @description
+     * Shortcut method to perform `PUT` request.
+     *
+     * @param {string} url Relative or absolute URL specifying the destination of the request
+     * @param {*} data Request content
+     * @param {Object=} config Optional configuration object
+     * @returns {HttpPromise} Future object
+     */
+
+     /**
+      * @ngdoc method
+      * @name $http#patch
+      *
+      * @description
+      * Shortcut method to perform `PATCH` request.
+      *
+      * @param {string} url Relative or absolute URL specifying the destination of the request
+      * @param {*} data Request content
+      * @param {Object=} config Optional configuration object
+      * @returns {HttpPromise} Future object
+      */
+    createShortMethodsWithData('post', 'put', 'patch');
+
+        /**
+         * @ngdoc property
+         * @name $http#defaults
+         *
+         * @description
+         * Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of
+         * default headers, withCredentials as well as request and response transformations.
+         *
+         * See "Setting HTTP Headers" and "Transforming Requests and Responses" sections above.
+         */
+    $http.defaults = defaults;
+
+
+    return $http;
+
+
+    function createShortMethods(names) {
+      forEach(arguments, function(name) {
+        $http[name] = function(url, config) {
+          return $http(extend({}, config || {}, {
+            method: name,
+            url: url
+          }));
+        };
+      });
+    }
+
+
+    function createShortMethodsWithData(name) {
+      forEach(arguments, function(name) {
+        $http[name] = function(url, data, config) {
+          return $http(extend({}, config || {}, {
+            method: name,
+            url: url,
+            data: data
+          }));
+        };
+      });
+    }
+
+
+    /**
+     * Makes the request.
+     *
+     * !!! ACCESSES CLOSURE VARS:
+     * $httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests
+     */
+    function sendReq(config, reqData) {
+      var deferred = $q.defer(),
+          promise = deferred.promise,
+          cache,
+          cachedResp,
+          reqHeaders = config.headers,
+          url = buildUrl(config.url, config.paramSerializer(config.params));
+
+      $http.pendingRequests.push(config);
+      promise.then(removePendingReq, removePendingReq);
+
+
+      if ((config.cache || defaults.cache) && config.cache !== false &&
+          (config.method === 'GET' || config.method === 'JSONP')) {
+        cache = isObject(config.cache) ? config.cache
+              : isObject(defaults.cache) ? defaults.cache
+              : defaultCache;
+      }
+
+      if (cache) {
+        cachedResp = cache.get(url);
+        if (isDefined(cachedResp)) {
+          if (isPromiseLike(cachedResp)) {
+            // cached request has already been sent, but there is no response yet
+            cachedResp.then(resolvePromiseWithResult, resolvePromiseWithResult);
+          } else {
+            // serving from cache
+            if (isArray(cachedResp)) {
+              resolvePromise(cachedResp[1], cachedResp[0], shallowCopy(cachedResp[2]), cachedResp[3]);
+            } else {
+              resolvePromise(cachedResp, 200, {}, 'OK');
+            }
+          }
+        } else {
+          // put the promise for the non-transformed response into cache as a placeholder
+          cache.put(url, promise);
+        }
+      }
+
+
+      // if we won't have the response in cache, set the xsrf headers and
+      // send the request to the backend
+      if (isUndefined(cachedResp)) {
+        var xsrfValue = urlIsSameOrigin(config.url)
+            ? $$cookieReader()[config.xsrfCookieName || defaults.xsrfCookieName]
+            : undefined;
+        if (xsrfValue) {
+          reqHeaders[(config.xsrfHeaderName || defaults.xsrfHeaderName)] = xsrfValue;
+        }
+
+        $httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout,
+            config.withCredentials, config.responseType,
+            createApplyHandlers(config.eventHandlers),
+            createApplyHandlers(config.uploadEventHandlers));
+      }
+
+      return promise;
+
+      function createApplyHandlers(eventHandlers) {
+        if (eventHandlers) {
+          var applyHandlers = {};
+          forEach(eventHandlers, function(eventHandler, key) {
+            applyHandlers[key] = function(event) {
+              if (useApplyAsync) {
+                $rootScope.$applyAsync(callEventHandler);
+              } else if ($rootScope.$$phase) {
+                callEventHandler();
+              } else {
+                $rootScope.$apply(callEventHandler);
+              }
+
+              function callEventHandler() {
+                eventHandler(event);
+              }
+            };
+          });
+          return applyHandlers;
+        }
+      }
+
+
+      /**
+       * Callback registered to $httpBackend():
+       *  - caches the response if desired
+       *  - resolves the raw $http promise
+       *  - calls $apply
+       */
+      function done(status, response, headersString, statusText) {
+        if (cache) {
+          if (isSuccess(status)) {
+            cache.put(url, [status, response, parseHeaders(headersString), statusText]);
+          } else {
+            // remove promise from the cache
+            cache.remove(url);
+          }
+        }
+
+        function resolveHttpPromise() {
+          resolvePromise(response, status, headersString, statusText);
+        }
+
+        if (useApplyAsync) {
+          $rootScope.$applyAsync(resolveHttpPromise);
+        } else {
+          resolveHttpPromise();
+          if (!$rootScope.$$phase) $rootScope.$apply();
+        }
+      }
+
+
+      /**
+       * Resolves the raw $http promise.
+       */
+      function resolvePromise(response, status, headers, statusText) {
+        //status: HTTP response status code, 0, -1 (aborted by timeout / promise)
+        status = status >= -1 ? status : 0;
+
+        (isSuccess(status) ? deferred.resolve : deferred.reject)({
+          data: response,
+          status: status,
+          headers: headersGetter(headers),
+          config: config,
+          statusText: statusText
+        });
+      }
+
+      function resolvePromiseWithResult(result) {
+        resolvePromise(result.data, result.status, shallowCopy(result.headers()), result.statusText);
+      }
+
+      function removePendingReq() {
+        var idx = $http.pendingRequests.indexOf(config);
+        if (idx !== -1) $http.pendingRequests.splice(idx, 1);
+      }
+    }
+
+
+    function buildUrl(url, serializedParams) {
+      if (serializedParams.length > 0) {
+        url += ((url.indexOf('?') == -1) ? '?' : '&') + serializedParams;
+      }
+      return url;
+    }
+  }];
+}
+
+/**
+ * @ngdoc service
+ * @name $xhrFactory
+ *
+ * @description
+ * Factory function used to create XMLHttpRequest objects.
+ *
+ * Replace or decorate this service to create your own custom XMLHttpRequest objects.
+ *
+ * ```
+ * angular.module('myApp', [])
+ * .factory('$xhrFactory', function() {
+ *   return function createXhr(method, url) {
+ *     return new window.XMLHttpRequest({mozSystem: true});
+ *   };
+ * });
+ * ```
+ *
+ * @param {string} method HTTP method of the request (GET, POST, PUT, ..)
+ * @param {string} url URL of the request.
+ */
+function $xhrFactoryProvider() {
+  this.$get = function() {
+    return function createXhr() {
+      return new window.XMLHttpRequest();
+    };
+  };
+}
+
+/**
+ * @ngdoc service
+ * @name $httpBackend
+ * @requires $jsonpCallbacks
+ * @requires $document
+ * @requires $xhrFactory
+ *
+ * @description
+ * HTTP backend used by the {@link ng.$http service} that delegates to
+ * XMLHttpRequest object or JSONP and deals with browser incompatibilities.
+ *
+ * You should never need to use this service directly, instead use the higher-level abstractions:
+ * {@link ng.$http $http} or {@link ngResource.$resource $resource}.
+ *
+ * During testing this implementation is swapped with {@link ngMock.$httpBackend mock
+ * $httpBackend} which can be trained with responses.
+ */
+function $HttpBackendProvider() {
+  this.$get = ['$browser', '$jsonpCallbacks', '$document', '$xhrFactory', function($browser, $jsonpCallbacks, $document, $xhrFactory) {
+    return createHttpBackend($browser, $xhrFactory, $browser.defer, $jsonpCallbacks, $document[0]);
+  }];
+}
+
+function createHttpBackend($browser, createXhr, $browserDefer, callbacks, rawDocument) {
+  // TODO(vojta): fix the signature
+  return function(method, url, post, callback, headers, timeout, withCredentials, responseType, eventHandlers, uploadEventHandlers) {
+    $browser.$$incOutstandingRequestCount();
+    url = url || $browser.url();
+
+    if (lowercase(method) === 'jsonp') {
+      var callbackPath = callbacks.createCallback(url);
+      var jsonpDone = jsonpReq(url, callbackPath, function(status, text) {
+        // jsonpReq only ever sets status to 200 (OK), 404 (ERROR) or -1 (WAITING)
+        var response = (status === 200) && callbacks.getResponse(callbackPath);
+        completeRequest(callback, status, response, "", text);
+        callbacks.removeCallback(callbackPath);
+      });
+    } else {
+
+      var xhr = createXhr(method, url);
+
+      xhr.open(method, url, true);
+      forEach(headers, function(value, key) {
+        if (isDefined(value)) {
+            xhr.setRequestHeader(key, value);
+        }
+      });
+
+      xhr.onload = function requestLoaded() {
+        var statusText = xhr.statusText || '';
+
+        // responseText is the old-school way of retrieving response (supported by IE9)
+        // response/responseType properties were introduced in XHR Level2 spec (supported by IE10)
+        var response = ('response' in xhr) ? xhr.response : xhr.responseText;
+
+        // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)
+        var status = xhr.status === 1223 ? 204 : xhr.status;
+
+        // fix status code when it is 0 (0 status is undocumented).
+        // Occurs when accessing file resources or on Android 4.1 stock browser
+        // while retrieving files from application cache.
+        if (status === 0) {
+          status = response ? 200 : urlResolve(url).protocol == 'file' ? 404 : 0;
+        }
+
+        completeRequest(callback,
+            status,
+            response,
+            xhr.getAllResponseHeaders(),
+            statusText);
+      };
+
+      var requestError = function() {
+        // The response is always empty
+        // See https://xhr.spec.whatwg.org/#request-error-steps and https://fetch.spec.whatwg.org/#concept-network-error
+        completeRequest(callback, -1, null, null, '');
+      };
+
+      xhr.onerror = requestError;
+      xhr.onabort = requestError;
+
+      forEach(eventHandlers, function(value, key) {
+          xhr.addEventListener(key, value);
+      });
+
+      forEach(uploadEventHandlers, function(value, key) {
+        xhr.upload.addEventListener(key, value);
+      });
+
+      if (withCredentials) {
+        xhr.withCredentials = true;
+      }
+
+      if (responseType) {
+        try {
+          xhr.responseType = responseType;
+        } catch (e) {
+          // WebKit added support for the json responseType value on 09/03/2013
+          // https://bugs.webkit.org/show_bug.cgi?id=73648. Versions of Safari prior to 7 are
+          // known to throw when setting the value "json" as the response type. Other older
+          // browsers implementing the responseType
+          //
+          // The json response type can be ignored if not supported, because JSON payloads are
+          // parsed on the client-side regardless.
+          if (responseType !== 'json') {
+            throw e;
+          }
+        }
+      }
+
+      xhr.send(isUndefined(post) ? null : post);
+    }
+
+    if (timeout > 0) {
+      var timeoutId = $browserDefer(timeoutRequest, timeout);
+    } else if (isPromiseLike(timeout)) {
+      timeout.then(timeoutRequest);
+    }
+
+
+    function timeoutRequest() {
+      jsonpDone && jsonpDone();
+      xhr && xhr.abort();
+    }
+
+    function completeRequest(callback, status, response, headersString, statusText) {
+      // cancel timeout and subsequent timeout promise resolution
+      if (isDefined(timeoutId)) {
+        $browserDefer.cancel(timeoutId);
+      }
+      jsonpDone = xhr = null;
+
+      callback(status, response, headersString, statusText);
+      $browser.$$completeOutstandingRequest(noop);
+    }
+  };
+
+  function jsonpReq(url, callbackPath, done) {
+    url = url.replace('JSON_CALLBACK', callbackPath);
+    // we can't use jQuery/jqLite here because jQuery does crazy stuff with script elements, e.g.:
+    // - fetches local scripts via XHR and evals them
+    // - adds and immediately removes script elements from the document
+    var script = rawDocument.createElement('script'), callback = null;
+    script.type = "text/javascript";
+    script.src = url;
+    script.async = true;
+
+    callback = function(event) {
+      removeEventListenerFn(script, "load", callback);
+      removeEventListenerFn(script, "error", callback);
+      rawDocument.body.removeChild(script);
+      script = null;
+      var status = -1;
+      var text = "unknown";
+
+      if (event) {
+        if (event.type === "load" && !callbacks.wasCalled(callbackPath)) {
+          event = { type: "error" };
+        }
+        text = event.type;
+        status = event.type === "error" ? 404 : 200;
+      }
+
+      if (done) {
+        done(status, text);
+      }
+    };
+
+    addEventListenerFn(script, "load", callback);
+    addEventListenerFn(script, "error", callback);
+    rawDocument.body.appendChild(script);
+    return callback;
+  }
+}
+
+var $interpolateMinErr = angular.$interpolateMinErr = minErr('$interpolate');
+$interpolateMinErr.throwNoconcat = function(text) {
+  throw $interpolateMinErr('noconcat',
+      "Error while interpolating: {0}\nStrict Contextual Escaping disallows " +
+      "interpolations that concatenate multiple expressions when a trusted value is " +
+      "required.  See http://docs.angularjs.org/api/ng.$sce", text);
+};
+
+$interpolateMinErr.interr = function(text, err) {
+  return $interpolateMinErr('interr', "Can't interpolate: {0}\n{1}", text, err.toString());
+};
+
+/**
+ * @ngdoc provider
+ * @name $interpolateProvider
+ *
+ * @description
+ *
+ * Used for configuring the interpolation markup. Defaults to `{{` and `}}`.
+ *
+ * <div class="alert alert-danger">
+ * This feature is sometimes used to mix different markup languages, e.g. to wrap an Angular
+ * template within a Python Jinja template (or any other template language). Mixing templating
+ * languages is **very dangerous**. The embedding template language will not safely escape Angular
+ * expressions, so any user-controlled values in the template will cause Cross Site Scripting (XSS)
+ * security bugs!
+ * </div>
+ *
+ * @example
+<example name="custom-interpolation-markup" module="customInterpolationApp">
+<file name="index.html">
+<script>
+  var customInterpolationApp = angular.module('customInterpolationApp', []);
+
+  customInterpolationApp.config(function($interpolateProvider) {
+    $interpolateProvider.startSymbol('//');
+    $interpolateProvider.endSymbol('//');
+  });
+
+
+  customInterpolationApp.controller('DemoController', function() {
+      this.label = "This binding is brought you by // interpolation symbols.";
+  });
+</script>
+<div ng-controller="DemoController as demo">
+    //demo.label//
+</div>
+</file>
+<file name="protractor.js" type="protractor">
+  it('should interpolate binding with custom symbols', function() {
+    expect(element(by.binding('demo.label')).getText()).toBe('This binding is brought you by // interpolation symbols.');
+  });
+</file>
+</example>
+ */
+function $InterpolateProvider() {
+  var startSymbol = '{{';
+  var endSymbol = '}}';
+
+  /**
+   * @ngdoc method
+   * @name $interpolateProvider#startSymbol
+   * @description
+   * Symbol to denote start of expression in the interpolated string. Defaults to `{{`.
+   *
+   * @param {string=} value new value to set the starting symbol to.
+   * @returns {string|self} Returns the symbol when used as getter and self if used as setter.
+   */
+  this.startSymbol = function(value) {
+    if (value) {
+      startSymbol = value;
+      return this;
+    } else {
+      return startSymbol;
+    }
+  };
+
+  /**
+   * @ngdoc method
+   * @name $interpolateProvider#endSymbol
+   * @description
+   * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
+   *
+   * @param {string=} value new value to set the ending symbol to.
+   * @returns {string|self} Returns the symbol when used as getter and self if used as setter.
+   */
+  this.endSymbol = function(value) {
+    if (value) {
+      endSymbol = value;
+      return this;
+    } else {
+      return endSymbol;
+    }
+  };
+
+
+  this.$get = ['$parse', '$exceptionHandler', '$sce', function($parse, $exceptionHandler, $sce) {
+    var startSymbolLength = startSymbol.length,
+        endSymbolLength = endSymbol.length,
+        escapedStartRegexp = new RegExp(startSymbol.replace(/./g, escape), 'g'),
+        escapedEndRegexp = new RegExp(endSymbol.replace(/./g, escape), 'g');
+
+    function escape(ch) {
+      return '\\\\\\' + ch;
+    }
+
+    function unescapeText(text) {
+      return text.replace(escapedStartRegexp, startSymbol).
+        replace(escapedEndRegexp, endSymbol);
+    }
+
+    function stringify(value) {
+      if (value == null) { // null || undefined
+        return '';
+      }
+      switch (typeof value) {
+        case 'string':
+          break;
+        case 'number':
+          value = '' + value;
+          break;
+        default:
+          value = toJson(value);
+      }
+
+      return value;
+    }
+
+    //TODO: this is the same as the constantWatchDelegate in parse.js
+    function constantWatchDelegate(scope, listener, objectEquality, constantInterp) {
+      var unwatch;
+      return unwatch = scope.$watch(function constantInterpolateWatch(scope) {
+        unwatch();
+        return constantInterp(scope);
+      }, listener, objectEquality);
+    }
+
+    /**
+     * @ngdoc service
+     * @name $interpolate
+     * @kind function
+     *
+     * @requires $parse
+     * @requires $sce
+     *
+     * @description
+     *
+     * Compiles a string with markup into an interpolation function. This service is used by the
+     * HTML {@link ng.$compile $compile} service for data binding. See
+     * {@link ng.$interpolateProvider $interpolateProvider} for configuring the
+     * interpolation markup.
+     *
+     *
+     * ```js
+     *   var $interpolate = ...; // injected
+     *   var exp = $interpolate('Hello {{name | uppercase}}!');
+     *   expect(exp({name:'Angular'})).toEqual('Hello ANGULAR!');
+     * ```
+     *
+     * `$interpolate` takes an optional fourth argument, `allOrNothing`. If `allOrNothing` is
+     * `true`, the interpolation function will return `undefined` unless all embedded expressions
+     * evaluate to a value other than `undefined`.
+     *
+     * ```js
+     *   var $interpolate = ...; // injected
+     *   var context = {greeting: 'Hello', name: undefined };
+     *
+     *   // default "forgiving" mode
+     *   var exp = $interpolate('{{greeting}} {{name}}!');
+     *   expect(exp(context)).toEqual('Hello !');
+     *
+     *   // "allOrNothing" mode
+     *   exp = $interpolate('{{greeting}} {{name}}!', false, null, true);
+     *   expect(exp(context)).toBeUndefined();
+     *   context.name = 'Angular';
+     *   expect(exp(context)).toEqual('Hello Angular!');
+     * ```
+     *
+     * `allOrNothing` is useful for interpolating URLs. `ngSrc` and `ngSrcset` use this behavior.
+     *
+     * #### Escaped Interpolation
+     * $interpolate provides a mechanism for escaping interpolation markers. Start and end markers
+     * can be escaped by preceding each of their characters with a REVERSE SOLIDUS U+005C (backslash).
+     * It will be rendered as a regular start/end marker, and will not be interpreted as an expression
+     * or binding.
+     *
+     * This enables web-servers to prevent script injection attacks and defacing attacks, to some
+     * degree, while also enabling code examples to work without relying on the
+     * {@link ng.directive:ngNonBindable ngNonBindable} directive.
+     *
+     * **For security purposes, it is strongly encouraged that web servers escape user-supplied data,
+     * replacing angle brackets (&lt;, &gt;) with &amp;lt; and &amp;gt; respectively, and replacing all
+     * interpolation start/end markers with their escaped counterparts.**
+     *
+     * Escaped interpolation markers are only replaced with the actual interpolation markers in rendered
+     * output when the $interpolate service processes the text. So, for HTML elements interpolated
+     * by {@link ng.$compile $compile}, or otherwise interpolated with the `mustHaveExpression` parameter
+     * set to `true`, the interpolated text must contain an unescaped interpolation expression. As such,
+     * this is typically useful only when user-data is used in rendering a template from the server, or
+     * when otherwise untrusted data is used by a directive.
+     *
+     * <example>
+     *  <file name="index.html">
+     *    <div ng-init="username='A user'">
+     *      <p ng-init="apptitle='Escaping demo'">{{apptitle}}: \{\{ username = "defaced value"; \}\}
+     *        </p>
+     *      <p><strong>{{username}}</strong> attempts to inject code which will deface the
+     *        application, but fails to accomplish their task, because the server has correctly
+     *        escaped the interpolation start/end markers with REVERSE SOLIDUS U+005C (backslash)
+     *        characters.</p>
+     *      <p>Instead, the result of the attempted script injection is visible, and can be removed
+     *        from the database by an administrator.</p>
+     *    </div>
+     *  </file>
+     * </example>
+     *
+     * @knownIssue
+     * It is currently not possible for an interpolated expression to contain the interpolation end
+     * symbol. For example, `{{ '}}' }}` will be incorrectly interpreted as `{{ ' }}` + `' }}`, i.e.
+     * an interpolated expression consisting of a single-quote (`'`) and the `' }}` string.
+     *
+     * @knownIssue
+     * All directives and components must use the standard `{{` `}}` interpolation symbols
+     * in their templates. If you change the application interpolation symbols the {@link $compile}
+     * service will attempt to denormalize the standard symbols to the custom symbols.
+     * The denormalization process is not clever enough to know not to replace instances of the standard
+     * symbols where they would not normally be treated as interpolation symbols. For example in the following
+     * code snippet the closing braces of the literal object will get incorrectly denormalized:
+     *
+     * ```
+     * <div data-context='{"context":{"id":3,"type":"page"}}">
+     * ```
+     *
+     * The workaround is to ensure that such instances are separated by whitespace:
+     * ```
+     * <div data-context='{"context":{"id":3,"type":"page"} }">
+     * ```
+     *
+     * See https://github.com/angular/angular.js/pull/14610#issuecomment-219401099 for more information.
+     *
+     * @param {string} text The text with markup to interpolate.
+     * @param {boolean=} mustHaveExpression if set to true then the interpolation string must have
+     *    embedded expression in order to return an interpolation function. Strings with no
+     *    embedded expression will return null for the interpolation function.
+     * @param {string=} trustedContext when provided, the returned function passes the interpolated
+     *    result through {@link ng.$sce#getTrusted $sce.getTrusted(interpolatedResult,
+     *    trustedContext)} before returning it.  Refer to the {@link ng.$sce $sce} service that
+     *    provides Strict Contextual Escaping for details.
+     * @param {boolean=} allOrNothing if `true`, then the returned function returns undefined
+     *    unless all embedded expressions evaluate to a value other than `undefined`.
+     * @returns {function(context)} an interpolation function which is used to compute the
+     *    interpolated string. The function has these parameters:
+     *
+     * - `context`: evaluation context for all expressions embedded in the interpolated text
+     */
+    function $interpolate(text, mustHaveExpression, trustedContext, allOrNothing) {
+      // Provide a quick exit and simplified result function for text with no interpolation
+      if (!text.length || text.indexOf(startSymbol) === -1) {
+        var constantInterp;
+        if (!mustHaveExpression) {
+          var unescapedText = unescapeText(text);
+          constantInterp = valueFn(unescapedText);
+          constantInterp.exp = text;
+          constantInterp.expressions = [];
+          constantInterp.$$watchDelegate = constantWatchDelegate;
+        }
+        return constantInterp;
+      }
+
+      allOrNothing = !!allOrNothing;
+      var startIndex,
+          endIndex,
+          index = 0,
+          expressions = [],
+          parseFns = [],
+          textLength = text.length,
+          exp,
+          concat = [],
+          expressionPositions = [];
+
+      while (index < textLength) {
+        if (((startIndex = text.indexOf(startSymbol, index)) != -1) &&
+             ((endIndex = text.indexOf(endSymbol, startIndex + startSymbolLength)) != -1)) {
+          if (index !== startIndex) {
+            concat.push(unescapeText(text.substring(index, startIndex)));
+          }
+          exp = text.substring(startIndex + startSymbolLength, endIndex);
+          expressions.push(exp);
+          parseFns.push($parse(exp, parseStringifyInterceptor));
+          index = endIndex + endSymbolLength;
+          expressionPositions.push(concat.length);
+          concat.push('');
+        } else {
+          // we did not find an interpolation, so we have to add the remainder to the separators array
+          if (index !== textLength) {
+            concat.push(unescapeText(text.substring(index)));
+          }
+          break;
+        }
+      }
+
+      // Concatenating expressions makes it hard to reason about whether some combination of
+      // concatenated values are unsafe to use and could easily lead to XSS.  By requiring that a
+      // single expression be used for iframe[src], object[src], etc., we ensure that the value
+      // that's used is assigned or constructed by some JS code somewhere that is more testable or
+      // make it obvious that you bound the value to some user controlled value.  This helps reduce
+      // the load when auditing for XSS issues.
+      if (trustedContext && concat.length > 1) {
+          $interpolateMinErr.throwNoconcat(text);
+      }
+
+      if (!mustHaveExpression || expressions.length) {
+        var compute = function(values) {
+          for (var i = 0, ii = expressions.length; i < ii; i++) {
+            if (allOrNothing && isUndefined(values[i])) return;
+            concat[expressionPositions[i]] = values[i];
+          }
+          return concat.join('');
+        };
+
+        var getValue = function(value) {
+          return trustedContext ?
+            $sce.getTrusted(trustedContext, value) :
+            $sce.valueOf(value);
+        };
+
+        return extend(function interpolationFn(context) {
+            var i = 0;
+            var ii = expressions.length;
+            var values = new Array(ii);
+
+            try {
+              for (; i < ii; i++) {
+                values[i] = parseFns[i](context);
+              }
+
+              return compute(values);
+            } catch (err) {
+              $exceptionHandler($interpolateMinErr.interr(text, err));
+            }
+
+          }, {
+          // all of these properties are undocumented for now
+          exp: text, //just for compatibility with regular watchers created via $watch
+          expressions: expressions,
+          $$watchDelegate: function(scope, listener) {
+            var lastValue;
+            return scope.$watchGroup(parseFns, function interpolateFnWatcher(values, oldValues) {
+              var currValue = compute(values);
+              if (isFunction(listener)) {
+                listener.call(this, currValue, values !== oldValues ? lastValue : currValue, scope);
+              }
+              lastValue = currValue;
+            });
+          }
+        });
+      }
+
+      function parseStringifyInterceptor(value) {
+        try {
+          value = getValue(value);
+          return allOrNothing && !isDefined(value) ? value : stringify(value);
+        } catch (err) {
+          $exceptionHandler($interpolateMinErr.interr(text, err));
+        }
+      }
+    }
+
+
+    /**
+     * @ngdoc method
+     * @name $interpolate#startSymbol
+     * @description
+     * Symbol to denote the start of expression in the interpolated string. Defaults to `{{`.
+     *
+     * Use {@link ng.$interpolateProvider#startSymbol `$interpolateProvider.startSymbol`} to change
+     * the symbol.
+     *
+     * @returns {string} start symbol.
+     */
+    $interpolate.startSymbol = function() {
+      return startSymbol;
+    };
+
+
+    /**
+     * @ngdoc method
+     * @name $interpolate#endSymbol
+     * @description
+     * Symbol to denote the end of expression in the interpolated string. Defaults to `}}`.
+     *
+     * Use {@link ng.$interpolateProvider#endSymbol `$interpolateProvider.endSymbol`} to change
+     * the symbol.
+     *
+     * @returns {string} end symbol.
+     */
+    $interpolate.endSymbol = function() {
+      return endSymbol;
+    };
+
+    return $interpolate;
+  }];
+}
+
+function $IntervalProvider() {
+  this.$get = ['$rootScope', '$window', '$q', '$$q', '$browser',
+       function($rootScope,   $window,   $q,   $$q,   $browser) {
+    var intervals = {};
+
+
+     /**
+      * @ngdoc service
+      * @name $interval
+      *
+      * @description
+      * Angular's wrapper for `window.setInterval`. The `fn` function is executed every `delay`
+      * milliseconds.
+      *
+      * The return value of registering an interval function is a promise. This promise will be
+      * notified upon each tick of the interval, and will be resolved after `count` iterations, or
+      * run indefinitely if `count` is not defined. The value of the notification will be the
+      * number of iterations that have run.
+      * To cancel an interval, call `$interval.cancel(promise)`.
+      *
+      * In tests you can use {@link ngMock.$interval#flush `$interval.flush(millis)`} to
+      * move forward by `millis` milliseconds and trigger any functions scheduled to run in that
+      * time.
+      *
+      * <div class="alert alert-warning">
+      * **Note**: Intervals created by this service must be explicitly destroyed when you are finished
+      * with them.  In particular they are not automatically destroyed when a controller's scope or a
+      * directive's element are destroyed.
+      * You should take this into consideration and make sure to always cancel the interval at the
+      * appropriate moment.  See the example below for more details on how and when to do this.
+      * </div>
+      *
+      * @param {function()} fn A function that should be called repeatedly.
+      * @param {number} delay Number of milliseconds between each function call.
+      * @param {number=} [count=0] Number of times to repeat. If not set, or 0, will repeat
+      *   indefinitely.
+      * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
+      *   will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
+      * @param {...*=} Pass additional parameters to the executed function.
+      * @returns {promise} A promise which will be notified on each iteration.
+      *
+      * @example
+      * <example module="intervalExample">
+      * <file name="index.html">
+      *   <script>
+      *     angular.module('intervalExample', [])
+      *       .controller('ExampleController', ['$scope', '$interval',
+      *         function($scope, $interval) {
+      *           $scope.format = 'M/d/yy h:mm:ss a';
+      *           $scope.blood_1 = 100;
+      *           $scope.blood_2 = 120;
+      *
+      *           var stop;
+      *           $scope.fight = function() {
+      *             // Don't start a new fight if we are already fighting
+      *             if ( angular.isDefined(stop) ) return;
+      *
+      *             stop = $interval(function() {
+      *               if ($scope.blood_1 > 0 && $scope.blood_2 > 0) {
+      *                 $scope.blood_1 = $scope.blood_1 - 3;
+      *                 $scope.blood_2 = $scope.blood_2 - 4;
+      *               } else {
+      *                 $scope.stopFight();
+      *               }
+      *             }, 100);
+      *           };
+      *
+      *           $scope.stopFight = function() {
+      *             if (angular.isDefined(stop)) {
+      *               $interval.cancel(stop);
+      *               stop = undefined;
+      *             }
+      *           };
+      *
+      *           $scope.resetFight = function() {
+      *             $scope.blood_1 = 100;
+      *             $scope.blood_2 = 120;
+      *           };
+      *
+      *           $scope.$on('$destroy', function() {
+      *             // Make sure that the interval is destroyed too
+      *             $scope.stopFight();
+      *           });
+      *         }])
+      *       // Register the 'myCurrentTime' directive factory method.
+      *       // We inject $interval and dateFilter service since the factory method is DI.
+      *       .directive('myCurrentTime', ['$interval', 'dateFilter',
+      *         function($interval, dateFilter) {
+      *           // return the directive link function. (compile function not needed)
+      *           return function(scope, element, attrs) {
+      *             var format,  // date format
+      *                 stopTime; // so that we can cancel the time updates
+      *
+      *             // used to update the UI
+      *             function updateTime() {
+      *               element.text(dateFilter(new Date(), format));
+      *             }
+      *
+      *             // watch the expression, and update the UI on change.
+      *             scope.$watch(attrs.myCurrentTime, function(value) {
+      *               format = value;
+      *               updateTime();
+      *             });
+      *
+      *             stopTime = $interval(updateTime, 1000);
+      *
+      *             // listen on DOM destroy (removal) event, and cancel the next UI update
+      *             // to prevent updating time after the DOM element was removed.
+      *             element.on('$destroy', function() {
+      *               $interval.cancel(stopTime);
+      *             });
+      *           }
+      *         }]);
+      *   </script>
+      *
+      *   <div>
+      *     <div ng-controller="ExampleController">
+      *       <label>Date format: <input ng-model="format"></label> <hr/>
+      *       Current time is: <span my-current-time="format"></span>
+      *       <hr/>
+      *       Blood 1 : <font color='red'>{{blood_1}}</font>
+      *       Blood 2 : <font color='red'>{{blood_2}}</font>
+      *       <button type="button" data-ng-click="fight()">Fight</button>
+      *       <button type="button" data-ng-click="stopFight()">StopFight</button>
+      *       <button type="button" data-ng-click="resetFight()">resetFight</button>
+      *     </div>
+      *   </div>
+      *
+      * </file>
+      * </example>
+      */
+    function interval(fn, delay, count, invokeApply) {
+      var hasParams = arguments.length > 4,
+          args = hasParams ? sliceArgs(arguments, 4) : [],
+          setInterval = $window.setInterval,
+          clearInterval = $window.clearInterval,
+          iteration = 0,
+          skipApply = (isDefined(invokeApply) && !invokeApply),
+          deferred = (skipApply ? $$q : $q).defer(),
+          promise = deferred.promise;
+
+      count = isDefined(count) ? count : 0;
+
+      promise.$$intervalId = setInterval(function tick() {
+        if (skipApply) {
+          $browser.defer(callback);
+        } else {
+          $rootScope.$evalAsync(callback);
+        }
+        deferred.notify(iteration++);
+
+        if (count > 0 && iteration >= count) {
+          deferred.resolve(iteration);
+          clearInterval(promise.$$intervalId);
+          delete intervals[promise.$$intervalId];
+        }
+
+        if (!skipApply) $rootScope.$apply();
+
+      }, delay);
+
+      intervals[promise.$$intervalId] = deferred;
+
+      return promise;
+
+      function callback() {
+        if (!hasParams) {
+          fn(iteration);
+        } else {
+          fn.apply(null, args);
+        }
+      }
+    }
+
+
+     /**
+      * @ngdoc method
+      * @name $interval#cancel
+      *
+      * @description
+      * Cancels a task associated with the `promise`.
+      *
+      * @param {Promise=} promise returned by the `$interval` function.
+      * @returns {boolean} Returns `true` if the task was successfully canceled.
+      */
+    interval.cancel = function(promise) {
+      if (promise && promise.$$intervalId in intervals) {
+        intervals[promise.$$intervalId].reject('canceled');
+        $window.clearInterval(promise.$$intervalId);
+        delete intervals[promise.$$intervalId];
+        return true;
+      }
+      return false;
+    };
+
+    return interval;
+  }];
+}
+
+/**
+ * @ngdoc service
+ * @name $jsonpCallbacks
+ * @requires $window
+ * @description
+ * This service handles the lifecycle of callbacks to handle JSONP requests.
+ * Override this service if you wish to customise where the callbacks are stored and
+ * how they vary compared to the requested url.
+ */
+var $jsonpCallbacksProvider = function() {
+  this.$get = ['$window', function($window) {
+    var callbacks = $window.angular.callbacks;
+    var callbackMap = {};
+
+    function createCallback(callbackId) {
+      var callback = function(data) {
+        callback.data = data;
+        callback.called = true;
+      };
+      callback.id = callbackId;
+      return callback;
+    }
+
+    return {
+      /**
+       * @ngdoc method
+       * @name $jsonpCallbacks#createCallback
+       * @param {string} url the url of the JSONP request
+       * @returns {string} the callback path to send to the server as part of the JSONP request
+       * @description
+       * {@link $httpBackend} calls this method to create a callback and get hold of the path to the callback
+       * to pass to the server, which will be used to call the callback with its payload in the JSONP response.
+       */
+      createCallback: function(url) {
+        var callbackId = '_' + (callbacks.$$counter++).toString(36);
+        var callbackPath = 'angular.callbacks.' + callbackId;
+        var callback = createCallback(callbackId);
+        callbackMap[callbackPath] = callbacks[callbackId] = callback;
+        return callbackPath;
+      },
+      /**
+       * @ngdoc method
+       * @name $jsonpCallbacks#wasCalled
+       * @param {string} callbackPath the path to the callback that was sent in the JSONP request
+       * @returns {boolean} whether the callback has been called, as a result of the JSONP response
+       * @description
+       * {@link $httpBackend} calls this method to find out whether the JSONP response actually called the
+       * callback that was passed in the request.
+       */
+      wasCalled: function(callbackPath) {
+        return callbackMap[callbackPath].called;
+      },
+      /**
+       * @ngdoc method
+       * @name $jsonpCallbacks#getResponse
+       * @param {string} callbackPath the path to the callback that was sent in the JSONP request
+       * @returns {*} the data received from the response via the registered callback
+       * @description
+       * {@link $httpBackend} calls this method to get hold of the data that was provided to the callback
+       * in the JSONP response.
+       */
+      getResponse: function(callbackPath) {
+        return callbackMap[callbackPath].data;
+      },
+      /**
+       * @ngdoc method
+       * @name $jsonpCallbacks#removeCallback
+       * @param {string} callbackPath the path to the callback that was sent in the JSONP request
+       * @description
+       * {@link $httpBackend} calls this method to remove the callback after the JSONP request has
+       * completed or timed-out.
+       */
+      removeCallback: function(callbackPath) {
+        var callback = callbackMap[callbackPath];
+        delete callbacks[callback.id];
+        delete callbackMap[callbackPath];
+      }
+    };
+  }];
+};
+
+/**
+ * @ngdoc service
+ * @name $locale
+ *
+ * @description
+ * $locale service provides localization rules for various Angular components. As of right now the
+ * only public api is:
+ *
+ * * `id` – `{string}` – locale id formatted as `languageId-countryId` (e.g. `en-us`)
+ */
+
+var PATH_MATCH = /^([^\?#]*)(\?([^#]*))?(#(.*))?$/,
+    DEFAULT_PORTS = {'http': 80, 'https': 443, 'ftp': 21};
+var $locationMinErr = minErr('$location');
+
+
+/**
+ * Encode path using encodeUriSegment, ignoring forward slashes
+ *
+ * @param {string} path Path to encode
+ * @returns {string}
+ */
+function encodePath(path) {
+  var segments = path.split('/'),
+      i = segments.length;
+
+  while (i--) {
+    segments[i] = encodeUriSegment(segments[i]);
+  }
+
+  return segments.join('/');
+}
+
+function parseAbsoluteUrl(absoluteUrl, locationObj) {
+  var parsedUrl = urlResolve(absoluteUrl);
+
+  locationObj.$$protocol = parsedUrl.protocol;
+  locationObj.$$host = parsedUrl.hostname;
+  locationObj.$$port = toInt(parsedUrl.port) || DEFAULT_PORTS[parsedUrl.protocol] || null;
+}
+
+
+function parseAppUrl(relativeUrl, locationObj) {
+  var prefixed = (relativeUrl.charAt(0) !== '/');
+  if (prefixed) {
+    relativeUrl = '/' + relativeUrl;
+  }
+  var match = urlResolve(relativeUrl);
+  locationObj.$$path = decodeURIComponent(prefixed && match.pathname.charAt(0) === '/' ?
+      match.pathname.substring(1) : match.pathname);
+  locationObj.$$search = parseKeyValue(match.search);
+  locationObj.$$hash = decodeURIComponent(match.hash);
+
+  // make sure path starts with '/';
+  if (locationObj.$$path && locationObj.$$path.charAt(0) != '/') {
+    locationObj.$$path = '/' + locationObj.$$path;
+  }
+}
+
+function startsWith(haystack, needle) {
+  return haystack.lastIndexOf(needle, 0) === 0;
+}
+
+/**
+ *
+ * @param {string} base
+ * @param {string} url
+ * @returns {string} returns text from `url` after `base` or `undefined` if it does not begin with
+ *                   the expected string.
+ */
+function stripBaseUrl(base, url) {
+  if (startsWith(url, base)) {
+    return url.substr(base.length);
+  }
+}
+
+
+function stripHash(url) {
+  var index = url.indexOf('#');
+  return index == -1 ? url : url.substr(0, index);
+}
+
+function trimEmptyHash(url) {
+  return url.replace(/(#.+)|#$/, '$1');
+}
+
+
+function stripFile(url) {
+  return url.substr(0, stripHash(url).lastIndexOf('/') + 1);
+}
+
+/* return the server only (scheme://host:port) */
+function serverBase(url) {
+  return url.substring(0, url.indexOf('/', url.indexOf('//') + 2));
+}
+
+
+/**
+ * LocationHtml5Url represents an url
+ * This object is exposed as $location service when HTML5 mode is enabled and supported
+ *
+ * @constructor
+ * @param {string} appBase application base URL
+ * @param {string} appBaseNoFile application base URL stripped of any filename
+ * @param {string} basePrefix url path prefix
+ */
+function LocationHtml5Url(appBase, appBaseNoFile, basePrefix) {
+  this.$$html5 = true;
+  basePrefix = basePrefix || '';
+  parseAbsoluteUrl(appBase, this);
+
+
+  /**
+   * Parse given html5 (regular) url string into properties
+   * @param {string} url HTML5 url
+   * @private
+   */
+  this.$$parse = function(url) {
+    var pathUrl = stripBaseUrl(appBaseNoFile, url);
+    if (!isString(pathUrl)) {
+      throw $locationMinErr('ipthprfx', 'Invalid url "{0}", missing path prefix "{1}".', url,
+          appBaseNoFile);
+    }
+
+    parseAppUrl(pathUrl, this);
+
+    if (!this.$$path) {
+      this.$$path = '/';
+    }
+
+    this.$$compose();
+  };
+
+  /**
+   * Compose url and update `absUrl` property
+   * @private
+   */
+  this.$$compose = function() {
+    var search = toKeyValue(this.$$search),
+        hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
+
+    this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
+    this.$$absUrl = appBaseNoFile + this.$$url.substr(1); // first char is always '/'
+  };
+
+  this.$$parseLinkUrl = function(url, relHref) {
+    if (relHref && relHref[0] === '#') {
+      // special case for links to hash fragments:
+      // keep the old url and only replace the hash fragment
+      this.hash(relHref.slice(1));
+      return true;
+    }
+    var appUrl, prevAppUrl;
+    var rewrittenUrl;
+
+    if (isDefined(appUrl = stripBaseUrl(appBase, url))) {
+      prevAppUrl = appUrl;
+      if (isDefined(appUrl = stripBaseUrl(basePrefix, appUrl))) {
+        rewrittenUrl = appBaseNoFile + (stripBaseUrl('/', appUrl) || appUrl);
+      } else {
+        rewrittenUrl = appBase + prevAppUrl;
+      }
+    } else if (isDefined(appUrl = stripBaseUrl(appBaseNoFile, url))) {
+      rewrittenUrl = appBaseNoFile + appUrl;
+    } else if (appBaseNoFile == url + '/') {
+      rewrittenUrl = appBaseNoFile;
+    }
+    if (rewrittenUrl) {
+      this.$$parse(rewrittenUrl);
+    }
+    return !!rewrittenUrl;
+  };
+}
+
+
+/**
+ * LocationHashbangUrl represents url
+ * This object is exposed as $location service when developer doesn't opt into html5 mode.
+ * It also serves as the base class for html5 mode fallback on legacy browsers.
+ *
+ * @constructor
+ * @param {string} appBase application base URL
+ * @param {string} appBaseNoFile application base URL stripped of any filename
+ * @param {string} hashPrefix hashbang prefix
+ */
+function LocationHashbangUrl(appBase, appBaseNoFile, hashPrefix) {
+
+  parseAbsoluteUrl(appBase, this);
+
+
+  /**
+   * Parse given hashbang url into properties
+   * @param {string} url Hashbang url
+   * @private
+   */
+  this.$$parse = function(url) {
+    var withoutBaseUrl = stripBaseUrl(appBase, url) || stripBaseUrl(appBaseNoFile, url);
+    var withoutHashUrl;
+
+    if (!isUndefined(withoutBaseUrl) && withoutBaseUrl.charAt(0) === '#') {
+
+      // The rest of the url starts with a hash so we have
+      // got either a hashbang path or a plain hash fragment
+      withoutHashUrl = stripBaseUrl(hashPrefix, withoutBaseUrl);
+      if (isUndefined(withoutHashUrl)) {
+        // There was no hashbang prefix so we just have a hash fragment
+        withoutHashUrl = withoutBaseUrl;
+      }
+
+    } else {
+      // There was no hashbang path nor hash fragment:
+      // If we are in HTML5 mode we use what is left as the path;
+      // Otherwise we ignore what is left
+      if (this.$$html5) {
+        withoutHashUrl = withoutBaseUrl;
+      } else {
+        withoutHashUrl = '';
+        if (isUndefined(withoutBaseUrl)) {
+          appBase = url;
+          this.replace();
+        }
+      }
+    }
+
+    parseAppUrl(withoutHashUrl, this);
+
+    this.$$path = removeWindowsDriveName(this.$$path, withoutHashUrl, appBase);
+
+    this.$$compose();
+
+    /*
+     * In Windows, on an anchor node on documents loaded from
+     * the filesystem, the browser will return a pathname
+     * prefixed with the drive name ('/C:/path') when a
+     * pathname without a drive is set:
+     *  * a.setAttribute('href', '/foo')
+     *   * a.pathname === '/C:/foo' //true
+     *
+     * Inside of Angular, we're always using pathnames that
+     * do not include drive names for routing.
+     */
+    function removeWindowsDriveName(path, url, base) {
+      /*
+      Matches paths for file protocol on windows,
+      such as /C:/foo/bar, and captures only /foo/bar.
+      */
+      var windowsFilePathExp = /^\/[A-Z]:(\/.*)/;
+
+      var firstPathSegmentMatch;
+
+      //Get the relative path from the input URL.
+      if (startsWith(url, base)) {
+        url = url.replace(base, '');
+      }
+
+      // The input URL intentionally contains a first path segment that ends with a colon.
+      if (windowsFilePathExp.exec(url)) {
+        return path;
+      }
+
+      firstPathSegmentMatch = windowsFilePathExp.exec(path);
+      return firstPathSegmentMatch ? firstPathSegmentMatch[1] : path;
+    }
+  };
+
+  /**
+   * Compose hashbang url and update `absUrl` property
+   * @private
+   */
+  this.$$compose = function() {
+    var search = toKeyValue(this.$$search),
+        hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
+
+    this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
+    this.$$absUrl = appBase + (this.$$url ? hashPrefix + this.$$url : '');
+  };
+
+  this.$$parseLinkUrl = function(url, relHref) {
+    if (stripHash(appBase) == stripHash(url)) {
+      this.$$parse(url);
+      return true;
+    }
+    return false;
+  };
+}
+
+
+/**
+ * LocationHashbangUrl represents url
+ * This object is exposed as $location service when html5 history api is enabled but the browser
+ * does not support it.
+ *
+ * @constructor
+ * @param {string} appBase application base URL
+ * @param {string} appBaseNoFile application base URL stripped of any filename
+ * @param {string} hashPrefix hashbang prefix
+ */
+function LocationHashbangInHtml5Url(appBase, appBaseNoFile, hashPrefix) {
+  this.$$html5 = true;
+  LocationHashbangUrl.apply(this, arguments);
+
+  this.$$parseLinkUrl = function(url, relHref) {
+    if (relHref && relHref[0] === '#') {
+      // special case for links to hash fragments:
+      // keep the old url and only replace the hash fragment
+      this.hash(relHref.slice(1));
+      return true;
+    }
+
+    var rewrittenUrl;
+    var appUrl;
+
+    if (appBase == stripHash(url)) {
+      rewrittenUrl = url;
+    } else if ((appUrl = stripBaseUrl(appBaseNoFile, url))) {
+      rewrittenUrl = appBase + hashPrefix + appUrl;
+    } else if (appBaseNoFile === url + '/') {
+      rewrittenUrl = appBaseNoFile;
+    }
+    if (rewrittenUrl) {
+      this.$$parse(rewrittenUrl);
+    }
+    return !!rewrittenUrl;
+  };
+
+  this.$$compose = function() {
+    var search = toKeyValue(this.$$search),
+        hash = this.$$hash ? '#' + encodeUriSegment(this.$$hash) : '';
+
+    this.$$url = encodePath(this.$$path) + (search ? '?' + search : '') + hash;
+    // include hashPrefix in $$absUrl when $$url is empty so IE9 does not reload page because of removal of '#'
+    this.$$absUrl = appBase + hashPrefix + this.$$url;
+  };
+
+}
+
+
+var locationPrototype = {
+
+  /**
+   * Ensure absolute url is initialized.
+   * @private
+   */
+  $$absUrl:'',
+
+  /**
+   * Are we in html5 mode?
+   * @private
+   */
+  $$html5: false,
+
+  /**
+   * Has any change been replacing?
+   * @private
+   */
+  $$replace: false,
+
+  /**
+   * @ngdoc method
+   * @name $location#absUrl
+   *
+   * @description
+   * This method is getter only.
+   *
+   * Return full url representation with all segments encoded according to rules specified in
+   * [RFC 3986](http://www.ietf.org/rfc/rfc3986.txt).
+   *
+   *
+   * ```js
+   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+   * var absUrl = $location.absUrl();
+   * // => "http://example.com/#/some/path?foo=bar&baz=xoxo"
+   * ```
+   *
+   * @return {string} full url
+   */
+  absUrl: locationGetter('$$absUrl'),
+
+  /**
+   * @ngdoc method
+   * @name $location#url
+   *
+   * @description
+   * This method is getter / setter.
+   *
+   * Return url (e.g. `/path?a=b#hash`) when called without any parameter.
+   *
+   * Change path, search and hash, when called with parameter and return `$location`.
+   *
+   *
+   * ```js
+   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+   * var url = $location.url();
+   * // => "/some/path?foo=bar&baz=xoxo"
+   * ```
+   *
+   * @param {string=} url New url without base prefix (e.g. `/path?a=b#hash`)
+   * @return {string} url
+   */
+  url: function(url) {
+    if (isUndefined(url)) {
+      return this.$$url;
+    }
+
+    var match = PATH_MATCH.exec(url);
+    if (match[1] || url === '') this.path(decodeURIComponent(match[1]));
+    if (match[2] || match[1] || url === '') this.search(match[3] || '');
+    this.hash(match[5] || '');
+
+    return this;
+  },
+
+  /**
+   * @ngdoc method
+   * @name $location#protocol
+   *
+   * @description
+   * This method is getter only.
+   *
+   * Return protocol of current url.
+   *
+   *
+   * ```js
+   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+   * var protocol = $location.protocol();
+   * // => "http"
+   * ```
+   *
+   * @return {string} protocol of current url
+   */
+  protocol: locationGetter('$$protocol'),
+
+  /**
+   * @ngdoc method
+   * @name $location#host
+   *
+   * @description
+   * This method is getter only.
+   *
+   * Return host of current url.
+   *
+   * Note: compared to the non-angular version `location.host` which returns `hostname:port`, this returns the `hostname` portion only.
+   *
+   *
+   * ```js
+   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+   * var host = $location.host();
+   * // => "example.com"
+   *
+   * // given url http://user:password@example.com:8080/#/some/path?foo=bar&baz=xoxo
+   * host = $location.host();
+   * // => "example.com"
+   * host = location.host;
+   * // => "example.com:8080"
+   * ```
+   *
+   * @return {string} host of current url.
+   */
+  host: locationGetter('$$host'),
+
+  /**
+   * @ngdoc method
+   * @name $location#port
+   *
+   * @description
+   * This method is getter only.
+   *
+   * Return port of current url.
+   *
+   *
+   * ```js
+   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+   * var port = $location.port();
+   * // => 80
+   * ```
+   *
+   * @return {Number} port
+   */
+  port: locationGetter('$$port'),
+
+  /**
+   * @ngdoc method
+   * @name $location#path
+   *
+   * @description
+   * This method is getter / setter.
+   *
+   * Return path of current url when called without any parameter.
+   *
+   * Change path when called with parameter and return `$location`.
+   *
+   * Note: Path should always begin with forward slash (/), this method will add the forward slash
+   * if it is missing.
+   *
+   *
+   * ```js
+   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+   * var path = $location.path();
+   * // => "/some/path"
+   * ```
+   *
+   * @param {(string|number)=} path New path
+   * @return {(string|object)} path if called with no parameters, or `$location` if called with a parameter
+   */
+  path: locationGetterSetter('$$path', function(path) {
+    path = path !== null ? path.toString() : '';
+    return path.charAt(0) == '/' ? path : '/' + path;
+  }),
+
+  /**
+   * @ngdoc method
+   * @name $location#search
+   *
+   * @description
+   * This method is getter / setter.
+   *
+   * Return search part (as object) of current url when called without any parameter.
+   *
+   * Change search part when called with parameter and return `$location`.
+   *
+   *
+   * ```js
+   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo
+   * var searchObject = $location.search();
+   * // => {foo: 'bar', baz: 'xoxo'}
+   *
+   * // set foo to 'yipee'
+   * $location.search('foo', 'yipee');
+   * // $location.search() => {foo: 'yipee', baz: 'xoxo'}
+   * ```
+   *
+   * @param {string|Object.<string>|Object.<Array.<string>>} search New search params - string or
+   * hash object.
+   *
+   * When called with a single argument the method acts as a setter, setting the `search` component
+   * of `$location` to the specified value.
+   *
+   * If the argument is a hash object containing an array of values, these values will be encoded
+   * as duplicate search parameters in the url.
+   *
+   * @param {(string|Number|Array<string>|boolean)=} paramValue If `search` is a string or number, then `paramValue`
+   * will override only a single search property.
+   *
+   * If `paramValue` is an array, it will override the property of the `search` component of
+   * `$location` specified via the first argument.
+   *
+   * If `paramValue` is `null`, the property specified via the first argument will be deleted.
+   *
+   * If `paramValue` is `true`, the property specified via the first argument will be added with no
+   * value nor trailing equal sign.
+   *
+   * @return {Object} If called with no arguments returns the parsed `search` object. If called with
+   * one or more arguments returns `$location` object itself.
+   */
+  search: function(search, paramValue) {
+    switch (arguments.length) {
+      case 0:
+        return this.$$search;
+      case 1:
+        if (isString(search) || isNumber(search)) {
+          search = search.toString();
+          this.$$search = parseKeyValue(search);
+        } else if (isObject(search)) {
+          search = copy(search, {});
+          // remove object undefined or null properties
+          forEach(search, function(value, key) {
+            if (value == null) delete search[key];
+          });
+
+          this.$$search = search;
+        } else {
+          throw $locationMinErr('isrcharg',
+              'The first argument of the `$location#search()` call must be a string or an object.');
+        }
+        break;
+      default:
+        if (isUndefined(paramValue) || paramValue === null) {
+          delete this.$$search[search];
+        } else {
+          this.$$search[search] = paramValue;
+        }
+    }
+
+    this.$$compose();
+    return this;
+  },
+
+  /**
+   * @ngdoc method
+   * @name $location#hash
+   *
+   * @description
+   * This method is getter / setter.
+   *
+   * Returns the hash fragment when called without any parameters.
+   *
+   * Changes the hash fragment when called with a parameter and returns `$location`.
+   *
+   *
+   * ```js
+   * // given url http://example.com/#/some/path?foo=bar&baz=xoxo#hashValue
+   * var hash = $location.hash();
+   * // => "hashValue"
+   * ```
+   *
+   * @param {(string|number)=} hash New hash fragment
+   * @return {string} hash
+   */
+  hash: locationGetterSetter('$$hash', function(hash) {
+    return hash !== null ? hash.toString() : '';
+  }),
+
+  /**
+   * @ngdoc method
+   * @name $location#replace
+   *
+   * @description
+   * If called, all changes to $location during the current `$digest` will replace the current history
+   * record, instead of adding a new one.
+   */
+  replace: function() {
+    this.$$replace = true;
+    return this;
+  }
+};
+
+forEach([LocationHashbangInHtml5Url, LocationHashbangUrl, LocationHtml5Url], function(Location) {
+  Location.prototype = Object.create(locationPrototype);
+
+  /**
+   * @ngdoc method
+   * @name $location#state
+   *
+   * @description
+   * This method is getter / setter.
+   *
+   * Return the history state object when called without any parameter.
+   *
+   * Change the history state object when called with one parameter and return `$location`.
+   * The state object is later passed to `pushState` or `replaceState`.
+   *
+   * NOTE: This method is supported only in HTML5 mode and only in browsers supporting
+   * the HTML5 History API (i.e. methods `pushState` and `replaceState`). If you need to support
+   * older browsers (like IE9 or Android < 4.0), don't use this method.
+   *
+   * @param {object=} state State object for pushState or replaceState
+   * @return {object} state
+   */
+  Location.prototype.state = function(state) {
+    if (!arguments.length) {
+      return this.$$state;
+    }
+
+    if (Location !== LocationHtml5Url || !this.$$html5) {
+      throw $locationMinErr('nostate', 'History API state support is available only ' +
+        'in HTML5 mode and only in browsers supporting HTML5 History API');
+    }
+    // The user might modify `stateObject` after invoking `$location.state(stateObject)`
+    // but we're changing the $$state reference to $browser.state() during the $digest
+    // so the modification window is narrow.
+    this.$$state = isUndefined(state) ? null : state;
+
+    return this;
+  };
+});
+
+
+function locationGetter(property) {
+  return function() {
+    return this[property];
+  };
+}
+
+
+function locationGetterSetter(property, preprocess) {
+  return function(value) {
+    if (isUndefined(value)) {
+      return this[property];
+    }
+
+    this[property] = preprocess(value);
+    this.$$compose();
+
+    return this;
+  };
+}
+
+
+/**
+ * @ngdoc service
+ * @name $location
+ *
+ * @requires $rootElement
+ *
+ * @description
+ * The $location service parses the URL in the browser address bar (based on the
+ * [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL
+ * available to your application. Changes to the URL in the address bar are reflected into
+ * $location service and changes to $location are reflected into the browser address bar.
+ *
+ * **The $location service:**
+ *
+ * - Exposes the current URL in the browser address bar, so you can
+ *   - Watch and observe the URL.
+ *   - Change the URL.
+ * - Synchronizes the URL with the browser when the user
+ *   - Changes the address bar.
+ *   - Clicks the back or forward button (or clicks a History link).
+ *   - Clicks on a link.
+ * - Represents the URL object as a set of methods (protocol, host, port, path, search, hash).
+ *
+ * For more information see {@link guide/$location Developer Guide: Using $location}
+ */
+
+/**
+ * @ngdoc provider
+ * @name $locationProvider
+ * @description
+ * Use the `$locationProvider` to configure how the application deep linking paths are stored.
+ */
+function $LocationProvider() {
+  var hashPrefix = '',
+      html5Mode = {
+        enabled: false,
+        requireBase: true,
+        rewriteLinks: true
+      };
+
+  /**
+   * @ngdoc method
+   * @name $locationProvider#hashPrefix
+   * @description
+   * @param {string=} prefix Prefix for hash part (containing path and search)
+   * @returns {*} current value if used as getter or itself (chaining) if used as setter
+   */
+  this.hashPrefix = function(prefix) {
+    if (isDefined(prefix)) {
+      hashPrefix = prefix;
+      return this;
+    } else {
+      return hashPrefix;
+    }
+  };
+
+  /**
+   * @ngdoc method
+   * @name $locationProvider#html5Mode
+   * @description
+   * @param {(boolean|Object)=} mode If boolean, sets `html5Mode.enabled` to value.
+   *   If object, sets `enabled`, `requireBase` and `rewriteLinks` to respective values. Supported
+   *   properties:
+   *   - **enabled** – `{boolean}` – (default: false) If true, will rely on `history.pushState` to
+   *     change urls where supported. Will fall back to hash-prefixed paths in browsers that do not
+   *     support `pushState`.
+   *   - **requireBase** - `{boolean}` - (default: `true`) When html5Mode is enabled, specifies
+   *     whether or not a <base> tag is required to be present. If `enabled` and `requireBase` are
+   *     true, and a base tag is not present, an error will be thrown when `$location` is injected.
+   *     See the {@link guide/$location $location guide for more information}
+   *   - **rewriteLinks** - `{boolean}` - (default: `true`) When html5Mode is enabled,
+   *     enables/disables url rewriting for relative links.
+   *
+   * @returns {Object} html5Mode object if used as getter or itself (chaining) if used as setter
+   */
+  this.html5Mode = function(mode) {
+    if (isBoolean(mode)) {
+      html5Mode.enabled = mode;
+      return this;
+    } else if (isObject(mode)) {
+
+      if (isBoolean(mode.enabled)) {
+        html5Mode.enabled = mode.enabled;
+      }
+
+      if (isBoolean(mode.requireBase)) {
+        html5Mode.requireBase = mode.requireBase;
+      }
+
+      if (isBoolean(mode.rewriteLinks)) {
+        html5Mode.rewriteLinks = mode.rewriteLinks;
+      }
+
+      return this;
+    } else {
+      return html5Mode;
+    }
+  };
+
+  /**
+   * @ngdoc event
+   * @name $location#$locationChangeStart
+   * @eventType broadcast on root scope
+   * @description
+   * Broadcasted before a URL will change.
+   *
+   * This change can be prevented by calling
+   * `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more
+   * details about event object. Upon successful change
+   * {@link ng.$location#$locationChangeSuccess $locationChangeSuccess} is fired.
+   *
+   * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when
+   * the browser supports the HTML5 History API.
+   *
+   * @param {Object} angularEvent Synthetic event object.
+   * @param {string} newUrl New URL
+   * @param {string=} oldUrl URL that was before it was changed.
+   * @param {string=} newState New history state object
+   * @param {string=} oldState History state object that was before it was changed.
+   */
+
+  /**
+   * @ngdoc event
+   * @name $location#$locationChangeSuccess
+   * @eventType broadcast on root scope
+   * @description
+   * Broadcasted after a URL was changed.
+   *
+   * The `newState` and `oldState` parameters may be defined only in HTML5 mode and when
+   * the browser supports the HTML5 History API.
+   *
+   * @param {Object} angularEvent Synthetic event object.
+   * @param {string} newUrl New URL
+   * @param {string=} oldUrl URL that was before it was changed.
+   * @param {string=} newState New history state object
+   * @param {string=} oldState History state object that was before it was changed.
+   */
+
+  this.$get = ['$rootScope', '$browser', '$sniffer', '$rootElement', '$window',
+      function($rootScope, $browser, $sniffer, $rootElement, $window) {
+    var $location,
+        LocationMode,
+        baseHref = $browser.baseHref(), // if base[href] is undefined, it defaults to ''
+        initialUrl = $browser.url(),
+        appBase;
+
+    if (html5Mode.enabled) {
+      if (!baseHref && html5Mode.requireBase) {
+        throw $locationMinErr('nobase',
+          "$location in HTML5 mode requires a <base> tag to be present!");
+      }
+      appBase = serverBase(initialUrl) + (baseHref || '/');
+      LocationMode = $sniffer.history ? LocationHtml5Url : LocationHashbangInHtml5Url;
+    } else {
+      appBase = stripHash(initialUrl);
+      LocationMode = LocationHashbangUrl;
+    }
+    var appBaseNoFile = stripFile(appBase);
+
+    $location = new LocationMode(appBase, appBaseNoFile, '#' + hashPrefix);
+    $location.$$parseLinkUrl(initialUrl, initialUrl);
+
+    $location.$$state = $browser.state();
+
+    var IGNORE_URI_REGEXP = /^\s*(javascript|mailto):/i;
+
+    function setBrowserUrlWithFallback(url, replace, state) {
+      var oldUrl = $location.url();
+      var oldState = $location.$$state;
+      try {
+        $browser.url(url, replace, state);
+
+        // Make sure $location.state() returns referentially identical (not just deeply equal)
+        // state object; this makes possible quick checking if the state changed in the digest
+        // loop. Checking deep equality would be too expensive.
+        $location.$$state = $browser.state();
+      } catch (e) {
+        // Restore old values if pushState fails
+        $location.url(oldUrl);
+        $location.$$state = oldState;
+
+        throw e;
+      }
+    }
+
+    $rootElement.on('click', function(event) {
+      // TODO(vojta): rewrite link when opening in new tab/window (in legacy browser)
+      // currently we open nice url link and redirect then
+
+      if (!html5Mode.rewriteLinks || event.ctrlKey || event.metaKey || event.shiftKey || event.which == 2 || event.button == 2) return;
+
+      var elm = jqLite(event.target);
+
+      // traverse the DOM up to find first A tag
+      while (nodeName_(elm[0]) !== 'a') {
+        // ignore rewriting if no A tag (reached root element, or no parent - removed from document)
+        if (elm[0] === $rootElement[0] || !(elm = elm.parent())[0]) return;
+      }
+
+      var absHref = elm.prop('href');
+      // get the actual href attribute - see
+      // http://msdn.microsoft.com/en-us/library/ie/dd347148(v=vs.85).aspx
+      var relHref = elm.attr('href') || elm.attr('xlink:href');
+
+      if (isObject(absHref) && absHref.toString() === '[object SVGAnimatedString]') {
+        // SVGAnimatedString.animVal should be identical to SVGAnimatedString.baseVal, unless during
+        // an animation.
+        absHref = urlResolve(absHref.animVal).href;
+      }
+
+      // Ignore when url is started with javascript: or mailto:
+      if (IGNORE_URI_REGEXP.test(absHref)) return;
+
+      if (absHref && !elm.attr('target') && !event.isDefaultPrevented()) {
+        if ($location.$$parseLinkUrl(absHref, relHref)) {
+          // We do a preventDefault for all urls that are part of the angular application,
+          // in html5mode and also without, so that we are able to abort navigation without
+          // getting double entries in the location history.
+          event.preventDefault();
+          // update location manually
+          if ($location.absUrl() != $browser.url()) {
+            $rootScope.$apply();
+            // hack to work around FF6 bug 684208 when scenario runner clicks on links
+            $window.angular['ff-684208-preventDefault'] = true;
+          }
+        }
+      }
+    });
+
+
+    // rewrite hashbang url <> html5 url
+    if (trimEmptyHash($location.absUrl()) != trimEmptyHash(initialUrl)) {
+      $browser.url($location.absUrl(), true);
+    }
+
+    var initializing = true;
+
+    // update $location when $browser url changes
+    $browser.onUrlChange(function(newUrl, newState) {
+
+      if (isUndefined(stripBaseUrl(appBaseNoFile, newUrl))) {
+        // If we are navigating outside of the app then force a reload
+        $window.location.href = newUrl;
+        return;
+      }
+
+      $rootScope.$evalAsync(function() {
+        var oldUrl = $location.absUrl();
+        var oldState = $location.$$state;
+        var defaultPrevented;
+        newUrl = trimEmptyHash(newUrl);
+        $location.$$parse(newUrl);
+        $location.$$state = newState;
+
+        defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,
+            newState, oldState).defaultPrevented;
+
+        // if the location was changed by a `$locationChangeStart` handler then stop
+        // processing this location change
+        if ($location.absUrl() !== newUrl) return;
+
+        if (defaultPrevented) {
+          $location.$$parse(oldUrl);
+          $location.$$state = oldState;
+          setBrowserUrlWithFallback(oldUrl, false, oldState);
+        } else {
+          initializing = false;
+          afterLocationChange(oldUrl, oldState);
+        }
+      });
+      if (!$rootScope.$$phase) $rootScope.$digest();
+    });
+
+    // update browser
+    $rootScope.$watch(function $locationWatch() {
+      var oldUrl = trimEmptyHash($browser.url());
+      var newUrl = trimEmptyHash($location.absUrl());
+      var oldState = $browser.state();
+      var currentReplace = $location.$$replace;
+      var urlOrStateChanged = oldUrl !== newUrl ||
+        ($location.$$html5 && $sniffer.history && oldState !== $location.$$state);
+
+      if (initializing || urlOrStateChanged) {
+        initializing = false;
+
+        $rootScope.$evalAsync(function() {
+          var newUrl = $location.absUrl();
+          var defaultPrevented = $rootScope.$broadcast('$locationChangeStart', newUrl, oldUrl,
+              $location.$$state, oldState).defaultPrevented;
+
+          // if the location was changed by a `$locationChangeStart` handler then stop
+          // processing this location change
+          if ($location.absUrl() !== newUrl) return;
+
+          if (defaultPrevented) {
+            $location.$$parse(oldUrl);
+            $location.$$state = oldState;
+          } else {
+            if (urlOrStateChanged) {
+              setBrowserUrlWithFallback(newUrl, currentReplace,
+                                        oldState === $location.$$state ? null : $location.$$state);
+            }
+            afterLocationChange(oldUrl, oldState);
+          }
+        });
+      }
+
+      $location.$$replace = false;
+
+      // we don't need to return anything because $evalAsync will make the digest loop dirty when
+      // there is a change
+    });
+
+    return $location;
+
+    function afterLocationChange(oldUrl, oldState) {
+      $rootScope.$broadcast('$locationChangeSuccess', $location.absUrl(), oldUrl,
+        $location.$$state, oldState);
+    }
+}];
+}
+
+/**
+ * @ngdoc service
+ * @name $log
+ * @requires $window
+ *
+ * @description
+ * Simple service for logging. Default implementation safely writes the message
+ * into the browser's console (if present).
+ *
+ * The main purpose of this service is to simplify debugging and troubleshooting.
+ *
+ * The default is to log `debug` messages. You can use
+ * {@link ng.$logProvider ng.$logProvider#debugEnabled} to change this.
+ *
+ * @example
+   <example module="logExample">
+     <file name="script.js">
+       angular.module('logExample', [])
+         .controller('LogController', ['$scope', '$log', function($scope, $log) {
+           $scope.$log = $log;
+           $scope.message = 'Hello World!';
+         }]);
+     </file>
+     <file name="index.html">
+       <div ng-controller="LogController">
+         <p>Reload this page with open console, enter text and hit the log button...</p>
+         <label>Message:
+         <input type="text" ng-model="message" /></label>
+         <button ng-click="$log.log(message)">log</button>
+         <button ng-click="$log.warn(message)">warn</button>
+         <button ng-click="$log.info(message)">info</button>
+         <button ng-click="$log.error(message)">error</button>
+         <button ng-click="$log.debug(message)">debug</button>
+       </div>
+     </file>
+   </example>
+ */
+
+/**
+ * @ngdoc provider
+ * @name $logProvider
+ * @description
+ * Use the `$logProvider` to configure how the application logs messages
+ */
+function $LogProvider() {
+  var debug = true,
+      self = this;
+
+  /**
+   * @ngdoc method
+   * @name $logProvider#debugEnabled
+   * @description
+   * @param {boolean=} flag enable or disable debug level messages
+   * @returns {*} current value if used as getter or itself (chaining) if used as setter
+   */
+  this.debugEnabled = function(flag) {
+    if (isDefined(flag)) {
+      debug = flag;
+    return this;
+    } else {
+      return debug;
+    }
+  };
+
+  this.$get = ['$window', function($window) {
+    return {
+      /**
+       * @ngdoc method
+       * @name $log#log
+       *
+       * @description
+       * Write a log message
+       */
+      log: consoleLog('log'),
+
+      /**
+       * @ngdoc method
+       * @name $log#info
+       *
+       * @description
+       * Write an information message
+       */
+      info: consoleLog('info'),
+
+      /**
+       * @ngdoc method
+       * @name $log#warn
+       *
+       * @description
+       * Write a warning message
+       */
+      warn: consoleLog('warn'),
+
+      /**
+       * @ngdoc method
+       * @name $log#error
+       *
+       * @description
+       * Write an error message
+       */
+      error: consoleLog('error'),
+
+      /**
+       * @ngdoc method
+       * @name $log#debug
+       *
+       * @description
+       * Write a debug message
+       */
+      debug: (function() {
+        var fn = consoleLog('debug');
+
+        return function() {
+          if (debug) {
+            fn.apply(self, arguments);
+          }
+        };
+      }())
+    };
+
+    function formatError(arg) {
+      if (arg instanceof Error) {
+        if (arg.stack) {
+          arg = (arg.message && arg.stack.indexOf(arg.message) === -1)
+              ? 'Error: ' + arg.message + '\n' + arg.stack
+              : arg.stack;
+        } else if (arg.sourceURL) {
+          arg = arg.message + '\n' + arg.sourceURL + ':' + arg.line;
+        }
+      }
+      return arg;
+    }
+
+    function consoleLog(type) {
+      var console = $window.console || {},
+          logFn = console[type] || console.log || noop,
+          hasApply = false;
+
+      // Note: reading logFn.apply throws an error in IE11 in IE8 document mode.
+      // The reason behind this is that console.log has type "object" in IE8...
+      try {
+        hasApply = !!logFn.apply;
+      } catch (e) {}
+
+      if (hasApply) {
+        return function() {
+          var args = [];
+          forEach(arguments, function(arg) {
+            args.push(formatError(arg));
+          });
+          return logFn.apply(console, args);
+        };
+      }
+
+      // we are IE which either doesn't have window.console => this is noop and we do nothing,
+      // or we are IE where console.log doesn't have apply so we log at least first 2 args
+      return function(arg1, arg2) {
+        logFn(arg1, arg2 == null ? '' : arg2);
+      };
+    }
+  }];
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *     Any commits to this file should be reviewed with security in mind.  *
+ *   Changes to this file can potentially create security vulnerabilities. *
+ *          An approval from 2 Core members with history of modifying      *
+ *                         this file is required.                          *
+ *                                                                         *
+ *  Does the change somehow allow for arbitrary javascript to be executed? *
+ *    Or allows for someone to change the prototype of built-in objects?   *
+ *     Or gives undesired access to variables likes document or window?    *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+var $parseMinErr = minErr('$parse');
+
+// Sandboxing Angular Expressions
+// ------------------------------
+// Angular expressions are generally considered safe because these expressions only have direct
+// access to `$scope` and locals. However, one can obtain the ability to execute arbitrary JS code by
+// obtaining a reference to native JS functions such as the Function constructor.
+//
+// As an example, consider the following Angular expression:
+//
+//   {}.toString.constructor('alert("evil JS code")')
+//
+// This sandboxing technique is not perfect and doesn't aim to be. The goal is to prevent exploits
+// against the expression language, but not to prevent exploits that were enabled by exposing
+// sensitive JavaScript or browser APIs on Scope. Exposing such objects on a Scope is never a good
+// practice and therefore we are not even trying to protect against interaction with an object
+// explicitly exposed in this way.
+//
+// In general, it is not possible to access a Window object from an angular expression unless a
+// window or some DOM object that has a reference to window is published onto a Scope.
+// Similarly we prevent invocations of function known to be dangerous, as well as assignments to
+// native objects.
+//
+// See https://docs.angularjs.org/guide/security
+
+
+function ensureSafeMemberName(name, fullExpression) {
+  if (name === "__defineGetter__" || name === "__defineSetter__"
+      || name === "__lookupGetter__" || name === "__lookupSetter__"
+      || name === "__proto__") {
+    throw $parseMinErr('isecfld',
+        'Attempting to access a disallowed field in Angular expressions! '
+        + 'Expression: {0}', fullExpression);
+  }
+  return name;
+}
+
+function getStringValue(name) {
+  // Property names must be strings. This means that non-string objects cannot be used
+  // as keys in an object. Any non-string object, including a number, is typecasted
+  // into a string via the toString method.
+  // -- MDN, https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Property_accessors#Property_names
+  //
+  // So, to ensure that we are checking the same `name` that JavaScript would use, we cast it
+  // to a string. It's not always possible. If `name` is an object and its `toString` method is
+  // 'broken' (doesn't return a string, isn't a function, etc.), an error will be thrown:
+  //
+  // TypeError: Cannot convert object to primitive value
+  //
+  // For performance reasons, we don't catch this error here and allow it to propagate up the call
+  // stack. Note that you'll get the same error in JavaScript if you try to access a property using
+  // such a 'broken' object as a key.
+  return name + '';
+}
+
+function ensureSafeObject(obj, fullExpression) {
+  // nifty check if obj is Function that is fast and works across iframes and other contexts
+  if (obj) {
+    if (obj.constructor === obj) {
+      throw $parseMinErr('isecfn',
+          'Referencing Function in Angular expressions is disallowed! Expression: {0}',
+          fullExpression);
+    } else if (// isWindow(obj)
+        obj.window === obj) {
+      throw $parseMinErr('isecwindow',
+          'Referencing the Window in Angular expressions is disallowed! Expression: {0}',
+          fullExpression);
+    } else if (// isElement(obj)
+        obj.children && (obj.nodeName || (obj.prop && obj.attr && obj.find))) {
+      throw $parseMinErr('isecdom',
+          'Referencing DOM nodes in Angular expressions is disallowed! Expression: {0}',
+          fullExpression);
+    } else if (// block Object so that we can't get hold of dangerous Object.* methods
+        obj === Object) {
+      throw $parseMinErr('isecobj',
+          'Referencing Object in Angular expressions is disallowed! Expression: {0}',
+          fullExpression);
+    }
+  }
+  return obj;
+}
+
+var CALL = Function.prototype.call;
+var APPLY = Function.prototype.apply;
+var BIND = Function.prototype.bind;
+
+function ensureSafeFunction(obj, fullExpression) {
+  if (obj) {
+    if (obj.constructor === obj) {
+      throw $parseMinErr('isecfn',
+        'Referencing Function in Angular expressions is disallowed! Expression: {0}',
+        fullExpression);
+    } else if (obj === CALL || obj === APPLY || obj === BIND) {
+      throw $parseMinErr('isecff',
+        'Referencing call, apply or bind in Angular expressions is disallowed! Expression: {0}',
+        fullExpression);
+    }
+  }
+}
+
+function ensureSafeAssignContext(obj, fullExpression) {
+  if (obj) {
+    if (obj === (0).constructor || obj === (false).constructor || obj === ''.constructor ||
+        obj === {}.constructor || obj === [].constructor || obj === Function.constructor) {
+      throw $parseMinErr('isecaf',
+        'Assigning to a constructor is disallowed! Expression: {0}', fullExpression);
+    }
+  }
+}
+
+var OPERATORS = createMap();
+forEach('+ - * / % === !== == != < > <= >= && || ! = |'.split(' '), function(operator) { OPERATORS[operator] = true; });
+var ESCAPE = {"n":"\n", "f":"\f", "r":"\r", "t":"\t", "v":"\v", "'":"'", '"':'"'};
+
+
+/////////////////////////////////////////
+
+
+/**
+ * @constructor
+ */
+var Lexer = function(options) {
+  this.options = options;
+};
+
+Lexer.prototype = {
+  constructor: Lexer,
+
+  lex: function(text) {
+    this.text = text;
+    this.index = 0;
+    this.tokens = [];
+
+    while (this.index < this.text.length) {
+      var ch = this.text.charAt(this.index);
+      if (ch === '"' || ch === "'") {
+        this.readString(ch);
+      } else if (this.isNumber(ch) || ch === '.' && this.isNumber(this.peek())) {
+        this.readNumber();
+      } else if (this.isIdentifierStart(this.peekMultichar())) {
+        this.readIdent();
+      } else if (this.is(ch, '(){}[].,;:?')) {
+        this.tokens.push({index: this.index, text: ch});
+        this.index++;
+      } else if (this.isWhitespace(ch)) {
+        this.index++;
+      } else {
+        var ch2 = ch + this.peek();
+        var ch3 = ch2 + this.peek(2);
+        var op1 = OPERATORS[ch];
+        var op2 = OPERATORS[ch2];
+        var op3 = OPERATORS[ch3];
+        if (op1 || op2 || op3) {
+          var token = op3 ? ch3 : (op2 ? ch2 : ch);
+          this.tokens.push({index: this.index, text: token, operator: true});
+          this.index += token.length;
+        } else {
+          this.throwError('Unexpected next character ', this.index, this.index + 1);
+        }
+      }
+    }
+    return this.tokens;
+  },
+
+  is: function(ch, chars) {
+    return chars.indexOf(ch) !== -1;
+  },
+
+  peek: function(i) {
+    var num = i || 1;
+    return (this.index + num < this.text.length) ? this.text.charAt(this.index + num) : false;
+  },
+
+  isNumber: function(ch) {
+    return ('0' <= ch && ch <= '9') && typeof ch === "string";
+  },
+
+  isWhitespace: function(ch) {
+    // IE treats non-breaking space as \u00A0
+    return (ch === ' ' || ch === '\r' || ch === '\t' ||
+            ch === '\n' || ch === '\v' || ch === '\u00A0');
+  },
+
+  isIdentifierStart: function(ch) {
+    return this.options.isIdentifierStart ?
+        this.options.isIdentifierStart(ch, this.codePointAt(ch)) :
+        this.isValidIdentifierStart(ch);
+  },
+
+  isValidIdentifierStart: function(ch) {
+    return ('a' <= ch && ch <= 'z' ||
+            'A' <= ch && ch <= 'Z' ||
+            '_' === ch || ch === '$');
+  },
+
+  isIdentifierContinue: function(ch) {
+    return this.options.isIdentifierContinue ?
+        this.options.isIdentifierContinue(ch, this.codePointAt(ch)) :
+        this.isValidIdentifierContinue(ch);
+  },
+
+  isValidIdentifierContinue: function(ch, cp) {
+    return this.isValidIdentifierStart(ch, cp) || this.isNumber(ch);
+  },
+
+  codePointAt: function(ch) {
+    if (ch.length === 1) return ch.charCodeAt(0);
+    /*jshint bitwise: false*/
+    return (ch.charCodeAt(0) << 10) + ch.charCodeAt(1) - 0x35FDC00;
+    /*jshint bitwise: true*/
+  },
+
+  peekMultichar: function() {
+    var ch = this.text.charAt(this.index);
+    var peek = this.peek();
+    if (!peek) {
+      return ch;
+    }
+    var cp1 = ch.charCodeAt(0);
+    var cp2 = peek.charCodeAt(0);
+    if (cp1 >= 0xD800 && cp1 <= 0xDBFF && cp2 >= 0xDC00 && cp2 <= 0xDFFF) {
+      return ch + peek;
+    }
+    return ch;
+  },
+
+  isExpOperator: function(ch) {
+    return (ch === '-' || ch === '+' || this.isNumber(ch));
+  },
+
+  throwError: function(error, start, end) {
+    end = end || this.index;
+    var colStr = (isDefined(start)
+            ? 's ' + start +  '-' + this.index + ' [' + this.text.substring(start, end) + ']'
+            : ' ' + end);
+    throw $parseMinErr('lexerr', 'Lexer Error: {0} at column{1} in expression [{2}].',
+        error, colStr, this.text);
+  },
+
+  readNumber: function() {
+    var number = '';
+    var start = this.index;
+    while (this.index < this.text.length) {
+      var ch = lowercase(this.text.charAt(this.index));
+      if (ch == '.' || this.isNumber(ch)) {
+        number += ch;
+      } else {
+        var peekCh = this.peek();
+        if (ch == 'e' && this.isExpOperator(peekCh)) {
+          number += ch;
+        } else if (this.isExpOperator(ch) &&
+            peekCh && this.isNumber(peekCh) &&
+            number.charAt(number.length - 1) == 'e') {
+          number += ch;
+        } else if (this.isExpOperator(ch) &&
+            (!peekCh || !this.isNumber(peekCh)) &&
+            number.charAt(number.length - 1) == 'e') {
+          this.throwError('Invalid exponent');
+        } else {
+          break;
+        }
+      }
+      this.index++;
+    }
+    this.tokens.push({
+      index: start,
+      text: number,
+      constant: true,
+      value: Number(number)
+    });
+  },
+
+  readIdent: function() {
+    var start = this.index;
+    this.index += this.peekMultichar().length;
+    while (this.index < this.text.length) {
+      var ch = this.peekMultichar();
+      if (!this.isIdentifierContinue(ch)) {
+        break;
+      }
+      this.index += ch.length;
+    }
+    this.tokens.push({
+      index: start,
+      text: this.text.slice(start, this.index),
+      identifier: true
+    });
+  },
+
+  readString: function(quote) {
+    var start = this.index;
+    this.index++;
+    var string = '';
+    var rawString = quote;
+    var escape = false;
+    while (this.index < this.text.length) {
+      var ch = this.text.charAt(this.index);
+      rawString += ch;
+      if (escape) {
+        if (ch === 'u') {
+          var hex = this.text.substring(this.index + 1, this.index + 5);
+          if (!hex.match(/[\da-f]{4}/i)) {
+            this.throwError('Invalid unicode escape [\\u' + hex + ']');
+          }
+          this.index += 4;
+          string += String.fromCharCode(parseInt(hex, 16));
+        } else {
+          var rep = ESCAPE[ch];
+          string = string + (rep || ch);
+        }
+        escape = false;
+      } else if (ch === '\\') {
+        escape = true;
+      } else if (ch === quote) {
+        this.index++;
+        this.tokens.push({
+          index: start,
+          text: rawString,
+          constant: true,
+          value: string
+        });
+        return;
+      } else {
+        string += ch;
+      }
+      this.index++;
+    }
+    this.throwError('Unterminated quote', start);
+  }
+};
+
+var AST = function(lexer, options) {
+  this.lexer = lexer;
+  this.options = options;
+};
+
+AST.Program = 'Program';
+AST.ExpressionStatement = 'ExpressionStatement';
+AST.AssignmentExpression = 'AssignmentExpression';
+AST.ConditionalExpression = 'ConditionalExpression';
+AST.LogicalExpression = 'LogicalExpression';
+AST.BinaryExpression = 'BinaryExpression';
+AST.UnaryExpression = 'UnaryExpression';
+AST.CallExpression = 'CallExpression';
+AST.MemberExpression = 'MemberExpression';
+AST.Identifier = 'Identifier';
+AST.Literal = 'Literal';
+AST.ArrayExpression = 'ArrayExpression';
+AST.Property = 'Property';
+AST.ObjectExpression = 'ObjectExpression';
+AST.ThisExpression = 'ThisExpression';
+AST.LocalsExpression = 'LocalsExpression';
+
+// Internal use only
+AST.NGValueParameter = 'NGValueParameter';
+
+AST.prototype = {
+  ast: function(text) {
+    this.text = text;
+    this.tokens = this.lexer.lex(text);
+
+    var value = this.program();
+
+    if (this.tokens.length !== 0) {
+      this.throwError('is an unexpected token', this.tokens[0]);
+    }
+
+    return value;
+  },
+
+  program: function() {
+    var body = [];
+    while (true) {
+      if (this.tokens.length > 0 && !this.peek('}', ')', ';', ']'))
+        body.push(this.expressionStatement());
+      if (!this.expect(';')) {
+        return { type: AST.Program, body: body};
+      }
+    }
+  },
+
+  expressionStatement: function() {
+    return { type: AST.ExpressionStatement, expression: this.filterChain() };
+  },
+
+  filterChain: function() {
+    var left = this.expression();
+    var token;
+    while ((token = this.expect('|'))) {
+      left = this.filter(left);
+    }
+    return left;
+  },
+
+  expression: function() {
+    return this.assignment();
+  },
+
+  assignment: function() {
+    var result = this.ternary();
+    if (this.expect('=')) {
+      result = { type: AST.AssignmentExpression, left: result, right: this.assignment(), operator: '='};
+    }
+    return result;
+  },
+
+  ternary: function() {
+    var test = this.logicalOR();
+    var alternate;
+    var consequent;
+    if (this.expect('?')) {
+      alternate = this.expression();
+      if (this.consume(':')) {
+        consequent = this.expression();
+        return { type: AST.ConditionalExpression, test: test, alternate: alternate, consequent: consequent};
+      }
+    }
+    return test;
+  },
+
+  logicalOR: function() {
+    var left = this.logicalAND();
+    while (this.expect('||')) {
+      left = { type: AST.LogicalExpression, operator: '||', left: left, right: this.logicalAND() };
+    }
+    return left;
+  },
+
+  logicalAND: function() {
+    var left = this.equality();
+    while (this.expect('&&')) {
+      left = { type: AST.LogicalExpression, operator: '&&', left: left, right: this.equality()};
+    }
+    return left;
+  },
+
+  equality: function() {
+    var left = this.relational();
+    var token;
+    while ((token = this.expect('==','!=','===','!=='))) {
+      left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.relational() };
+    }
+    return left;
+  },
+
+  relational: function() {
+    var left = this.additive();
+    var token;
+    while ((token = this.expect('<', '>', '<=', '>='))) {
+      left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.additive() };
+    }
+    return left;
+  },
+
+  additive: function() {
+    var left = this.multiplicative();
+    var token;
+    while ((token = this.expect('+','-'))) {
+      left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.multiplicative() };
+    }
+    return left;
+  },
+
+  multiplicative: function() {
+    var left = this.unary();
+    var token;
+    while ((token = this.expect('*','/','%'))) {
+      left = { type: AST.BinaryExpression, operator: token.text, left: left, right: this.unary() };
+    }
+    return left;
+  },
+
+  unary: function() {
+    var token;
+    if ((token = this.expect('+', '-', '!'))) {
+      return { type: AST.UnaryExpression, operator: token.text, prefix: true, argument: this.unary() };
+    } else {
+      return this.primary();
+    }
+  },
+
+  primary: function() {
+    var primary;
+    if (this.expect('(')) {
+      primary = this.filterChain();
+      this.consume(')');
+    } else if (this.expect('[')) {
+      primary = this.arrayDeclaration();
+    } else if (this.expect('{')) {
+      primary = this.object();
+    } else if (this.selfReferential.hasOwnProperty(this.peek().text)) {
+      primary = copy(this.selfReferential[this.consume().text]);
+    } else if (this.options.literals.hasOwnProperty(this.peek().text)) {
+      primary = { type: AST.Literal, value: this.options.literals[this.consume().text]};
+    } else if (this.peek().identifier) {
+      primary = this.identifier();
+    } else if (this.peek().constant) {
+      primary = this.constant();
+    } else {
+      this.throwError('not a primary expression', this.peek());
+    }
+
+    var next;
+    while ((next = this.expect('(', '[', '.'))) {
+      if (next.text === '(') {
+        primary = {type: AST.CallExpression, callee: primary, arguments: this.parseArguments() };
+        this.consume(')');
+      } else if (next.text === '[') {
+        primary = { type: AST.MemberExpression, object: primary, property: this.expression(), computed: true };
+        this.consume(']');
+      } else if (next.text === '.') {
+        primary = { type: AST.MemberExpression, object: primary, property: this.identifier(), computed: false };
+      } else {
+        this.throwError('IMPOSSIBLE');
+      }
+    }
+    return primary;
+  },
+
+  filter: function(baseExpression) {
+    var args = [baseExpression];
+    var result = {type: AST.CallExpression, callee: this.identifier(), arguments: args, filter: true};
+
+    while (this.expect(':')) {
+      args.push(this.expression());
+    }
+
+    return result;
+  },
+
+  parseArguments: function() {
+    var args = [];
+    if (this.peekToken().text !== ')') {
+      do {
+        args.push(this.filterChain());
+      } while (this.expect(','));
+    }
+    return args;
+  },
+
+  identifier: function() {
+    var token = this.consume();
+    if (!token.identifier) {
+      this.throwError('is not a valid identifier', token);
+    }
+    return { type: AST.Identifier, name: token.text };
+  },
+
+  constant: function() {
+    // TODO check that it is a constant
+    return { type: AST.Literal, value: this.consume().value };
+  },
+
+  arrayDeclaration: function() {
+    var elements = [];
+    if (this.peekToken().text !== ']') {
+      do {
+        if (this.peek(']')) {
+          // Support trailing commas per ES5.1.
+          break;
+        }
+        elements.push(this.expression());
+      } while (this.expect(','));
+    }
+    this.consume(']');
+
+    return { type: AST.ArrayExpression, elements: elements };
+  },
+
+  object: function() {
+    var properties = [], property;
+    if (this.peekToken().text !== '}') {
+      do {
+        if (this.peek('}')) {
+          // Support trailing commas per ES5.1.
+          break;
+        }
+        property = {type: AST.Property, kind: 'init'};
+        if (this.peek().constant) {
+          property.key = this.constant();
+          property.computed = false;
+          this.consume(':');
+          property.value = this.expression();
+        } else if (this.peek().identifier) {
+          property.key = this.identifier();
+          property.computed = false;
+          if (this.peek(':')) {
+            this.consume(':');
+            property.value = this.expression();
+          } else {
+            property.value = property.key;
+          }
+        } else if (this.peek('[')) {
+          this.consume('[');
+          property.key = this.expression();
+          this.consume(']');
+          property.computed = true;
+          this.consume(':');
+          property.value = this.expression();
+        } else {
+          this.throwError("invalid key", this.peek());
+        }
+        properties.push(property);
+      } while (this.expect(','));
+    }
+    this.consume('}');
+
+    return {type: AST.ObjectExpression, properties: properties };
+  },
+
+  throwError: function(msg, token) {
+    throw $parseMinErr('syntax',
+        'Syntax Error: Token \'{0}\' {1} at column {2} of the expression [{3}] starting at [{4}].',
+          token.text, msg, (token.index + 1), this.text, this.text.substring(token.index));
+  },
+
+  consume: function(e1) {
+    if (this.tokens.length === 0) {
+      throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);
+    }
+
+    var token = this.expect(e1);
+    if (!token) {
+      this.throwError('is unexpected, expecting [' + e1 + ']', this.peek());
+    }
+    return token;
+  },
+
+  peekToken: function() {
+    if (this.tokens.length === 0) {
+      throw $parseMinErr('ueoe', 'Unexpected end of expression: {0}', this.text);
+    }
+    return this.tokens[0];
+  },
+
+  peek: function(e1, e2, e3, e4) {
+    return this.peekAhead(0, e1, e2, e3, e4);
+  },
+
+  peekAhead: function(i, e1, e2, e3, e4) {
+    if (this.tokens.length > i) {
+      var token = this.tokens[i];
+      var t = token.text;
+      if (t === e1 || t === e2 || t === e3 || t === e4 ||
+          (!e1 && !e2 && !e3 && !e4)) {
+        return token;
+      }
+    }
+    return false;
+  },
+
+  expect: function(e1, e2, e3, e4) {
+    var token = this.peek(e1, e2, e3, e4);
+    if (token) {
+      this.tokens.shift();
+      return token;
+    }
+    return false;
+  },
+
+  selfReferential: {
+    'this': {type: AST.ThisExpression },
+    '$locals': {type: AST.LocalsExpression }
+  }
+};
+
+function ifDefined(v, d) {
+  return typeof v !== 'undefined' ? v : d;
+}
+
+function plusFn(l, r) {
+  if (typeof l === 'undefined') return r;
+  if (typeof r === 'undefined') return l;
+  return l + r;
+}
+
+function isStateless($filter, filterName) {
+  var fn = $filter(filterName);
+  return !fn.$stateful;
+}
+
+function findConstantAndWatchExpressions(ast, $filter) {
+  var allConstants;
+  var argsToWatch;
+  switch (ast.type) {
+  case AST.Program:
+    allConstants = true;
+    forEach(ast.body, function(expr) {
+      findConstantAndWatchExpressions(expr.expression, $filter);
+      allConstants = allConstants && expr.expression.constant;
+    });
+    ast.constant = allConstants;
+    break;
+  case AST.Literal:
+    ast.constant = true;
+    ast.toWatch = [];
+    break;
+  case AST.UnaryExpression:
+    findConstantAndWatchExpressions(ast.argument, $filter);
+    ast.constant = ast.argument.constant;
+    ast.toWatch = ast.argument.toWatch;
+    break;
+  case AST.BinaryExpression:
+    findConstantAndWatchExpressions(ast.left, $filter);
+    findConstantAndWatchExpressions(ast.right, $filter);
+    ast.constant = ast.left.constant && ast.right.constant;
+    ast.toWatch = ast.left.toWatch.concat(ast.right.toWatch);
+    break;
+  case AST.LogicalExpression:
+    findConstantAndWatchExpressions(ast.left, $filter);
+    findConstantAndWatchExpressions(ast.right, $filter);
+    ast.constant = ast.left.constant && ast.right.constant;
+    ast.toWatch = ast.constant ? [] : [ast];
+    break;
+  case AST.ConditionalExpression:
+    findConstantAndWatchExpressions(ast.test, $filter);
+    findConstantAndWatchExpressions(ast.alternate, $filter);
+    findConstantAndWatchExpressions(ast.consequent, $filter);
+    ast.constant = ast.test.constant && ast.alternate.constant && ast.consequent.constant;
+    ast.toWatch = ast.constant ? [] : [ast];
+    break;
+  case AST.Identifier:
+    ast.constant = false;
+    ast.toWatch = [ast];
+    break;
+  case AST.MemberExpression:
+    findConstantAndWatchExpressions(ast.object, $filter);
+    if (ast.computed) {
+      findConstantAndWatchExpressions(ast.property, $filter);
+    }
+    ast.constant = ast.object.constant && (!ast.computed || ast.property.constant);
+    ast.toWatch = [ast];
+    break;
+  case AST.CallExpression:
+    allConstants = ast.filter ? isStateless($filter, ast.callee.name) : false;
+    argsToWatch = [];
+    forEach(ast.arguments, function(expr) {
+      findConstantAndWatchExpressions(expr, $filter);
+      allConstants = allConstants && expr.constant;
+      if (!expr.constant) {
+        argsToWatch.push.apply(argsToWatch, expr.toWatch);
+      }
+    });
+    ast.constant = allConstants;
+    ast.toWatch = ast.filter && isStateless($filter, ast.callee.name) ? argsToWatch : [ast];
+    break;
+  case AST.AssignmentExpression:
+    findConstantAndWatchExpressions(ast.left, $filter);
+    findConstantAndWatchExpressions(ast.right, $filter);
+    ast.constant = ast.left.constant && ast.right.constant;
+    ast.toWatch = [ast];
+    break;
+  case AST.ArrayExpression:
+    allConstants = true;
+    argsToWatch = [];
+    forEach(ast.elements, function(expr) {
+      findConstantAndWatchExpressions(expr, $filter);
+      allConstants = allConstants && expr.constant;
+      if (!expr.constant) {
+        argsToWatch.push.apply(argsToWatch, expr.toWatch);
+      }
+    });
+    ast.constant = allConstants;
+    ast.toWatch = argsToWatch;
+    break;
+  case AST.ObjectExpression:
+    allConstants = true;
+    argsToWatch = [];
+    forEach(ast.properties, function(property) {
+      findConstantAndWatchExpressions(property.value, $filter);
+      allConstants = allConstants && property.value.constant && !property.computed;
+      if (!property.value.constant) {
+        argsToWatch.push.apply(argsToWatch, property.value.toWatch);
+      }
+    });
+    ast.constant = allConstants;
+    ast.toWatch = argsToWatch;
+    break;
+  case AST.ThisExpression:
+    ast.constant = false;
+    ast.toWatch = [];
+    break;
+  case AST.LocalsExpression:
+    ast.constant = false;
+    ast.toWatch = [];
+    break;
+  }
+}
+
+function getInputs(body) {
+  if (body.length != 1) return;
+  var lastExpression = body[0].expression;
+  var candidate = lastExpression.toWatch;
+  if (candidate.length !== 1) return candidate;
+  return candidate[0] !== lastExpression ? candidate : undefined;
+}
+
+function isAssignable(ast) {
+  return ast.type === AST.Identifier || ast.type === AST.MemberExpression;
+}
+
+function assignableAST(ast) {
+  if (ast.body.length === 1 && isAssignable(ast.body[0].expression)) {
+    return {type: AST.AssignmentExpression, left: ast.body[0].expression, right: {type: AST.NGValueParameter}, operator: '='};
+  }
+}
+
+function isLiteral(ast) {
+  return ast.body.length === 0 ||
+      ast.body.length === 1 && (
+      ast.body[0].expression.type === AST.Literal ||
+      ast.body[0].expression.type === AST.ArrayExpression ||
+      ast.body[0].expression.type === AST.ObjectExpression);
+}
+
+function isConstant(ast) {
+  return ast.constant;
+}
+
+function ASTCompiler(astBuilder, $filter) {
+  this.astBuilder = astBuilder;
+  this.$filter = $filter;
+}
+
+ASTCompiler.prototype = {
+  compile: function(expression, expensiveChecks) {
+    var self = this;
+    var ast = this.astBuilder.ast(expression);
+    this.state = {
+      nextId: 0,
+      filters: {},
+      expensiveChecks: expensiveChecks,
+      fn: {vars: [], body: [], own: {}},
+      assign: {vars: [], body: [], own: {}},
+      inputs: []
+    };
+    findConstantAndWatchExpressions(ast, self.$filter);
+    var extra = '';
+    var assignable;
+    this.stage = 'assign';
+    if ((assignable = assignableAST(ast))) {
+      this.state.computing = 'assign';
+      var result = this.nextId();
+      this.recurse(assignable, result);
+      this.return_(result);
+      extra = 'fn.assign=' + this.generateFunction('assign', 's,v,l');
+    }
+    var toWatch = getInputs(ast.body);
+    self.stage = 'inputs';
+    forEach(toWatch, function(watch, key) {
+      var fnKey = 'fn' + key;
+      self.state[fnKey] = {vars: [], body: [], own: {}};
+      self.state.computing = fnKey;
+      var intoId = self.nextId();
+      self.recurse(watch, intoId);
+      self.return_(intoId);
+      self.state.inputs.push(fnKey);
+      watch.watchId = key;
+    });
+    this.state.computing = 'fn';
+    this.stage = 'main';
+    this.recurse(ast);
+    var fnString =
+      // The build and minification steps remove the string "use strict" from the code, but this is done using a regex.
+      // This is a workaround for this until we do a better job at only removing the prefix only when we should.
+      '"' + this.USE + ' ' + this.STRICT + '";\n' +
+      this.filterPrefix() +
+      'var fn=' + this.generateFunction('fn', 's,l,a,i') +
+      extra +
+      this.watchFns() +
+      'return fn;';
+
+    /* jshint -W054 */
+    var fn = (new Function('$filter',
+        'ensureSafeMemberName',
+        'ensureSafeObject',
+        'ensureSafeFunction',
+        'getStringValue',
+        'ensureSafeAssignContext',
+        'ifDefined',
+        'plus',
+        'text',
+        fnString))(
+          this.$filter,
+          ensureSafeMemberName,
+          ensureSafeObject,
+          ensureSafeFunction,
+          getStringValue,
+          ensureSafeAssignContext,
+          ifDefined,
+          plusFn,
+          expression);
+    /* jshint +W054 */
+    this.state = this.stage = undefined;
+    fn.literal = isLiteral(ast);
+    fn.constant = isConstant(ast);
+    return fn;
+  },
+
+  USE: 'use',
+
+  STRICT: 'strict',
+
+  watchFns: function() {
+    var result = [];
+    var fns = this.state.inputs;
+    var self = this;
+    forEach(fns, function(name) {
+      result.push('var ' + name + '=' + self.generateFunction(name, 's'));
+    });
+    if (fns.length) {
+      result.push('fn.inputs=[' + fns.join(',') + '];');
+    }
+    return result.join('');
+  },
+
+  generateFunction: function(name, params) {
+    return 'function(' + params + '){' +
+        this.varsPrefix(name) +
+        this.body(name) +
+        '};';
+  },
+
+  filterPrefix: function() {
+    var parts = [];
+    var self = this;
+    forEach(this.state.filters, function(id, filter) {
+      parts.push(id + '=$filter(' + self.escape(filter) + ')');
+    });
+    if (parts.length) return 'var ' + parts.join(',') + ';';
+    return '';
+  },
+
+  varsPrefix: function(section) {
+    return this.state[section].vars.length ? 'var ' + this.state[section].vars.join(',') + ';' : '';
+  },
+
+  body: function(section) {
+    return this.state[section].body.join('');
+  },
+
+  recurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {
+    var left, right, self = this, args, expression, computed;
+    recursionFn = recursionFn || noop;
+    if (!skipWatchIdCheck && isDefined(ast.watchId)) {
+      intoId = intoId || this.nextId();
+      this.if_('i',
+        this.lazyAssign(intoId, this.computedMember('i', ast.watchId)),
+        this.lazyRecurse(ast, intoId, nameId, recursionFn, create, true)
+      );
+      return;
+    }
+    switch (ast.type) {
+    case AST.Program:
+      forEach(ast.body, function(expression, pos) {
+        self.recurse(expression.expression, undefined, undefined, function(expr) { right = expr; });
+        if (pos !== ast.body.length - 1) {
+          self.current().body.push(right, ';');
+        } else {
+          self.return_(right);
+        }
+      });
+      break;
+    case AST.Literal:
+      expression = this.escape(ast.value);
+      this.assign(intoId, expression);
+      recursionFn(expression);
+      break;
+    case AST.UnaryExpression:
+      this.recurse(ast.argument, undefined, undefined, function(expr) { right = expr; });
+      expression = ast.operator + '(' + this.ifDefined(right, 0) + ')';
+      this.assign(intoId, expression);
+      recursionFn(expression);
+      break;
+    case AST.BinaryExpression:
+      this.recurse(ast.left, undefined, undefined, function(expr) { left = expr; });
+      this.recurse(ast.right, undefined, undefined, function(expr) { right = expr; });
+      if (ast.operator === '+') {
+        expression = this.plus(left, right);
+      } else if (ast.operator === '-') {
+        expression = this.ifDefined(left, 0) + ast.operator + this.ifDefined(right, 0);
+      } else {
+        expression = '(' + left + ')' + ast.operator + '(' + right + ')';
+      }
+      this.assign(intoId, expression);
+      recursionFn(expression);
+      break;
+    case AST.LogicalExpression:
+      intoId = intoId || this.nextId();
+      self.recurse(ast.left, intoId);
+      self.if_(ast.operator === '&&' ? intoId : self.not(intoId), self.lazyRecurse(ast.right, intoId));
+      recursionFn(intoId);
+      break;
+    case AST.ConditionalExpression:
+      intoId = intoId || this.nextId();
+      self.recurse(ast.test, intoId);
+      self.if_(intoId, self.lazyRecurse(ast.alternate, intoId), self.lazyRecurse(ast.consequent, intoId));
+      recursionFn(intoId);
+      break;
+    case AST.Identifier:
+      intoId = intoId || this.nextId();
+      if (nameId) {
+        nameId.context = self.stage === 'inputs' ? 's' : this.assign(this.nextId(), this.getHasOwnProperty('l', ast.name) + '?l:s');
+        nameId.computed = false;
+        nameId.name = ast.name;
+      }
+      ensureSafeMemberName(ast.name);
+      self.if_(self.stage === 'inputs' || self.not(self.getHasOwnProperty('l', ast.name)),
+        function() {
+          self.if_(self.stage === 'inputs' || 's', function() {
+            if (create && create !== 1) {
+              self.if_(
+                self.not(self.nonComputedMember('s', ast.name)),
+                self.lazyAssign(self.nonComputedMember('s', ast.name), '{}'));
+            }
+            self.assign(intoId, self.nonComputedMember('s', ast.name));
+          });
+        }, intoId && self.lazyAssign(intoId, self.nonComputedMember('l', ast.name))
+        );
+      if (self.state.expensiveChecks || isPossiblyDangerousMemberName(ast.name)) {
+        self.addEnsureSafeObject(intoId);
+      }
+      recursionFn(intoId);
+      break;
+    case AST.MemberExpression:
+      left = nameId && (nameId.context = this.nextId()) || this.nextId();
+      intoId = intoId || this.nextId();
+      self.recurse(ast.object, left, undefined, function() {
+        self.if_(self.notNull(left), function() {
+          if (create && create !== 1) {
+            self.addEnsureSafeAssignContext(left);
+          }
+          if (ast.computed) {
+            right = self.nextId();
+            self.recurse(ast.property, right);
+            self.getStringValue(right);
+            self.addEnsureSafeMemberName(right);
+            if (create && create !== 1) {
+              self.if_(self.not(self.computedMember(left, right)), self.lazyAssign(self.computedMember(left, right), '{}'));
+            }
+            expression = self.ensureSafeObject(self.computedMember(left, right));
+            self.assign(intoId, expression);
+            if (nameId) {
+              nameId.computed = true;
+              nameId.name = right;
+            }
+          } else {
+            ensureSafeMemberName(ast.property.name);
+            if (create && create !== 1) {
+              self.if_(self.not(self.nonComputedMember(left, ast.property.name)), self.lazyAssign(self.nonComputedMember(left, ast.property.name), '{}'));
+            }
+            expression = self.nonComputedMember(left, ast.property.name);
+            if (self.state.expensiveChecks || isPossiblyDangerousMemberName(ast.property.name)) {
+              expression = self.ensureSafeObject(expression);
+            }
+            self.assign(intoId, expression);
+            if (nameId) {
+              nameId.computed = false;
+              nameId.name = ast.property.name;
+            }
+          }
+        }, function() {
+          self.assign(intoId, 'undefined');
+        });
+        recursionFn(intoId);
+      }, !!create);
+      break;
+    case AST.CallExpression:
+      intoId = intoId || this.nextId();
+      if (ast.filter) {
+        right = self.filter(ast.callee.name);
+        args = [];
+        forEach(ast.arguments, function(expr) {
+          var argument = self.nextId();
+          self.recurse(expr, argument);
+          args.push(argument);
+        });
+        expression = right + '(' + args.join(',') + ')';
+        self.assign(intoId, expression);
+        recursionFn(intoId);
+      } else {
+        right = self.nextId();
+        left = {};
+        args = [];
+        self.recurse(ast.callee, right, left, function() {
+          self.if_(self.notNull(right), function() {
+            self.addEnsureSafeFunction(right);
+            forEach(ast.arguments, function(expr) {
+              self.recurse(expr, self.nextId(), undefined, function(argument) {
+                args.push(self.ensureSafeObject(argument));
+              });
+            });
+            if (left.name) {
+              if (!self.state.expensiveChecks) {
+                self.addEnsureSafeObject(left.context);
+              }
+              expression = self.member(left.context, left.name, left.computed) + '(' + args.join(',') + ')';
+            } else {
+              expression = right + '(' + args.join(',') + ')';
+            }
+            expression = self.ensureSafeObject(expression);
+            self.assign(intoId, expression);
+          }, function() {
+            self.assign(intoId, 'undefined');
+          });
+          recursionFn(intoId);
+        });
+      }
+      break;
+    case AST.AssignmentExpression:
+      right = this.nextId();
+      left = {};
+      if (!isAssignable(ast.left)) {
+        throw $parseMinErr('lval', 'Trying to assign a value to a non l-value');
+      }
+      this.recurse(ast.left, undefined, left, function() {
+        self.if_(self.notNull(left.context), function() {
+          self.recurse(ast.right, right);
+          self.addEnsureSafeObject(self.member(left.context, left.name, left.computed));
+          self.addEnsureSafeAssignContext(left.context);
+          expression = self.member(left.context, left.name, left.computed) + ast.operator + right;
+          self.assign(intoId, expression);
+          recursionFn(intoId || expression);
+        });
+      }, 1);
+      break;
+    case AST.ArrayExpression:
+      args = [];
+      forEach(ast.elements, function(expr) {
+        self.recurse(expr, self.nextId(), undefined, function(argument) {
+          args.push(argument);
+        });
+      });
+      expression = '[' + args.join(',') + ']';
+      this.assign(intoId, expression);
+      recursionFn(expression);
+      break;
+    case AST.ObjectExpression:
+      args = [];
+      computed = false;
+      forEach(ast.properties, function(property) {
+        if (property.computed) {
+          computed = true;
+        }
+      });
+      if (computed) {
+        intoId = intoId || this.nextId();
+        this.assign(intoId, '{}');
+        forEach(ast.properties, function(property) {
+          if (property.computed) {
+            left = self.nextId();
+            self.recurse(property.key, left);
+          } else {
+            left = property.key.type === AST.Identifier ?
+                       property.key.name :
+                       ('' + property.key.value);
+          }
+          right = self.nextId();
+          self.recurse(property.value, right);
+          self.assign(self.member(intoId, left, property.computed), right);
+        });
+      } else {
+        forEach(ast.properties, function(property) {
+          self.recurse(property.value, ast.constant ? undefined : self.nextId(), undefined, function(expr) {
+            args.push(self.escape(
+                property.key.type === AST.Identifier ? property.key.name :
+                  ('' + property.key.value)) +
+                ':' + expr);
+          });
+        });
+        expression = '{' + args.join(',') + '}';
+        this.assign(intoId, expression);
+      }
+      recursionFn(intoId || expression);
+      break;
+    case AST.ThisExpression:
+      this.assign(intoId, 's');
+      recursionFn('s');
+      break;
+    case AST.LocalsExpression:
+      this.assign(intoId, 'l');
+      recursionFn('l');
+      break;
+    case AST.NGValueParameter:
+      this.assign(intoId, 'v');
+      recursionFn('v');
+      break;
+    }
+  },
+
+  getHasOwnProperty: function(element, property) {
+    var key = element + '.' + property;
+    var own = this.current().own;
+    if (!own.hasOwnProperty(key)) {
+      own[key] = this.nextId(false, element + '&&(' + this.escape(property) + ' in ' + element + ')');
+    }
+    return own[key];
+  },
+
+  assign: function(id, value) {
+    if (!id) return;
+    this.current().body.push(id, '=', value, ';');
+    return id;
+  },
+
+  filter: function(filterName) {
+    if (!this.state.filters.hasOwnProperty(filterName)) {
+      this.state.filters[filterName] = this.nextId(true);
+    }
+    return this.state.filters[filterName];
+  },
+
+  ifDefined: function(id, defaultValue) {
+    return 'ifDefined(' + id + ',' + this.escape(defaultValue) + ')';
+  },
+
+  plus: function(left, right) {
+    return 'plus(' + left + ',' + right + ')';
+  },
+
+  return_: function(id) {
+    this.current().body.push('return ', id, ';');
+  },
+
+  if_: function(test, alternate, consequent) {
+    if (test === true) {
+      alternate();
+    } else {
+      var body = this.current().body;
+      body.push('if(', test, '){');
+      alternate();
+      body.push('}');
+      if (consequent) {
+        body.push('else{');
+        consequent();
+        body.push('}');
+      }
+    }
+  },
+
+  not: function(expression) {
+    return '!(' + expression + ')';
+  },
+
+  notNull: function(expression) {
+    return expression + '!=null';
+  },
+
+  nonComputedMember: function(left, right) {
+    var SAFE_IDENTIFIER = /[$_a-zA-Z][$_a-zA-Z0-9]*/;
+    var UNSAFE_CHARACTERS = /[^$_a-zA-Z0-9]/g;
+    if (SAFE_IDENTIFIER.test(right)) {
+      return left + '.' + right;
+    } else {
+      return left  + '["' + right.replace(UNSAFE_CHARACTERS, this.stringEscapeFn) + '"]';
+    }
+  },
+
+  computedMember: function(left, right) {
+    return left + '[' + right + ']';
+  },
+
+  member: function(left, right, computed) {
+    if (computed) return this.computedMember(left, right);
+    return this.nonComputedMember(left, right);
+  },
+
+  addEnsureSafeObject: function(item) {
+    this.current().body.push(this.ensureSafeObject(item), ';');
+  },
+
+  addEnsureSafeMemberName: function(item) {
+    this.current().body.push(this.ensureSafeMemberName(item), ';');
+  },
+
+  addEnsureSafeFunction: function(item) {
+    this.current().body.push(this.ensureSafeFunction(item), ';');
+  },
+
+  addEnsureSafeAssignContext: function(item) {
+    this.current().body.push(this.ensureSafeAssignContext(item), ';');
+  },
+
+  ensureSafeObject: function(item) {
+    return 'ensureSafeObject(' + item + ',text)';
+  },
+
+  ensureSafeMemberName: function(item) {
+    return 'ensureSafeMemberName(' + item + ',text)';
+  },
+
+  ensureSafeFunction: function(item) {
+    return 'ensureSafeFunction(' + item + ',text)';
+  },
+
+  getStringValue: function(item) {
+    this.assign(item, 'getStringValue(' + item + ')');
+  },
+
+  ensureSafeAssignContext: function(item) {
+    return 'ensureSafeAssignContext(' + item + ',text)';
+  },
+
+  lazyRecurse: function(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck) {
+    var self = this;
+    return function() {
+      self.recurse(ast, intoId, nameId, recursionFn, create, skipWatchIdCheck);
+    };
+  },
+
+  lazyAssign: function(id, value) {
+    var self = this;
+    return function() {
+      self.assign(id, value);
+    };
+  },
+
+  stringEscapeRegex: /[^ a-zA-Z0-9]/g,
+
+  stringEscapeFn: function(c) {
+    return '\\u' + ('0000' + c.charCodeAt(0).toString(16)).slice(-4);
+  },
+
+  escape: function(value) {
+    if (isString(value)) return "'" + value.replace(this.stringEscapeRegex, this.stringEscapeFn) + "'";
+    if (isNumber(value)) return value.toString();
+    if (value === true) return 'true';
+    if (value === false) return 'false';
+    if (value === null) return 'null';
+    if (typeof value === 'undefined') return 'undefined';
+
+    throw $parseMinErr('esc', 'IMPOSSIBLE');
+  },
+
+  nextId: function(skip, init) {
+    var id = 'v' + (this.state.nextId++);
+    if (!skip) {
+      this.current().vars.push(id + (init ? '=' + init : ''));
+    }
+    return id;
+  },
+
+  current: function() {
+    return this.state[this.state.computing];
+  }
+};
+
+
+function ASTInterpreter(astBuilder, $filter) {
+  this.astBuilder = astBuilder;
+  this.$filter = $filter;
+}
+
+ASTInterpreter.prototype = {
+  compile: function(expression, expensiveChecks) {
+    var self = this;
+    var ast = this.astBuilder.ast(expression);
+    this.expression = expression;
+    this.expensiveChecks = expensiveChecks;
+    findConstantAndWatchExpressions(ast, self.$filter);
+    var assignable;
+    var assign;
+    if ((assignable = assignableAST(ast))) {
+      assign = this.recurse(assignable);
+    }
+    var toWatch = getInputs(ast.body);
+    var inputs;
+    if (toWatch) {
+      inputs = [];
+      forEach(toWatch, function(watch, key) {
+        var input = self.recurse(watch);
+        watch.input = input;
+        inputs.push(input);
+        watch.watchId = key;
+      });
+    }
+    var expressions = [];
+    forEach(ast.body, function(expression) {
+      expressions.push(self.recurse(expression.expression));
+    });
+    var fn = ast.body.length === 0 ? noop :
+             ast.body.length === 1 ? expressions[0] :
+             function(scope, locals) {
+               var lastValue;
+               forEach(expressions, function(exp) {
+                 lastValue = exp(scope, locals);
+               });
+               return lastValue;
+             };
+    if (assign) {
+      fn.assign = function(scope, value, locals) {
+        return assign(scope, locals, value);
+      };
+    }
+    if (inputs) {
+      fn.inputs = inputs;
+    }
+    fn.literal = isLiteral(ast);
+    fn.constant = isConstant(ast);
+    return fn;
+  },
+
+  recurse: function(ast, context, create) {
+    var left, right, self = this, args, expression;
+    if (ast.input) {
+      return this.inputs(ast.input, ast.watchId);
+    }
+    switch (ast.type) {
+    case AST.Literal:
+      return this.value(ast.value, context);
+    case AST.UnaryExpression:
+      right = this.recurse(ast.argument);
+      return this['unary' + ast.operator](right, context);
+    case AST.BinaryExpression:
+      left = this.recurse(ast.left);
+      right = this.recurse(ast.right);
+      return this['binary' + ast.operator](left, right, context);
+    case AST.LogicalExpression:
+      left = this.recurse(ast.left);
+      right = this.recurse(ast.right);
+      return this['binary' + ast.operator](left, right, context);
+    case AST.ConditionalExpression:
+      return this['ternary?:'](
+        this.recurse(ast.test),
+        this.recurse(ast.alternate),
+        this.recurse(ast.consequent),
+        context
+      );
+    case AST.Identifier:
+      ensureSafeMemberName(ast.name, self.expression);
+      return self.identifier(ast.name,
+                             self.expensiveChecks || isPossiblyDangerousMemberName(ast.name),
+                             context, create, self.expression);
+    case AST.MemberExpression:
+      left = this.recurse(ast.object, false, !!create);
+      if (!ast.computed) {
+        ensureSafeMemberName(ast.property.name, self.expression);
+        right = ast.property.name;
+      }
+      if (ast.computed) right = this.recurse(ast.property);
+      return ast.computed ?
+        this.computedMember(left, right, context, create, self.expression) :
+        this.nonComputedMember(left, right, self.expensiveChecks, context, create, self.expression);
+    case AST.CallExpression:
+      args = [];
+      forEach(ast.arguments, function(expr) {
+        args.push(self.recurse(expr));
+      });
+      if (ast.filter) right = this.$filter(ast.callee.name);
+      if (!ast.filter) right = this.recurse(ast.callee, true);
+      return ast.filter ?
+        function(scope, locals, assign, inputs) {
+          var values = [];
+          for (var i = 0; i < args.length; ++i) {
+            values.push(args[i](scope, locals, assign, inputs));
+          }
+          var value = right.apply(undefined, values, inputs);
+          return context ? {context: undefined, name: undefined, value: value} : value;
+        } :
+        function(scope, locals, assign, inputs) {
+          var rhs = right(scope, locals, assign, inputs);
+          var value;
+          if (rhs.value != null) {
+            ensureSafeObject(rhs.context, self.expression);
+            ensureSafeFunction(rhs.value, self.expression);
+            var values = [];
+            for (var i = 0; i < args.length; ++i) {
+              values.push(ensureSafeObject(args[i](scope, locals, assign, inputs), self.expression));
+            }
+            value = ensureSafeObject(rhs.value.apply(rhs.context, values), self.expression);
+          }
+          return context ? {value: value} : value;
+        };
+    case AST.AssignmentExpression:
+      left = this.recurse(ast.left, true, 1);
+      right = this.recurse(ast.right);
+      return function(scope, locals, assign, inputs) {
+        var lhs = left(scope, locals, assign, inputs);
+        var rhs = right(scope, locals, assign, inputs);
+        ensureSafeObject(lhs.value, self.expression);
+        ensureSafeAssignContext(lhs.context);
+        lhs.context[lhs.name] = rhs;
+        return context ? {value: rhs} : rhs;
+      };
+    case AST.ArrayExpression:
+      args = [];
+      forEach(ast.elements, function(expr) {
+        args.push(self.recurse(expr));
+      });
+      return function(scope, locals, assign, inputs) {
+        var value = [];
+        for (var i = 0; i < args.length; ++i) {
+          value.push(args[i](scope, locals, assign, inputs));
+        }
+        return context ? {value: value} : value;
+      };
+    case AST.ObjectExpression:
+      args = [];
+      forEach(ast.properties, function(property) {
+        if (property.computed) {
+          args.push({key: self.recurse(property.key),
+                     computed: true,
+                     value: self.recurse(property.value)
+          });
+        } else {
+          args.push({key: property.key.type === AST.Identifier ?
+                          property.key.name :
+                          ('' + property.key.value),
+                     computed: false,
+                     value: self.recurse(property.value)
+          });
+        }
+      });
+      return function(scope, locals, assign, inputs) {
+        var value = {};
+        for (var i = 0; i < args.length; ++i) {
+          if (args[i].computed) {
+            value[args[i].key(scope, locals, assign, inputs)] = args[i].value(scope, locals, assign, inputs);
+          } else {
+            value[args[i].key] = args[i].value(scope, locals, assign, inputs);
+          }
+        }
+        return context ? {value: value} : value;
+      };
+    case AST.ThisExpression:
+      return function(scope) {
+        return context ? {value: scope} : scope;
+      };
+    case AST.LocalsExpression:
+      return function(scope, locals) {
+        return context ? {value: locals} : locals;
+      };
+    case AST.NGValueParameter:
+      return function(scope, locals, assign) {
+        return context ? {value: assign} : assign;
+      };
+    }
+  },
+
+  'unary+': function(argument, context) {
+    return function(scope, locals, assign, inputs) {
+      var arg = argument(scope, locals, assign, inputs);
+      if (isDefined(arg)) {
+        arg = +arg;
+      } else {
+        arg = 0;
+      }
+      return context ? {value: arg} : arg;
+    };
+  },
+  'unary-': function(argument, context) {
+    return function(scope, locals, assign, inputs) {
+      var arg = argument(scope, locals, assign, inputs);
+      if (isDefined(arg)) {
+        arg = -arg;
+      } else {
+        arg = 0;
+      }
+      return context ? {value: arg} : arg;
+    };
+  },
+  'unary!': function(argument, context) {
+    return function(scope, locals, assign, inputs) {
+      var arg = !argument(scope, locals, assign, inputs);
+      return context ? {value: arg} : arg;
+    };
+  },
+  'binary+': function(left, right, context) {
+    return function(scope, locals, assign, inputs) {
+      var lhs = left(scope, locals, assign, inputs);
+      var rhs = right(scope, locals, assign, inputs);
+      var arg = plusFn(lhs, rhs);
+      return context ? {value: arg} : arg;
+    };
+  },
+  'binary-': function(left, right, context) {
+    return function(scope, locals, assign, inputs) {
+      var lhs = left(scope, locals, assign, inputs);
+      var rhs = right(scope, locals, assign, inputs);
+      var arg = (isDefined(lhs) ? lhs : 0) - (isDefined(rhs) ? rhs : 0);
+      return context ? {value: arg} : arg;
+    };
+  },
+  'binary*': function(left, right, context) {
+    return function(scope, locals, assign, inputs) {
+      var arg = left(scope, locals, assign, inputs) * right(scope, locals, assign, inputs);
+      return context ? {value: arg} : arg;
+    };
+  },
+  'binary/': function(left, right, context) {
+    return function(scope, locals, assign, inputs) {
+      var arg = left(scope, locals, assign, inputs) / right(scope, locals, assign, inputs);
+      return context ? {value: arg} : arg;
+    };
+  },
+  'binary%': function(left, right, context) {
+    return function(scope, locals, assign, inputs) {
+      var arg = left(scope, locals, assign, inputs) % right(scope, locals, assign, inputs);
+      return context ? {value: arg} : arg;
+    };
+  },
+  'binary===': function(left, right, context) {
+    return function(scope, locals, assign, inputs) {
+      var arg = left(scope, locals, assign, inputs) === right(scope, locals, assign, inputs);
+      return context ? {value: arg} : arg;
+    };
+  },
+  'binary!==': function(left, right, context) {
+    return function(scope, locals, assign, inputs) {
+      var arg = left(scope, locals, assign, inputs) !== right(scope, locals, assign, inputs);
+      return context ? {value: arg} : arg;
+    };
+  },
+  'binary==': function(left, right, context) {
+    return function(scope, locals, assign, inputs) {
+      var arg = left(scope, locals, assign, inputs) == right(scope, locals, assign, inputs);
+      return context ? {value: arg} : arg;
+    };
+  },
+  'binary!=': function(left, right, context) {
+    return function(scope, locals, assign, inputs) {
+      var arg = left(scope, locals, assign, inputs) != right(scope, locals, assign, inputs);
+      return context ? {value: arg} : arg;
+    };
+  },
+  'binary<': function(left, right, context) {
+    return function(scope, locals, assign, inputs) {
+      var arg = left(scope, locals, assign, inputs) < right(scope, locals, assign, inputs);
+      return context ? {value: arg} : arg;
+    };
+  },
+  'binary>': function(left, right, context) {
+    return function(scope, locals, assign, inputs) {
+      var arg = left(scope, locals, assign, inputs) > right(scope, locals, assign, inputs);
+      return context ? {value: arg} : arg;
+    };
+  },
+  'binary<=': function(left, right, context) {
+    return function(scope, locals, assign, inputs) {
+      var arg = left(scope, locals, assign, inputs) <= right(scope, locals, assign, inputs);
+      return context ? {value: arg} : arg;
+    };
+  },
+  'binary>=': function(left, right, context) {
+    return function(scope, locals, assign, inputs) {
+      var arg = left(scope, locals, assign, inputs) >= right(scope, locals, assign, inputs);
+      return context ? {value: arg} : arg;
+    };
+  },
+  'binary&&': function(left, right, context) {
+    return function(scope, locals, assign, inputs) {
+      var arg = left(scope, locals, assign, inputs) && right(scope, locals, assign, inputs);
+      return context ? {value: arg} : arg;
+    };
+  },
+  'binary||': function(left, right, context) {
+    return function(scope, locals, assign, inputs) {
+      var arg = left(scope, locals, assign, inputs) || right(scope, locals, assign, inputs);
+      return context ? {value: arg} : arg;
+    };
+  },
+  'ternary?:': function(test, alternate, consequent, context) {
+    return function(scope, locals, assign, inputs) {
+      var arg = test(scope, locals, assign, inputs) ? alternate(scope, locals, assign, inputs) : consequent(scope, locals, assign, inputs);
+      return context ? {value: arg} : arg;
+    };
+  },
+  value: function(value, context) {
+    return function() { return context ? {context: undefined, name: undefined, value: value} : value; };
+  },
+  identifier: function(name, expensiveChecks, context, create, expression) {
+    return function(scope, locals, assign, inputs) {
+      var base = locals && (name in locals) ? locals : scope;
+      if (create && create !== 1 && base && !(base[name])) {
+        base[name] = {};
+      }
+      var value = base ? base[name] : undefined;
+      if (expensiveChecks) {
+        ensureSafeObject(value, expression);
+      }
+      if (context) {
+        return {context: base, name: name, value: value};
+      } else {
+        return value;
+      }
+    };
+  },
+  computedMember: function(left, right, context, create, expression) {
+    return function(scope, locals, assign, inputs) {
+      var lhs = left(scope, locals, assign, inputs);
+      var rhs;
+      var value;
+      if (lhs != null) {
+        rhs = right(scope, locals, assign, inputs);
+        rhs = getStringValue(rhs);
+        ensureSafeMemberName(rhs, expression);
+        if (create && create !== 1) {
+          ensureSafeAssignContext(lhs);
+          if (lhs && !(lhs[rhs])) {
+            lhs[rhs] = {};
+          }
+        }
+        value = lhs[rhs];
+        ensureSafeObject(value, expression);
+      }
+      if (context) {
+        return {context: lhs, name: rhs, value: value};
+      } else {
+        return value;
+      }
+    };
+  },
+  nonComputedMember: function(left, right, expensiveChecks, context, create, expression) {
+    return function(scope, locals, assign, inputs) {
+      var lhs = left(scope, locals, assign, inputs);
+      if (create && create !== 1) {
+        ensureSafeAssignContext(lhs);
+        if (lhs && !(lhs[right])) {
+          lhs[right] = {};
+        }
+      }
+      var value = lhs != null ? lhs[right] : undefined;
+      if (expensiveChecks || isPossiblyDangerousMemberName(right)) {
+        ensureSafeObject(value, expression);
+      }
+      if (context) {
+        return {context: lhs, name: right, value: value};
+      } else {
+        return value;
+      }
+    };
+  },
+  inputs: function(input, watchId) {
+    return function(scope, value, locals, inputs) {
+      if (inputs) return inputs[watchId];
+      return input(scope, value, locals);
+    };
+  }
+};
+
+/**
+ * @constructor
+ */
+var Parser = function(lexer, $filter, options) {
+  this.lexer = lexer;
+  this.$filter = $filter;
+  this.options = options;
+  this.ast = new AST(lexer, options);
+  this.astCompiler = options.csp ? new ASTInterpreter(this.ast, $filter) :
+                                   new ASTCompiler(this.ast, $filter);
+};
+
+Parser.prototype = {
+  constructor: Parser,
+
+  parse: function(text) {
+    return this.astCompiler.compile(text, this.options.expensiveChecks);
+  }
+};
+
+function isPossiblyDangerousMemberName(name) {
+  return name == 'constructor';
+}
+
+var objectValueOf = Object.prototype.valueOf;
+
+function getValueOf(value) {
+  return isFunction(value.valueOf) ? value.valueOf() : objectValueOf.call(value);
+}
+
+///////////////////////////////////
+
+/**
+ * @ngdoc service
+ * @name $parse
+ * @kind function
+ *
+ * @description
+ *
+ * Converts Angular {@link guide/expression expression} into a function.
+ *
+ * ```js
+ *   var getter = $parse('user.name');
+ *   var setter = getter.assign;
+ *   var context = {user:{name:'angular'}};
+ *   var locals = {user:{name:'local'}};
+ *
+ *   expect(getter(context)).toEqual('angular');
+ *   setter(context, 'newValue');
+ *   expect(context.user.name).toEqual('newValue');
+ *   expect(getter(context, locals)).toEqual('local');
+ * ```
+ *
+ *
+ * @param {string} expression String expression to compile.
+ * @returns {function(context, locals)} a function which represents the compiled expression:
+ *
+ *    * `context` – `{object}` – an object against which any expressions embedded in the strings
+ *      are evaluated against (typically a scope object).
+ *    * `locals` – `{object=}` – local variables context object, useful for overriding values in
+ *      `context`.
+ *
+ *    The returned function also has the following properties:
+ *      * `literal` – `{boolean}` – whether the expression's top-level node is a JavaScript
+ *        literal.
+ *      * `constant` – `{boolean}` – whether the expression is made entirely of JavaScript
+ *        constant literals.
+ *      * `assign` – `{?function(context, value)}` – if the expression is assignable, this will be
+ *        set to a function to change its value on the given context.
+ *
+ */
+
+
+/**
+ * @ngdoc provider
+ * @name $parseProvider
+ *
+ * @description
+ * `$parseProvider` can be used for configuring the default behavior of the {@link ng.$parse $parse}
+ *  service.
+ */
+function $ParseProvider() {
+  var cacheDefault = createMap();
+  var cacheExpensive = createMap();
+  var literals = {
+    'true': true,
+    'false': false,
+    'null': null,
+    'undefined': undefined
+  };
+  var identStart, identContinue;
+
+  /**
+   * @ngdoc method
+   * @name $parseProvider#addLiteral
+   * @description
+   *
+   * Configure $parse service to add literal values that will be present as literal at expressions.
+   *
+   * @param {string} literalName Token for the literal value. The literal name value must be a valid literal name.
+   * @param {*} literalValue Value for this literal. All literal values must be primitives or `undefined`.
+   *
+   **/
+  this.addLiteral = function(literalName, literalValue) {
+    literals[literalName] = literalValue;
+  };
+
+ /**
+  * @ngdoc method
+  * @name $parseProvider#setIdentifierFns
+  * @description
+  *
+  * Allows defining the set of characters that are allowed in Angular expressions. The function
+  * `identifierStart` will get called to know if a given character is a valid character to be the
+  * first character for an identifier. The function `identifierContinue` will get called to know if
+  * a given character is a valid character to be a follow-up identifier character. The functions
+  * `identifierStart` and `identifierContinue` will receive as arguments the single character to be
+  * identifier and the character code point. These arguments will be `string` and `numeric`. Keep in
+  * mind that the `string` parameter can be two characters long depending on the character
+  * representation. It is expected for the function to return `true` or `false`, whether that
+  * character is allowed or not.
+  *
+  * Since this function will be called extensivelly, keep the implementation of these functions fast,
+  * as the performance of these functions have a direct impact on the expressions parsing speed.
+  *
+  * @param {function=} identifierStart The function that will decide whether the given character is
+  *   a valid identifier start character.
+  * @param {function=} identifierContinue The function that will decide whether the given character is
+  *   a valid identifier continue character.
+  */
+  this.setIdentifierFns = function(identifierStart, identifierContinue) {
+    identStart = identifierStart;
+    identContinue = identifierContinue;
+    return this;
+  };
+
+  this.$get = ['$filter', function($filter) {
+    var noUnsafeEval = csp().noUnsafeEval;
+    var $parseOptions = {
+          csp: noUnsafeEval,
+          expensiveChecks: false,
+          literals: copy(literals),
+          isIdentifierStart: isFunction(identStart) && identStart,
+          isIdentifierContinue: isFunction(identContinue) && identContinue
+        },
+        $parseOptionsExpensive = {
+          csp: noUnsafeEval,
+          expensiveChecks: true,
+          literals: copy(literals),
+          isIdentifierStart: isFunction(identStart) && identStart,
+          isIdentifierContinue: isFunction(identContinue) && identContinue
+        };
+    var runningChecksEnabled = false;
+
+    $parse.$$runningExpensiveChecks = function() {
+      return runningChecksEnabled;
+    };
+
+    return $parse;
+
+    function $parse(exp, interceptorFn, expensiveChecks) {
+      var parsedExpression, oneTime, cacheKey;
+
+      expensiveChecks = expensiveChecks || runningChecksEnabled;
+
+      switch (typeof exp) {
+        case 'string':
+          exp = exp.trim();
+          cacheKey = exp;
+
+          var cache = (expensiveChecks ? cacheExpensive : cacheDefault);
+          parsedExpression = cache[cacheKey];
+
+          if (!parsedExpression) {
+            if (exp.charAt(0) === ':' && exp.charAt(1) === ':') {
+              oneTime = true;
+              exp = exp.substring(2);
+            }
+            var parseOptions = expensiveChecks ? $parseOptionsExpensive : $parseOptions;
+            var lexer = new Lexer(parseOptions);
+            var parser = new Parser(lexer, $filter, parseOptions);
+            parsedExpression = parser.parse(exp);
+            if (parsedExpression.constant) {
+              parsedExpression.$$watchDelegate = constantWatchDelegate;
+            } else if (oneTime) {
+              parsedExpression.$$watchDelegate = parsedExpression.literal ?
+                  oneTimeLiteralWatchDelegate : oneTimeWatchDelegate;
+            } else if (parsedExpression.inputs) {
+              parsedExpression.$$watchDelegate = inputsWatchDelegate;
+            }
+            if (expensiveChecks) {
+              parsedExpression = expensiveChecksInterceptor(parsedExpression);
+            }
+            cache[cacheKey] = parsedExpression;
+          }
+          return addInterceptor(parsedExpression, interceptorFn);
+
+        case 'function':
+          return addInterceptor(exp, interceptorFn);
+
+        default:
+          return addInterceptor(noop, interceptorFn);
+      }
+    }
+
+    function expensiveChecksInterceptor(fn) {
+      if (!fn) return fn;
+      expensiveCheckFn.$$watchDelegate = fn.$$watchDelegate;
+      expensiveCheckFn.assign = expensiveChecksInterceptor(fn.assign);
+      expensiveCheckFn.constant = fn.constant;
+      expensiveCheckFn.literal = fn.literal;
+      for (var i = 0; fn.inputs && i < fn.inputs.length; ++i) {
+        fn.inputs[i] = expensiveChecksInterceptor(fn.inputs[i]);
+      }
+      expensiveCheckFn.inputs = fn.inputs;
+
+      return expensiveCheckFn;
+
+      function expensiveCheckFn(scope, locals, assign, inputs) {
+        var expensiveCheckOldValue = runningChecksEnabled;
+        runningChecksEnabled = true;
+        try {
+          return fn(scope, locals, assign, inputs);
+        } finally {
+          runningChecksEnabled = expensiveCheckOldValue;
+        }
+      }
+    }
+
+    function expressionInputDirtyCheck(newValue, oldValueOfValue) {
+
+      if (newValue == null || oldValueOfValue == null) { // null/undefined
+        return newValue === oldValueOfValue;
+      }
+
+      if (typeof newValue === 'object') {
+
+        // attempt to convert the value to a primitive type
+        // TODO(docs): add a note to docs that by implementing valueOf even objects and arrays can
+        //             be cheaply dirty-checked
+        newValue = getValueOf(newValue);
+
+        if (typeof newValue === 'object') {
+          // objects/arrays are not supported - deep-watching them would be too expensive
+          return false;
+        }
+
+        // fall-through to the primitive equality check
+      }
+
+      //Primitive or NaN
+      return newValue === oldValueOfValue || (newValue !== newValue && oldValueOfValue !== oldValueOfValue);
+    }
+
+    function inputsWatchDelegate(scope, listener, objectEquality, parsedExpression, prettyPrintExpression) {
+      var inputExpressions = parsedExpression.inputs;
+      var lastResult;
+
+      if (inputExpressions.length === 1) {
+        var oldInputValueOf = expressionInputDirtyCheck; // init to something unique so that equals check fails
+        inputExpressions = inputExpressions[0];
+        return scope.$watch(function expressionInputWatch(scope) {
+          var newInputValue = inputExpressions(scope);
+          if (!expressionInputDirtyCheck(newInputValue, oldInputValueOf)) {
+            lastResult = parsedExpression(scope, undefined, undefined, [newInputValue]);
+            oldInputValueOf = newInputValue && getValueOf(newInputValue);
+          }
+          return lastResult;
+        }, listener, objectEquality, prettyPrintExpression);
+      }
+
+      var oldInputValueOfValues = [];
+      var oldInputValues = [];
+      for (var i = 0, ii = inputExpressions.length; i < ii; i++) {
+        oldInputValueOfValues[i] = expressionInputDirtyCheck; // init to something unique so that equals check fails
+        oldInputValues[i] = null;
+      }
+
+      return scope.$watch(function expressionInputsWatch(scope) {
+        var changed = false;
+
+        for (var i = 0, ii = inputExpressions.length; i < ii; i++) {
+          var newInputValue = inputExpressions[i](scope);
+          if (changed || (changed = !expressionInputDirtyCheck(newInputValue, oldInputValueOfValues[i]))) {
+            oldInputValues[i] = newInputValue;
+            oldInputValueOfValues[i] = newInputValue && getValueOf(newInputValue);
+          }
+        }
+
+        if (changed) {
+          lastResult = parsedExpression(scope, undefined, undefined, oldInputValues);
+        }
+
+        return lastResult;
+      }, listener, objectEquality, prettyPrintExpression);
+    }
+
+    function oneTimeWatchDelegate(scope, listener, objectEquality, parsedExpression) {
+      var unwatch, lastValue;
+      return unwatch = scope.$watch(function oneTimeWatch(scope) {
+        return parsedExpression(scope);
+      }, function oneTimeListener(value, old, scope) {
+        lastValue = value;
+        if (isFunction(listener)) {
+          listener.apply(this, arguments);
+        }
+        if (isDefined(value)) {
+          scope.$$postDigest(function() {
+            if (isDefined(lastValue)) {
+              unwatch();
+            }
+          });
+        }
+      }, objectEquality);
+    }
+
+    function oneTimeLiteralWatchDelegate(scope, listener, objectEquality, parsedExpression) {
+      var unwatch, lastValue;
+      return unwatch = scope.$watch(function oneTimeWatch(scope) {
+        return parsedExpression(scope);
+      }, function oneTimeListener(value, old, scope) {
+        lastValue = value;
+        if (isFunction(listener)) {
+          listener.call(this, value, old, scope);
+        }
+        if (isAllDefined(value)) {
+          scope.$$postDigest(function() {
+            if (isAllDefined(lastValue)) unwatch();
+          });
+        }
+      }, objectEquality);
+
+      function isAllDefined(value) {
+        var allDefined = true;
+        forEach(value, function(val) {
+          if (!isDefined(val)) allDefined = false;
+        });
+        return allDefined;
+      }
+    }
+
+    function constantWatchDelegate(scope, listener, objectEquality, parsedExpression) {
+      var unwatch;
+      return unwatch = scope.$watch(function constantWatch(scope) {
+        unwatch();
+        return parsedExpression(scope);
+      }, listener, objectEquality);
+    }
+
+    function addInterceptor(parsedExpression, interceptorFn) {
+      if (!interceptorFn) return parsedExpression;
+      var watchDelegate = parsedExpression.$$watchDelegate;
+      var useInputs = false;
+
+      var regularWatch =
+          watchDelegate !== oneTimeLiteralWatchDelegate &&
+          watchDelegate !== oneTimeWatchDelegate;
+
+      var fn = regularWatch ? function regularInterceptedExpression(scope, locals, assign, inputs) {
+        var value = useInputs && inputs ? inputs[0] : parsedExpression(scope, locals, assign, inputs);
+        return interceptorFn(value, scope, locals);
+      } : function oneTimeInterceptedExpression(scope, locals, assign, inputs) {
+        var value = parsedExpression(scope, locals, assign, inputs);
+        var result = interceptorFn(value, scope, locals);
+        // we only return the interceptor's result if the
+        // initial value is defined (for bind-once)
+        return isDefined(value) ? result : value;
+      };
+
+      // Propagate $$watchDelegates other then inputsWatchDelegate
+      if (parsedExpression.$$watchDelegate &&
+          parsedExpression.$$watchDelegate !== inputsWatchDelegate) {
+        fn.$$watchDelegate = parsedExpression.$$watchDelegate;
+      } else if (!interceptorFn.$stateful) {
+        // If there is an interceptor, but no watchDelegate then treat the interceptor like
+        // we treat filters - it is assumed to be a pure function unless flagged with $stateful
+        fn.$$watchDelegate = inputsWatchDelegate;
+        useInputs = !parsedExpression.inputs;
+        fn.inputs = parsedExpression.inputs ? parsedExpression.inputs : [parsedExpression];
+      }
+
+      return fn;
+    }
+  }];
+}
+
+/**
+ * @ngdoc service
+ * @name $q
+ * @requires $rootScope
+ *
+ * @description
+ * A service that helps you run functions asynchronously, and use their return values (or exceptions)
+ * when they are done processing.
+ *
+ * This is an implementation of promises/deferred objects inspired by
+ * [Kris Kowal's Q](https://github.com/kriskowal/q).
+ *
+ * $q can be used in two fashions --- one which is more similar to Kris Kowal's Q or jQuery's Deferred
+ * implementations, and the other which resembles ES6 (ES2015) promises to some degree.
+ *
+ * # $q constructor
+ *
+ * The streamlined ES6 style promise is essentially just using $q as a constructor which takes a `resolver`
+ * function as the first argument. This is similar to the native Promise implementation from ES6,
+ * see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise).
+ *
+ * While the constructor-style use is supported, not all of the supporting methods from ES6 promises are
+ * available yet.
+ *
+ * It can be used like so:
+ *
+ * ```js
+ *   // for the purpose of this example let's assume that variables `$q` and `okToGreet`
+ *   // are available in the current lexical scope (they could have been injected or passed in).
+ *
+ *   function asyncGreet(name) {
+ *     // perform some asynchronous operation, resolve or reject the promise when appropriate.
+ *     return $q(function(resolve, reject) {
+ *       setTimeout(function() {
+ *         if (okToGreet(name)) {
+ *           resolve('Hello, ' + name + '!');
+ *         } else {
+ *           reject('Greeting ' + name + ' is not allowed.');
+ *         }
+ *       }, 1000);
+ *     });
+ *   }
+ *
+ *   var promise = asyncGreet('Robin Hood');
+ *   promise.then(function(greeting) {
+ *     alert('Success: ' + greeting);
+ *   }, function(reason) {
+ *     alert('Failed: ' + reason);
+ *   });
+ * ```
+ *
+ * Note: progress/notify callbacks are not currently supported via the ES6-style interface.
+ *
+ * Note: unlike ES6 behavior, an exception thrown in the constructor function will NOT implicitly reject the promise.
+ *
+ * However, the more traditional CommonJS-style usage is still available, and documented below.
+ *
+ * [The CommonJS Promise proposal](http://wiki.commonjs.org/wiki/Promises) describes a promise as an
+ * interface for interacting with an object that represents the result of an action that is
+ * performed asynchronously, and may or may not be finished at any given point in time.
+ *
+ * From the perspective of dealing with error handling, deferred and promise APIs are to
+ * asynchronous programming what `try`, `catch` and `throw` keywords are to synchronous programming.
+ *
+ * ```js
+ *   // for the purpose of this example let's assume that variables `$q` and `okToGreet`
+ *   // are available in the current lexical scope (they could have been injected or passed in).
+ *
+ *   function asyncGreet(name) {
+ *     var deferred = $q.defer();
+ *
+ *     setTimeout(function() {
+ *       deferred.notify('About to greet ' + name + '.');
+ *
+ *       if (okToGreet(name)) {
+ *         deferred.resolve('Hello, ' + name + '!');
+ *       } else {
+ *         deferred.reject('Greeting ' + name + ' is not allowed.');
+ *       }
+ *     }, 1000);
+ *
+ *     return deferred.promise;
+ *   }
+ *
+ *   var promise = asyncGreet('Robin Hood');
+ *   promise.then(function(greeting) {
+ *     alert('Success: ' + greeting);
+ *   }, function(reason) {
+ *     alert('Failed: ' + reason);
+ *   }, function(update) {
+ *     alert('Got notification: ' + update);
+ *   });
+ * ```
+ *
+ * At first it might not be obvious why this extra complexity is worth the trouble. The payoff
+ * comes in the way of guarantees that promise and deferred APIs make, see
+ * https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md.
+ *
+ * Additionally the promise api allows for composition that is very hard to do with the
+ * traditional callback ([CPS](http://en.wikipedia.org/wiki/Continuation-passing_style)) approach.
+ * For more on this please see the [Q documentation](https://github.com/kriskowal/q) especially the
+ * section on serial or parallel joining of promises.
+ *
+ * # The Deferred API
+ *
+ * A new instance of deferred is constructed by calling `$q.defer()`.
+ *
+ * The purpose of the deferred object is to expose the associated Promise instance as well as APIs
+ * that can be used for signaling the successful or unsuccessful completion, as well as the status
+ * of the task.
+ *
+ * **Methods**
+ *
+ * - `resolve(value)` – resolves the derived promise with the `value`. If the value is a rejection
+ *   constructed via `$q.reject`, the promise will be rejected instead.
+ * - `reject(reason)` – rejects the derived promise with the `reason`. This is equivalent to
+ *   resolving it with a rejection constructed via `$q.reject`.
+ * - `notify(value)` - provides updates on the status of the promise's execution. This may be called
+ *   multiple times before the promise is either resolved or rejected.
+ *
+ * **Properties**
+ *
+ * - promise – `{Promise}` – promise object associated with this deferred.
+ *
+ *
+ * # The Promise API
+ *
+ * A new promise instance is created when a deferred instance is created and can be retrieved by
+ * calling `deferred.promise`.
+ *
+ * The purpose of the promise object is to allow for interested parties to get access to the result
+ * of the deferred task when it completes.
+ *
+ * **Methods**
+ *
+ * - `then(successCallback, [errorCallback], [notifyCallback])` – regardless of when the promise was or
+ *   will be resolved or rejected, `then` calls one of the success or error callbacks asynchronously
+ *   as soon as the result is available. The callbacks are called with a single argument: the result
+ *   or rejection reason. Additionally, the notify callback may be called zero or more times to
+ *   provide a progress indication, before the promise is resolved or rejected.
+ *
+ *   This method *returns a new promise* which is resolved or rejected via the return value of the
+ *   `successCallback`, `errorCallback` (unless that value is a promise, in which case it is resolved
+ *   with the value which is resolved in that promise using
+ *   [promise chaining](http://www.html5rocks.com/en/tutorials/es6/promises/#toc-promises-queues)).
+ *   It also notifies via the return value of the `notifyCallback` method. The promise cannot be
+ *   resolved or rejected from the notifyCallback method. The errorCallback and notifyCallback
+ *   arguments are optional.
+ *
+ * - `catch(errorCallback)` – shorthand for `promise.then(null, errorCallback)`
+ *
+ * - `finally(callback, notifyCallback)` – allows you to observe either the fulfillment or rejection of a promise,
+ *   but to do so without modifying the final value. This is useful to release resources or do some
+ *   clean-up that needs to be done whether the promise was rejected or resolved. See the [full
+ *   specification](https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback) for
+ *   more information.
+ *
+ * # Chaining promises
+ *
+ * Because calling the `then` method of a promise returns a new derived promise, it is easily
+ * possible to create a chain of promises:
+ *
+ * ```js
+ *   promiseB = promiseA.then(function(result) {
+ *     return result + 1;
+ *   });
+ *
+ *   // promiseB will be resolved immediately after promiseA is resolved and its value
+ *   // will be the result of promiseA incremented by 1
+ * ```
+ *
+ * It is possible to create chains of any length and since a promise can be resolved with another
+ * promise (which will defer its resolution further), it is possible to pause/defer resolution of
+ * the promises at any point in the chain. This makes it possible to implement powerful APIs like
+ * $http's response interceptors.
+ *
+ *
+ * # Differences between Kris Kowal's Q and $q
+ *
+ *  There are two main differences:
+ *
+ * - $q is integrated with the {@link ng.$rootScope.Scope} Scope model observation
+ *   mechanism in angular, which means faster propagation of resolution or rejection into your
+ *   models and avoiding unnecessary browser repaints, which would result in flickering UI.
+ * - Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains
+ *   all the important functionality needed for common async tasks.
+ *
+ * # Testing
+ *
+ *  ```js
+ *    it('should simulate promise', inject(function($q, $rootScope) {
+ *      var deferred = $q.defer();
+ *      var promise = deferred.promise;
+ *      var resolvedValue;
+ *
+ *      promise.then(function(value) { resolvedValue = value; });
+ *      expect(resolvedValue).toBeUndefined();
+ *
+ *      // Simulate resolving of promise
+ *      deferred.resolve(123);
+ *      // Note that the 'then' function does not get called synchronously.
+ *      // This is because we want the promise API to always be async, whether or not
+ *      // it got called synchronously or asynchronously.
+ *      expect(resolvedValue).toBeUndefined();
+ *
+ *      // Propagate promise resolution to 'then' functions using $apply().
+ *      $rootScope.$apply();
+ *      expect(resolvedValue).toEqual(123);
+ *    }));
+ *  ```
+ *
+ * @param {function(function, function)} resolver Function which is responsible for resolving or
+ *   rejecting the newly created promise. The first parameter is a function which resolves the
+ *   promise, the second parameter is a function which rejects the promise.
+ *
+ * @returns {Promise} The newly created promise.
+ */
+function $QProvider() {
+
+  this.$get = ['$rootScope', '$exceptionHandler', function($rootScope, $exceptionHandler) {
+    return qFactory(function(callback) {
+      $rootScope.$evalAsync(callback);
+    }, $exceptionHandler);
+  }];
+}
+
+function $$QProvider() {
+  this.$get = ['$browser', '$exceptionHandler', function($browser, $exceptionHandler) {
+    return qFactory(function(callback) {
+      $browser.defer(callback);
+    }, $exceptionHandler);
+  }];
+}
+
+/**
+ * Constructs a promise manager.
+ *
+ * @param {function(function)} nextTick Function for executing functions in the next turn.
+ * @param {function(...*)} exceptionHandler Function into which unexpected exceptions are passed for
+ *     debugging purposes.
+ * @returns {object} Promise manager.
+ */
+function qFactory(nextTick, exceptionHandler) {
+  var $qMinErr = minErr('$q', TypeError);
+
+  /**
+   * @ngdoc method
+   * @name ng.$q#defer
+   * @kind function
+   *
+   * @description
+   * Creates a `Deferred` object which represents a task which will finish in the future.
+   *
+   * @returns {Deferred} Returns a new instance of deferred.
+   */
+  var defer = function() {
+    var d = new Deferred();
+    //Necessary to support unbound execution :/
+    d.resolve = simpleBind(d, d.resolve);
+    d.reject = simpleBind(d, d.reject);
+    d.notify = simpleBind(d, d.notify);
+    return d;
+  };
+
+  function Promise() {
+    this.$$state = { status: 0 };
+  }
+
+  extend(Promise.prototype, {
+    then: function(onFulfilled, onRejected, progressBack) {
+      if (isUndefined(onFulfilled) && isUndefined(onRejected) && isUndefined(progressBack)) {
+        return this;
+      }
+      var result = new Deferred();
+
+      this.$$state.pending = this.$$state.pending || [];
+      this.$$state.pending.push([result, onFulfilled, onRejected, progressBack]);
+      if (this.$$state.status > 0) scheduleProcessQueue(this.$$state);
+
+      return result.promise;
+    },
+
+    "catch": function(callback) {
+      return this.then(null, callback);
+    },
+
+    "finally": function(callback, progressBack) {
+      return this.then(function(value) {
+        return handleCallback(value, true, callback);
+      }, function(error) {
+        return handleCallback(error, false, callback);
+      }, progressBack);
+    }
+  });
+
+  //Faster, more basic than angular.bind http://jsperf.com/angular-bind-vs-custom-vs-native
+  function simpleBind(context, fn) {
+    return function(value) {
+      fn.call(context, value);
+    };
+  }
+
+  function processQueue(state) {
+    var fn, deferred, pending;
+
+    pending = state.pending;
+    state.processScheduled = false;
+    state.pending = undefined;
+    for (var i = 0, ii = pending.length; i < ii; ++i) {
+      deferred = pending[i][0];
+      fn = pending[i][state.status];
+      try {
+        if (isFunction(fn)) {
+          deferred.resolve(fn(state.value));
+        } else if (state.status === 1) {
+          deferred.resolve(state.value);
+        } else {
+          deferred.reject(state.value);
+        }
+      } catch (e) {
+        deferred.reject(e);
+        exceptionHandler(e);
+      }
+    }
+  }
+
+  function scheduleProcessQueue(state) {
+    if (state.processScheduled || !state.pending) return;
+    state.processScheduled = true;
+    nextTick(function() { processQueue(state); });
+  }
+
+  function Deferred() {
+    this.promise = new Promise();
+  }
+
+  extend(Deferred.prototype, {
+    resolve: function(val) {
+      if (this.promise.$$state.status) return;
+      if (val === this.promise) {
+        this.$$reject($qMinErr(
+          'qcycle',
+          "Expected promise to be resolved with value other than itself '{0}'",
+          val));
+      } else {
+        this.$$resolve(val);
+      }
+
+    },
+
+    $$resolve: function(val) {
+      var then;
+      var that = this;
+      var done = false;
+      try {
+        if ((isObject(val) || isFunction(val))) then = val && val.then;
+        if (isFunction(then)) {
+          this.promise.$$state.status = -1;
+          then.call(val, resolvePromise, rejectPromise, simpleBind(this, this.notify));
+        } else {
+          this.promise.$$state.value = val;
+          this.promise.$$state.status = 1;
+          scheduleProcessQueue(this.promise.$$state);
+        }
+      } catch (e) {
+        rejectPromise(e);
+        exceptionHandler(e);
+      }
+
+      function resolvePromise(val) {
+        if (done) return;
+        done = true;
+        that.$$resolve(val);
+      }
+      function rejectPromise(val) {
+        if (done) return;
+        done = true;
+        that.$$reject(val);
+      }
+    },
+
+    reject: function(reason) {
+      if (this.promise.$$state.status) return;
+      this.$$reject(reason);
+    },
+
+    $$reject: function(reason) {
+      this.promise.$$state.value = reason;
+      this.promise.$$state.status = 2;
+      scheduleProcessQueue(this.promise.$$state);
+    },
+
+    notify: function(progress) {
+      var callbacks = this.promise.$$state.pending;
+
+      if ((this.promise.$$state.status <= 0) && callbacks && callbacks.length) {
+        nextTick(function() {
+          var callback, result;
+          for (var i = 0, ii = callbacks.length; i < ii; i++) {
+            result = callbacks[i][0];
+            callback = callbacks[i][3];
+            try {
+              result.notify(isFunction(callback) ? callback(progress) : progress);
+            } catch (e) {
+              exceptionHandler(e);
+            }
+          }
+        });
+      }
+    }
+  });
+
+  /**
+   * @ngdoc method
+   * @name $q#reject
+   * @kind function
+   *
+   * @description
+   * Creates a promise that is resolved as rejected with the specified `reason`. This api should be
+   * used to forward rejection in a chain of promises. If you are dealing with the last promise in
+   * a promise chain, you don't need to worry about it.
+   *
+   * When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of
+   * `reject` as the `throw` keyword in JavaScript. This also means that if you "catch" an error via
+   * a promise error callback and you want to forward the error to the promise derived from the
+   * current promise, you have to "rethrow" the error by returning a rejection constructed via
+   * `reject`.
+   *
+   * ```js
+   *   promiseB = promiseA.then(function(result) {
+   *     // success: do something and resolve promiseB
+   *     //          with the old or a new result
+   *     return result;
+   *   }, function(reason) {
+   *     // error: handle the error if possible and
+   *     //        resolve promiseB with newPromiseOrValue,
+   *     //        otherwise forward the rejection to promiseB
+   *     if (canHandle(reason)) {
+   *      // handle the error and recover
+   *      return newPromiseOrValue;
+   *     }
+   *     return $q.reject(reason);
+   *   });
+   * ```
+   *
+   * @param {*} reason Constant, message, exception or an object representing the rejection reason.
+   * @returns {Promise} Returns a promise that was already resolved as rejected with the `reason`.
+   */
+  var reject = function(reason) {
+    var result = new Deferred();
+    result.reject(reason);
+    return result.promise;
+  };
+
+  var makePromise = function makePromise(value, resolved) {
+    var result = new Deferred();
+    if (resolved) {
+      result.resolve(value);
+    } else {
+      result.reject(value);
+    }
+    return result.promise;
+  };
+
+  var handleCallback = function handleCallback(value, isResolved, callback) {
+    var callbackOutput = null;
+    try {
+      if (isFunction(callback)) callbackOutput = callback();
+    } catch (e) {
+      return makePromise(e, false);
+    }
+    if (isPromiseLike(callbackOutput)) {
+      return callbackOutput.then(function() {
+        return makePromise(value, isResolved);
+      }, function(error) {
+        return makePromise(error, false);
+      });
+    } else {
+      return makePromise(value, isResolved);
+    }
+  };
+
+  /**
+   * @ngdoc method
+   * @name $q#when
+   * @kind function
+   *
+   * @description
+   * Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise.
+   * This is useful when you are dealing with an object that might or might not be a promise, or if
+   * the promise comes from a source that can't be trusted.
+   *
+   * @param {*} value Value or a promise
+   * @param {Function=} successCallback
+   * @param {Function=} errorCallback
+   * @param {Function=} progressCallback
+   * @returns {Promise} Returns a promise of the passed value or promise
+   */
+
+
+  var when = function(value, callback, errback, progressBack) {
+    var result = new Deferred();
+    result.resolve(value);
+    return result.promise.then(callback, errback, progressBack);
+  };
+
+  /**
+   * @ngdoc method
+   * @name $q#resolve
+   * @kind function
+   *
+   * @description
+   * Alias of {@link ng.$q#when when} to maintain naming consistency with ES6.
+   *
+   * @param {*} value Value or a promise
+   * @param {Function=} successCallback
+   * @param {Function=} errorCallback
+   * @param {Function=} progressCallback
+   * @returns {Promise} Returns a promise of the passed value or promise
+   */
+  var resolve = when;
+
+  /**
+   * @ngdoc method
+   * @name $q#all
+   * @kind function
+   *
+   * @description
+   * Combines multiple promises into a single promise that is resolved when all of the input
+   * promises are resolved.
+   *
+   * @param {Array.<Promise>|Object.<Promise>} promises An array or hash of promises.
+   * @returns {Promise} Returns a single promise that will be resolved with an array/hash of values,
+   *   each value corresponding to the promise at the same index/key in the `promises` array/hash.
+   *   If any of the promises is resolved with a rejection, this resulting promise will be rejected
+   *   with the same rejection value.
+   */
+
+  function all(promises) {
+    var deferred = new Deferred(),
+        counter = 0,
+        results = isArray(promises) ? [] : {};
+
+    forEach(promises, function(promise, key) {
+      counter++;
+      when(promise).then(function(value) {
+        if (results.hasOwnProperty(key)) return;
+        results[key] = value;
+        if (!(--counter)) deferred.resolve(results);
+      }, function(reason) {
+        if (results.hasOwnProperty(key)) return;
+        deferred.reject(reason);
+      });
+    });
+
+    if (counter === 0) {
+      deferred.resolve(results);
+    }
+
+    return deferred.promise;
+  }
+
+  /**
+   * @ngdoc method
+   * @name $q#race
+   * @kind function
+   *
+   * @description
+   * Returns a promise that resolves or rejects as soon as one of those promises
+   * resolves or rejects, with the value or reason from that promise.
+   *
+   * @param {Array.<Promise>|Object.<Promise>} promises An array or hash of promises.
+   * @returns {Promise} a promise that resolves or rejects as soon as one of the `promises`
+   * resolves or rejects, with the value or reason from that promise.
+   */
+
+  function race(promises) {
+    var deferred = defer();
+
+    forEach(promises, function(promise) {
+      when(promise).then(deferred.resolve, deferred.reject);
+    });
+
+    return deferred.promise;
+  }
+
+  var $Q = function Q(resolver) {
+    if (!isFunction(resolver)) {
+      throw $qMinErr('norslvr', "Expected resolverFn, got '{0}'", resolver);
+    }
+
+    var deferred = new Deferred();
+
+    function resolveFn(value) {
+      deferred.resolve(value);
+    }
+
+    function rejectFn(reason) {
+      deferred.reject(reason);
+    }
+
+    resolver(resolveFn, rejectFn);
+
+    return deferred.promise;
+  };
+
+  // Let's make the instanceof operator work for promises, so that
+  // `new $q(fn) instanceof $q` would evaluate to true.
+  $Q.prototype = Promise.prototype;
+
+  $Q.defer = defer;
+  $Q.reject = reject;
+  $Q.when = when;
+  $Q.resolve = resolve;
+  $Q.all = all;
+  $Q.race = race;
+
+  return $Q;
+}
+
+function $$RAFProvider() { //rAF
+  this.$get = ['$window', '$timeout', function($window, $timeout) {
+    var requestAnimationFrame = $window.requestAnimationFrame ||
+                                $window.webkitRequestAnimationFrame;
+
+    var cancelAnimationFrame = $window.cancelAnimationFrame ||
+                               $window.webkitCancelAnimationFrame ||
+                               $window.webkitCancelRequestAnimationFrame;
+
+    var rafSupported = !!requestAnimationFrame;
+    var raf = rafSupported
+      ? function(fn) {
+          var id = requestAnimationFrame(fn);
+          return function() {
+            cancelAnimationFrame(id);
+          };
+        }
+      : function(fn) {
+          var timer = $timeout(fn, 16.66, false); // 1000 / 60 = 16.666
+          return function() {
+            $timeout.cancel(timer);
+          };
+        };
+
+    raf.supported = rafSupported;
+
+    return raf;
+  }];
+}
+
+/**
+ * DESIGN NOTES
+ *
+ * The design decisions behind the scope are heavily favored for speed and memory consumption.
+ *
+ * The typical use of scope is to watch the expressions, which most of the time return the same
+ * value as last time so we optimize the operation.
+ *
+ * Closures construction is expensive in terms of speed as well as memory:
+ *   - No closures, instead use prototypical inheritance for API
+ *   - Internal state needs to be stored on scope directly, which means that private state is
+ *     exposed as $$____ properties
+ *
+ * Loop operations are optimized by using while(count--) { ... }
+ *   - This means that in order to keep the same order of execution as addition we have to add
+ *     items to the array at the beginning (unshift) instead of at the end (push)
+ *
+ * Child scopes are created and removed often
+ *   - Using an array would be slow since inserts in the middle are expensive; so we use linked lists
+ *
+ * There are fewer watches than observers. This is why you don't want the observer to be implemented
+ * in the same way as watch. Watch requires return of the initialization function which is expensive
+ * to construct.
+ */
+
+
+/**
+ * @ngdoc provider
+ * @name $rootScopeProvider
+ * @description
+ *
+ * Provider for the $rootScope service.
+ */
+
+/**
+ * @ngdoc method
+ * @name $rootScopeProvider#digestTtl
+ * @description
+ *
+ * Sets the number of `$digest` iterations the scope should attempt to execute before giving up and
+ * assuming that the model is unstable.
+ *
+ * The current default is 10 iterations.
+ *
+ * In complex applications it's possible that the dependencies between `$watch`s will result in
+ * several digest iterations. However if an application needs more than the default 10 digest
+ * iterations for its model to stabilize then you should investigate what is causing the model to
+ * continuously change during the digest.
+ *
+ * Increasing the TTL could have performance implications, so you should not change it without
+ * proper justification.
+ *
+ * @param {number} limit The number of digest iterations.
+ */
+
+
+/**
+ * @ngdoc service
+ * @name $rootScope
+ * @description
+ *
+ * Every application has a single root {@link ng.$rootScope.Scope scope}.
+ * All other scopes are descendant scopes of the root scope. Scopes provide separation
+ * between the model and the view, via a mechanism for watching the model for changes.
+ * They also provide event emission/broadcast and subscription facility. See the
+ * {@link guide/scope developer guide on scopes}.
+ */
+function $RootScopeProvider() {
+  var TTL = 10;
+  var $rootScopeMinErr = minErr('$rootScope');
+  var lastDirtyWatch = null;
+  var applyAsyncId = null;
+
+  this.digestTtl = function(value) {
+    if (arguments.length) {
+      TTL = value;
+    }
+    return TTL;
+  };
+
+  function createChildScopeClass(parent) {
+    function ChildScope() {
+      this.$$watchers = this.$$nextSibling =
+          this.$$childHead = this.$$childTail = null;
+      this.$$listeners = {};
+      this.$$listenerCount = {};
+      this.$$watchersCount = 0;
+      this.$id = nextUid();
+      this.$$ChildScope = null;
+    }
+    ChildScope.prototype = parent;
+    return ChildScope;
+  }
+
+  this.$get = ['$exceptionHandler', '$parse', '$browser',
+      function($exceptionHandler, $parse, $browser) {
+
+    function destroyChildScope($event) {
+        $event.currentScope.$$destroyed = true;
+    }
+
+    function cleanUpScope($scope) {
+
+      if (msie === 9) {
+        // There is a memory leak in IE9 if all child scopes are not disconnected
+        // completely when a scope is destroyed. So this code will recurse up through
+        // all this scopes children
+        //
+        // See issue https://github.com/angular/angular.js/issues/10706
+        $scope.$$childHead && cleanUpScope($scope.$$childHead);
+        $scope.$$nextSibling && cleanUpScope($scope.$$nextSibling);
+      }
+
+      // The code below works around IE9 and V8's memory leaks
+      //
+      // See:
+      // - https://code.google.com/p/v8/issues/detail?id=2073#c26
+      // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909
+      // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451
+
+      $scope.$parent = $scope.$$nextSibling = $scope.$$prevSibling = $scope.$$childHead =
+          $scope.$$childTail = $scope.$root = $scope.$$watchers = null;
+    }
+
+    /**
+     * @ngdoc type
+     * @name $rootScope.Scope
+     *
+     * @description
+     * A root scope can be retrieved using the {@link ng.$rootScope $rootScope} key from the
+     * {@link auto.$injector $injector}. Child scopes are created using the
+     * {@link ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when
+     * compiled HTML template is executed.) See also the {@link guide/scope Scopes guide} for
+     * an in-depth introduction and usage examples.
+     *
+     *
+     * # Inheritance
+     * A scope can inherit from a parent scope, as in this example:
+     * ```js
+         var parent = $rootScope;
+         var child = parent.$new();
+
+         parent.salutation = "Hello";
+         expect(child.salutation).toEqual('Hello');
+
+         child.salutation = "Welcome";
+         expect(child.salutation).toEqual('Welcome');
+         expect(parent.salutation).toEqual('Hello');
+     * ```
+     *
+     * When interacting with `Scope` in tests, additional helper methods are available on the
+     * instances of `Scope` type. See {@link ngMock.$rootScope.Scope ngMock Scope} for additional
+     * details.
+     *
+     *
+     * @param {Object.<string, function()>=} providers Map of service factory which need to be
+     *                                       provided for the current scope. Defaults to {@link ng}.
+     * @param {Object.<string, *>=} instanceCache Provides pre-instantiated services which should
+     *                              append/override services provided by `providers`. This is handy
+     *                              when unit-testing and having the need to override a default
+     *                              service.
+     * @returns {Object} Newly created scope.
+     *
+     */
+    function Scope() {
+      this.$id = nextUid();
+      this.$$phase = this.$parent = this.$$watchers =
+                     this.$$nextSibling = this.$$prevSibling =
+                     this.$$childHead = this.$$childTail = null;
+      this.$root = this;
+      this.$$destroyed = false;
+      this.$$listeners = {};
+      this.$$listenerCount = {};
+      this.$$watchersCount = 0;
+      this.$$isolateBindings = null;
+    }
+
+    /**
+     * @ngdoc property
+     * @name $rootScope.Scope#$id
+     *
+     * @description
+     * Unique scope ID (monotonically increasing) useful for debugging.
+     */
+
+     /**
+      * @ngdoc property
+      * @name $rootScope.Scope#$parent
+      *
+      * @description
+      * Reference to the parent scope.
+      */
+
+      /**
+       * @ngdoc property
+       * @name $rootScope.Scope#$root
+       *
+       * @description
+       * Reference to the root scope.
+       */
+
+    Scope.prototype = {
+      constructor: Scope,
+      /**
+       * @ngdoc method
+       * @name $rootScope.Scope#$new
+       * @kind function
+       *
+       * @description
+       * Creates a new child {@link ng.$rootScope.Scope scope}.
+       *
+       * The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} event.
+       * The scope can be removed from the scope hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}.
+       *
+       * {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is
+       * desired for the scope and its child scopes to be permanently detached from the parent and
+       * thus stop participating in model change detection and listener notification by invoking.
+       *
+       * @param {boolean} isolate If true, then the scope does not prototypically inherit from the
+       *         parent scope. The scope is isolated, as it can not see parent scope properties.
+       *         When creating widgets, it is useful for the widget to not accidentally read parent
+       *         state.
+       *
+       * @param {Scope} [parent=this] The {@link ng.$rootScope.Scope `Scope`} that will be the `$parent`
+       *                              of the newly created scope. Defaults to `this` scope if not provided.
+       *                              This is used when creating a transclude scope to correctly place it
+       *                              in the scope hierarchy while maintaining the correct prototypical
+       *                              inheritance.
+       *
+       * @returns {Object} The newly created child scope.
+       *
+       */
+      $new: function(isolate, parent) {
+        var child;
+
+        parent = parent || this;
+
+        if (isolate) {
+          child = new Scope();
+          child.$root = this.$root;
+        } else {
+          // Only create a child scope class if somebody asks for one,
+          // but cache it to allow the VM to optimize lookups.
+          if (!this.$$ChildScope) {
+            this.$$ChildScope = createChildScopeClass(this);
+          }
+          child = new this.$$ChildScope();
+        }
+        child.$parent = parent;
+        child.$$prevSibling = parent.$$childTail;
+        if (parent.$$childHead) {
+          parent.$$childTail.$$nextSibling = child;
+          parent.$$childTail = child;
+        } else {
+          parent.$$childHead = parent.$$childTail = child;
+        }
+
+        // When the new scope is not isolated or we inherit from `this`, and
+        // the parent scope is destroyed, the property `$$destroyed` is inherited
+        // prototypically. In all other cases, this property needs to be set
+        // when the parent scope is destroyed.
+        // The listener needs to be added after the parent is set
+        if (isolate || parent != this) child.$on('$destroy', destroyChildScope);
+
+        return child;
+      },
+
+      /**
+       * @ngdoc method
+       * @name $rootScope.Scope#$watch
+       * @kind function
+       *
+       * @description
+       * Registers a `listener` callback to be executed whenever the `watchExpression` changes.
+       *
+       * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest
+       *   $digest()} and should return the value that will be watched. (`watchExpression` should not change
+       *   its value when executed multiple times with the same input because it may be executed multiple
+       *   times by {@link ng.$rootScope.Scope#$digest $digest()}. That is, `watchExpression` should be
+       *   [idempotent](http://en.wikipedia.org/wiki/Idempotence).
+       * - The `listener` is called only when the value from the current `watchExpression` and the
+       *   previous call to `watchExpression` are not equal (with the exception of the initial run,
+       *   see below). Inequality is determined according to reference inequality,
+       *   [strict comparison](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators)
+       *    via the `!==` Javascript operator, unless `objectEquality == true`
+       *   (see next point)
+       * - When `objectEquality == true`, inequality of the `watchExpression` is determined
+       *   according to the {@link angular.equals} function. To save the value of the object for
+       *   later comparison, the {@link angular.copy} function is used. This therefore means that
+       *   watching complex objects will have adverse memory and performance implications.
+       * - The watch `listener` may change the model, which may trigger other `listener`s to fire.
+       *   This is achieved by rerunning the watchers until no changes are detected. The rerun
+       *   iteration limit is 10 to prevent an infinite loop deadlock.
+       *
+       *
+       * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called,
+       * you can register a `watchExpression` function with no `listener`. (Be prepared for
+       * multiple calls to your `watchExpression` because it will execute multiple times in a
+       * single {@link ng.$rootScope.Scope#$digest $digest} cycle if a change is detected.)
+       *
+       * After a watcher is registered with the scope, the `listener` fn is called asynchronously
+       * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the
+       * watcher. In rare cases, this is undesirable because the listener is called when the result
+       * of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you
+       * can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the
+       * listener was called due to initialization.
+       *
+       *
+       *
+       * # Example
+       * ```js
+           // let's assume that scope was dependency injected as the $rootScope
+           var scope = $rootScope;
+           scope.name = 'misko';
+           scope.counter = 0;
+
+           expect(scope.counter).toEqual(0);
+           scope.$watch('name', function(newValue, oldValue) {
+             scope.counter = scope.counter + 1;
+           });
+           expect(scope.counter).toEqual(0);
+
+           scope.$digest();
+           // the listener is always called during the first $digest loop after it was registered
+           expect(scope.counter).toEqual(1);
+
+           scope.$digest();
+           // but now it will not be called unless the value changes
+           expect(scope.counter).toEqual(1);
+
+           scope.name = 'adam';
+           scope.$digest();
+           expect(scope.counter).toEqual(2);
+
+
+
+           // Using a function as a watchExpression
+           var food;
+           scope.foodCounter = 0;
+           expect(scope.foodCounter).toEqual(0);
+           scope.$watch(
+             // This function returns the value being watched. It is called for each turn of the $digest loop
+             function() { return food; },
+             // This is the change listener, called when the value returned from the above function changes
+             function(newValue, oldValue) {
+               if ( newValue !== oldValue ) {
+                 // Only increment the counter if the value changed
+                 scope.foodCounter = scope.foodCounter + 1;
+               }
+             }
+           );
+           // No digest has been run so the counter will be zero
+           expect(scope.foodCounter).toEqual(0);
+
+           // Run the digest but since food has not changed count will still be zero
+           scope.$digest();
+           expect(scope.foodCounter).toEqual(0);
+
+           // Update food and run digest.  Now the counter will increment
+           food = 'cheeseburger';
+           scope.$digest();
+           expect(scope.foodCounter).toEqual(1);
+
+       * ```
+       *
+       *
+       *
+       * @param {(function()|string)} watchExpression Expression that is evaluated on each
+       *    {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers
+       *    a call to the `listener`.
+       *
+       *    - `string`: Evaluated as {@link guide/expression expression}
+       *    - `function(scope)`: called with current `scope` as a parameter.
+       * @param {function(newVal, oldVal, scope)} listener Callback called whenever the value
+       *    of `watchExpression` changes.
+       *
+       *    - `newVal` contains the current value of the `watchExpression`
+       *    - `oldVal` contains the previous value of the `watchExpression`
+       *    - `scope` refers to the current scope
+       * @param {boolean=} [objectEquality=false] Compare for object equality using {@link angular.equals} instead of
+       *     comparing for reference equality.
+       * @returns {function()} Returns a deregistration function for this listener.
+       */
+      $watch: function(watchExp, listener, objectEquality, prettyPrintExpression) {
+        var get = $parse(watchExp);
+
+        if (get.$$watchDelegate) {
+          return get.$$watchDelegate(this, listener, objectEquality, get, watchExp);
+        }
+        var scope = this,
+            array = scope.$$watchers,
+            watcher = {
+              fn: listener,
+              last: initWatchVal,
+              get: get,
+              exp: prettyPrintExpression || watchExp,
+              eq: !!objectEquality
+            };
+
+        lastDirtyWatch = null;
+
+        if (!isFunction(listener)) {
+          watcher.fn = noop;
+        }
+
+        if (!array) {
+          array = scope.$$watchers = [];
+        }
+        // we use unshift since we use a while loop in $digest for speed.
+        // the while loop reads in reverse order.
+        array.unshift(watcher);
+        incrementWatchersCount(this, 1);
+
+        return function deregisterWatch() {
+          if (arrayRemove(array, watcher) >= 0) {
+            incrementWatchersCount(scope, -1);
+          }
+          lastDirtyWatch = null;
+        };
+      },
+
+      /**
+       * @ngdoc method
+       * @name $rootScope.Scope#$watchGroup
+       * @kind function
+       *
+       * @description
+       * A variant of {@link ng.$rootScope.Scope#$watch $watch()} where it watches an array of `watchExpressions`.
+       * If any one expression in the collection changes the `listener` is executed.
+       *
+       * - The items in the `watchExpressions` array are observed via standard $watch operation and are examined on every
+       *   call to $digest() to see if any items changes.
+       * - The `listener` is called whenever any expression in the `watchExpressions` array changes.
+       *
+       * @param {Array.<string|Function(scope)>} watchExpressions Array of expressions that will be individually
+       * watched using {@link ng.$rootScope.Scope#$watch $watch()}
+       *
+       * @param {function(newValues, oldValues, scope)} listener Callback called whenever the return value of any
+       *    expression in `watchExpressions` changes
+       *    The `newValues` array contains the current values of the `watchExpressions`, with the indexes matching
+       *    those of `watchExpression`
+       *    and the `oldValues` array contains the previous values of the `watchExpressions`, with the indexes matching
+       *    those of `watchExpression`
+       *    The `scope` refers to the current scope.
+       * @returns {function()} Returns a de-registration function for all listeners.
+       */
+      $watchGroup: function(watchExpressions, listener) {
+        var oldValues = new Array(watchExpressions.length);
+        var newValues = new Array(watchExpressions.length);
+        var deregisterFns = [];
+        var self = this;
+        var changeReactionScheduled = false;
+        var firstRun = true;
+
+        if (!watchExpressions.length) {
+          // No expressions means we call the listener ASAP
+          var shouldCall = true;
+          self.$evalAsync(function() {
+            if (shouldCall) listener(newValues, newValues, self);
+          });
+          return function deregisterWatchGroup() {
+            shouldCall = false;
+          };
+        }
+
+        if (watchExpressions.length === 1) {
+          // Special case size of one
+          return this.$watch(watchExpressions[0], function watchGroupAction(value, oldValue, scope) {
+            newValues[0] = value;
+            oldValues[0] = oldValue;
+            listener(newValues, (value === oldValue) ? newValues : oldValues, scope);
+          });
+        }
+
+        forEach(watchExpressions, function(expr, i) {
+          var unwatchFn = self.$watch(expr, function watchGroupSubAction(value, oldValue) {
+            newValues[i] = value;
+            oldValues[i] = oldValue;
+            if (!changeReactionScheduled) {
+              changeReactionScheduled = true;
+              self.$evalAsync(watchGroupAction);
+            }
+          });
+          deregisterFns.push(unwatchFn);
+        });
+
+        function watchGroupAction() {
+          changeReactionScheduled = false;
+
+          if (firstRun) {
+            firstRun = false;
+            listener(newValues, newValues, self);
+          } else {
+            listener(newValues, oldValues, self);
+          }
+        }
+
+        return function deregisterWatchGroup() {
+          while (deregisterFns.length) {
+            deregisterFns.shift()();
+          }
+        };
+      },
+
+
+      /**
+       * @ngdoc method
+       * @name $rootScope.Scope#$watchCollection
+       * @kind function
+       *
+       * @description
+       * Shallow watches the properties of an object and fires whenever any of the properties change
+       * (for arrays, this implies watching the array items; for object maps, this implies watching
+       * the properties). If a change is detected, the `listener` callback is fired.
+       *
+       * - The `obj` collection is observed via standard $watch operation and is examined on every
+       *   call to $digest() to see if any items have been added, removed, or moved.
+       * - The `listener` is called whenever anything within the `obj` has changed. Examples include
+       *   adding, removing, and moving items belonging to an object or array.
+       *
+       *
+       * # Example
+       * ```js
+          $scope.names = ['igor', 'matias', 'misko', 'james'];
+          $scope.dataCount = 4;
+
+          $scope.$watchCollection('names', function(newNames, oldNames) {
+            $scope.dataCount = newNames.length;
+          });
+
+          expect($scope.dataCount).toEqual(4);
+          $scope.$digest();
+
+          //still at 4 ... no changes
+          expect($scope.dataCount).toEqual(4);
+
+          $scope.names.pop();
+          $scope.$digest();
+
+          //now there's been a change
+          expect($scope.dataCount).toEqual(3);
+       * ```
+       *
+       *
+       * @param {string|function(scope)} obj Evaluated as {@link guide/expression expression}. The
+       *    expression value should evaluate to an object or an array which is observed on each
+       *    {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the
+       *    collection will trigger a call to the `listener`.
+       *
+       * @param {function(newCollection, oldCollection, scope)} listener a callback function called
+       *    when a change is detected.
+       *    - The `newCollection` object is the newly modified data obtained from the `obj` expression
+       *    - The `oldCollection` object is a copy of the former collection data.
+       *      Due to performance considerations, the`oldCollection` value is computed only if the
+       *      `listener` function declares two or more arguments.
+       *    - The `scope` argument refers to the current scope.
+       *
+       * @returns {function()} Returns a de-registration function for this listener. When the
+       *    de-registration function is executed, the internal watch operation is terminated.
+       */
+      $watchCollection: function(obj, listener) {
+        $watchCollectionInterceptor.$stateful = true;
+
+        var self = this;
+        // the current value, updated on each dirty-check run
+        var newValue;
+        // a shallow copy of the newValue from the last dirty-check run,
+        // updated to match newValue during dirty-check run
+        var oldValue;
+        // a shallow copy of the newValue from when the last change happened
+        var veryOldValue;
+        // only track veryOldValue if the listener is asking for it
+        var trackVeryOldValue = (listener.length > 1);
+        var changeDetected = 0;
+        var changeDetector = $parse(obj, $watchCollectionInterceptor);
+        var internalArray = [];
+        var internalObject = {};
+        var initRun = true;
+        var oldLength = 0;
+
+        function $watchCollectionInterceptor(_value) {
+          newValue = _value;
+          var newLength, key, bothNaN, newItem, oldItem;
+
+          // If the new value is undefined, then return undefined as the watch may be a one-time watch
+          if (isUndefined(newValue)) return;
+
+          if (!isObject(newValue)) { // if primitive
+            if (oldValue !== newValue) {
+              oldValue = newValue;
+              changeDetected++;
+            }
+          } else if (isArrayLike(newValue)) {
+            if (oldValue !== internalArray) {
+              // we are transitioning from something which was not an array into array.
+              oldValue = internalArray;
+              oldLength = oldValue.length = 0;
+              changeDetected++;
+            }
+
+            newLength = newValue.length;
+
+            if (oldLength !== newLength) {
+              // if lengths do not match we need to trigger change notification
+              changeDetected++;
+              oldValue.length = oldLength = newLength;
+            }
+            // copy the items to oldValue and look for changes.
+            for (var i = 0; i < newLength; i++) {
+              oldItem = oldValue[i];
+              newItem = newValue[i];
+
+              bothNaN = (oldItem !== oldItem) && (newItem !== newItem);
+              if (!bothNaN && (oldItem !== newItem)) {
+                changeDetected++;
+                oldValue[i] = newItem;
+              }
+            }
+          } else {
+            if (oldValue !== internalObject) {
+              // we are transitioning from something which was not an object into object.
+              oldValue = internalObject = {};
+              oldLength = 0;
+              changeDetected++;
+            }
+            // copy the items to oldValue and look for changes.
+            newLength = 0;
+            for (key in newValue) {
+              if (hasOwnProperty.call(newValue, key)) {
+                newLength++;
+                newItem = newValue[key];
+                oldItem = oldValue[key];
+
+                if (key in oldValue) {
+                  bothNaN = (oldItem !== oldItem) && (newItem !== newItem);
+                  if (!bothNaN && (oldItem !== newItem)) {
+                    changeDetected++;
+                    oldValue[key] = newItem;
+                  }
+                } else {
+                  oldLength++;
+                  oldValue[key] = newItem;
+                  changeDetected++;
+                }
+              }
+            }
+            if (oldLength > newLength) {
+              // we used to have more keys, need to find them and destroy them.
+              changeDetected++;
+              for (key in oldValue) {
+                if (!hasOwnProperty.call(newValue, key)) {
+                  oldLength--;
+                  delete oldValue[key];
+                }
+              }
+            }
+          }
+          return changeDetected;
+        }
+
+        function $watchCollectionAction() {
+          if (initRun) {
+            initRun = false;
+            listener(newValue, newValue, self);
+          } else {
+            listener(newValue, veryOldValue, self);
+          }
+
+          // make a copy for the next time a collection is changed
+          if (trackVeryOldValue) {
+            if (!isObject(newValue)) {
+              //primitive
+              veryOldValue = newValue;
+            } else if (isArrayLike(newValue)) {
+              veryOldValue = new Array(newValue.length);
+              for (var i = 0; i < newValue.length; i++) {
+                veryOldValue[i] = newValue[i];
+              }
+            } else { // if object
+              veryOldValue = {};
+              for (var key in newValue) {
+                if (hasOwnProperty.call(newValue, key)) {
+                  veryOldValue[key] = newValue[key];
+                }
+              }
+            }
+          }
+        }
+
+        return this.$watch(changeDetector, $watchCollectionAction);
+      },
+
+      /**
+       * @ngdoc method
+       * @name $rootScope.Scope#$digest
+       * @kind function
+       *
+       * @description
+       * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and
+       * its children. Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change
+       * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers}
+       * until no more listeners are firing. This means that it is possible to get into an infinite
+       * loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of
+       * iterations exceeds 10.
+       *
+       * Usually, you don't call `$digest()` directly in
+       * {@link ng.directive:ngController controllers} or in
+       * {@link ng.$compileProvider#directive directives}.
+       * Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within
+       * a {@link ng.$compileProvider#directive directive}), which will force a `$digest()`.
+       *
+       * If you want to be notified whenever `$digest()` is called,
+       * you can register a `watchExpression` function with
+       * {@link ng.$rootScope.Scope#$watch $watch()} with no `listener`.
+       *
+       * In unit tests, you may need to call `$digest()` to simulate the scope life cycle.
+       *
+       * # Example
+       * ```js
+           var scope = ...;
+           scope.name = 'misko';
+           scope.counter = 0;
+
+           expect(scope.counter).toEqual(0);
+           scope.$watch('name', function(newValue, oldValue) {
+             scope.counter = scope.counter + 1;
+           });
+           expect(scope.counter).toEqual(0);
+
+           scope.$digest();
+           // the listener is always called during the first $digest loop after it was registered
+           expect(scope.counter).toEqual(1);
+
+           scope.$digest();
+           // but now it will not be called unless the value changes
+           expect(scope.counter).toEqual(1);
+
+           scope.name = 'adam';
+           scope.$digest();
+           expect(scope.counter).toEqual(2);
+       * ```
+       *
+       */
+      $digest: function() {
+        var watch, value, last, fn, get,
+            watchers,
+            length,
+            dirty, ttl = TTL,
+            next, current, target = this,
+            watchLog = [],
+            logIdx, asyncTask;
+
+        beginPhase('$digest');
+        // Check for changes to browser url that happened in sync before the call to $digest
+        $browser.$$checkUrlChange();
+
+        if (this === $rootScope && applyAsyncId !== null) {
+          // If this is the root scope, and $applyAsync has scheduled a deferred $apply(), then
+          // cancel the scheduled $apply and flush the queue of expressions to be evaluated.
+          $browser.defer.cancel(applyAsyncId);
+          flushApplyAsync();
+        }
+
+        lastDirtyWatch = null;
+
+        do { // "while dirty" loop
+          dirty = false;
+          current = target;
+
+          // It's safe for asyncQueuePosition to be a local variable here because this loop can't
+          // be reentered recursively. Calling $digest from a function passed to $applyAsync would
+          // lead to a '$digest already in progress' error.
+          for (var asyncQueuePosition = 0; asyncQueuePosition < asyncQueue.length; asyncQueuePosition++) {
+            try {
+              asyncTask = asyncQueue[asyncQueuePosition];
+              asyncTask.scope.$eval(asyncTask.expression, asyncTask.locals);
+            } catch (e) {
+              $exceptionHandler(e);
+            }
+            lastDirtyWatch = null;
+          }
+          asyncQueue.length = 0;
+
+          traverseScopesLoop:
+          do { // "traverse the scopes" loop
+            if ((watchers = current.$$watchers)) {
+              // process our watches
+              length = watchers.length;
+              while (length--) {
+                try {
+                  watch = watchers[length];
+                  // Most common watches are on primitives, in which case we can short
+                  // circuit it with === operator, only when === fails do we use .equals
+                  if (watch) {
+                    get = watch.get;
+                    if ((value = get(current)) !== (last = watch.last) &&
+                        !(watch.eq
+                            ? equals(value, last)
+                            : (typeof value === 'number' && typeof last === 'number'
+                               && isNaN(value) && isNaN(last)))) {
+                      dirty = true;
+                      lastDirtyWatch = watch;
+                      watch.last = watch.eq ? copy(value, null) : value;
+                      fn = watch.fn;
+                      fn(value, ((last === initWatchVal) ? value : last), current);
+                      if (ttl < 5) {
+                        logIdx = 4 - ttl;
+                        if (!watchLog[logIdx]) watchLog[logIdx] = [];
+                        watchLog[logIdx].push({
+                          msg: isFunction(watch.exp) ? 'fn: ' + (watch.exp.name || watch.exp.toString()) : watch.exp,
+                          newVal: value,
+                          oldVal: last
+                        });
+                      }
+                    } else if (watch === lastDirtyWatch) {
+                      // If the most recently dirty watcher is now clean, short circuit since the remaining watchers
+                      // have already been tested.
+                      dirty = false;
+                      break traverseScopesLoop;
+                    }
+                  }
+                } catch (e) {
+                  $exceptionHandler(e);
+                }
+              }
+            }
+
+            // Insanity Warning: scope depth-first traversal
+            // yes, this code is a bit crazy, but it works and we have tests to prove it!
+            // this piece should be kept in sync with the traversal in $broadcast
+            if (!(next = ((current.$$watchersCount && current.$$childHead) ||
+                (current !== target && current.$$nextSibling)))) {
+              while (current !== target && !(next = current.$$nextSibling)) {
+                current = current.$parent;
+              }
+            }
+          } while ((current = next));
+
+          // `break traverseScopesLoop;` takes us to here
+
+          if ((dirty || asyncQueue.length) && !(ttl--)) {
+            clearPhase();
+            throw $rootScopeMinErr('infdig',
+                '{0} $digest() iterations reached. Aborting!\n' +
+                'Watchers fired in the last 5 iterations: {1}',
+                TTL, watchLog);
+          }
+
+        } while (dirty || asyncQueue.length);
+
+        clearPhase();
+
+        // postDigestQueuePosition isn't local here because this loop can be reentered recursively.
+        while (postDigestQueuePosition < postDigestQueue.length) {
+          try {
+            postDigestQueue[postDigestQueuePosition++]();
+          } catch (e) {
+            $exceptionHandler(e);
+          }
+        }
+        postDigestQueue.length = postDigestQueuePosition = 0;
+      },
+
+
+      /**
+       * @ngdoc event
+       * @name $rootScope.Scope#$destroy
+       * @eventType broadcast on scope being destroyed
+       *
+       * @description
+       * Broadcasted when a scope and its children are being destroyed.
+       *
+       * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to
+       * clean up DOM bindings before an element is removed from the DOM.
+       */
+
+      /**
+       * @ngdoc method
+       * @name $rootScope.Scope#$destroy
+       * @kind function
+       *
+       * @description
+       * Removes the current scope (and all of its children) from the parent scope. Removal implies
+       * that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer
+       * propagate to the current scope and its children. Removal also implies that the current
+       * scope is eligible for garbage collection.
+       *
+       * The `$destroy()` is usually used by directives such as
+       * {@link ng.directive:ngRepeat ngRepeat} for managing the
+       * unrolling of the loop.
+       *
+       * Just before a scope is destroyed, a `$destroy` event is broadcasted on this scope.
+       * Application code can register a `$destroy` event handler that will give it a chance to
+       * perform any necessary cleanup.
+       *
+       * Note that, in AngularJS, there is also a `$destroy` jQuery event, which can be used to
+       * clean up DOM bindings before an element is removed from the DOM.
+       */
+      $destroy: function() {
+        // We can't destroy a scope that has been already destroyed.
+        if (this.$$destroyed) return;
+        var parent = this.$parent;
+
+        this.$broadcast('$destroy');
+        this.$$destroyed = true;
+
+        if (this === $rootScope) {
+          //Remove handlers attached to window when $rootScope is removed
+          $browser.$$applicationDestroyed();
+        }
+
+        incrementWatchersCount(this, -this.$$watchersCount);
+        for (var eventName in this.$$listenerCount) {
+          decrementListenerCount(this, this.$$listenerCount[eventName], eventName);
+        }
+
+        // sever all the references to parent scopes (after this cleanup, the current scope should
+        // not be retained by any of our references and should be eligible for garbage collection)
+        if (parent && parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;
+        if (parent && parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;
+        if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;
+        if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling;
+
+        // Disable listeners, watchers and apply/digest methods
+        this.$destroy = this.$digest = this.$apply = this.$evalAsync = this.$applyAsync = noop;
+        this.$on = this.$watch = this.$watchGroup = function() { return noop; };
+        this.$$listeners = {};
+
+        // Disconnect the next sibling to prevent `cleanUpScope` destroying those too
+        this.$$nextSibling = null;
+        cleanUpScope(this);
+      },
+
+      /**
+       * @ngdoc method
+       * @name $rootScope.Scope#$eval
+       * @kind function
+       *
+       * @description
+       * Executes the `expression` on the current scope and returns the result. Any exceptions in
+       * the expression are propagated (uncaught). This is useful when evaluating Angular
+       * expressions.
+       *
+       * # Example
+       * ```js
+           var scope = ng.$rootScope.Scope();
+           scope.a = 1;
+           scope.b = 2;
+
+           expect(scope.$eval('a+b')).toEqual(3);
+           expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);
+       * ```
+       *
+       * @param {(string|function())=} expression An angular expression to be executed.
+       *
+       *    - `string`: execute using the rules as defined in  {@link guide/expression expression}.
+       *    - `function(scope)`: execute the function with the current `scope` parameter.
+       *
+       * @param {(object)=} locals Local variables object, useful for overriding values in scope.
+       * @returns {*} The result of evaluating the expression.
+       */
+      $eval: function(expr, locals) {
+        return $parse(expr)(this, locals);
+      },
+
+      /**
+       * @ngdoc method
+       * @name $rootScope.Scope#$evalAsync
+       * @kind function
+       *
+       * @description
+       * Executes the expression on the current scope at a later point in time.
+       *
+       * The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only
+       * that:
+       *
+       *   - it will execute after the function that scheduled the evaluation (preferably before DOM
+       *     rendering).
+       *   - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after
+       *     `expression` execution.
+       *
+       * Any exceptions from the execution of the expression are forwarded to the
+       * {@link ng.$exceptionHandler $exceptionHandler} service.
+       *
+       * __Note:__ if this function is called outside of a `$digest` cycle, a new `$digest` cycle
+       * will be scheduled. However, it is encouraged to always call code that changes the model
+       * from within an `$apply` call. That includes code evaluated via `$evalAsync`.
+       *
+       * @param {(string|function())=} expression An angular expression to be executed.
+       *
+       *    - `string`: execute using the rules as defined in {@link guide/expression expression}.
+       *    - `function(scope)`: execute the function with the current `scope` parameter.
+       *
+       * @param {(object)=} locals Local variables object, useful for overriding values in scope.
+       */
+      $evalAsync: function(expr, locals) {
+        // if we are outside of an $digest loop and this is the first time we are scheduling async
+        // task also schedule async auto-flush
+        if (!$rootScope.$$phase && !asyncQueue.length) {
+          $browser.defer(function() {
+            if (asyncQueue.length) {
+              $rootScope.$digest();
+            }
+          });
+        }
+
+        asyncQueue.push({scope: this, expression: $parse(expr), locals: locals});
+      },
+
+      $$postDigest: function(fn) {
+        postDigestQueue.push(fn);
+      },
+
+      /**
+       * @ngdoc method
+       * @name $rootScope.Scope#$apply
+       * @kind function
+       *
+       * @description
+       * `$apply()` is used to execute an expression in angular from outside of the angular
+       * framework. (For example from browser DOM events, setTimeout, XHR or third party libraries).
+       * Because we are calling into the angular framework we need to perform proper scope life
+       * cycle of {@link ng.$exceptionHandler exception handling},
+       * {@link ng.$rootScope.Scope#$digest executing watches}.
+       *
+       * ## Life cycle
+       *
+       * # Pseudo-Code of `$apply()`
+       * ```js
+           function $apply(expr) {
+             try {
+               return $eval(expr);
+             } catch (e) {
+               $exceptionHandler(e);
+             } finally {
+               $root.$digest();
+             }
+           }
+       * ```
+       *
+       *
+       * Scope's `$apply()` method transitions through the following stages:
+       *
+       * 1. The {@link guide/expression expression} is executed using the
+       *    {@link ng.$rootScope.Scope#$eval $eval()} method.
+       * 2. Any exceptions from the execution of the expression are forwarded to the
+       *    {@link ng.$exceptionHandler $exceptionHandler} service.
+       * 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the
+       *    expression was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method.
+       *
+       *
+       * @param {(string|function())=} exp An angular expression to be executed.
+       *
+       *    - `string`: execute using the rules as defined in {@link guide/expression expression}.
+       *    - `function(scope)`: execute the function with current `scope` parameter.
+       *
+       * @returns {*} The result of evaluating the expression.
+       */
+      $apply: function(expr) {
+        try {
+          beginPhase('$apply');
+          try {
+            return this.$eval(expr);
+          } finally {
+            clearPhase();
+          }
+        } catch (e) {
+          $exceptionHandler(e);
+        } finally {
+          try {
+            $rootScope.$digest();
+          } catch (e) {
+            $exceptionHandler(e);
+            throw e;
+          }
+        }
+      },
+
+      /**
+       * @ngdoc method
+       * @name $rootScope.Scope#$applyAsync
+       * @kind function
+       *
+       * @description
+       * Schedule the invocation of $apply to occur at a later time. The actual time difference
+       * varies across browsers, but is typically around ~10 milliseconds.
+       *
+       * This can be used to queue up multiple expressions which need to be evaluated in the same
+       * digest.
+       *
+       * @param {(string|function())=} exp An angular expression to be executed.
+       *
+       *    - `string`: execute using the rules as defined in {@link guide/expression expression}.
+       *    - `function(scope)`: execute the function with current `scope` parameter.
+       */
+      $applyAsync: function(expr) {
+        var scope = this;
+        expr && applyAsyncQueue.push($applyAsyncExpression);
+        expr = $parse(expr);
+        scheduleApplyAsync();
+
+        function $applyAsyncExpression() {
+          scope.$eval(expr);
+        }
+      },
+
+      /**
+       * @ngdoc method
+       * @name $rootScope.Scope#$on
+       * @kind function
+       *
+       * @description
+       * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for
+       * discussion of event life cycle.
+       *
+       * The event listener function format is: `function(event, args...)`. The `event` object
+       * passed into the listener has the following attributes:
+       *
+       *   - `targetScope` - `{Scope}`: the scope on which the event was `$emit`-ed or
+       *     `$broadcast`-ed.
+       *   - `currentScope` - `{Scope}`: the scope that is currently handling the event. Once the
+       *     event propagates through the scope hierarchy, this property is set to null.
+       *   - `name` - `{string}`: name of the event.
+       *   - `stopPropagation` - `{function=}`: calling `stopPropagation` function will cancel
+       *     further event propagation (available only for events that were `$emit`-ed).
+       *   - `preventDefault` - `{function}`: calling `preventDefault` sets `defaultPrevented` flag
+       *     to true.
+       *   - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called.
+       *
+       * @param {string} name Event name to listen on.
+       * @param {function(event, ...args)} listener Function to call when the event is emitted.
+       * @returns {function()} Returns a deregistration function for this listener.
+       */
+      $on: function(name, listener) {
+        var namedListeners = this.$$listeners[name];
+        if (!namedListeners) {
+          this.$$listeners[name] = namedListeners = [];
+        }
+        namedListeners.push(listener);
+
+        var current = this;
+        do {
+          if (!current.$$listenerCount[name]) {
+            current.$$listenerCount[name] = 0;
+          }
+          current.$$listenerCount[name]++;
+        } while ((current = current.$parent));
+
+        var self = this;
+        return function() {
+          var indexOfListener = namedListeners.indexOf(listener);
+          if (indexOfListener !== -1) {
+            namedListeners[indexOfListener] = null;
+            decrementListenerCount(self, 1, name);
+          }
+        };
+      },
+
+
+      /**
+       * @ngdoc method
+       * @name $rootScope.Scope#$emit
+       * @kind function
+       *
+       * @description
+       * Dispatches an event `name` upwards through the scope hierarchy notifying the
+       * registered {@link ng.$rootScope.Scope#$on} listeners.
+       *
+       * The event life cycle starts at the scope on which `$emit` was called. All
+       * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get
+       * notified. Afterwards, the event traverses upwards toward the root scope and calls all
+       * registered listeners along the way. The event will stop propagating if one of the listeners
+       * cancels it.
+       *
+       * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed
+       * onto the {@link ng.$exceptionHandler $exceptionHandler} service.
+       *
+       * @param {string} name Event name to emit.
+       * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.
+       * @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}).
+       */
+      $emit: function(name, args) {
+        var empty = [],
+            namedListeners,
+            scope = this,
+            stopPropagation = false,
+            event = {
+              name: name,
+              targetScope: scope,
+              stopPropagation: function() {stopPropagation = true;},
+              preventDefault: function() {
+                event.defaultPrevented = true;
+              },
+              defaultPrevented: false
+            },
+            listenerArgs = concat([event], arguments, 1),
+            i, length;
+
+        do {
+          namedListeners = scope.$$listeners[name] || empty;
+          event.currentScope = scope;
+          for (i = 0, length = namedListeners.length; i < length; i++) {
+
+            // if listeners were deregistered, defragment the array
+            if (!namedListeners[i]) {
+              namedListeners.splice(i, 1);
+              i--;
+              length--;
+              continue;
+            }
+            try {
+              //allow all listeners attached to the current scope to run
+              namedListeners[i].apply(null, listenerArgs);
+            } catch (e) {
+              $exceptionHandler(e);
+            }
+          }
+          //if any listener on the current scope stops propagation, prevent bubbling
+          if (stopPropagation) {
+            event.currentScope = null;
+            return event;
+          }
+          //traverse upwards
+          scope = scope.$parent;
+        } while (scope);
+
+        event.currentScope = null;
+
+        return event;
+      },
+
+
+      /**
+       * @ngdoc method
+       * @name $rootScope.Scope#$broadcast
+       * @kind function
+       *
+       * @description
+       * Dispatches an event `name` downwards to all child scopes (and their children) notifying the
+       * registered {@link ng.$rootScope.Scope#$on} listeners.
+       *
+       * The event life cycle starts at the scope on which `$broadcast` was called. All
+       * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get
+       * notified. Afterwards, the event propagates to all direct and indirect scopes of the current
+       * scope and calls all registered listeners along the way. The event cannot be canceled.
+       *
+       * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed
+       * onto the {@link ng.$exceptionHandler $exceptionHandler} service.
+       *
+       * @param {string} name Event name to broadcast.
+       * @param {...*} args Optional one or more arguments which will be passed onto the event listeners.
+       * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on}
+       */
+      $broadcast: function(name, args) {
+        var target = this,
+            current = target,
+            next = target,
+            event = {
+              name: name,
+              targetScope: target,
+              preventDefault: function() {
+                event.defaultPrevented = true;
+              },
+              defaultPrevented: false
+            };
+
+        if (!target.$$listenerCount[name]) return event;
+
+        var listenerArgs = concat([event], arguments, 1),
+            listeners, i, length;
+
+        //down while you can, then up and next sibling or up and next sibling until back at root
+        while ((current = next)) {
+          event.currentScope = current;
+          listeners = current.$$listeners[name] || [];
+          for (i = 0, length = listeners.length; i < length; i++) {
+            // if listeners were deregistered, defragment the array
+            if (!listeners[i]) {
+              listeners.splice(i, 1);
+              i--;
+              length--;
+              continue;
+            }
+
+            try {
+              listeners[i].apply(null, listenerArgs);
+            } catch (e) {
+              $exceptionHandler(e);
+            }
+          }
+
+          // Insanity Warning: scope depth-first traversal
+          // yes, this code is a bit crazy, but it works and we have tests to prove it!
+          // this piece should be kept in sync with the traversal in $digest
+          // (though it differs due to having the extra check for $$listenerCount)
+          if (!(next = ((current.$$listenerCount[name] && current.$$childHead) ||
+              (current !== target && current.$$nextSibling)))) {
+            while (current !== target && !(next = current.$$nextSibling)) {
+              current = current.$parent;
+            }
+          }
+        }
+
+        event.currentScope = null;
+        return event;
+      }
+    };
+
+    var $rootScope = new Scope();
+
+    //The internal queues. Expose them on the $rootScope for debugging/testing purposes.
+    var asyncQueue = $rootScope.$$asyncQueue = [];
+    var postDigestQueue = $rootScope.$$postDigestQueue = [];
+    var applyAsyncQueue = $rootScope.$$applyAsyncQueue = [];
+
+    var postDigestQueuePosition = 0;
+
+    return $rootScope;
+
+
+    function beginPhase(phase) {
+      if ($rootScope.$$phase) {
+        throw $rootScopeMinErr('inprog', '{0} already in progress', $rootScope.$$phase);
+      }
+
+      $rootScope.$$phase = phase;
+    }
+
+    function clearPhase() {
+      $rootScope.$$phase = null;
+    }
+
+    function incrementWatchersCount(current, count) {
+      do {
+        current.$$watchersCount += count;
+      } while ((current = current.$parent));
+    }
+
+    function decrementListenerCount(current, count, name) {
+      do {
+        current.$$listenerCount[name] -= count;
+
+        if (current.$$listenerCount[name] === 0) {
+          delete current.$$listenerCount[name];
+        }
+      } while ((current = current.$parent));
+    }
+
+    /**
+     * function used as an initial value for watchers.
+     * because it's unique we can easily tell it apart from other values
+     */
+    function initWatchVal() {}
+
+    function flushApplyAsync() {
+      while (applyAsyncQueue.length) {
+        try {
+          applyAsyncQueue.shift()();
+        } catch (e) {
+          $exceptionHandler(e);
+        }
+      }
+      applyAsyncId = null;
+    }
+
+    function scheduleApplyAsync() {
+      if (applyAsyncId === null) {
+        applyAsyncId = $browser.defer(function() {
+          $rootScope.$apply(flushApplyAsync);
+        });
+      }
+    }
+  }];
+}
+
+/**
+ * @ngdoc service
+ * @name $rootElement
+ *
+ * @description
+ * The root element of Angular application. This is either the element where {@link
+ * ng.directive:ngApp ngApp} was declared or the element passed into
+ * {@link angular.bootstrap}. The element represents the root element of application. It is also the
+ * location where the application's {@link auto.$injector $injector} service gets
+ * published, and can be retrieved using `$rootElement.injector()`.
+ */
+
+
+// the implementation is in angular.bootstrap
+
+/**
+ * @description
+ * Private service to sanitize uris for links and images. Used by $compile and $sanitize.
+ */
+function $$SanitizeUriProvider() {
+  var aHrefSanitizationWhitelist = /^\s*(https?|ftp|mailto|tel|file):/,
+    imgSrcSanitizationWhitelist = /^\s*((https?|ftp|file|blob):|data:image\/)/;
+
+  /**
+   * @description
+   * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+   * urls during a[href] sanitization.
+   *
+   * The sanitization is a security measure aimed at prevent XSS attacks via html links.
+   *
+   * Any url about to be assigned to a[href] via data-binding is first normalized and turned into
+   * an absolute url. Afterwards, the url is matched against the `aHrefSanitizationWhitelist`
+   * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+   *
+   * @param {RegExp=} regexp New regexp to whitelist urls with.
+   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+   *    chaining otherwise.
+   */
+  this.aHrefSanitizationWhitelist = function(regexp) {
+    if (isDefined(regexp)) {
+      aHrefSanitizationWhitelist = regexp;
+      return this;
+    }
+    return aHrefSanitizationWhitelist;
+  };
+
+
+  /**
+   * @description
+   * Retrieves or overrides the default regular expression that is used for whitelisting of safe
+   * urls during img[src] sanitization.
+   *
+   * The sanitization is a security measure aimed at prevent XSS attacks via html links.
+   *
+   * Any url about to be assigned to img[src] via data-binding is first normalized and turned into
+   * an absolute url. Afterwards, the url is matched against the `imgSrcSanitizationWhitelist`
+   * regular expression. If a match is found, the original url is written into the dom. Otherwise,
+   * the absolute url is prefixed with `'unsafe:'` string and only then is it written into the DOM.
+   *
+   * @param {RegExp=} regexp New regexp to whitelist urls with.
+   * @returns {RegExp|ng.$compileProvider} Current RegExp if called without value or self for
+   *    chaining otherwise.
+   */
+  this.imgSrcSanitizationWhitelist = function(regexp) {
+    if (isDefined(regexp)) {
+      imgSrcSanitizationWhitelist = regexp;
+      return this;
+    }
+    return imgSrcSanitizationWhitelist;
+  };
+
+  this.$get = function() {
+    return function sanitizeUri(uri, isImage) {
+      var regex = isImage ? imgSrcSanitizationWhitelist : aHrefSanitizationWhitelist;
+      var normalizedVal;
+      normalizedVal = urlResolve(uri).href;
+      if (normalizedVal !== '' && !normalizedVal.match(regex)) {
+        return 'unsafe:' + normalizedVal;
+      }
+      return uri;
+    };
+  };
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *     Any commits to this file should be reviewed with security in mind.  *
+ *   Changes to this file can potentially create security vulnerabilities. *
+ *          An approval from 2 Core members with history of modifying      *
+ *                         this file is required.                          *
+ *                                                                         *
+ *  Does the change somehow allow for arbitrary javascript to be executed? *
+ *    Or allows for someone to change the prototype of built-in objects?   *
+ *     Or gives undesired access to variables likes document or window?    *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+var $sceMinErr = minErr('$sce');
+
+var SCE_CONTEXTS = {
+  HTML: 'html',
+  CSS: 'css',
+  URL: 'url',
+  // RESOURCE_URL is a subtype of URL used in contexts where a privileged resource is sourced from a
+  // url.  (e.g. ng-include, script src, templateUrl)
+  RESOURCE_URL: 'resourceUrl',
+  JS: 'js'
+};
+
+// Helper functions follow.
+
+function adjustMatcher(matcher) {
+  if (matcher === 'self') {
+    return matcher;
+  } else if (isString(matcher)) {
+    // Strings match exactly except for 2 wildcards - '*' and '**'.
+    // '*' matches any character except those from the set ':/.?&'.
+    // '**' matches any character (like .* in a RegExp).
+    // More than 2 *'s raises an error as it's ill defined.
+    if (matcher.indexOf('***') > -1) {
+      throw $sceMinErr('iwcard',
+          'Illegal sequence *** in string matcher.  String: {0}', matcher);
+    }
+    matcher = escapeForRegexp(matcher).
+                  replace('\\*\\*', '.*').
+                  replace('\\*', '[^:/.?&;]*');
+    return new RegExp('^' + matcher + '$');
+  } else if (isRegExp(matcher)) {
+    // The only other type of matcher allowed is a Regexp.
+    // Match entire URL / disallow partial matches.
+    // Flags are reset (i.e. no global, ignoreCase or multiline)
+    return new RegExp('^' + matcher.source + '$');
+  } else {
+    throw $sceMinErr('imatcher',
+        'Matchers may only be "self", string patterns or RegExp objects');
+  }
+}
+
+
+function adjustMatchers(matchers) {
+  var adjustedMatchers = [];
+  if (isDefined(matchers)) {
+    forEach(matchers, function(matcher) {
+      adjustedMatchers.push(adjustMatcher(matcher));
+    });
+  }
+  return adjustedMatchers;
+}
+
+
+/**
+ * @ngdoc service
+ * @name $sceDelegate
+ * @kind function
+ *
+ * @description
+ *
+ * `$sceDelegate` is a service that is used by the `$sce` service to provide {@link ng.$sce Strict
+ * Contextual Escaping (SCE)} services to AngularJS.
+ *
+ * Typically, you would configure or override the {@link ng.$sceDelegate $sceDelegate} instead of
+ * the `$sce` service to customize the way Strict Contextual Escaping works in AngularJS.  This is
+ * because, while the `$sce` provides numerous shorthand methods, etc., you really only need to
+ * override 3 core functions (`trustAs`, `getTrusted` and `valueOf`) to replace the way things
+ * work because `$sce` delegates to `$sceDelegate` for these operations.
+ *
+ * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} to configure this service.
+ *
+ * The default instance of `$sceDelegate` should work out of the box with little pain.  While you
+ * can override it completely to change the behavior of `$sce`, the common case would
+ * involve configuring the {@link ng.$sceDelegateProvider $sceDelegateProvider} instead by setting
+ * your own whitelists and blacklists for trusting URLs used for loading AngularJS resources such as
+ * templates.  Refer {@link ng.$sceDelegateProvider#resourceUrlWhitelist
+ * $sceDelegateProvider.resourceUrlWhitelist} and {@link
+ * ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}
+ */
+
+/**
+ * @ngdoc provider
+ * @name $sceDelegateProvider
+ * @description
+ *
+ * The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate
+ * $sceDelegate} service.  This allows one to get/set the whitelists and blacklists used to ensure
+ * that the URLs used for sourcing Angular templates are safe.  Refer {@link
+ * ng.$sceDelegateProvider#resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist} and
+ * {@link ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}
+ *
+ * For the general details about this service in Angular, read the main page for {@link ng.$sce
+ * Strict Contextual Escaping (SCE)}.
+ *
+ * **Example**:  Consider the following case. <a name="example"></a>
+ *
+ * - your app is hosted at url `http://myapp.example.com/`
+ * - but some of your templates are hosted on other domains you control such as
+ *   `http://srv01.assets.example.com/`,  `http://srv02.assets.example.com/`, etc.
+ * - and you have an open redirect at `http://myapp.example.com/clickThru?...`.
+ *
+ * Here is what a secure configuration for this scenario might look like:
+ *
+ * ```
+ *  angular.module('myApp', []).config(function($sceDelegateProvider) {
+ *    $sceDelegateProvider.resourceUrlWhitelist([
+ *      // Allow same origin resource loads.
+ *      'self',
+ *      // Allow loading from our assets domain.  Notice the difference between * and **.
+ *      'http://srv*.assets.example.com/**'
+ *    ]);
+ *
+ *    // The blacklist overrides the whitelist so the open redirect here is blocked.
+ *    $sceDelegateProvider.resourceUrlBlacklist([
+ *      'http://myapp.example.com/clickThru**'
+ *    ]);
+ *  });
+ * ```
+ */
+
+function $SceDelegateProvider() {
+  this.SCE_CONTEXTS = SCE_CONTEXTS;
+
+  // Resource URLs can also be trusted by policy.
+  var resourceUrlWhitelist = ['self'],
+      resourceUrlBlacklist = [];
+
+  /**
+   * @ngdoc method
+   * @name $sceDelegateProvider#resourceUrlWhitelist
+   * @kind function
+   *
+   * @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value
+   *    provided.  This must be an array or null.  A snapshot of this array is used so further
+   *    changes to the array are ignored.
+   *
+   *    Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
+   *    allowed in this array.
+   *
+   *    <div class="alert alert-warning">
+   *    **Note:** an empty whitelist array will block all URLs!
+   *    </div>
+   *
+   * @return {Array} the currently set whitelist array.
+   *
+   * The **default value** when no whitelist has been explicitly set is `['self']` allowing only
+   * same origin resource requests.
+   *
+   * @description
+   * Sets/Gets the whitelist of trusted resource URLs.
+   */
+  this.resourceUrlWhitelist = function(value) {
+    if (arguments.length) {
+      resourceUrlWhitelist = adjustMatchers(value);
+    }
+    return resourceUrlWhitelist;
+  };
+
+  /**
+   * @ngdoc method
+   * @name $sceDelegateProvider#resourceUrlBlacklist
+   * @kind function
+   *
+   * @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value
+   *    provided.  This must be an array or null.  A snapshot of this array is used so further
+   *    changes to the array are ignored.
+   *
+   *    Follow {@link ng.$sce#resourceUrlPatternItem this link} for a description of the items
+   *    allowed in this array.
+   *
+   *    The typical usage for the blacklist is to **block
+   *    [open redirects](http://cwe.mitre.org/data/definitions/601.html)** served by your domain as
+   *    these would otherwise be trusted but actually return content from the redirected domain.
+   *
+   *    Finally, **the blacklist overrides the whitelist** and has the final say.
+   *
+   * @return {Array} the currently set blacklist array.
+   *
+   * The **default value** when no whitelist has been explicitly set is the empty array (i.e. there
+   * is no blacklist.)
+   *
+   * @description
+   * Sets/Gets the blacklist of trusted resource URLs.
+   */
+
+  this.resourceUrlBlacklist = function(value) {
+    if (arguments.length) {
+      resourceUrlBlacklist = adjustMatchers(value);
+    }
+    return resourceUrlBlacklist;
+  };
+
+  this.$get = ['$injector', function($injector) {
+
+    var htmlSanitizer = function htmlSanitizer(html) {
+      throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');
+    };
+
+    if ($injector.has('$sanitize')) {
+      htmlSanitizer = $injector.get('$sanitize');
+    }
+
+
+    function matchUrl(matcher, parsedUrl) {
+      if (matcher === 'self') {
+        return urlIsSameOrigin(parsedUrl);
+      } else {
+        // definitely a regex.  See adjustMatchers()
+        return !!matcher.exec(parsedUrl.href);
+      }
+    }
+
+    function isResourceUrlAllowedByPolicy(url) {
+      var parsedUrl = urlResolve(url.toString());
+      var i, n, allowed = false;
+      // Ensure that at least one item from the whitelist allows this url.
+      for (i = 0, n = resourceUrlWhitelist.length; i < n; i++) {
+        if (matchUrl(resourceUrlWhitelist[i], parsedUrl)) {
+          allowed = true;
+          break;
+        }
+      }
+      if (allowed) {
+        // Ensure that no item from the blacklist blocked this url.
+        for (i = 0, n = resourceUrlBlacklist.length; i < n; i++) {
+          if (matchUrl(resourceUrlBlacklist[i], parsedUrl)) {
+            allowed = false;
+            break;
+          }
+        }
+      }
+      return allowed;
+    }
+
+    function generateHolderType(Base) {
+      var holderType = function TrustedValueHolderType(trustedValue) {
+        this.$$unwrapTrustedValue = function() {
+          return trustedValue;
+        };
+      };
+      if (Base) {
+        holderType.prototype = new Base();
+      }
+      holderType.prototype.valueOf = function sceValueOf() {
+        return this.$$unwrapTrustedValue();
+      };
+      holderType.prototype.toString = function sceToString() {
+        return this.$$unwrapTrustedValue().toString();
+      };
+      return holderType;
+    }
+
+    var trustedValueHolderBase = generateHolderType(),
+        byType = {};
+
+    byType[SCE_CONTEXTS.HTML] = generateHolderType(trustedValueHolderBase);
+    byType[SCE_CONTEXTS.CSS] = generateHolderType(trustedValueHolderBase);
+    byType[SCE_CONTEXTS.URL] = generateHolderType(trustedValueHolderBase);
+    byType[SCE_CONTEXTS.JS] = generateHolderType(trustedValueHolderBase);
+    byType[SCE_CONTEXTS.RESOURCE_URL] = generateHolderType(byType[SCE_CONTEXTS.URL]);
+
+    /**
+     * @ngdoc method
+     * @name $sceDelegate#trustAs
+     *
+     * @description
+     * Returns an object that is trusted by angular for use in specified strict
+     * contextual escaping contexts (such as ng-bind-html, ng-include, any src
+     * attribute interpolation, any dom event binding attribute interpolation
+     * such as for onclick,  etc.) that uses the provided value.
+     * See {@link ng.$sce $sce} for enabling strict contextual escaping.
+     *
+     * @param {string} type The kind of context in which this value is safe for use.  e.g. url,
+     *   resourceUrl, html, js and css.
+     * @param {*} value The value that that should be considered trusted/safe.
+     * @returns {*} A value that can be used to stand in for the provided `value` in places
+     * where Angular expects a $sce.trustAs() return value.
+     */
+    function trustAs(type, trustedValue) {
+      var Constructor = (byType.hasOwnProperty(type) ? byType[type] : null);
+      if (!Constructor) {
+        throw $sceMinErr('icontext',
+            'Attempted to trust a value in invalid context. Context: {0}; Value: {1}',
+            type, trustedValue);
+      }
+      if (trustedValue === null || isUndefined(trustedValue) || trustedValue === '') {
+        return trustedValue;
+      }
+      // All the current contexts in SCE_CONTEXTS happen to be strings.  In order to avoid trusting
+      // mutable objects, we ensure here that the value passed in is actually a string.
+      if (typeof trustedValue !== 'string') {
+        throw $sceMinErr('itype',
+            'Attempted to trust a non-string value in a content requiring a string: Context: {0}',
+            type);
+      }
+      return new Constructor(trustedValue);
+    }
+
+    /**
+     * @ngdoc method
+     * @name $sceDelegate#valueOf
+     *
+     * @description
+     * If the passed parameter had been returned by a prior call to {@link ng.$sceDelegate#trustAs
+     * `$sceDelegate.trustAs`}, returns the value that had been passed to {@link
+     * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.
+     *
+     * If the passed parameter is not a value that had been returned by {@link
+     * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}, returns it as-is.
+     *
+     * @param {*} value The result of a prior {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}
+     *      call or anything else.
+     * @returns {*} The `value` that was originally provided to {@link ng.$sceDelegate#trustAs
+     *     `$sceDelegate.trustAs`} if `value` is the result of such a call.  Otherwise, returns
+     *     `value` unchanged.
+     */
+    function valueOf(maybeTrusted) {
+      if (maybeTrusted instanceof trustedValueHolderBase) {
+        return maybeTrusted.$$unwrapTrustedValue();
+      } else {
+        return maybeTrusted;
+      }
+    }
+
+    /**
+     * @ngdoc method
+     * @name $sceDelegate#getTrusted
+     *
+     * @description
+     * Takes the result of a {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} call and
+     * returns the originally supplied value if the queried context type is a supertype of the
+     * created type.  If this condition isn't satisfied, throws an exception.
+     *
+     * <div class="alert alert-danger">
+     * Disabling auto-escaping is extremely dangerous, it usually creates a Cross Site Scripting
+     * (XSS) vulnerability in your application.
+     * </div>
+     *
+     * @param {string} type The kind of context in which this value is to be used.
+     * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#trustAs
+     *     `$sceDelegate.trustAs`} call.
+     * @returns {*} The value the was originally provided to {@link ng.$sceDelegate#trustAs
+     *     `$sceDelegate.trustAs`} if valid in this context.  Otherwise, throws an exception.
+     */
+    function getTrusted(type, maybeTrusted) {
+      if (maybeTrusted === null || isUndefined(maybeTrusted) || maybeTrusted === '') {
+        return maybeTrusted;
+      }
+      var constructor = (byType.hasOwnProperty(type) ? byType[type] : null);
+      if (constructor && maybeTrusted instanceof constructor) {
+        return maybeTrusted.$$unwrapTrustedValue();
+      }
+      // If we get here, then we may only take one of two actions.
+      // 1. sanitize the value for the requested type, or
+      // 2. throw an exception.
+      if (type === SCE_CONTEXTS.RESOURCE_URL) {
+        if (isResourceUrlAllowedByPolicy(maybeTrusted)) {
+          return maybeTrusted;
+        } else {
+          throw $sceMinErr('insecurl',
+              'Blocked loading resource from url not allowed by $sceDelegate policy.  URL: {0}',
+              maybeTrusted.toString());
+        }
+      } else if (type === SCE_CONTEXTS.HTML) {
+        return htmlSanitizer(maybeTrusted);
+      }
+      throw $sceMinErr('unsafe', 'Attempting to use an unsafe value in a safe context.');
+    }
+
+    return { trustAs: trustAs,
+             getTrusted: getTrusted,
+             valueOf: valueOf };
+  }];
+}
+
+
+/**
+ * @ngdoc provider
+ * @name $sceProvider
+ * @description
+ *
+ * The $sceProvider provider allows developers to configure the {@link ng.$sce $sce} service.
+ * -   enable/disable Strict Contextual Escaping (SCE) in a module
+ * -   override the default implementation with a custom delegate
+ *
+ * Read more about {@link ng.$sce Strict Contextual Escaping (SCE)}.
+ */
+
+/* jshint maxlen: false*/
+
+/**
+ * @ngdoc service
+ * @name $sce
+ * @kind function
+ *
+ * @description
+ *
+ * `$sce` is a service that provides Strict Contextual Escaping services to AngularJS.
+ *
+ * # Strict Contextual Escaping
+ *
+ * Strict Contextual Escaping (SCE) is a mode in which AngularJS requires bindings in certain
+ * contexts to result in a value that is marked as safe to use for that context.  One example of
+ * such a context is binding arbitrary html controlled by the user via `ng-bind-html`.  We refer
+ * to these contexts as privileged or SCE contexts.
+ *
+ * As of version 1.2, Angular ships with SCE enabled by default.
+ *
+ * Note:  When enabled (the default), IE<11 in quirks mode is not supported.  In this mode, IE<11 allow
+ * one to execute arbitrary javascript by the use of the expression() syntax.  Refer
+ * <http://blogs.msdn.com/b/ie/archive/2008/10/16/ending-expressions.aspx> to learn more about them.
+ * You can ensure your document is in standards mode and not quirks mode by adding `<!doctype html>`
+ * to the top of your HTML document.
+ *
+ * SCE assists in writing code in a way that (a) is secure by default and (b) makes auditing for
+ * security vulnerabilities such as XSS, clickjacking, etc. a lot easier.
+ *
+ * Here's an example of a binding in a privileged context:
+ *
+ * ```
+ * <input ng-model="userHtml" aria-label="User input">
+ * <div ng-bind-html="userHtml"></div>
+ * ```
+ *
+ * Notice that `ng-bind-html` is bound to `userHtml` controlled by the user.  With SCE
+ * disabled, this application allows the user to render arbitrary HTML into the DIV.
+ * In a more realistic example, one may be rendering user comments, blog articles, etc. via
+ * bindings.  (HTML is just one example of a context where rendering user controlled input creates
+ * security vulnerabilities.)
+ *
+ * For the case of HTML, you might use a library, either on the client side, or on the server side,
+ * to sanitize unsafe HTML before binding to the value and rendering it in the document.
+ *
+ * How would you ensure that every place that used these types of bindings was bound to a value that
+ * was sanitized by your library (or returned as safe for rendering by your server?)  How can you
+ * ensure that you didn't accidentally delete the line that sanitized the value, or renamed some
+ * properties/fields and forgot to update the binding to the sanitized value?
+ *
+ * To be secure by default, you want to ensure that any such bindings are disallowed unless you can
+ * determine that something explicitly says it's safe to use a value for binding in that
+ * context.  You can then audit your code (a simple grep would do) to ensure that this is only done
+ * for those values that you can easily tell are safe - because they were received from your server,
+ * sanitized by your library, etc.  You can organize your codebase to help with this - perhaps
+ * allowing only the files in a specific directory to do this.  Ensuring that the internal API
+ * exposed by that code doesn't markup arbitrary values as safe then becomes a more manageable task.
+ *
+ * In the case of AngularJS' SCE service, one uses {@link ng.$sce#trustAs $sce.trustAs}
+ * (and shorthand methods such as {@link ng.$sce#trustAsHtml $sce.trustAsHtml}, etc.) to
+ * obtain values that will be accepted by SCE / privileged contexts.
+ *
+ *
+ * ## How does it work?
+ *
+ * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#getTrusted
+ * $sce.getTrusted(context, value)} rather than to the value directly.  Directives use {@link
+ * ng.$sce#parseAs $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs the
+ * {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals.
+ *
+ * As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link
+ * ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}.  Here's the actual code (slightly
+ * simplified):
+ *
+ * ```
+ * var ngBindHtmlDirective = ['$sce', function($sce) {
+ *   return function(scope, element, attr) {
+ *     scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) {
+ *       element.html(value || '');
+ *     });
+ *   };
+ * }];
+ * ```
+ *
+ * ## Impact on loading templates
+ *
+ * This applies both to the {@link ng.directive:ngInclude `ng-include`} directive as well as
+ * `templateUrl`'s specified by {@link guide/directive directives}.
+ *
+ * By default, Angular only loads templates from the same domain and protocol as the application
+ * document.  This is done by calling {@link ng.$sce#getTrustedResourceUrl
+ * $sce.getTrustedResourceUrl} on the template URL.  To load templates from other domains and/or
+ * protocols, you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist
+ * them} or {@link ng.$sce#trustAsResourceUrl wrap it} into a trusted value.
+ *
+ * *Please note*:
+ * The browser's
+ * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)
+ * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)
+ * policy apply in addition to this and may further restrict whether the template is successfully
+ * loaded.  This means that without the right CORS policy, loading templates from a different domain
+ * won't work on all browsers.  Also, loading templates from `file://` URL does not work on some
+ * browsers.
+ *
+ * ## This feels like too much overhead
+ *
+ * It's important to remember that SCE only applies to interpolation expressions.
+ *
+ * If your expressions are constant literals, they're automatically trusted and you don't need to
+ * call `$sce.trustAs` on them (remember to include the `ngSanitize` module) (e.g.
+ * `<div ng-bind-html="'<b>implicitly trusted</b>'"></div>`) just works.
+ *
+ * Additionally, `a[href]` and `img[src]` automatically sanitize their URLs and do not pass them
+ * through {@link ng.$sce#getTrusted $sce.getTrusted}.  SCE doesn't play a role here.
+ *
+ * The included {@link ng.$sceDelegate $sceDelegate} comes with sane defaults to allow you to load
+ * templates in `ng-include` from your application's domain without having to even know about SCE.
+ * It blocks loading templates from other domains or loading templates over http from an https
+ * served document.  You can change these by setting your own custom {@link
+ * ng.$sceDelegateProvider#resourceUrlWhitelist whitelists} and {@link
+ * ng.$sceDelegateProvider#resourceUrlBlacklist blacklists} for matching such URLs.
+ *
+ * This significantly reduces the overhead.  It is far easier to pay the small overhead and have an
+ * application that's secure and can be audited to verify that with much more ease than bolting
+ * security onto an application later.
+ *
+ * <a name="contexts"></a>
+ * ## What trusted context types are supported?
+ *
+ * | Context             | Notes          |
+ * |---------------------|----------------|
+ * | `$sce.HTML`         | For HTML that's safe to source into the application.  The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. If an unsafe value is encountered and the {@link ngSanitize $sanitize} module is present this will sanitize the value instead of throwing an error. |
+ * | `$sce.CSS`          | For CSS that's safe to source into the application.  Currently unused.  Feel free to use it in your own directives. |
+ * | `$sce.URL`          | For URLs that are safe to follow as links.  Currently unused (`<a href=` and `<img src=` sanitize their urls and don't constitute an SCE context. |
+ * | `$sce.RESOURCE_URL` | For URLs that are not only safe to follow as links, but whose contents are also safe to include in your application.  Examples include `ng-include`, `src` / `ngSrc` bindings for tags other than `IMG` (e.g. `IFRAME`, `OBJECT`, etc.)  <br><br>Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. |
+ * | `$sce.JS`           | For JavaScript that is safe to execute in your application's context.  Currently unused.  Feel free to use it in your own directives. |
+ *
+ * ## Format of items in {@link ng.$sceDelegateProvider#resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#resourceUrlBlacklist Blacklist} <a name="resourceUrlPatternItem"></a>
+ *
+ *  Each element in these arrays must be one of the following:
+ *
+ *  - **'self'**
+ *    - The special **string**, `'self'`, can be used to match against all URLs of the **same
+ *      domain** as the application document using the **same protocol**.
+ *  - **String** (except the special value `'self'`)
+ *    - The string is matched against the full *normalized / absolute URL* of the resource
+ *      being tested (substring matches are not good enough.)
+ *    - There are exactly **two wildcard sequences** - `*` and `**`.  All other characters
+ *      match themselves.
+ *    - `*`: matches zero or more occurrences of any character other than one of the following 6
+ *      characters: '`:`', '`/`', '`.`', '`?`', '`&`' and '`;`'.  It's a useful wildcard for use
+ *      in a whitelist.
+ *    - `**`: matches zero or more occurrences of *any* character.  As such, it's not
+ *      appropriate for use in a scheme, domain, etc. as it would match too much.  (e.g.
+ *      http://**.example.com/ would match http://evil.com/?ignore=.example.com/ and that might
+ *      not have been the intention.)  Its usage at the very end of the path is ok.  (e.g.
+ *      http://foo.example.com/templates/**).
+ *  - **RegExp** (*see caveat below*)
+ *    - *Caveat*:  While regular expressions are powerful and offer great flexibility,  their syntax
+ *      (and all the inevitable escaping) makes them *harder to maintain*.  It's easy to
+ *      accidentally introduce a bug when one updates a complex expression (imho, all regexes should
+ *      have good test coverage).  For instance, the use of `.` in the regex is correct only in a
+ *      small number of cases.  A `.` character in the regex used when matching the scheme or a
+ *      subdomain could be matched against a `:` or literal `.` that was likely not intended.   It
+ *      is highly recommended to use the string patterns and only fall back to regular expressions
+ *      as a last resort.
+ *    - The regular expression must be an instance of RegExp (i.e. not a string.)  It is
+ *      matched against the **entire** *normalized / absolute URL* of the resource being tested
+ *      (even when the RegExp did not have the `^` and `$` codes.)  In addition, any flags
+ *      present on the RegExp (such as multiline, global, ignoreCase) are ignored.
+ *    - If you are generating your JavaScript from some other templating engine (not
+ *      recommended, e.g. in issue [#4006](https://github.com/angular/angular.js/issues/4006)),
+ *      remember to escape your regular expression (and be aware that you might need more than
+ *      one level of escaping depending on your templating engine and the way you interpolated
+ *      the value.)  Do make use of your platform's escaping mechanism as it might be good
+ *      enough before coding your own.  E.g. Ruby has
+ *      [Regexp.escape(str)](http://www.ruby-doc.org/core-2.0.0/Regexp.html#method-c-escape)
+ *      and Python has [re.escape](http://docs.python.org/library/re.html#re.escape).
+ *      Javascript lacks a similar built in function for escaping.  Take a look at Google
+ *      Closure library's [goog.string.regExpEscape(s)](
+ *      http://docs.closure-library.googlecode.com/git/closure_goog_string_string.js.source.html#line962).
+ *
+ * Refer {@link ng.$sceDelegateProvider $sceDelegateProvider} for an example.
+ *
+ * ## Show me an example using SCE.
+ *
+ * <example module="mySceApp" deps="angular-sanitize.js">
+ * <file name="index.html">
+ *   <div ng-controller="AppController as myCtrl">
+ *     <i ng-bind-html="myCtrl.explicitlyTrustedHtml" id="explicitlyTrustedHtml"></i><br><br>
+ *     <b>User comments</b><br>
+ *     By default, HTML that isn't explicitly trusted (e.g. Alice's comment) is sanitized when
+ *     $sanitize is available.  If $sanitize isn't available, this results in an error instead of an
+ *     exploit.
+ *     <div class="well">
+ *       <div ng-repeat="userComment in myCtrl.userComments">
+ *         <b>{{userComment.name}}</b>:
+ *         <span ng-bind-html="userComment.htmlComment" class="htmlComment"></span>
+ *         <br>
+ *       </div>
+ *     </div>
+ *   </div>
+ * </file>
+ *
+ * <file name="script.js">
+ *   angular.module('mySceApp', ['ngSanitize'])
+ *     .controller('AppController', ['$http', '$templateCache', '$sce',
+ *       function($http, $templateCache, $sce) {
+ *         var self = this;
+ *         $http.get("test_data.json", {cache: $templateCache}).success(function(userComments) {
+ *           self.userComments = userComments;
+ *         });
+ *         self.explicitlyTrustedHtml = $sce.trustAsHtml(
+ *             '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
+ *             'sanitization.&quot;">Hover over this text.</span>');
+ *       }]);
+ * </file>
+ *
+ * <file name="test_data.json">
+ * [
+ *   { "name": "Alice",
+ *     "htmlComment":
+ *         "<span onmouseover='this.textContent=\"PWN3D!\"'>Is <i>anyone</i> reading this?</span>"
+ *   },
+ *   { "name": "Bob",
+ *     "htmlComment": "<i>Yes!</i>  Am I the only other one?"
+ *   }
+ * ]
+ * </file>
+ *
+ * <file name="protractor.js" type="protractor">
+ *   describe('SCE doc demo', function() {
+ *     it('should sanitize untrusted values', function() {
+ *       expect(element.all(by.css('.htmlComment')).first().getInnerHtml())
+ *           .toBe('<span>Is <i>anyone</i> reading this?</span>');
+ *     });
+ *
+ *     it('should NOT sanitize explicitly trusted values', function() {
+ *       expect(element(by.id('explicitlyTrustedHtml')).getInnerHtml()).toBe(
+ *           '<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
+ *           'sanitization.&quot;">Hover over this text.</span>');
+ *     });
+ *   });
+ * </file>
+ * </example>
+ *
+ *
+ *
+ * ## Can I disable SCE completely?
+ *
+ * Yes, you can.  However, this is strongly discouraged.  SCE gives you a lot of security benefits
+ * for little coding overhead.  It will be much harder to take an SCE disabled application and
+ * either secure it on your own or enable SCE at a later stage.  It might make sense to disable SCE
+ * for cases where you have a lot of existing code that was written before SCE was introduced and
+ * you're migrating them a module at a time.
+ *
+ * That said, here's how you can completely disable SCE:
+ *
+ * ```
+ * angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) {
+ *   // Completely disable SCE.  For demonstration purposes only!
+ *   // Do not use in new projects.
+ *   $sceProvider.enabled(false);
+ * });
+ * ```
+ *
+ */
+/* jshint maxlen: 100 */
+
+function $SceProvider() {
+  var enabled = true;
+
+  /**
+   * @ngdoc method
+   * @name $sceProvider#enabled
+   * @kind function
+   *
+   * @param {boolean=} value If provided, then enables/disables SCE.
+   * @return {boolean} true if SCE is enabled, false otherwise.
+   *
+   * @description
+   * Enables/disables SCE and returns the current value.
+   */
+  this.enabled = function(value) {
+    if (arguments.length) {
+      enabled = !!value;
+    }
+    return enabled;
+  };
+
+
+  /* Design notes on the default implementation for SCE.
+   *
+   * The API contract for the SCE delegate
+   * -------------------------------------
+   * The SCE delegate object must provide the following 3 methods:
+   *
+   * - trustAs(contextEnum, value)
+   *     This method is used to tell the SCE service that the provided value is OK to use in the
+   *     contexts specified by contextEnum.  It must return an object that will be accepted by
+   *     getTrusted() for a compatible contextEnum and return this value.
+   *
+   * - valueOf(value)
+   *     For values that were not produced by trustAs(), return them as is.  For values that were
+   *     produced by trustAs(), return the corresponding input value to trustAs.  Basically, if
+   *     trustAs is wrapping the given values into some type, this operation unwraps it when given
+   *     such a value.
+   *
+   * - getTrusted(contextEnum, value)
+   *     This function should return the a value that is safe to use in the context specified by
+   *     contextEnum or throw and exception otherwise.
+   *
+   * NOTE: This contract deliberately does NOT state that values returned by trustAs() must be
+   * opaque or wrapped in some holder object.  That happens to be an implementation detail.  For
+   * instance, an implementation could maintain a registry of all trusted objects by context.  In
+   * such a case, trustAs() would return the same object that was passed in.  getTrusted() would
+   * return the same object passed in if it was found in the registry under a compatible context or
+   * throw an exception otherwise.  An implementation might only wrap values some of the time based
+   * on some criteria.  getTrusted() might return a value and not throw an exception for special
+   * constants or objects even if not wrapped.  All such implementations fulfill this contract.
+   *
+   *
+   * A note on the inheritance model for SCE contexts
+   * ------------------------------------------------
+   * I've used inheritance and made RESOURCE_URL wrapped types a subtype of URL wrapped types.  This
+   * is purely an implementation details.
+   *
+   * The contract is simply this:
+   *
+   *     getTrusted($sce.RESOURCE_URL, value) succeeding implies that getTrusted($sce.URL, value)
+   *     will also succeed.
+   *
+   * Inheritance happens to capture this in a natural way.  In some future, we
+   * may not use inheritance anymore.  That is OK because no code outside of
+   * sce.js and sceSpecs.js would need to be aware of this detail.
+   */
+
+  this.$get = ['$parse', '$sceDelegate', function(
+                $parse,   $sceDelegate) {
+    // Prereq: Ensure that we're not running in IE<11 quirks mode.  In that mode, IE < 11 allow
+    // the "expression(javascript expression)" syntax which is insecure.
+    if (enabled && msie < 8) {
+      throw $sceMinErr('iequirks',
+        'Strict Contextual Escaping does not support Internet Explorer version < 11 in quirks ' +
+        'mode.  You can fix this by adding the text <!doctype html> to the top of your HTML ' +
+        'document.  See http://docs.angularjs.org/api/ng.$sce for more information.');
+    }
+
+    var sce = shallowCopy(SCE_CONTEXTS);
+
+    /**
+     * @ngdoc method
+     * @name $sce#isEnabled
+     * @kind function
+     *
+     * @return {Boolean} true if SCE is enabled, false otherwise.  If you want to set the value, you
+     * have to do it at module config time on {@link ng.$sceProvider $sceProvider}.
+     *
+     * @description
+     * Returns a boolean indicating if SCE is enabled.
+     */
+    sce.isEnabled = function() {
+      return enabled;
+    };
+    sce.trustAs = $sceDelegate.trustAs;
+    sce.getTrusted = $sceDelegate.getTrusted;
+    sce.valueOf = $sceDelegate.valueOf;
+
+    if (!enabled) {
+      sce.trustAs = sce.getTrusted = function(type, value) { return value; };
+      sce.valueOf = identity;
+    }
+
+    /**
+     * @ngdoc method
+     * @name $sce#parseAs
+     *
+     * @description
+     * Converts Angular {@link guide/expression expression} into a function.  This is like {@link
+     * ng.$parse $parse} and is identical when the expression is a literal constant.  Otherwise, it
+     * wraps the expression in a call to {@link ng.$sce#getTrusted $sce.getTrusted(*type*,
+     * *result*)}
+     *
+     * @param {string} type The kind of SCE context in which this result will be used.
+     * @param {string} expression String expression to compile.
+     * @returns {function(context, locals)} a function which represents the compiled expression:
+     *
+     *    * `context` – `{object}` – an object against which any expressions embedded in the strings
+     *      are evaluated against (typically a scope object).
+     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in
+     *      `context`.
+     */
+    sce.parseAs = function sceParseAs(type, expr) {
+      var parsed = $parse(expr);
+      if (parsed.literal && parsed.constant) {
+        return parsed;
+      } else {
+        return $parse(expr, function(value) {
+          return sce.getTrusted(type, value);
+        });
+      }
+    };
+
+    /**
+     * @ngdoc method
+     * @name $sce#trustAs
+     *
+     * @description
+     * Delegates to {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.  As such,
+     * returns an object that is trusted by angular for use in specified strict contextual
+     * escaping contexts (such as ng-bind-html, ng-include, any src attribute
+     * interpolation, any dom event binding attribute interpolation such as for onclick,  etc.)
+     * that uses the provided value.  See * {@link ng.$sce $sce} for enabling strict contextual
+     * escaping.
+     *
+     * @param {string} type The kind of context in which this value is safe for use.  e.g. url,
+     *   resourceUrl, html, js and css.
+     * @param {*} value The value that that should be considered trusted/safe.
+     * @returns {*} A value that can be used to stand in for the provided `value` in places
+     * where Angular expects a $sce.trustAs() return value.
+     */
+
+    /**
+     * @ngdoc method
+     * @name $sce#trustAsHtml
+     *
+     * @description
+     * Shorthand method.  `$sce.trustAsHtml(value)` →
+     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.HTML, value)`}
+     *
+     * @param {*} value The value to trustAs.
+     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedHtml
+     *     $sce.getTrustedHtml(value)} to obtain the original value.  (privileged directives
+     *     only accept expressions that are either literal constants or are the
+     *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)
+     */
+
+    /**
+     * @ngdoc method
+     * @name $sce#trustAsUrl
+     *
+     * @description
+     * Shorthand method.  `$sce.trustAsUrl(value)` →
+     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.URL, value)`}
+     *
+     * @param {*} value The value to trustAs.
+     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedUrl
+     *     $sce.getTrustedUrl(value)} to obtain the original value.  (privileged directives
+     *     only accept expressions that are either literal constants or are the
+     *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)
+     */
+
+    /**
+     * @ngdoc method
+     * @name $sce#trustAsResourceUrl
+     *
+     * @description
+     * Shorthand method.  `$sce.trustAsResourceUrl(value)` →
+     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`}
+     *
+     * @param {*} value The value to trustAs.
+     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedResourceUrl
+     *     $sce.getTrustedResourceUrl(value)} to obtain the original value.  (privileged directives
+     *     only accept expressions that are either literal constants or are the return
+     *     value of {@link ng.$sce#trustAs $sce.trustAs}.)
+     */
+
+    /**
+     * @ngdoc method
+     * @name $sce#trustAsJs
+     *
+     * @description
+     * Shorthand method.  `$sce.trustAsJs(value)` →
+     *     {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.JS, value)`}
+     *
+     * @param {*} value The value to trustAs.
+     * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedJs
+     *     $sce.getTrustedJs(value)} to obtain the original value.  (privileged directives
+     *     only accept expressions that are either literal constants or are the
+     *     return value of {@link ng.$sce#trustAs $sce.trustAs}.)
+     */
+
+    /**
+     * @ngdoc method
+     * @name $sce#getTrusted
+     *
+     * @description
+     * Delegates to {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted`}.  As such,
+     * takes the result of a {@link ng.$sce#trustAs `$sce.trustAs`}() call and returns the
+     * originally supplied value if the queried context type is a supertype of the created type.
+     * If this condition isn't satisfied, throws an exception.
+     *
+     * @param {string} type The kind of context in which this value is to be used.
+     * @param {*} maybeTrusted The result of a prior {@link ng.$sce#trustAs `$sce.trustAs`}
+     *                         call.
+     * @returns {*} The value the was originally provided to
+     *              {@link ng.$sce#trustAs `$sce.trustAs`} if valid in this context.
+     *              Otherwise, throws an exception.
+     */
+
+    /**
+     * @ngdoc method
+     * @name $sce#getTrustedHtml
+     *
+     * @description
+     * Shorthand method.  `$sce.getTrustedHtml(value)` →
+     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`}
+     *
+     * @param {*} value The value to pass to `$sce.getTrusted`.
+     * @returns {*} The return value of `$sce.getTrusted($sce.HTML, value)`
+     */
+
+    /**
+     * @ngdoc method
+     * @name $sce#getTrustedCss
+     *
+     * @description
+     * Shorthand method.  `$sce.getTrustedCss(value)` →
+     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`}
+     *
+     * @param {*} value The value to pass to `$sce.getTrusted`.
+     * @returns {*} The return value of `$sce.getTrusted($sce.CSS, value)`
+     */
+
+    /**
+     * @ngdoc method
+     * @name $sce#getTrustedUrl
+     *
+     * @description
+     * Shorthand method.  `$sce.getTrustedUrl(value)` →
+     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.URL, value)`}
+     *
+     * @param {*} value The value to pass to `$sce.getTrusted`.
+     * @returns {*} The return value of `$sce.getTrusted($sce.URL, value)`
+     */
+
+    /**
+     * @ngdoc method
+     * @name $sce#getTrustedResourceUrl
+     *
+     * @description
+     * Shorthand method.  `$sce.getTrustedResourceUrl(value)` →
+     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`}
+     *
+     * @param {*} value The value to pass to `$sceDelegate.getTrusted`.
+     * @returns {*} The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)`
+     */
+
+    /**
+     * @ngdoc method
+     * @name $sce#getTrustedJs
+     *
+     * @description
+     * Shorthand method.  `$sce.getTrustedJs(value)` →
+     *     {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.JS, value)`}
+     *
+     * @param {*} value The value to pass to `$sce.getTrusted`.
+     * @returns {*} The return value of `$sce.getTrusted($sce.JS, value)`
+     */
+
+    /**
+     * @ngdoc method
+     * @name $sce#parseAsHtml
+     *
+     * @description
+     * Shorthand method.  `$sce.parseAsHtml(expression string)` →
+     *     {@link ng.$sce#parseAs `$sce.parseAs($sce.HTML, value)`}
+     *
+     * @param {string} expression String expression to compile.
+     * @returns {function(context, locals)} a function which represents the compiled expression:
+     *
+     *    * `context` – `{object}` – an object against which any expressions embedded in the strings
+     *      are evaluated against (typically a scope object).
+     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in
+     *      `context`.
+     */
+
+    /**
+     * @ngdoc method
+     * @name $sce#parseAsCss
+     *
+     * @description
+     * Shorthand method.  `$sce.parseAsCss(value)` →
+     *     {@link ng.$sce#parseAs `$sce.parseAs($sce.CSS, value)`}
+     *
+     * @param {string} expression String expression to compile.
+     * @returns {function(context, locals)} a function which represents the compiled expression:
+     *
+     *    * `context` – `{object}` – an object against which any expressions embedded in the strings
+     *      are evaluated against (typically a scope object).
+     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in
+     *      `context`.
+     */
+
+    /**
+     * @ngdoc method
+     * @name $sce#parseAsUrl
+     *
+     * @description
+     * Shorthand method.  `$sce.parseAsUrl(value)` →
+     *     {@link ng.$sce#parseAs `$sce.parseAs($sce.URL, value)`}
+     *
+     * @param {string} expression String expression to compile.
+     * @returns {function(context, locals)} a function which represents the compiled expression:
+     *
+     *    * `context` – `{object}` – an object against which any expressions embedded in the strings
+     *      are evaluated against (typically a scope object).
+     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in
+     *      `context`.
+     */
+
+    /**
+     * @ngdoc method
+     * @name $sce#parseAsResourceUrl
+     *
+     * @description
+     * Shorthand method.  `$sce.parseAsResourceUrl(value)` →
+     *     {@link ng.$sce#parseAs `$sce.parseAs($sce.RESOURCE_URL, value)`}
+     *
+     * @param {string} expression String expression to compile.
+     * @returns {function(context, locals)} a function which represents the compiled expression:
+     *
+     *    * `context` – `{object}` – an object against which any expressions embedded in the strings
+     *      are evaluated against (typically a scope object).
+     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in
+     *      `context`.
+     */
+
+    /**
+     * @ngdoc method
+     * @name $sce#parseAsJs
+     *
+     * @description
+     * Shorthand method.  `$sce.parseAsJs(value)` →
+     *     {@link ng.$sce#parseAs `$sce.parseAs($sce.JS, value)`}
+     *
+     * @param {string} expression String expression to compile.
+     * @returns {function(context, locals)} a function which represents the compiled expression:
+     *
+     *    * `context` – `{object}` – an object against which any expressions embedded in the strings
+     *      are evaluated against (typically a scope object).
+     *    * `locals` – `{object=}` – local variables context object, useful for overriding values in
+     *      `context`.
+     */
+
+    // Shorthand delegations.
+    var parse = sce.parseAs,
+        getTrusted = sce.getTrusted,
+        trustAs = sce.trustAs;
+
+    forEach(SCE_CONTEXTS, function(enumValue, name) {
+      var lName = lowercase(name);
+      sce[camelCase("parse_as_" + lName)] = function(expr) {
+        return parse(enumValue, expr);
+      };
+      sce[camelCase("get_trusted_" + lName)] = function(value) {
+        return getTrusted(enumValue, value);
+      };
+      sce[camelCase("trust_as_" + lName)] = function(value) {
+        return trustAs(enumValue, value);
+      };
+    });
+
+    return sce;
+  }];
+}
+
+/**
+ * !!! This is an undocumented "private" service !!!
+ *
+ * @name $sniffer
+ * @requires $window
+ * @requires $document
+ *
+ * @property {boolean} history Does the browser support html5 history api ?
+ * @property {boolean} transitions Does the browser support CSS transition events ?
+ * @property {boolean} animations Does the browser support CSS animation events ?
+ *
+ * @description
+ * This is very simple implementation of testing browser's features.
+ */
+function $SnifferProvider() {
+  this.$get = ['$window', '$document', function($window, $document) {
+    var eventSupport = {},
+        // Chrome Packaged Apps are not allowed to access `history.pushState`. They can be detected by
+        // the presence of `chrome.app.runtime` (see https://developer.chrome.com/apps/api_index)
+        isChromePackagedApp = $window.chrome && $window.chrome.app && $window.chrome.app.runtime,
+        hasHistoryPushState = !isChromePackagedApp && $window.history && $window.history.pushState,
+        android =
+          toInt((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]),
+        boxee = /Boxee/i.test(($window.navigator || {}).userAgent),
+        document = $document[0] || {},
+        vendorPrefix,
+        vendorRegex = /^(Moz|webkit|ms)(?=[A-Z])/,
+        bodyStyle = document.body && document.body.style,
+        transitions = false,
+        animations = false,
+        match;
+
+    if (bodyStyle) {
+      for (var prop in bodyStyle) {
+        if (match = vendorRegex.exec(prop)) {
+          vendorPrefix = match[0];
+          vendorPrefix = vendorPrefix[0].toUpperCase() + vendorPrefix.substr(1);
+          break;
+        }
+      }
+
+      if (!vendorPrefix) {
+        vendorPrefix = ('WebkitOpacity' in bodyStyle) && 'webkit';
+      }
+
+      transitions = !!(('transition' in bodyStyle) || (vendorPrefix + 'Transition' in bodyStyle));
+      animations  = !!(('animation' in bodyStyle) || (vendorPrefix + 'Animation' in bodyStyle));
+
+      if (android && (!transitions ||  !animations)) {
+        transitions = isString(bodyStyle.webkitTransition);
+        animations = isString(bodyStyle.webkitAnimation);
+      }
+    }
+
+
+    return {
+      // Android has history.pushState, but it does not update location correctly
+      // so let's not use the history API at all.
+      // http://code.google.com/p/android/issues/detail?id=17471
+      // https://github.com/angular/angular.js/issues/904
+
+      // older webkit browser (533.9) on Boxee box has exactly the same problem as Android has
+      // so let's not use the history API also
+      // We are purposefully using `!(android < 4)` to cover the case when `android` is undefined
+      // jshint -W018
+      history: !!(hasHistoryPushState && !(android < 4) && !boxee),
+      // jshint +W018
+      hasEvent: function(event) {
+        // IE9 implements 'input' event it's so fubared that we rather pretend that it doesn't have
+        // it. In particular the event is not fired when backspace or delete key are pressed or
+        // when cut operation is performed.
+        // IE10+ implements 'input' event but it erroneously fires under various situations,
+        // e.g. when placeholder changes, or a form is focused.
+        if (event === 'input' && msie <= 11) return false;
+
+        if (isUndefined(eventSupport[event])) {
+          var divElm = document.createElement('div');
+          eventSupport[event] = 'on' + event in divElm;
+        }
+
+        return eventSupport[event];
+      },
+      csp: csp(),
+      vendorPrefix: vendorPrefix,
+      transitions: transitions,
+      animations: animations,
+      android: android
+    };
+  }];
+}
+
+var $templateRequestMinErr = minErr('$compile');
+
+/**
+ * @ngdoc provider
+ * @name $templateRequestProvider
+ * @description
+ * Used to configure the options passed to the {@link $http} service when making a template request.
+ *
+ * For example, it can be used for specifying the "Accept" header that is sent to the server, when
+ * requesting a template.
+ */
+function $TemplateRequestProvider() {
+
+  var httpOptions;
+
+  /**
+   * @ngdoc method
+   * @name $templateRequestProvider#httpOptions
+   * @description
+   * The options to be passed to the {@link $http} service when making the request.
+   * You can use this to override options such as the "Accept" header for template requests.
+   *
+   * The {@link $templateRequest} will set the `cache` and the `transformResponse` properties of the
+   * options if not overridden here.
+   *
+   * @param {string=} value new value for the {@link $http} options.
+   * @returns {string|self} Returns the {@link $http} options when used as getter and self if used as setter.
+   */
+  this.httpOptions = function(val) {
+    if (val) {
+      httpOptions = val;
+      return this;
+    }
+    return httpOptions;
+  };
+
+  /**
+   * @ngdoc service
+   * @name $templateRequest
+   *
+   * @description
+   * The `$templateRequest` service runs security checks then downloads the provided template using
+   * `$http` and, upon success, stores the contents inside of `$templateCache`. If the HTTP request
+   * fails or the response data of the HTTP request is empty, a `$compile` error will be thrown (the
+   * exception can be thwarted by setting the 2nd parameter of the function to true). Note that the
+   * contents of `$templateCache` are trusted, so the call to `$sce.getTrustedUrl(tpl)` is omitted
+   * when `tpl` is of type string and `$templateCache` has the matching entry.
+   *
+   * If you want to pass custom options to the `$http` service, such as setting the Accept header you
+   * can configure this via {@link $templateRequestProvider#httpOptions}.
+   *
+   * @param {string|TrustedResourceUrl} tpl The HTTP request template URL
+   * @param {boolean=} ignoreRequestError Whether or not to ignore the exception when the request fails or the template is empty
+   *
+   * @return {Promise} a promise for the HTTP response data of the given URL.
+   *
+   * @property {number} totalPendingRequests total amount of pending template requests being downloaded.
+   */
+  this.$get = ['$templateCache', '$http', '$q', '$sce', function($templateCache, $http, $q, $sce) {
+
+    function handleRequestFn(tpl, ignoreRequestError) {
+      handleRequestFn.totalPendingRequests++;
+
+      // We consider the template cache holds only trusted templates, so
+      // there's no need to go through whitelisting again for keys that already
+      // are included in there. This also makes Angular accept any script
+      // directive, no matter its name. However, we still need to unwrap trusted
+      // types.
+      if (!isString(tpl) || isUndefined($templateCache.get(tpl))) {
+        tpl = $sce.getTrustedResourceUrl(tpl);
+      }
+
+      var transformResponse = $http.defaults && $http.defaults.transformResponse;
+
+      if (isArray(transformResponse)) {
+        transformResponse = transformResponse.filter(function(transformer) {
+          return transformer !== defaultHttpResponseTransform;
+        });
+      } else if (transformResponse === defaultHttpResponseTransform) {
+        transformResponse = null;
+      }
+
+      return $http.get(tpl, extend({
+          cache: $templateCache,
+          transformResponse: transformResponse
+        }, httpOptions))
+        ['finally'](function() {
+          handleRequestFn.totalPendingRequests--;
+        })
+        .then(function(response) {
+          $templateCache.put(tpl, response.data);
+          return response.data;
+        }, handleError);
+
+      function handleError(resp) {
+        if (!ignoreRequestError) {
+          throw $templateRequestMinErr('tpload', 'Failed to load template: {0} (HTTP status: {1} {2})',
+            tpl, resp.status, resp.statusText);
+        }
+        return $q.reject(resp);
+      }
+    }
+
+    handleRequestFn.totalPendingRequests = 0;
+
+    return handleRequestFn;
+  }];
+}
+
+function $$TestabilityProvider() {
+  this.$get = ['$rootScope', '$browser', '$location',
+       function($rootScope,   $browser,   $location) {
+
+    /**
+     * @name $testability
+     *
+     * @description
+     * The private $$testability service provides a collection of methods for use when debugging
+     * or by automated test and debugging tools.
+     */
+    var testability = {};
+
+    /**
+     * @name $$testability#findBindings
+     *
+     * @description
+     * Returns an array of elements that are bound (via ng-bind or {{}})
+     * to expressions matching the input.
+     *
+     * @param {Element} element The element root to search from.
+     * @param {string} expression The binding expression to match.
+     * @param {boolean} opt_exactMatch If true, only returns exact matches
+     *     for the expression. Filters and whitespace are ignored.
+     */
+    testability.findBindings = function(element, expression, opt_exactMatch) {
+      var bindings = element.getElementsByClassName('ng-binding');
+      var matches = [];
+      forEach(bindings, function(binding) {
+        var dataBinding = angular.element(binding).data('$binding');
+        if (dataBinding) {
+          forEach(dataBinding, function(bindingName) {
+            if (opt_exactMatch) {
+              var matcher = new RegExp('(^|\\s)' + escapeForRegexp(expression) + '(\\s|\\||$)');
+              if (matcher.test(bindingName)) {
+                matches.push(binding);
+              }
+            } else {
+              if (bindingName.indexOf(expression) != -1) {
+                matches.push(binding);
+              }
+            }
+          });
+        }
+      });
+      return matches;
+    };
+
+    /**
+     * @name $$testability#findModels
+     *
+     * @description
+     * Returns an array of elements that are two-way found via ng-model to
+     * expressions matching the input.
+     *
+     * @param {Element} element The element root to search from.
+     * @param {string} expression The model expression to match.
+     * @param {boolean} opt_exactMatch If true, only returns exact matches
+     *     for the expression.
+     */
+    testability.findModels = function(element, expression, opt_exactMatch) {
+      var prefixes = ['ng-', 'data-ng-', 'ng\\:'];
+      for (var p = 0; p < prefixes.length; ++p) {
+        var attributeEquals = opt_exactMatch ? '=' : '*=';
+        var selector = '[' + prefixes[p] + 'model' + attributeEquals + '"' + expression + '"]';
+        var elements = element.querySelectorAll(selector);
+        if (elements.length) {
+          return elements;
+        }
+      }
+    };
+
+    /**
+     * @name $$testability#getLocation
+     *
+     * @description
+     * Shortcut for getting the location in a browser agnostic way. Returns
+     *     the path, search, and hash. (e.g. /path?a=b#hash)
+     */
+    testability.getLocation = function() {
+      return $location.url();
+    };
+
+    /**
+     * @name $$testability#setLocation
+     *
+     * @description
+     * Shortcut for navigating to a location without doing a full page reload.
+     *
+     * @param {string} url The location url (path, search and hash,
+     *     e.g. /path?a=b#hash) to go to.
+     */
+    testability.setLocation = function(url) {
+      if (url !== $location.url()) {
+        $location.url(url);
+        $rootScope.$digest();
+      }
+    };
+
+    /**
+     * @name $$testability#whenStable
+     *
+     * @description
+     * Calls the callback when $timeout and $http requests are completed.
+     *
+     * @param {function} callback
+     */
+    testability.whenStable = function(callback) {
+      $browser.notifyWhenNoOutstandingRequests(callback);
+    };
+
+    return testability;
+  }];
+}
+
+function $TimeoutProvider() {
+  this.$get = ['$rootScope', '$browser', '$q', '$$q', '$exceptionHandler',
+       function($rootScope,   $browser,   $q,   $$q,   $exceptionHandler) {
+
+    var deferreds = {};
+
+
+     /**
+      * @ngdoc service
+      * @name $timeout
+      *
+      * @description
+      * Angular's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch
+      * block and delegates any exceptions to
+      * {@link ng.$exceptionHandler $exceptionHandler} service.
+      *
+      * The return value of calling `$timeout` is a promise, which will be resolved when
+      * the delay has passed and the timeout function, if provided, is executed.
+      *
+      * To cancel a timeout request, call `$timeout.cancel(promise)`.
+      *
+      * In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to
+      * synchronously flush the queue of deferred functions.
+      *
+      * If you only want a promise that will be resolved after some specified delay
+      * then you can call `$timeout` without the `fn` function.
+      *
+      * @param {function()=} fn A function, whose execution should be delayed.
+      * @param {number=} [delay=0] Delay in milliseconds.
+      * @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
+      *   will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
+      * @param {...*=} Pass additional parameters to the executed function.
+      * @returns {Promise} Promise that will be resolved when the timeout is reached. The promise
+      *   will be resolved with the return value of the `fn` function.
+      *
+      */
+    function timeout(fn, delay, invokeApply) {
+      if (!isFunction(fn)) {
+        invokeApply = delay;
+        delay = fn;
+        fn = noop;
+      }
+
+      var args = sliceArgs(arguments, 3),
+          skipApply = (isDefined(invokeApply) && !invokeApply),
+          deferred = (skipApply ? $$q : $q).defer(),
+          promise = deferred.promise,
+          timeoutId;
+
+      timeoutId = $browser.defer(function() {
+        try {
+          deferred.resolve(fn.apply(null, args));
+        } catch (e) {
+          deferred.reject(e);
+          $exceptionHandler(e);
+        }
+        finally {
+          delete deferreds[promise.$$timeoutId];
+        }
+
+        if (!skipApply) $rootScope.$apply();
+      }, delay);
+
+      promise.$$timeoutId = timeoutId;
+      deferreds[timeoutId] = deferred;
+
+      return promise;
+    }
+
+
+     /**
+      * @ngdoc method
+      * @name $timeout#cancel
+      *
+      * @description
+      * Cancels a task associated with the `promise`. As a result of this, the promise will be
+      * resolved with a rejection.
+      *
+      * @param {Promise=} promise Promise returned by the `$timeout` function.
+      * @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully
+      *   canceled.
+      */
+    timeout.cancel = function(promise) {
+      if (promise && promise.$$timeoutId in deferreds) {
+        deferreds[promise.$$timeoutId].reject('canceled');
+        delete deferreds[promise.$$timeoutId];
+        return $browser.defer.cancel(promise.$$timeoutId);
+      }
+      return false;
+    };
+
+    return timeout;
+  }];
+}
+
+// NOTE:  The usage of window and document instead of $window and $document here is
+// deliberate.  This service depends on the specific behavior of anchor nodes created by the
+// browser (resolving and parsing URLs) that is unlikely to be provided by mock objects and
+// cause us to break tests.  In addition, when the browser resolves a URL for XHR, it
+// doesn't know about mocked locations and resolves URLs to the real document - which is
+// exactly the behavior needed here.  There is little value is mocking these out for this
+// service.
+var urlParsingNode = window.document.createElement("a");
+var originUrl = urlResolve(window.location.href);
+
+
+/**
+ *
+ * Implementation Notes for non-IE browsers
+ * ----------------------------------------
+ * Assigning a URL to the href property of an anchor DOM node, even one attached to the DOM,
+ * results both in the normalizing and parsing of the URL.  Normalizing means that a relative
+ * URL will be resolved into an absolute URL in the context of the application document.
+ * Parsing means that the anchor node's host, hostname, protocol, port, pathname and related
+ * properties are all populated to reflect the normalized URL.  This approach has wide
+ * compatibility - Safari 1+, Mozilla 1+, Opera 7+,e etc.  See
+ * http://www.aptana.com/reference/html/api/HTMLAnchorElement.html
+ *
+ * Implementation Notes for IE
+ * ---------------------------
+ * IE <= 10 normalizes the URL when assigned to the anchor node similar to the other
+ * browsers.  However, the parsed components will not be set if the URL assigned did not specify
+ * them.  (e.g. if you assign a.href = "foo", then a.protocol, a.host, etc. will be empty.)  We
+ * work around that by performing the parsing in a 2nd step by taking a previously normalized
+ * URL (e.g. by assigning to a.href) and assigning it a.href again.  This correctly populates the
+ * properties such as protocol, hostname, port, etc.
+ *
+ * References:
+ *   http://developer.mozilla.org/en-US/docs/Web/API/HTMLAnchorElement
+ *   http://www.aptana.com/reference/html/api/HTMLAnchorElement.html
+ *   http://url.spec.whatwg.org/#urlutils
+ *   https://github.com/angular/angular.js/pull/2902
+ *   http://james.padolsey.com/javascript/parsing-urls-with-the-dom/
+ *
+ * @kind function
+ * @param {string} url The URL to be parsed.
+ * @description Normalizes and parses a URL.
+ * @returns {object} Returns the normalized URL as a dictionary.
+ *
+ *   | member name   | Description    |
+ *   |---------------|----------------|
+ *   | href          | A normalized version of the provided URL if it was not an absolute URL |
+ *   | protocol      | The protocol including the trailing colon                              |
+ *   | host          | The host and port (if the port is non-default) of the normalizedUrl    |
+ *   | search        | The search params, minus the question mark                             |
+ *   | hash          | The hash string, minus the hash symbol
+ *   | hostname      | The hostname
+ *   | port          | The port, without ":"
+ *   | pathname      | The pathname, beginning with "/"
+ *
+ */
+function urlResolve(url) {
+  var href = url;
+
+  if (msie) {
+    // Normalize before parse.  Refer Implementation Notes on why this is
+    // done in two steps on IE.
+    urlParsingNode.setAttribute("href", href);
+    href = urlParsingNode.href;
+  }
+
+  urlParsingNode.setAttribute('href', href);
+
+  // urlParsingNode provides the UrlUtils interface - http://url.spec.whatwg.org/#urlutils
+  return {
+    href: urlParsingNode.href,
+    protocol: urlParsingNode.protocol ? urlParsingNode.protocol.replace(/:$/, '') : '',
+    host: urlParsingNode.host,
+    search: urlParsingNode.search ? urlParsingNode.search.replace(/^\?/, '') : '',
+    hash: urlParsingNode.hash ? urlParsingNode.hash.replace(/^#/, '') : '',
+    hostname: urlParsingNode.hostname,
+    port: urlParsingNode.port,
+    pathname: (urlParsingNode.pathname.charAt(0) === '/')
+      ? urlParsingNode.pathname
+      : '/' + urlParsingNode.pathname
+  };
+}
+
+/**
+ * Parse a request URL and determine whether this is a same-origin request as the application document.
+ *
+ * @param {string|object} requestUrl The url of the request as a string that will be resolved
+ * or a parsed URL object.
+ * @returns {boolean} Whether the request is for the same origin as the application document.
+ */
+function urlIsSameOrigin(requestUrl) {
+  var parsed = (isString(requestUrl)) ? urlResolve(requestUrl) : requestUrl;
+  return (parsed.protocol === originUrl.protocol &&
+          parsed.host === originUrl.host);
+}
+
+/**
+ * @ngdoc service
+ * @name $window
+ *
+ * @description
+ * A reference to the browser's `window` object. While `window`
+ * is globally available in JavaScript, it causes testability problems, because
+ * it is a global variable. In angular we always refer to it through the
+ * `$window` service, so it may be overridden, removed or mocked for testing.
+ *
+ * Expressions, like the one defined for the `ngClick` directive in the example
+ * below, are evaluated with respect to the current scope.  Therefore, there is
+ * no risk of inadvertently coding in a dependency on a global value in such an
+ * expression.
+ *
+ * @example
+   <example module="windowExample">
+     <file name="index.html">
+       <script>
+         angular.module('windowExample', [])
+           .controller('ExampleController', ['$scope', '$window', function($scope, $window) {
+             $scope.greeting = 'Hello, World!';
+             $scope.doGreeting = function(greeting) {
+               $window.alert(greeting);
+             };
+           }]);
+       </script>
+       <div ng-controller="ExampleController">
+         <input type="text" ng-model="greeting" aria-label="greeting" />
+         <button ng-click="doGreeting(greeting)">ALERT</button>
+       </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+      it('should display the greeting in the input box', function() {
+       element(by.model('greeting')).sendKeys('Hello, E2E Tests');
+       // If we click the button it will block the test runner
+       // element(':button').click();
+      });
+     </file>
+   </example>
+ */
+function $WindowProvider() {
+  this.$get = valueFn(window);
+}
+
+/**
+ * @name $$cookieReader
+ * @requires $document
+ *
+ * @description
+ * This is a private service for reading cookies used by $http and ngCookies
+ *
+ * @return {Object} a key/value map of the current cookies
+ */
+function $$CookieReader($document) {
+  var rawDocument = $document[0] || {};
+  var lastCookies = {};
+  var lastCookieString = '';
+
+  function safeDecodeURIComponent(str) {
+    try {
+      return decodeURIComponent(str);
+    } catch (e) {
+      return str;
+    }
+  }
+
+  return function() {
+    var cookieArray, cookie, i, index, name;
+    var currentCookieString = rawDocument.cookie || '';
+
+    if (currentCookieString !== lastCookieString) {
+      lastCookieString = currentCookieString;
+      cookieArray = lastCookieString.split('; ');
+      lastCookies = {};
+
+      for (i = 0; i < cookieArray.length; i++) {
+        cookie = cookieArray[i];
+        index = cookie.indexOf('=');
+        if (index > 0) { //ignore nameless cookies
+          name = safeDecodeURIComponent(cookie.substring(0, index));
+          // the first value that is seen for a cookie is the most
+          // specific one.  values for the same cookie name that
+          // follow are for less specific paths.
+          if (isUndefined(lastCookies[name])) {
+            lastCookies[name] = safeDecodeURIComponent(cookie.substring(index + 1));
+          }
+        }
+      }
+    }
+    return lastCookies;
+  };
+}
+
+$$CookieReader.$inject = ['$document'];
+
+function $$CookieReaderProvider() {
+  this.$get = $$CookieReader;
+}
+
+/* global currencyFilter: true,
+ dateFilter: true,
+ filterFilter: true,
+ jsonFilter: true,
+ limitToFilter: true,
+ lowercaseFilter: true,
+ numberFilter: true,
+ orderByFilter: true,
+ uppercaseFilter: true,
+ */
+
+/**
+ * @ngdoc provider
+ * @name $filterProvider
+ * @description
+ *
+ * Filters are just functions which transform input to an output. However filters need to be
+ * Dependency Injected. To achieve this a filter definition consists of a factory function which is
+ * annotated with dependencies and is responsible for creating a filter function.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.
+ * Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace
+ * your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores
+ * (`myapp_subsection_filterx`).
+ * </div>
+ *
+ * ```js
+ *   // Filter registration
+ *   function MyModule($provide, $filterProvider) {
+ *     // create a service to demonstrate injection (not always needed)
+ *     $provide.value('greet', function(name){
+ *       return 'Hello ' + name + '!';
+ *     });
+ *
+ *     // register a filter factory which uses the
+ *     // greet service to demonstrate DI.
+ *     $filterProvider.register('greet', function(greet){
+ *       // return the filter function which uses the greet service
+ *       // to generate salutation
+ *       return function(text) {
+ *         // filters need to be forgiving so check input validity
+ *         return text && greet(text) || text;
+ *       };
+ *     });
+ *   }
+ * ```
+ *
+ * The filter function is registered with the `$injector` under the filter name suffix with
+ * `Filter`.
+ *
+ * ```js
+ *   it('should be the same instance', inject(
+ *     function($filterProvider) {
+ *       $filterProvider.register('reverse', function(){
+ *         return ...;
+ *       });
+ *     },
+ *     function($filter, reverseFilter) {
+ *       expect($filter('reverse')).toBe(reverseFilter);
+ *     });
+ * ```
+ *
+ *
+ * For more information about how angular filters work, and how to create your own filters, see
+ * {@link guide/filter Filters} in the Angular Developer Guide.
+ */
+
+/**
+ * @ngdoc service
+ * @name $filter
+ * @kind function
+ * @description
+ * Filters are used for formatting data displayed to the user.
+ *
+ * The general syntax in templates is as follows:
+ *
+ *         {{ expression [| filter_name[:parameter_value] ... ] }}
+ *
+ * @param {String} name Name of the filter function to retrieve
+ * @return {Function} the filter function
+ * @example
+   <example name="$filter" module="filterExample">
+     <file name="index.html">
+       <div ng-controller="MainCtrl">
+        <h3>{{ originalText }}</h3>
+        <h3>{{ filteredText }}</h3>
+       </div>
+     </file>
+
+     <file name="script.js">
+      angular.module('filterExample', [])
+      .controller('MainCtrl', function($scope, $filter) {
+        $scope.originalText = 'hello';
+        $scope.filteredText = $filter('uppercase')($scope.originalText);
+      });
+     </file>
+   </example>
+  */
+$FilterProvider.$inject = ['$provide'];
+function $FilterProvider($provide) {
+  var suffix = 'Filter';
+
+  /**
+   * @ngdoc method
+   * @name $filterProvider#register
+   * @param {string|Object} name Name of the filter function, or an object map of filters where
+   *    the keys are the filter names and the values are the filter factories.
+   *
+   *    <div class="alert alert-warning">
+   *    **Note:** Filter names must be valid angular {@link expression} identifiers, such as `uppercase` or `orderBy`.
+   *    Names with special characters, such as hyphens and dots, are not allowed. If you wish to namespace
+   *    your filters, then you can use capitalization (`myappSubsectionFilterx`) or underscores
+   *    (`myapp_subsection_filterx`).
+   *    </div>
+    * @param {Function} factory If the first argument was a string, a factory function for the filter to be registered.
+   * @returns {Object} Registered filter instance, or if a map of filters was provided then a map
+   *    of the registered filter instances.
+   */
+  function register(name, factory) {
+    if (isObject(name)) {
+      var filters = {};
+      forEach(name, function(filter, key) {
+        filters[key] = register(key, filter);
+      });
+      return filters;
+    } else {
+      return $provide.factory(name + suffix, factory);
+    }
+  }
+  this.register = register;
+
+  this.$get = ['$injector', function($injector) {
+    return function(name) {
+      return $injector.get(name + suffix);
+    };
+  }];
+
+  ////////////////////////////////////////
+
+  /* global
+    currencyFilter: false,
+    dateFilter: false,
+    filterFilter: false,
+    jsonFilter: false,
+    limitToFilter: false,
+    lowercaseFilter: false,
+    numberFilter: false,
+    orderByFilter: false,
+    uppercaseFilter: false,
+  */
+
+  register('currency', currencyFilter);
+  register('date', dateFilter);
+  register('filter', filterFilter);
+  register('json', jsonFilter);
+  register('limitTo', limitToFilter);
+  register('lowercase', lowercaseFilter);
+  register('number', numberFilter);
+  register('orderBy', orderByFilter);
+  register('uppercase', uppercaseFilter);
+}
+
+/**
+ * @ngdoc filter
+ * @name filter
+ * @kind function
+ *
+ * @description
+ * Selects a subset of items from `array` and returns it as a new array.
+ *
+ * @param {Array} array The source array.
+ * @param {string|Object|function()} expression The predicate to be used for selecting items from
+ *   `array`.
+ *
+ *   Can be one of:
+ *
+ *   - `string`: The string is used for matching against the contents of the `array`. All strings or
+ *     objects with string properties in `array` that match this string will be returned. This also
+ *     applies to nested object properties.
+ *     The predicate can be negated by prefixing the string with `!`.
+ *
+ *   - `Object`: A pattern object can be used to filter specific properties on objects contained
+ *     by `array`. For example `{name:"M", phone:"1"}` predicate will return an array of items
+ *     which have property `name` containing "M" and property `phone` containing "1". A special
+ *     property name (`$` by default) can be used (e.g. as in `{$: "text"}`) to accept a match
+ *     against any property of the object or its nested object properties. That's equivalent to the
+ *     simple substring match with a `string` as described above. The special property name can be
+ *     overwritten, using the `anyPropertyKey` parameter.
+ *     The predicate can be negated by prefixing the string with `!`.
+ *     For example `{name: "!M"}` predicate will return an array of items which have property `name`
+ *     not containing "M".
+ *
+ *     Note that a named property will match properties on the same level only, while the special
+ *     `$` property will match properties on the same level or deeper. E.g. an array item like
+ *     `{name: {first: 'John', last: 'Doe'}}` will **not** be matched by `{name: 'John'}`, but
+ *     **will** be matched by `{$: 'John'}`.
+ *
+ *   - `function(value, index, array)`: A predicate function can be used to write arbitrary filters.
+ *     The function is called for each element of the array, with the element, its index, and
+ *     the entire array itself as arguments.
+ *
+ *     The final result is an array of those elements that the predicate returned true for.
+ *
+ * @param {function(actual, expected)|true|undefined} comparator Comparator which is used in
+ *     determining if the expected value (from the filter expression) and actual value (from
+ *     the object in the array) should be considered a match.
+ *
+ *   Can be one of:
+ *
+ *   - `function(actual, expected)`:
+ *     The function will be given the object value and the predicate value to compare and
+ *     should return true if both values should be considered equal.
+ *
+ *   - `true`: A shorthand for `function(actual, expected) { return angular.equals(actual, expected)}`.
+ *     This is essentially strict comparison of expected and actual.
+ *
+ *   - `false|undefined`: A short hand for a function which will look for a substring match in case
+ *     insensitive way.
+ *
+ *     Primitive values are converted to strings. Objects are not compared against primitives,
+ *     unless they have a custom `toString` method (e.g. `Date` objects).
+ *
+ * @param {string=} anyPropertyKey The special property name that matches against any property.
+ *     By default `$`.
+ *
+ * @example
+   <example>
+     <file name="index.html">
+       <div ng-init="friends = [{name:'John', phone:'555-1276'},
+                                {name:'Mary', phone:'800-BIG-MARY'},
+                                {name:'Mike', phone:'555-4321'},
+                                {name:'Adam', phone:'555-5678'},
+                                {name:'Julie', phone:'555-8765'},
+                                {name:'Juliette', phone:'555-5678'}]"></div>
+
+       <label>Search: <input ng-model="searchText"></label>
+       <table id="searchTextResults">
+         <tr><th>Name</th><th>Phone</th></tr>
+         <tr ng-repeat="friend in friends | filter:searchText">
+           <td>{{friend.name}}</td>
+           <td>{{friend.phone}}</td>
+         </tr>
+       </table>
+       <hr>
+       <label>Any: <input ng-model="search.$"></label> <br>
+       <label>Name only <input ng-model="search.name"></label><br>
+       <label>Phone only <input ng-model="search.phone"></label><br>
+       <label>Equality <input type="checkbox" ng-model="strict"></label><br>
+       <table id="searchObjResults">
+         <tr><th>Name</th><th>Phone</th></tr>
+         <tr ng-repeat="friendObj in friends | filter:search:strict">
+           <td>{{friendObj.name}}</td>
+           <td>{{friendObj.phone}}</td>
+         </tr>
+       </table>
+     </file>
+     <file name="protractor.js" type="protractor">
+       var expectFriendNames = function(expectedNames, key) {
+         element.all(by.repeater(key + ' in friends').column(key + '.name')).then(function(arr) {
+           arr.forEach(function(wd, i) {
+             expect(wd.getText()).toMatch(expectedNames[i]);
+           });
+         });
+       };
+
+       it('should search across all fields when filtering with a string', function() {
+         var searchText = element(by.model('searchText'));
+         searchText.clear();
+         searchText.sendKeys('m');
+         expectFriendNames(['Mary', 'Mike', 'Adam'], 'friend');
+
+         searchText.clear();
+         searchText.sendKeys('76');
+         expectFriendNames(['John', 'Julie'], 'friend');
+       });
+
+       it('should search in specific fields when filtering with a predicate object', function() {
+         var searchAny = element(by.model('search.$'));
+         searchAny.clear();
+         searchAny.sendKeys('i');
+         expectFriendNames(['Mary', 'Mike', 'Julie', 'Juliette'], 'friendObj');
+       });
+       it('should use a equal comparison when comparator is true', function() {
+         var searchName = element(by.model('search.name'));
+         var strict = element(by.model('strict'));
+         searchName.clear();
+         searchName.sendKeys('Julie');
+         strict.click();
+         expectFriendNames(['Julie'], 'friendObj');
+       });
+     </file>
+   </example>
+ */
+
+function filterFilter() {
+  return function(array, expression, comparator, anyPropertyKey) {
+    if (!isArrayLike(array)) {
+      if (array == null) {
+        return array;
+      } else {
+        throw minErr('filter')('notarray', 'Expected array but received: {0}', array);
+      }
+    }
+
+    anyPropertyKey = anyPropertyKey || '$';
+    var expressionType = getTypeForFilter(expression);
+    var predicateFn;
+    var matchAgainstAnyProp;
+
+    switch (expressionType) {
+      case 'function':
+        predicateFn = expression;
+        break;
+      case 'boolean':
+      case 'null':
+      case 'number':
+      case 'string':
+        matchAgainstAnyProp = true;
+        //jshint -W086
+      case 'object':
+        //jshint +W086
+        predicateFn = createPredicateFn(expression, comparator, anyPropertyKey, matchAgainstAnyProp);
+        break;
+      default:
+        return array;
+    }
+
+    return Array.prototype.filter.call(array, predicateFn);
+  };
+}
+
+// Helper functions for `filterFilter`
+function createPredicateFn(expression, comparator, anyPropertyKey, matchAgainstAnyProp) {
+  var shouldMatchPrimitives = isObject(expression) && (anyPropertyKey in expression);
+  var predicateFn;
+
+  if (comparator === true) {
+    comparator = equals;
+  } else if (!isFunction(comparator)) {
+    comparator = function(actual, expected) {
+      if (isUndefined(actual)) {
+        // No substring matching against `undefined`
+        return false;
+      }
+      if ((actual === null) || (expected === null)) {
+        // No substring matching against `null`; only match against `null`
+        return actual === expected;
+      }
+      if (isObject(expected) || (isObject(actual) && !hasCustomToString(actual))) {
+        // Should not compare primitives against objects, unless they have custom `toString` method
+        return false;
+      }
+
+      actual = lowercase('' + actual);
+      expected = lowercase('' + expected);
+      return actual.indexOf(expected) !== -1;
+    };
+  }
+
+  predicateFn = function(item) {
+    if (shouldMatchPrimitives && !isObject(item)) {
+      return deepCompare(item, expression[anyPropertyKey], comparator, anyPropertyKey, false);
+    }
+    return deepCompare(item, expression, comparator, anyPropertyKey, matchAgainstAnyProp);
+  };
+
+  return predicateFn;
+}
+
+function deepCompare(actual, expected, comparator, anyPropertyKey, matchAgainstAnyProp, dontMatchWholeObject) {
+  var actualType = getTypeForFilter(actual);
+  var expectedType = getTypeForFilter(expected);
+
+  if ((expectedType === 'string') && (expected.charAt(0) === '!')) {
+    return !deepCompare(actual, expected.substring(1), comparator, anyPropertyKey, matchAgainstAnyProp);
+  } else if (isArray(actual)) {
+    // In case `actual` is an array, consider it a match
+    // if ANY of it's items matches `expected`
+    return actual.some(function(item) {
+      return deepCompare(item, expected, comparator, anyPropertyKey, matchAgainstAnyProp);
+    });
+  }
+
+  switch (actualType) {
+    case 'object':
+      var key;
+      if (matchAgainstAnyProp) {
+        for (key in actual) {
+          if ((key.charAt(0) !== '$') && deepCompare(actual[key], expected, comparator, anyPropertyKey, true)) {
+            return true;
+          }
+        }
+        return dontMatchWholeObject ? false : deepCompare(actual, expected, comparator, anyPropertyKey, false);
+      } else if (expectedType === 'object') {
+        for (key in expected) {
+          var expectedVal = expected[key];
+          if (isFunction(expectedVal) || isUndefined(expectedVal)) {
+            continue;
+          }
+
+          var matchAnyProperty = key === anyPropertyKey;
+          var actualVal = matchAnyProperty ? actual : actual[key];
+          if (!deepCompare(actualVal, expectedVal, comparator, anyPropertyKey, matchAnyProperty, matchAnyProperty)) {
+            return false;
+          }
+        }
+        return true;
+      } else {
+        return comparator(actual, expected);
+      }
+      break;
+    case 'function':
+      return false;
+    default:
+      return comparator(actual, expected);
+  }
+}
+
+// Used for easily differentiating between `null` and actual `object`
+function getTypeForFilter(val) {
+  return (val === null) ? 'null' : typeof val;
+}
+
+var MAX_DIGITS = 22;
+var DECIMAL_SEP = '.';
+var ZERO_CHAR = '0';
+
+/**
+ * @ngdoc filter
+ * @name currency
+ * @kind function
+ *
+ * @description
+ * Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default
+ * symbol for current locale is used.
+ *
+ * @param {number} amount Input to filter.
+ * @param {string=} symbol Currency symbol or identifier to be displayed.
+ * @param {number=} fractionSize Number of decimal places to round the amount to, defaults to default max fraction size for current locale
+ * @returns {string} Formatted number.
+ *
+ *
+ * @example
+   <example module="currencyExample">
+     <file name="index.html">
+       <script>
+         angular.module('currencyExample', [])
+           .controller('ExampleController', ['$scope', function($scope) {
+             $scope.amount = 1234.56;
+           }]);
+       </script>
+       <div ng-controller="ExampleController">
+         <input type="number" ng-model="amount" aria-label="amount"> <br>
+         default currency symbol ($): <span id="currency-default">{{amount | currency}}</span><br>
+         custom currency identifier (USD$): <span id="currency-custom">{{amount | currency:"USD$"}}</span>
+         no fractions (0): <span id="currency-no-fractions">{{amount | currency:"USD$":0}}</span>
+       </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+       it('should init with 1234.56', function() {
+         expect(element(by.id('currency-default')).getText()).toBe('$1,234.56');
+         expect(element(by.id('currency-custom')).getText()).toBe('USD$1,234.56');
+         expect(element(by.id('currency-no-fractions')).getText()).toBe('USD$1,235');
+       });
+       it('should update', function() {
+         if (browser.params.browser == 'safari') {
+           // Safari does not understand the minus key. See
+           // https://github.com/angular/protractor/issues/481
+           return;
+         }
+         element(by.model('amount')).clear();
+         element(by.model('amount')).sendKeys('-1234');
+         expect(element(by.id('currency-default')).getText()).toBe('-$1,234.00');
+         expect(element(by.id('currency-custom')).getText()).toBe('-USD$1,234.00');
+         expect(element(by.id('currency-no-fractions')).getText()).toBe('-USD$1,234');
+       });
+     </file>
+   </example>
+ */
+currencyFilter.$inject = ['$locale'];
+function currencyFilter($locale) {
+  var formats = $locale.NUMBER_FORMATS;
+  return function(amount, currencySymbol, fractionSize) {
+    if (isUndefined(currencySymbol)) {
+      currencySymbol = formats.CURRENCY_SYM;
+    }
+
+    if (isUndefined(fractionSize)) {
+      fractionSize = formats.PATTERNS[1].maxFrac;
+    }
+
+    // if null or undefined pass it through
+    return (amount == null)
+        ? amount
+        : formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, fractionSize).
+            replace(/\u00A4/g, currencySymbol);
+  };
+}
+
+/**
+ * @ngdoc filter
+ * @name number
+ * @kind function
+ *
+ * @description
+ * Formats a number as text.
+ *
+ * If the input is null or undefined, it will just be returned.
+ * If the input is infinite (Infinity or -Infinity), the Infinity symbol '∞' or '-∞' is returned, respectively.
+ * If the input is not a number an empty string is returned.
+ *
+ *
+ * @param {number|string} number Number to format.
+ * @param {(number|string)=} fractionSize Number of decimal places to round the number to.
+ * If this is not provided then the fraction size is computed from the current locale's number
+ * formatting pattern. In the case of the default locale, it will be 3.
+ * @returns {string} Number rounded to `fractionSize` appropriately formatted based on the current
+ *                   locale (e.g., in the en_US locale it will have "." as the decimal separator and
+ *                   include "," group separators after each third digit).
+ *
+ * @example
+   <example module="numberFilterExample">
+     <file name="index.html">
+       <script>
+         angular.module('numberFilterExample', [])
+           .controller('ExampleController', ['$scope', function($scope) {
+             $scope.val = 1234.56789;
+           }]);
+       </script>
+       <div ng-controller="ExampleController">
+         <label>Enter number: <input ng-model='val'></label><br>
+         Default formatting: <span id='number-default'>{{val | number}}</span><br>
+         No fractions: <span>{{val | number:0}}</span><br>
+         Negative number: <span>{{-val | number:4}}</span>
+       </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+       it('should format numbers', function() {
+         expect(element(by.id('number-default')).getText()).toBe('1,234.568');
+         expect(element(by.binding('val | number:0')).getText()).toBe('1,235');
+         expect(element(by.binding('-val | number:4')).getText()).toBe('-1,234.5679');
+       });
+
+       it('should update', function() {
+         element(by.model('val')).clear();
+         element(by.model('val')).sendKeys('3374.333');
+         expect(element(by.id('number-default')).getText()).toBe('3,374.333');
+         expect(element(by.binding('val | number:0')).getText()).toBe('3,374');
+         expect(element(by.binding('-val | number:4')).getText()).toBe('-3,374.3330');
+      });
+     </file>
+   </example>
+ */
+numberFilter.$inject = ['$locale'];
+function numberFilter($locale) {
+  var formats = $locale.NUMBER_FORMATS;
+  return function(number, fractionSize) {
+
+    // if null or undefined pass it through
+    return (number == null)
+        ? number
+        : formatNumber(number, formats.PATTERNS[0], formats.GROUP_SEP, formats.DECIMAL_SEP,
+                       fractionSize);
+  };
+}
+
+/**
+ * Parse a number (as a string) into three components that can be used
+ * for formatting the number.
+ *
+ * (Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/)
+ *
+ * @param  {string} numStr The number to parse
+ * @return {object} An object describing this number, containing the following keys:
+ *  - d : an array of digits containing leading zeros as necessary
+ *  - i : the number of the digits in `d` that are to the left of the decimal point
+ *  - e : the exponent for numbers that would need more than `MAX_DIGITS` digits in `d`
+ *
+ */
+function parse(numStr) {
+  var exponent = 0, digits, numberOfIntegerDigits;
+  var i, j, zeros;
+
+  // Decimal point?
+  if ((numberOfIntegerDigits = numStr.indexOf(DECIMAL_SEP)) > -1) {
+    numStr = numStr.replace(DECIMAL_SEP, '');
+  }
+
+  // Exponential form?
+  if ((i = numStr.search(/e/i)) > 0) {
+    // Work out the exponent.
+    if (numberOfIntegerDigits < 0) numberOfIntegerDigits = i;
+    numberOfIntegerDigits += +numStr.slice(i + 1);
+    numStr = numStr.substring(0, i);
+  } else if (numberOfIntegerDigits < 0) {
+    // There was no decimal point or exponent so it is an integer.
+    numberOfIntegerDigits = numStr.length;
+  }
+
+  // Count the number of leading zeros.
+  for (i = 0; numStr.charAt(i) == ZERO_CHAR; i++) {/* jshint noempty: false */}
+
+  if (i == (zeros = numStr.length)) {
+    // The digits are all zero.
+    digits = [0];
+    numberOfIntegerDigits = 1;
+  } else {
+    // Count the number of trailing zeros
+    zeros--;
+    while (numStr.charAt(zeros) == ZERO_CHAR) zeros--;
+
+    // Trailing zeros are insignificant so ignore them
+    numberOfIntegerDigits -= i;
+    digits = [];
+    // Convert string to array of digits without leading/trailing zeros.
+    for (j = 0; i <= zeros; i++, j++) {
+      digits[j] = +numStr.charAt(i);
+    }
+  }
+
+  // If the number overflows the maximum allowed digits then use an exponent.
+  if (numberOfIntegerDigits > MAX_DIGITS) {
+    digits = digits.splice(0, MAX_DIGITS - 1);
+    exponent = numberOfIntegerDigits - 1;
+    numberOfIntegerDigits = 1;
+  }
+
+  return { d: digits, e: exponent, i: numberOfIntegerDigits };
+}
+
+/**
+ * Round the parsed number to the specified number of decimal places
+ * This function changed the parsedNumber in-place
+ */
+function roundNumber(parsedNumber, fractionSize, minFrac, maxFrac) {
+    var digits = parsedNumber.d;
+    var fractionLen = digits.length - parsedNumber.i;
+
+    // determine fractionSize if it is not specified; `+fractionSize` converts it to a number
+    fractionSize = (isUndefined(fractionSize)) ? Math.min(Math.max(minFrac, fractionLen), maxFrac) : +fractionSize;
+
+    // The index of the digit to where rounding is to occur
+    var roundAt = fractionSize + parsedNumber.i;
+    var digit = digits[roundAt];
+
+    if (roundAt > 0) {
+      // Drop fractional digits beyond `roundAt`
+      digits.splice(Math.max(parsedNumber.i, roundAt));
+
+      // Set non-fractional digits beyond `roundAt` to 0
+      for (var j = roundAt; j < digits.length; j++) {
+        digits[j] = 0;
+      }
+    } else {
+      // We rounded to zero so reset the parsedNumber
+      fractionLen = Math.max(0, fractionLen);
+      parsedNumber.i = 1;
+      digits.length = Math.max(1, roundAt = fractionSize + 1);
+      digits[0] = 0;
+      for (var i = 1; i < roundAt; i++) digits[i] = 0;
+    }
+
+    if (digit >= 5) {
+      if (roundAt - 1 < 0) {
+        for (var k = 0; k > roundAt; k--) {
+          digits.unshift(0);
+          parsedNumber.i++;
+        }
+        digits.unshift(1);
+        parsedNumber.i++;
+      } else {
+        digits[roundAt - 1]++;
+      }
+    }
+
+    // Pad out with zeros to get the required fraction length
+    for (; fractionLen < Math.max(0, fractionSize); fractionLen++) digits.push(0);
+
+
+    // Do any carrying, e.g. a digit was rounded up to 10
+    var carry = digits.reduceRight(function(carry, d, i, digits) {
+      d = d + carry;
+      digits[i] = d % 10;
+      return Math.floor(d / 10);
+    }, 0);
+    if (carry) {
+      digits.unshift(carry);
+      parsedNumber.i++;
+    }
+}
+
+/**
+ * Format a number into a string
+ * @param  {number} number       The number to format
+ * @param  {{
+ *           minFrac, // the minimum number of digits required in the fraction part of the number
+ *           maxFrac, // the maximum number of digits required in the fraction part of the number
+ *           gSize,   // number of digits in each group of separated digits
+ *           lgSize,  // number of digits in the last group of digits before the decimal separator
+ *           negPre,  // the string to go in front of a negative number (e.g. `-` or `(`))
+ *           posPre,  // the string to go in front of a positive number
+ *           negSuf,  // the string to go after a negative number (e.g. `)`)
+ *           posSuf   // the string to go after a positive number
+ *         }} pattern
+ * @param  {string} groupSep     The string to separate groups of number (e.g. `,`)
+ * @param  {string} decimalSep   The string to act as the decimal separator (e.g. `.`)
+ * @param  {[type]} fractionSize The size of the fractional part of the number
+ * @return {string}              The number formatted as a string
+ */
+function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {
+
+  if (!(isString(number) || isNumber(number)) || isNaN(number)) return '';
+
+  var isInfinity = !isFinite(number);
+  var isZero = false;
+  var numStr = Math.abs(number) + '',
+      formattedText = '',
+      parsedNumber;
+
+  if (isInfinity) {
+    formattedText = '\u221e';
+  } else {
+    parsedNumber = parse(numStr);
+
+    roundNumber(parsedNumber, fractionSize, pattern.minFrac, pattern.maxFrac);
+
+    var digits = parsedNumber.d;
+    var integerLen = parsedNumber.i;
+    var exponent = parsedNumber.e;
+    var decimals = [];
+    isZero = digits.reduce(function(isZero, d) { return isZero && !d; }, true);
+
+    // pad zeros for small numbers
+    while (integerLen < 0) {
+      digits.unshift(0);
+      integerLen++;
+    }
+
+    // extract decimals digits
+    if (integerLen > 0) {
+      decimals = digits.splice(integerLen, digits.length);
+    } else {
+      decimals = digits;
+      digits = [0];
+    }
+
+    // format the integer digits with grouping separators
+    var groups = [];
+    if (digits.length >= pattern.lgSize) {
+      groups.unshift(digits.splice(-pattern.lgSize, digits.length).join(''));
+    }
+    while (digits.length > pattern.gSize) {
+      groups.unshift(digits.splice(-pattern.gSize, digits.length).join(''));
+    }
+    if (digits.length) {
+      groups.unshift(digits.join(''));
+    }
+    formattedText = groups.join(groupSep);
+
+    // append the decimal digits
+    if (decimals.length) {
+      formattedText += decimalSep + decimals.join('');
+    }
+
+    if (exponent) {
+      formattedText += 'e+' + exponent;
+    }
+  }
+  if (number < 0 && !isZero) {
+    return pattern.negPre + formattedText + pattern.negSuf;
+  } else {
+    return pattern.posPre + formattedText + pattern.posSuf;
+  }
+}
+
+function padNumber(num, digits, trim, negWrap) {
+  var neg = '';
+  if (num < 0 || (negWrap && num <= 0)) {
+    if (negWrap) {
+      num = -num + 1;
+    } else {
+      num = -num;
+      neg = '-';
+    }
+  }
+  num = '' + num;
+  while (num.length < digits) num = ZERO_CHAR + num;
+  if (trim) {
+    num = num.substr(num.length - digits);
+  }
+  return neg + num;
+}
+
+
+function dateGetter(name, size, offset, trim, negWrap) {
+  offset = offset || 0;
+  return function(date) {
+    var value = date['get' + name]();
+    if (offset > 0 || value > -offset) {
+      value += offset;
+    }
+    if (value === 0 && offset == -12) value = 12;
+    return padNumber(value, size, trim, negWrap);
+  };
+}
+
+function dateStrGetter(name, shortForm, standAlone) {
+  return function(date, formats) {
+    var value = date['get' + name]();
+    var propPrefix = (standAlone ? 'STANDALONE' : '') + (shortForm ? 'SHORT' : '');
+    var get = uppercase(propPrefix + name);
+
+    return formats[get][value];
+  };
+}
+
+function timeZoneGetter(date, formats, offset) {
+  var zone = -1 * offset;
+  var paddedZone = (zone >= 0) ? "+" : "";
+
+  paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) +
+                padNumber(Math.abs(zone % 60), 2);
+
+  return paddedZone;
+}
+
+function getFirstThursdayOfYear(year) {
+    // 0 = index of January
+    var dayOfWeekOnFirst = (new Date(year, 0, 1)).getDay();
+    // 4 = index of Thursday (+1 to account for 1st = 5)
+    // 11 = index of *next* Thursday (+1 account for 1st = 12)
+    return new Date(year, 0, ((dayOfWeekOnFirst <= 4) ? 5 : 12) - dayOfWeekOnFirst);
+}
+
+function getThursdayThisWeek(datetime) {
+    return new Date(datetime.getFullYear(), datetime.getMonth(),
+      // 4 = index of Thursday
+      datetime.getDate() + (4 - datetime.getDay()));
+}
+
+function weekGetter(size) {
+   return function(date) {
+      var firstThurs = getFirstThursdayOfYear(date.getFullYear()),
+         thisThurs = getThursdayThisWeek(date);
+
+      var diff = +thisThurs - +firstThurs,
+         result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week
+
+      return padNumber(result, size);
+   };
+}
+
+function ampmGetter(date, formats) {
+  return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1];
+}
+
+function eraGetter(date, formats) {
+  return date.getFullYear() <= 0 ? formats.ERAS[0] : formats.ERAS[1];
+}
+
+function longEraGetter(date, formats) {
+  return date.getFullYear() <= 0 ? formats.ERANAMES[0] : formats.ERANAMES[1];
+}
+
+var DATE_FORMATS = {
+  yyyy: dateGetter('FullYear', 4, 0, false, true),
+    yy: dateGetter('FullYear', 2, 0, true, true),
+     y: dateGetter('FullYear', 1, 0, false, true),
+  MMMM: dateStrGetter('Month'),
+   MMM: dateStrGetter('Month', true),
+    MM: dateGetter('Month', 2, 1),
+     M: dateGetter('Month', 1, 1),
+  LLLL: dateStrGetter('Month', false, true),
+    dd: dateGetter('Date', 2),
+     d: dateGetter('Date', 1),
+    HH: dateGetter('Hours', 2),
+     H: dateGetter('Hours', 1),
+    hh: dateGetter('Hours', 2, -12),
+     h: dateGetter('Hours', 1, -12),
+    mm: dateGetter('Minutes', 2),
+     m: dateGetter('Minutes', 1),
+    ss: dateGetter('Seconds', 2),
+     s: dateGetter('Seconds', 1),
+     // while ISO 8601 requires fractions to be prefixed with `.` or `,`
+     // we can be just safely rely on using `sss` since we currently don't support single or two digit fractions
+   sss: dateGetter('Milliseconds', 3),
+  EEEE: dateStrGetter('Day'),
+   EEE: dateStrGetter('Day', true),
+     a: ampmGetter,
+     Z: timeZoneGetter,
+    ww: weekGetter(2),
+     w: weekGetter(1),
+     G: eraGetter,
+     GG: eraGetter,
+     GGG: eraGetter,
+     GGGG: longEraGetter
+};
+
+var DATE_FORMATS_SPLIT = /((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))(.*)/,
+    NUMBER_STRING = /^\-?\d+$/;
+
+/**
+ * @ngdoc filter
+ * @name date
+ * @kind function
+ *
+ * @description
+ *   Formats `date` to a string based on the requested `format`.
+ *
+ *   `format` string can be composed of the following elements:
+ *
+ *   * `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010)
+ *   * `'yy'`: 2 digit representation of year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
+ *   * `'y'`: 1 digit representation of year, e.g. (AD 1 => 1, AD 199 => 199)
+ *   * `'MMMM'`: Month in year (January-December)
+ *   * `'MMM'`: Month in year (Jan-Dec)
+ *   * `'MM'`: Month in year, padded (01-12)
+ *   * `'M'`: Month in year (1-12)
+ *   * `'LLLL'`: Stand-alone month in year (January-December)
+ *   * `'dd'`: Day in month, padded (01-31)
+ *   * `'d'`: Day in month (1-31)
+ *   * `'EEEE'`: Day in Week,(Sunday-Saturday)
+ *   * `'EEE'`: Day in Week, (Sun-Sat)
+ *   * `'HH'`: Hour in day, padded (00-23)
+ *   * `'H'`: Hour in day (0-23)
+ *   * `'hh'`: Hour in AM/PM, padded (01-12)
+ *   * `'h'`: Hour in AM/PM, (1-12)
+ *   * `'mm'`: Minute in hour, padded (00-59)
+ *   * `'m'`: Minute in hour (0-59)
+ *   * `'ss'`: Second in minute, padded (00-59)
+ *   * `'s'`: Second in minute (0-59)
+ *   * `'sss'`: Millisecond in second, padded (000-999)
+ *   * `'a'`: AM/PM marker
+ *   * `'Z'`: 4 digit (+sign) representation of the timezone offset (-1200-+1200)
+ *   * `'ww'`: Week of year, padded (00-53). Week 01 is the week with the first Thursday of the year
+ *   * `'w'`: Week of year (0-53). Week 1 is the week with the first Thursday of the year
+ *   * `'G'`, `'GG'`, `'GGG'`: The abbreviated form of the era string (e.g. 'AD')
+ *   * `'GGGG'`: The long form of the era string (e.g. 'Anno Domini')
+ *
+ *   `format` string can also be one of the following predefined
+ *   {@link guide/i18n localizable formats}:
+ *
+ *   * `'medium'`: equivalent to `'MMM d, y h:mm:ss a'` for en_US locale
+ *     (e.g. Sep 3, 2010 12:05:08 PM)
+ *   * `'short'`: equivalent to `'M/d/yy h:mm a'` for en_US  locale (e.g. 9/3/10 12:05 PM)
+ *   * `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` for en_US  locale
+ *     (e.g. Friday, September 3, 2010)
+ *   * `'longDate'`: equivalent to `'MMMM d, y'` for en_US  locale (e.g. September 3, 2010)
+ *   * `'mediumDate'`: equivalent to `'MMM d, y'` for en_US  locale (e.g. Sep 3, 2010)
+ *   * `'shortDate'`: equivalent to `'M/d/yy'` for en_US locale (e.g. 9/3/10)
+ *   * `'mediumTime'`: equivalent to `'h:mm:ss a'` for en_US locale (e.g. 12:05:08 PM)
+ *   * `'shortTime'`: equivalent to `'h:mm a'` for en_US locale (e.g. 12:05 PM)
+ *
+ *   `format` string can contain literal values. These need to be escaped by surrounding with single quotes (e.g.
+ *   `"h 'in the morning'"`). In order to output a single quote, escape it - i.e., two single quotes in a sequence
+ *   (e.g. `"h 'o''clock'"`).
+ *
+ * @param {(Date|number|string)} date Date to format either as Date object, milliseconds (string or
+ *    number) or various ISO 8601 datetime string formats (e.g. yyyy-MM-ddTHH:mm:ss.sssZ and its
+ *    shorter versions like yyyy-MM-ddTHH:mmZ, yyyy-MM-dd or yyyyMMddTHHmmssZ). If no timezone is
+ *    specified in the string input, the time is considered to be in the local timezone.
+ * @param {string=} format Formatting rules (see Description). If not specified,
+ *    `mediumDate` is used.
+ * @param {string=} timezone Timezone to be used for formatting. It understands UTC/GMT and the
+ *    continental US time zone abbreviations, but for general use, use a time zone offset, for
+ *    example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)
+ *    If not specified, the timezone of the browser will be used.
+ * @returns {string} Formatted string or the input if input is not recognized as date/millis.
+ *
+ * @example
+   <example>
+     <file name="index.html">
+       <span ng-non-bindable>{{1288323623006 | date:'medium'}}</span>:
+           <span>{{1288323623006 | date:'medium'}}</span><br>
+       <span ng-non-bindable>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span>:
+          <span>{{1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'}}</span><br>
+       <span ng-non-bindable>{{1288323623006 | date:'MM/dd/yyyy @ h:mma'}}</span>:
+          <span>{{'1288323623006' | date:'MM/dd/yyyy @ h:mma'}}</span><br>
+       <span ng-non-bindable>{{1288323623006 | date:"MM/dd/yyyy 'at' h:mma"}}</span>:
+          <span>{{'1288323623006' | date:"MM/dd/yyyy 'at' h:mma"}}</span><br>
+     </file>
+     <file name="protractor.js" type="protractor">
+       it('should format date', function() {
+         expect(element(by.binding("1288323623006 | date:'medium'")).getText()).
+            toMatch(/Oct 2\d, 2010 \d{1,2}:\d{2}:\d{2} (AM|PM)/);
+         expect(element(by.binding("1288323623006 | date:'yyyy-MM-dd HH:mm:ss Z'")).getText()).
+            toMatch(/2010\-10\-2\d \d{2}:\d{2}:\d{2} (\-|\+)?\d{4}/);
+         expect(element(by.binding("'1288323623006' | date:'MM/dd/yyyy @ h:mma'")).getText()).
+            toMatch(/10\/2\d\/2010 @ \d{1,2}:\d{2}(AM|PM)/);
+         expect(element(by.binding("'1288323623006' | date:\"MM/dd/yyyy 'at' h:mma\"")).getText()).
+            toMatch(/10\/2\d\/2010 at \d{1,2}:\d{2}(AM|PM)/);
+       });
+     </file>
+   </example>
+ */
+dateFilter.$inject = ['$locale'];
+function dateFilter($locale) {
+
+
+  var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
+                     // 1        2       3         4          5          6          7          8  9     10      11
+  function jsonStringToDate(string) {
+    var match;
+    if (match = string.match(R_ISO8601_STR)) {
+      var date = new Date(0),
+          tzHour = 0,
+          tzMin  = 0,
+          dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear,
+          timeSetter = match[8] ? date.setUTCHours : date.setHours;
+
+      if (match[9]) {
+        tzHour = toInt(match[9] + match[10]);
+        tzMin = toInt(match[9] + match[11]);
+      }
+      dateSetter.call(date, toInt(match[1]), toInt(match[2]) - 1, toInt(match[3]));
+      var h = toInt(match[4] || 0) - tzHour;
+      var m = toInt(match[5] || 0) - tzMin;
+      var s = toInt(match[6] || 0);
+      var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);
+      timeSetter.call(date, h, m, s, ms);
+      return date;
+    }
+    return string;
+  }
+
+
+  return function(date, format, timezone) {
+    var text = '',
+        parts = [],
+        fn, match;
+
+    format = format || 'mediumDate';
+    format = $locale.DATETIME_FORMATS[format] || format;
+    if (isString(date)) {
+      date = NUMBER_STRING.test(date) ? toInt(date) : jsonStringToDate(date);
+    }
+
+    if (isNumber(date)) {
+      date = new Date(date);
+    }
+
+    if (!isDate(date) || !isFinite(date.getTime())) {
+      return date;
+    }
+
+    while (format) {
+      match = DATE_FORMATS_SPLIT.exec(format);
+      if (match) {
+        parts = concat(parts, match, 1);
+        format = parts.pop();
+      } else {
+        parts.push(format);
+        format = null;
+      }
+    }
+
+    var dateTimezoneOffset = date.getTimezoneOffset();
+    if (timezone) {
+      dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
+      date = convertTimezoneToLocal(date, timezone, true);
+    }
+    forEach(parts, function(value) {
+      fn = DATE_FORMATS[value];
+      text += fn ? fn(date, $locale.DATETIME_FORMATS, dateTimezoneOffset)
+                 : value === "''" ? "'" : value.replace(/(^'|'$)/g, '').replace(/''/g, "'");
+    });
+
+    return text;
+  };
+}
+
+
+/**
+ * @ngdoc filter
+ * @name json
+ * @kind function
+ *
+ * @description
+ *   Allows you to convert a JavaScript object into JSON string.
+ *
+ *   This filter is mostly useful for debugging. When using the double curly {{value}} notation
+ *   the binding is automatically converted to JSON.
+ *
+ * @param {*} object Any JavaScript object (including arrays and primitive types) to filter.
+ * @param {number=} spacing The number of spaces to use per indentation, defaults to 2.
+ * @returns {string} JSON string.
+ *
+ *
+ * @example
+   <example>
+     <file name="index.html">
+       <pre id="default-spacing">{{ {'name':'value'} | json }}</pre>
+       <pre id="custom-spacing">{{ {'name':'value'} | json:4 }}</pre>
+     </file>
+     <file name="protractor.js" type="protractor">
+       it('should jsonify filtered objects', function() {
+         expect(element(by.id('default-spacing')).getText()).toMatch(/\{\n  "name": ?"value"\n}/);
+         expect(element(by.id('custom-spacing')).getText()).toMatch(/\{\n    "name": ?"value"\n}/);
+       });
+     </file>
+   </example>
+ *
+ */
+function jsonFilter() {
+  return function(object, spacing) {
+    if (isUndefined(spacing)) {
+        spacing = 2;
+    }
+    return toJson(object, spacing);
+  };
+}
+
+
+/**
+ * @ngdoc filter
+ * @name lowercase
+ * @kind function
+ * @description
+ * Converts string to lowercase.
+ * @see angular.lowercase
+ */
+var lowercaseFilter = valueFn(lowercase);
+
+
+/**
+ * @ngdoc filter
+ * @name uppercase
+ * @kind function
+ * @description
+ * Converts string to uppercase.
+ * @see angular.uppercase
+ */
+var uppercaseFilter = valueFn(uppercase);
+
+/**
+ * @ngdoc filter
+ * @name limitTo
+ * @kind function
+ *
+ * @description
+ * Creates a new array or string containing only a specified number of elements. The elements are
+ * taken from either the beginning or the end of the source array, string or number, as specified by
+ * the value and sign (positive or negative) of `limit`. Other array-like objects are also supported
+ * (e.g. array subclasses, NodeLists, jqLite/jQuery collections etc). If a number is used as input,
+ * it is converted to a string.
+ *
+ * @param {Array|ArrayLike|string|number} input - Array/array-like, string or number to be limited.
+ * @param {string|number} limit - The length of the returned array or string. If the `limit` number
+ *     is positive, `limit` number of items from the beginning of the source array/string are copied.
+ *     If the number is negative, `limit` number  of items from the end of the source array/string
+ *     are copied. The `limit` will be trimmed if it exceeds `array.length`. If `limit` is undefined,
+ *     the input will be returned unchanged.
+ * @param {(string|number)=} begin - Index at which to begin limitation. As a negative index,
+ *     `begin` indicates an offset from the end of `input`. Defaults to `0`.
+ * @returns {Array|string} A new sub-array or substring of length `limit` or less if the input had
+ *     less than `limit` elements.
+ *
+ * @example
+   <example module="limitToExample">
+     <file name="index.html">
+       <script>
+         angular.module('limitToExample', [])
+           .controller('ExampleController', ['$scope', function($scope) {
+             $scope.numbers = [1,2,3,4,5,6,7,8,9];
+             $scope.letters = "abcdefghi";
+             $scope.longNumber = 2345432342;
+             $scope.numLimit = 3;
+             $scope.letterLimit = 3;
+             $scope.longNumberLimit = 3;
+           }]);
+       </script>
+       <div ng-controller="ExampleController">
+         <label>
+            Limit {{numbers}} to:
+            <input type="number" step="1" ng-model="numLimit">
+         </label>
+         <p>Output numbers: {{ numbers | limitTo:numLimit }}</p>
+         <label>
+            Limit {{letters}} to:
+            <input type="number" step="1" ng-model="letterLimit">
+         </label>
+         <p>Output letters: {{ letters | limitTo:letterLimit }}</p>
+         <label>
+            Limit {{longNumber}} to:
+            <input type="number" step="1" ng-model="longNumberLimit">
+         </label>
+         <p>Output long number: {{ longNumber | limitTo:longNumberLimit }}</p>
+       </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+       var numLimitInput = element(by.model('numLimit'));
+       var letterLimitInput = element(by.model('letterLimit'));
+       var longNumberLimitInput = element(by.model('longNumberLimit'));
+       var limitedNumbers = element(by.binding('numbers | limitTo:numLimit'));
+       var limitedLetters = element(by.binding('letters | limitTo:letterLimit'));
+       var limitedLongNumber = element(by.binding('longNumber | limitTo:longNumberLimit'));
+
+       it('should limit the number array to first three items', function() {
+         expect(numLimitInput.getAttribute('value')).toBe('3');
+         expect(letterLimitInput.getAttribute('value')).toBe('3');
+         expect(longNumberLimitInput.getAttribute('value')).toBe('3');
+         expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3]');
+         expect(limitedLetters.getText()).toEqual('Output letters: abc');
+         expect(limitedLongNumber.getText()).toEqual('Output long number: 234');
+       });
+
+       // There is a bug in safari and protractor that doesn't like the minus key
+       // it('should update the output when -3 is entered', function() {
+       //   numLimitInput.clear();
+       //   numLimitInput.sendKeys('-3');
+       //   letterLimitInput.clear();
+       //   letterLimitInput.sendKeys('-3');
+       //   longNumberLimitInput.clear();
+       //   longNumberLimitInput.sendKeys('-3');
+       //   expect(limitedNumbers.getText()).toEqual('Output numbers: [7,8,9]');
+       //   expect(limitedLetters.getText()).toEqual('Output letters: ghi');
+       //   expect(limitedLongNumber.getText()).toEqual('Output long number: 342');
+       // });
+
+       it('should not exceed the maximum size of input array', function() {
+         numLimitInput.clear();
+         numLimitInput.sendKeys('100');
+         letterLimitInput.clear();
+         letterLimitInput.sendKeys('100');
+         longNumberLimitInput.clear();
+         longNumberLimitInput.sendKeys('100');
+         expect(limitedNumbers.getText()).toEqual('Output numbers: [1,2,3,4,5,6,7,8,9]');
+         expect(limitedLetters.getText()).toEqual('Output letters: abcdefghi');
+         expect(limitedLongNumber.getText()).toEqual('Output long number: 2345432342');
+       });
+     </file>
+   </example>
+*/
+function limitToFilter() {
+  return function(input, limit, begin) {
+    if (Math.abs(Number(limit)) === Infinity) {
+      limit = Number(limit);
+    } else {
+      limit = toInt(limit);
+    }
+    if (isNaN(limit)) return input;
+
+    if (isNumber(input)) input = input.toString();
+    if (!isArrayLike(input)) return input;
+
+    begin = (!begin || isNaN(begin)) ? 0 : toInt(begin);
+    begin = (begin < 0) ? Math.max(0, input.length + begin) : begin;
+
+    if (limit >= 0) {
+      return sliceFn(input, begin, begin + limit);
+    } else {
+      if (begin === 0) {
+        return sliceFn(input, limit, input.length);
+      } else {
+        return sliceFn(input, Math.max(0, begin + limit), begin);
+      }
+    }
+  };
+}
+
+function sliceFn(input, begin, end) {
+  if (isString(input)) return input.slice(begin, end);
+
+  return slice.call(input, begin, end);
+}
+
+/**
+ * @ngdoc filter
+ * @name orderBy
+ * @kind function
+ *
+ * @description
+ * Returns an array containing the items from the specified `collection`, ordered by a `comparator`
+ * function based on the values computed using the `expression` predicate.
+ *
+ * For example, `[{id: 'foo'}, {id: 'bar'}] | orderBy:'id'` would result in
+ * `[{id: 'bar'}, {id: 'foo'}]`.
+ *
+ * The `collection` can be an Array or array-like object (e.g. NodeList, jQuery object, TypedArray,
+ * String, etc).
+ *
+ * The `expression` can be a single predicate, or a list of predicates each serving as a tie-breaker
+ * for the preceeding one. The `expression` is evaluated against each item and the output is used
+ * for comparing with other items.
+ *
+ * You can change the sorting order by setting `reverse` to `true`. By default, items are sorted in
+ * ascending order.
+ *
+ * The comparison is done using the `comparator` function. If none is specified, a default, built-in
+ * comparator is used (see below for details - in a nutshell, it compares numbers numerically and
+ * strings alphabetically).
+ *
+ * ### Under the hood
+ *
+ * Ordering the specified `collection` happens in two phases:
+ *
+ * 1. All items are passed through the predicate (or predicates), and the returned values are saved
+ *    along with their type (`string`, `number` etc). For example, an item `{label: 'foo'}`, passed
+ *    through a predicate that extracts the value of the `label` property, would be transformed to:
+ *    ```
+ *    {
+ *      value: 'foo',
+ *      type: 'string',
+ *      index: ...
+ *    }
+ *    ```
+ * 2. The comparator function is used to sort the items, based on the derived values, types and
+ *    indices.
+ *
+ * If you use a custom comparator, it will be called with pairs of objects of the form
+ * `{value: ..., type: '...', index: ...}` and is expected to return `0` if the objects are equal
+ * (as far as the comparator is concerned), `-1` if the 1st one should be ranked higher than the
+ * second, or `1` otherwise.
+ *
+ * In order to ensure that the sorting will be deterministic across platforms, if none of the
+ * specified predicates can distinguish between two items, `orderBy` will automatically introduce a
+ * dummy predicate that returns the item's index as `value`.
+ * (If you are using a custom comparator, make sure it can handle this predicate as well.)
+ *
+ * Finally, in an attempt to simplify things, if a predicate returns an object as the extracted
+ * value for an item, `orderBy` will try to convert that object to a primitive value, before passing
+ * it to the comparator. The following rules govern the conversion:
+ *
+ * 1. If the object has a `valueOf()` method that returns a primitive, its return value will be
+ *    used instead.<br />
+ *    (If the object has a `valueOf()` method that returns another object, then the returned object
+ *    will be used in subsequent steps.)
+ * 2. If the object has a custom `toString()` method (i.e. not the one inherited from `Object`) that
+ *    returns a primitive, its return value will be used instead.<br />
+ *    (If the object has a `toString()` method that returns another object, then the returned object
+ *    will be used in subsequent steps.)
+ * 3. No conversion; the object itself is used.
+ *
+ * ### The default comparator
+ *
+ * The default, built-in comparator should be sufficient for most usecases. In short, it compares
+ * numbers numerically, strings alphabetically (and case-insensitively), for objects falls back to
+ * using their index in the original collection, and sorts values of different types by type.
+ *
+ * More specifically, it follows these steps to determine the relative order of items:
+ *
+ * 1. If the compared values are of different types, compare the types themselves alphabetically.
+ * 2. If both values are of type `string`, compare them alphabetically in a case- and
+ *    locale-insensitive way.
+ * 3. If both values are objects, compare their indices instead.
+ * 4. Otherwise, return:
+ *    -  `0`, if the values are equal (by strict equality comparison, i.e. using `===`).
+ *    - `-1`, if the 1st value is "less than" the 2nd value (compared using the `<` operator).
+ *    -  `1`, otherwise.
+ *
+ * **Note:** If you notice numbers not being sorted as expected, make sure they are actually being
+ *           saved as numbers and not strings.
+ *
+ * @param {Array|ArrayLike} collection - The collection (array or array-like object) to sort.
+ * @param {(Function|string|Array.<Function|string>)=} expression - A predicate (or list of
+ *    predicates) to be used by the comparator to determine the order of elements.
+ *
+ *    Can be one of:
+ *
+ *    - `Function`: A getter function. This function will be called with each item as argument and
+ *      the return value will be used for sorting.
+ *    - `string`: An Angular expression. This expression will be evaluated against each item and the
+ *      result will be used for sorting. For example, use `'label'` to sort by a property called
+ *      `label` or `'label.substring(0, 3)'` to sort by the first 3 characters of the `label`
+ *      property.<br />
+ *      (The result of a constant expression is interpreted as a property name to be used for
+ *      comparison. For example, use `'"special name"'` (note the extra pair of quotes) to sort by a
+ *      property called `special name`.)<br />
+ *      An expression can be optionally prefixed with `+` or `-` to control the sorting direction,
+ *      ascending or descending. For example, `'+label'` or `'-label'`. If no property is provided,
+ *      (e.g. `'+'` or `'-'`), the collection element itself is used in comparisons.
+ *    - `Array`: An array of function and/or string predicates. If a predicate cannot determine the
+ *      relative order of two items, the next predicate is used as a tie-breaker.
+ *
+ * **Note:** If the predicate is missing or empty then it defaults to `'+'`.
+ *
+ * @param {boolean=} reverse - If `true`, reverse the sorting order.
+ * @param {(Function)=} comparator - The comparator function used to determine the relative order of
+ *    value pairs. If omitted, the built-in comparator will be used.
+ *
+ * @returns {Array} - The sorted array.
+ *
+ *
+ * @example
+ * ### Ordering a table with `ngRepeat`
+ *
+ * The example below demonstrates a simple {@link ngRepeat ngRepeat}, where the data is sorted by
+ * age in descending order (expression is set to `'-age'`). The `comparator` is not set, which means
+ * it defaults to the built-in comparator.
+ *
+   <example name="orderBy-static" module="orderByExample1">
+     <file name="index.html">
+       <div ng-controller="ExampleController">
+         <table class="friends">
+           <tr>
+             <th>Name</th>
+             <th>Phone Number</th>
+             <th>Age</th>
+           </tr>
+           <tr ng-repeat="friend in friends | orderBy:'-age'">
+             <td>{{friend.name}}</td>
+             <td>{{friend.phone}}</td>
+             <td>{{friend.age}}</td>
+           </tr>
+         </table>
+       </div>
+     </file>
+     <file name="script.js">
+       angular.module('orderByExample1', [])
+         .controller('ExampleController', ['$scope', function($scope) {
+           $scope.friends = [
+             {name: 'John',   phone: '555-1212',  age: 10},
+             {name: 'Mary',   phone: '555-9876',  age: 19},
+             {name: 'Mike',   phone: '555-4321',  age: 21},
+             {name: 'Adam',   phone: '555-5678',  age: 35},
+             {name: 'Julie',  phone: '555-8765',  age: 29}
+           ];
+         }]);
+     </file>
+     <file name="style.css">
+       .friends {
+         border-collapse: collapse;
+       }
+
+       .friends th {
+         border-bottom: 1px solid;
+       }
+       .friends td, .friends th {
+         border-left: 1px solid;
+         padding: 5px 10px;
+       }
+       .friends td:first-child, .friends th:first-child {
+         border-left: none;
+       }
+     </file>
+     <file name="protractor.js" type="protractor">
+       // Element locators
+       var names = element.all(by.repeater('friends').column('friend.name'));
+
+       it('should sort friends by age in reverse order', function() {
+         expect(names.get(0).getText()).toBe('Adam');
+         expect(names.get(1).getText()).toBe('Julie');
+         expect(names.get(2).getText()).toBe('Mike');
+         expect(names.get(3).getText()).toBe('Mary');
+         expect(names.get(4).getText()).toBe('John');
+       });
+     </file>
+   </example>
+ * <hr />
+ *
+ * @example
+ * ### Changing parameters dynamically
+ *
+ * All parameters can be changed dynamically. The next example shows how you can make the columns of
+ * a table sortable, by binding the `expression` and `reverse` parameters to scope properties.
+ *
+   <example name="orderBy-dynamic" module="orderByExample2">
+     <file name="index.html">
+       <div ng-controller="ExampleController">
+         <pre>Sort by = {{propertyName}}; reverse = {{reverse}}</pre>
+         <hr/>
+         <button ng-click="propertyName = null; reverse = false">Set to unsorted</button>
+         <hr/>
+         <table class="friends">
+           <tr>
+             <th>
+               <button ng-click="sortBy('name')">Name</button>
+               <span class="sortorder" ng-show="propertyName === 'name'" ng-class="{reverse: reverse}"></span>
+             </th>
+             <th>
+               <button ng-click="sortBy('phone')">Phone Number</button>
+               <span class="sortorder" ng-show="propertyName === 'phone'" ng-class="{reverse: reverse}"></span>
+             </th>
+             <th>
+               <button ng-click="sortBy('age')">Age</button>
+               <span class="sortorder" ng-show="propertyName === 'age'" ng-class="{reverse: reverse}"></span>
+             </th>
+           </tr>
+           <tr ng-repeat="friend in friends | orderBy:propertyName:reverse">
+             <td>{{friend.name}}</td>
+             <td>{{friend.phone}}</td>
+             <td>{{friend.age}}</td>
+           </tr>
+         </table>
+       </div>
+     </file>
+     <file name="script.js">
+       angular.module('orderByExample2', [])
+         .controller('ExampleController', ['$scope', function($scope) {
+           var friends = [
+             {name: 'John',   phone: '555-1212',  age: 10},
+             {name: 'Mary',   phone: '555-9876',  age: 19},
+             {name: 'Mike',   phone: '555-4321',  age: 21},
+             {name: 'Adam',   phone: '555-5678',  age: 35},
+             {name: 'Julie',  phone: '555-8765',  age: 29}
+           ];
+
+           $scope.propertyName = 'age';
+           $scope.reverse = true;
+           $scope.friends = friends;
+
+           $scope.sortBy = function(propertyName) {
+             $scope.reverse = ($scope.propertyName === propertyName) ? !$scope.reverse : false;
+             $scope.propertyName = propertyName;
+           };
+         }]);
+     </file>
+     <file name="style.css">
+       .friends {
+         border-collapse: collapse;
+       }
+
+       .friends th {
+         border-bottom: 1px solid;
+       }
+       .friends td, .friends th {
+         border-left: 1px solid;
+         padding: 5px 10px;
+       }
+       .friends td:first-child, .friends th:first-child {
+         border-left: none;
+       }
+
+       .sortorder:after {
+         content: '\25b2';   // BLACK UP-POINTING TRIANGLE
+       }
+       .sortorder.reverse:after {
+         content: '\25bc';   // BLACK DOWN-POINTING TRIANGLE
+       }
+     </file>
+     <file name="protractor.js" type="protractor">
+       // Element locators
+       var unsortButton = element(by.partialButtonText('unsorted'));
+       var nameHeader = element(by.partialButtonText('Name'));
+       var phoneHeader = element(by.partialButtonText('Phone'));
+       var ageHeader = element(by.partialButtonText('Age'));
+       var firstName = element(by.repeater('friends').column('friend.name').row(0));
+       var lastName = element(by.repeater('friends').column('friend.name').row(4));
+
+       it('should sort friends by some property, when clicking on the column header', function() {
+         expect(firstName.getText()).toBe('Adam');
+         expect(lastName.getText()).toBe('John');
+
+         phoneHeader.click();
+         expect(firstName.getText()).toBe('John');
+         expect(lastName.getText()).toBe('Mary');
+
+         nameHeader.click();
+         expect(firstName.getText()).toBe('Adam');
+         expect(lastName.getText()).toBe('Mike');
+
+         ageHeader.click();
+         expect(firstName.getText()).toBe('John');
+         expect(lastName.getText()).toBe('Adam');
+       });
+
+       it('should sort friends in reverse order, when clicking on the same column', function() {
+         expect(firstName.getText()).toBe('Adam');
+         expect(lastName.getText()).toBe('John');
+
+         ageHeader.click();
+         expect(firstName.getText()).toBe('John');
+         expect(lastName.getText()).toBe('Adam');
+
+         ageHeader.click();
+         expect(firstName.getText()).toBe('Adam');
+         expect(lastName.getText()).toBe('John');
+       });
+
+       it('should restore the original order, when clicking "Set to unsorted"', function() {
+         expect(firstName.getText()).toBe('Adam');
+         expect(lastName.getText()).toBe('John');
+
+         unsortButton.click();
+         expect(firstName.getText()).toBe('John');
+         expect(lastName.getText()).toBe('Julie');
+       });
+     </file>
+   </example>
+ * <hr />
+ *
+ * @example
+ * ### Using `orderBy` inside a controller
+ *
+ * It is also possible to call the `orderBy` filter manually, by injecting `orderByFilter`, and
+ * calling it with the desired parameters. (Alternatively, you could inject the `$filter` factory
+ * and retrieve the `orderBy` filter with `$filter('orderBy')`.)
+ *
+   <example name="orderBy-call-manually" module="orderByExample3">
+     <file name="index.html">
+       <div ng-controller="ExampleController">
+         <pre>Sort by = {{propertyName}}; reverse = {{reverse}}</pre>
+         <hr/>
+         <button ng-click="sortBy(null)">Set to unsorted</button>
+         <hr/>
+         <table class="friends">
+           <tr>
+             <th>
+               <button ng-click="sortBy('name')">Name</button>
+               <span class="sortorder" ng-show="propertyName === 'name'" ng-class="{reverse: reverse}"></span>
+             </th>
+             <th>
+               <button ng-click="sortBy('phone')">Phone Number</button>
+               <span class="sortorder" ng-show="propertyName === 'phone'" ng-class="{reverse: reverse}"></span>
+             </th>
+             <th>
+               <button ng-click="sortBy('age')">Age</button>
+               <span class="sortorder" ng-show="propertyName === 'age'" ng-class="{reverse: reverse}"></span>
+             </th>
+           </tr>
+           <tr ng-repeat="friend in friends">
+             <td>{{friend.name}}</td>
+             <td>{{friend.phone}}</td>
+             <td>{{friend.age}}</td>
+           </tr>
+         </table>
+       </div>
+     </file>
+     <file name="script.js">
+       angular.module('orderByExample3', [])
+         .controller('ExampleController', ['$scope', 'orderByFilter', function($scope, orderBy) {
+           var friends = [
+             {name: 'John',   phone: '555-1212',  age: 10},
+             {name: 'Mary',   phone: '555-9876',  age: 19},
+             {name: 'Mike',   phone: '555-4321',  age: 21},
+             {name: 'Adam',   phone: '555-5678',  age: 35},
+             {name: 'Julie',  phone: '555-8765',  age: 29}
+           ];
+
+           $scope.propertyName = 'age';
+           $scope.reverse = true;
+           $scope.friends = orderBy(friends, $scope.propertyName, $scope.reverse);
+
+           $scope.sortBy = function(propertyName) {
+             $scope.reverse = (propertyName !== null && $scope.propertyName === propertyName)
+                 ? !$scope.reverse : false;
+             $scope.propertyName = propertyName;
+             $scope.friends = orderBy(friends, $scope.propertyName, $scope.reverse);
+           };
+         }]);
+     </file>
+     <file name="style.css">
+       .friends {
+         border-collapse: collapse;
+       }
+
+       .friends th {
+         border-bottom: 1px solid;
+       }
+       .friends td, .friends th {
+         border-left: 1px solid;
+         padding: 5px 10px;
+       }
+       .friends td:first-child, .friends th:first-child {
+         border-left: none;
+       }
+
+       .sortorder:after {
+         content: '\25b2';   // BLACK UP-POINTING TRIANGLE
+       }
+       .sortorder.reverse:after {
+         content: '\25bc';   // BLACK DOWN-POINTING TRIANGLE
+       }
+     </file>
+     <file name="protractor.js" type="protractor">
+       // Element locators
+       var unsortButton = element(by.partialButtonText('unsorted'));
+       var nameHeader = element(by.partialButtonText('Name'));
+       var phoneHeader = element(by.partialButtonText('Phone'));
+       var ageHeader = element(by.partialButtonText('Age'));
+       var firstName = element(by.repeater('friends').column('friend.name').row(0));
+       var lastName = element(by.repeater('friends').column('friend.name').row(4));
+
+       it('should sort friends by some property, when clicking on the column header', function() {
+         expect(firstName.getText()).toBe('Adam');
+         expect(lastName.getText()).toBe('John');
+
+         phoneHeader.click();
+         expect(firstName.getText()).toBe('John');
+         expect(lastName.getText()).toBe('Mary');
+
+         nameHeader.click();
+         expect(firstName.getText()).toBe('Adam');
+         expect(lastName.getText()).toBe('Mike');
+
+         ageHeader.click();
+         expect(firstName.getText()).toBe('John');
+         expect(lastName.getText()).toBe('Adam');
+       });
+
+       it('should sort friends in reverse order, when clicking on the same column', function() {
+         expect(firstName.getText()).toBe('Adam');
+         expect(lastName.getText()).toBe('John');
+
+         ageHeader.click();
+         expect(firstName.getText()).toBe('John');
+         expect(lastName.getText()).toBe('Adam');
+
+         ageHeader.click();
+         expect(firstName.getText()).toBe('Adam');
+         expect(lastName.getText()).toBe('John');
+       });
+
+       it('should restore the original order, when clicking "Set to unsorted"', function() {
+         expect(firstName.getText()).toBe('Adam');
+         expect(lastName.getText()).toBe('John');
+
+         unsortButton.click();
+         expect(firstName.getText()).toBe('John');
+         expect(lastName.getText()).toBe('Julie');
+       });
+     </file>
+   </example>
+ * <hr />
+ *
+ * @example
+ * ### Using a custom comparator
+ *
+ * If you have very specific requirements about the way items are sorted, you can pass your own
+ * comparator function. For example, you might need to compare some strings in a locale-sensitive
+ * way. (When specifying a custom comparator, you also need to pass a value for the `reverse`
+ * argument - passing `false` retains the default sorting order, i.e. ascending.)
+ *
+   <example name="orderBy-custom-comparator" module="orderByExample4">
+     <file name="index.html">
+       <div ng-controller="ExampleController">
+         <div class="friends-container custom-comparator">
+           <h3>Locale-sensitive Comparator</h3>
+           <table class="friends">
+             <tr>
+               <th>Name</th>
+               <th>Favorite Letter</th>
+             </tr>
+             <tr ng-repeat="friend in friends | orderBy:'favoriteLetter':false:localeSensitiveComparator">
+               <td>{{friend.name}}</td>
+               <td>{{friend.favoriteLetter}}</td>
+             </tr>
+           </table>
+         </div>
+         <div class="friends-container default-comparator">
+           <h3>Default Comparator</h3>
+           <table class="friends">
+             <tr>
+               <th>Name</th>
+               <th>Favorite Letter</th>
+             </tr>
+             <tr ng-repeat="friend in friends | orderBy:'favoriteLetter'">
+               <td>{{friend.name}}</td>
+               <td>{{friend.favoriteLetter}}</td>
+             </tr>
+           </table>
+         </div>
+       </div>
+     </file>
+     <file name="script.js">
+       angular.module('orderByExample4', [])
+         .controller('ExampleController', ['$scope', function($scope) {
+           $scope.friends = [
+             {name: 'John',   favoriteLetter: 'Ä'},
+             {name: 'Mary',   favoriteLetter: 'Ü'},
+             {name: 'Mike',   favoriteLetter: 'Ö'},
+             {name: 'Adam',   favoriteLetter: 'H'},
+             {name: 'Julie',  favoriteLetter: 'Z'}
+           ];
+
+           $scope.localeSensitiveComparator = function(v1, v2) {
+             // If we don't get strings, just compare by index
+             if (v1.type !== 'string' || v2.type !== 'string') {
+               return (v1.index < v2.index) ? -1 : 1;
+             }
+
+             // Compare strings alphabetically, taking locale into account
+             return v1.value.localeCompare(v2.value);
+           };
+         }]);
+     </file>
+     <file name="style.css">
+       .friends-container {
+         display: inline-block;
+         margin: 0 30px;
+       }
+
+       .friends {
+         border-collapse: collapse;
+       }
+
+       .friends th {
+         border-bottom: 1px solid;
+       }
+       .friends td, .friends th {
+         border-left: 1px solid;
+         padding: 5px 10px;
+       }
+       .friends td:first-child, .friends th:first-child {
+         border-left: none;
+       }
+     </file>
+     <file name="protractor.js" type="protractor">
+       // Element locators
+       var container = element(by.css('.custom-comparator'));
+       var names = container.all(by.repeater('friends').column('friend.name'));
+
+       it('should sort friends by favorite letter (in correct alphabetical order)', function() {
+         expect(names.get(0).getText()).toBe('John');
+         expect(names.get(1).getText()).toBe('Adam');
+         expect(names.get(2).getText()).toBe('Mike');
+         expect(names.get(3).getText()).toBe('Mary');
+         expect(names.get(4).getText()).toBe('Julie');
+       });
+     </file>
+   </example>
+ *
+ */
+orderByFilter.$inject = ['$parse'];
+function orderByFilter($parse) {
+  return function(array, sortPredicate, reverseOrder, compareFn) {
+
+    if (array == null) return array;
+    if (!isArrayLike(array)) {
+      throw minErr('orderBy')('notarray', 'Expected array but received: {0}', array);
+    }
+
+    if (!isArray(sortPredicate)) { sortPredicate = [sortPredicate]; }
+    if (sortPredicate.length === 0) { sortPredicate = ['+']; }
+
+    var predicates = processPredicates(sortPredicate);
+
+    var descending = reverseOrder ? -1 : 1;
+
+    // Define the `compare()` function. Use a default comparator if none is specified.
+    var compare = isFunction(compareFn) ? compareFn : defaultCompare;
+
+    // The next three lines are a version of a Swartzian Transform idiom from Perl
+    // (sometimes called the Decorate-Sort-Undecorate idiom)
+    // See https://en.wikipedia.org/wiki/Schwartzian_transform
+    var compareValues = Array.prototype.map.call(array, getComparisonObject);
+    compareValues.sort(doComparison);
+    array = compareValues.map(function(item) { return item.value; });
+
+    return array;
+
+    function getComparisonObject(value, index) {
+      // NOTE: We are adding an extra `tieBreaker` value based on the element's index.
+      // This will be used to keep the sort stable when none of the input predicates can
+      // distinguish between two elements.
+      return {
+        value: value,
+        tieBreaker: {value: index, type: 'number', index: index},
+        predicateValues: predicates.map(function(predicate) {
+          return getPredicateValue(predicate.get(value), index);
+        })
+      };
+    }
+
+    function doComparison(v1, v2) {
+      for (var i = 0, ii = predicates.length; i < ii; i++) {
+        var result = compare(v1.predicateValues[i], v2.predicateValues[i]);
+        if (result) {
+          return result * predicates[i].descending * descending;
+        }
+      }
+
+      return compare(v1.tieBreaker, v2.tieBreaker) * descending;
+    }
+  };
+
+  function processPredicates(sortPredicates) {
+    return sortPredicates.map(function(predicate) {
+      var descending = 1, get = identity;
+
+      if (isFunction(predicate)) {
+        get = predicate;
+      } else if (isString(predicate)) {
+        if ((predicate.charAt(0) == '+' || predicate.charAt(0) == '-')) {
+          descending = predicate.charAt(0) == '-' ? -1 : 1;
+          predicate = predicate.substring(1);
+        }
+        if (predicate !== '') {
+          get = $parse(predicate);
+          if (get.constant) {
+            var key = get();
+            get = function(value) { return value[key]; };
+          }
+        }
+      }
+      return {get: get, descending: descending};
+    });
+  }
+
+  function isPrimitive(value) {
+    switch (typeof value) {
+      case 'number': /* falls through */
+      case 'boolean': /* falls through */
+      case 'string':
+        return true;
+      default:
+        return false;
+    }
+  }
+
+  function objectValue(value) {
+    // If `valueOf` is a valid function use that
+    if (isFunction(value.valueOf)) {
+      value = value.valueOf();
+      if (isPrimitive(value)) return value;
+    }
+    // If `toString` is a valid function and not the one from `Object.prototype` use that
+    if (hasCustomToString(value)) {
+      value = value.toString();
+      if (isPrimitive(value)) return value;
+    }
+
+    return value;
+  }
+
+  function getPredicateValue(value, index) {
+    var type = typeof value;
+    if (value === null) {
+      type = 'string';
+      value = 'null';
+    } else if (type === 'object') {
+      value = objectValue(value);
+    }
+    return {value: value, type: type, index: index};
+  }
+
+  function defaultCompare(v1, v2) {
+    var result = 0;
+    var type1 = v1.type;
+    var type2 = v2.type;
+
+    if (type1 === type2) {
+      var value1 = v1.value;
+      var value2 = v2.value;
+
+      if (type1 === 'string') {
+        // Compare strings case-insensitively
+        value1 = value1.toLowerCase();
+        value2 = value2.toLowerCase();
+      } else if (type1 === 'object') {
+        // For basic objects, use the position of the object
+        // in the collection instead of the value
+        if (isObject(value1)) value1 = v1.index;
+        if (isObject(value2)) value2 = v2.index;
+      }
+
+      if (value1 !== value2) {
+        result = value1 < value2 ? -1 : 1;
+      }
+    } else {
+      result = type1 < type2 ? -1 : 1;
+    }
+
+    return result;
+  }
+}
+
+function ngDirective(directive) {
+  if (isFunction(directive)) {
+    directive = {
+      link: directive
+    };
+  }
+  directive.restrict = directive.restrict || 'AC';
+  return valueFn(directive);
+}
+
+/**
+ * @ngdoc directive
+ * @name a
+ * @restrict E
+ *
+ * @description
+ * Modifies the default behavior of the html A tag so that the default action is prevented when
+ * the href attribute is empty.
+ *
+ * This change permits the easy creation of action links with the `ngClick` directive
+ * without changing the location or causing page reloads, e.g.:
+ * `<a href="" ng-click="list.addItem()">Add Item</a>`
+ */
+var htmlAnchorDirective = valueFn({
+  restrict: 'E',
+  compile: function(element, attr) {
+    if (!attr.href && !attr.xlinkHref) {
+      return function(scope, element) {
+        // If the linked element is not an anchor tag anymore, do nothing
+        if (element[0].nodeName.toLowerCase() !== 'a') return;
+
+        // SVGAElement does not use the href attribute, but rather the 'xlinkHref' attribute.
+        var href = toString.call(element.prop('href')) === '[object SVGAnimatedString]' ?
+                   'xlink:href' : 'href';
+        element.on('click', function(event) {
+          // if we have no href url, then don't navigate anywhere.
+          if (!element.attr(href)) {
+            event.preventDefault();
+          }
+        });
+      };
+    }
+  }
+});
+
+/**
+ * @ngdoc directive
+ * @name ngHref
+ * @restrict A
+ * @priority 99
+ *
+ * @description
+ * Using Angular markup like `{{hash}}` in an href attribute will
+ * make the link go to the wrong URL if the user clicks it before
+ * Angular has a chance to replace the `{{hash}}` markup with its
+ * value. Until Angular replaces the markup the link will be broken
+ * and will most likely return a 404 error. The `ngHref` directive
+ * solves this problem.
+ *
+ * The wrong way to write it:
+ * ```html
+ * <a href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
+ * ```
+ *
+ * The correct way to write it:
+ * ```html
+ * <a ng-href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
+ * ```
+ *
+ * @element A
+ * @param {template} ngHref any string which can contain `{{}}` markup.
+ *
+ * @example
+ * This example shows various combinations of `href`, `ng-href` and `ng-click` attributes
+ * in links and their different behaviors:
+    <example>
+      <file name="index.html">
+        <input ng-model="value" /><br />
+        <a id="link-1" href ng-click="value = 1">link 1</a> (link, don't reload)<br />
+        <a id="link-2" href="" ng-click="value = 2">link 2</a> (link, don't reload)<br />
+        <a id="link-3" ng-href="/{{'123'}}">link 3</a> (link, reload!)<br />
+        <a id="link-4" href="" name="xx" ng-click="value = 4">anchor</a> (link, don't reload)<br />
+        <a id="link-5" name="xxx" ng-click="value = 5">anchor</a> (no link)<br />
+        <a id="link-6" ng-href="{{value}}">link</a> (link, change location)
+      </file>
+      <file name="protractor.js" type="protractor">
+        it('should execute ng-click but not reload when href without value', function() {
+          element(by.id('link-1')).click();
+          expect(element(by.model('value')).getAttribute('value')).toEqual('1');
+          expect(element(by.id('link-1')).getAttribute('href')).toBe('');
+        });
+
+        it('should execute ng-click but not reload when href empty string', function() {
+          element(by.id('link-2')).click();
+          expect(element(by.model('value')).getAttribute('value')).toEqual('2');
+          expect(element(by.id('link-2')).getAttribute('href')).toBe('');
+        });
+
+        it('should execute ng-click and change url when ng-href specified', function() {
+          expect(element(by.id('link-3')).getAttribute('href')).toMatch(/\/123$/);
+
+          element(by.id('link-3')).click();
+
+          // At this point, we navigate away from an Angular page, so we need
+          // to use browser.driver to get the base webdriver.
+
+          browser.wait(function() {
+            return browser.driver.getCurrentUrl().then(function(url) {
+              return url.match(/\/123$/);
+            });
+          }, 5000, 'page should navigate to /123');
+        });
+
+        it('should execute ng-click but not reload when href empty string and name specified', function() {
+          element(by.id('link-4')).click();
+          expect(element(by.model('value')).getAttribute('value')).toEqual('4');
+          expect(element(by.id('link-4')).getAttribute('href')).toBe('');
+        });
+
+        it('should execute ng-click but not reload when no href but name specified', function() {
+          element(by.id('link-5')).click();
+          expect(element(by.model('value')).getAttribute('value')).toEqual('5');
+          expect(element(by.id('link-5')).getAttribute('href')).toBe(null);
+        });
+
+        it('should only change url when only ng-href', function() {
+          element(by.model('value')).clear();
+          element(by.model('value')).sendKeys('6');
+          expect(element(by.id('link-6')).getAttribute('href')).toMatch(/\/6$/);
+
+          element(by.id('link-6')).click();
+
+          // At this point, we navigate away from an Angular page, so we need
+          // to use browser.driver to get the base webdriver.
+          browser.wait(function() {
+            return browser.driver.getCurrentUrl().then(function(url) {
+              return url.match(/\/6$/);
+            });
+          }, 5000, 'page should navigate to /6');
+        });
+      </file>
+    </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngSrc
+ * @restrict A
+ * @priority 99
+ *
+ * @description
+ * Using Angular markup like `{{hash}}` in a `src` attribute doesn't
+ * work right: The browser will fetch from the URL with the literal
+ * text `{{hash}}` until Angular replaces the expression inside
+ * `{{hash}}`. The `ngSrc` directive solves this problem.
+ *
+ * The buggy way to write it:
+ * ```html
+ * <img src="http://www.gravatar.com/avatar/{{hash}}" alt="Description"/>
+ * ```
+ *
+ * The correct way to write it:
+ * ```html
+ * <img ng-src="http://www.gravatar.com/avatar/{{hash}}" alt="Description" />
+ * ```
+ *
+ * @element IMG
+ * @param {template} ngSrc any string which can contain `{{}}` markup.
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngSrcset
+ * @restrict A
+ * @priority 99
+ *
+ * @description
+ * Using Angular markup like `{{hash}}` in a `srcset` attribute doesn't
+ * work right: The browser will fetch from the URL with the literal
+ * text `{{hash}}` until Angular replaces the expression inside
+ * `{{hash}}`. The `ngSrcset` directive solves this problem.
+ *
+ * The buggy way to write it:
+ * ```html
+ * <img srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description"/>
+ * ```
+ *
+ * The correct way to write it:
+ * ```html
+ * <img ng-srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description" />
+ * ```
+ *
+ * @element IMG
+ * @param {template} ngSrcset any string which can contain `{{}}` markup.
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngDisabled
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ *
+ * This directive sets the `disabled` attribute on the element if the
+ * {@link guide/expression expression} inside `ngDisabled` evaluates to truthy.
+ *
+ * A special directive is necessary because we cannot use interpolation inside the `disabled`
+ * attribute. See the {@link guide/interpolation interpolation guide} for more info.
+ *
+ * @example
+    <example>
+      <file name="index.html">
+        <label>Click me to toggle: <input type="checkbox" ng-model="checked"></label><br/>
+        <button ng-model="button" ng-disabled="checked">Button</button>
+      </file>
+      <file name="protractor.js" type="protractor">
+        it('should toggle button', function() {
+          expect(element(by.css('button')).getAttribute('disabled')).toBeFalsy();
+          element(by.model('checked')).click();
+          expect(element(by.css('button')).getAttribute('disabled')).toBeTruthy();
+        });
+      </file>
+    </example>
+ *
+ * @element INPUT
+ * @param {expression} ngDisabled If the {@link guide/expression expression} is truthy,
+ *     then the `disabled` attribute will be set on the element
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngChecked
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ * Sets the `checked` attribute on the element, if the expression inside `ngChecked` is truthy.
+ *
+ * Note that this directive should not be used together with {@link ngModel `ngModel`},
+ * as this can lead to unexpected behavior.
+ *
+ * A special directive is necessary because we cannot use interpolation inside the `checked`
+ * attribute. See the {@link guide/interpolation interpolation guide} for more info.
+ *
+ * @example
+    <example>
+      <file name="index.html">
+        <label>Check me to check both: <input type="checkbox" ng-model="master"></label><br/>
+        <input id="checkSlave" type="checkbox" ng-checked="master" aria-label="Slave input">
+      </file>
+      <file name="protractor.js" type="protractor">
+        it('should check both checkBoxes', function() {
+          expect(element(by.id('checkSlave')).getAttribute('checked')).toBeFalsy();
+          element(by.model('master')).click();
+          expect(element(by.id('checkSlave')).getAttribute('checked')).toBeTruthy();
+        });
+      </file>
+    </example>
+ *
+ * @element INPUT
+ * @param {expression} ngChecked If the {@link guide/expression expression} is truthy,
+ *     then the `checked` attribute will be set on the element
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngReadonly
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ *
+ * Sets the `readonly` attribute on the element, if the expression inside `ngReadonly` is truthy.
+ * Note that `readonly` applies only to `input` elements with specific types. [See the input docs on
+ * MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly) for more information.
+ *
+ * A special directive is necessary because we cannot use interpolation inside the `readonly`
+ * attribute. See the {@link guide/interpolation interpolation guide} for more info.
+ *
+ * @example
+    <example>
+      <file name="index.html">
+        <label>Check me to make text readonly: <input type="checkbox" ng-model="checked"></label><br/>
+        <input type="text" ng-readonly="checked" value="I'm Angular" aria-label="Readonly field" />
+      </file>
+      <file name="protractor.js" type="protractor">
+        it('should toggle readonly attr', function() {
+          expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeFalsy();
+          element(by.model('checked')).click();
+          expect(element(by.css('[type="text"]')).getAttribute('readonly')).toBeTruthy();
+        });
+      </file>
+    </example>
+ *
+ * @element INPUT
+ * @param {expression} ngReadonly If the {@link guide/expression expression} is truthy,
+ *     then special attribute "readonly" will be set on the element
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngSelected
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ *
+ * Sets the `selected` attribute on the element, if the expression inside `ngSelected` is truthy.
+ *
+ * A special directive is necessary because we cannot use interpolation inside the `selected`
+ * attribute. See the {@link guide/interpolation interpolation guide} for more info.
+ *
+ * <div class="alert alert-warning">
+ *   **Note:** `ngSelected` does not interact with the `select` and `ngModel` directives, it only
+ *   sets the `selected` attribute on the element. If you are using `ngModel` on the select, you
+ *   should not use `ngSelected` on the options, as `ngModel` will set the select value and
+ *   selected options.
+ * </div>
+ *
+ * @example
+    <example>
+      <file name="index.html">
+        <label>Check me to select: <input type="checkbox" ng-model="selected"></label><br/>
+        <select aria-label="ngSelected demo">
+          <option>Hello!</option>
+          <option id="greet" ng-selected="selected">Greetings!</option>
+        </select>
+      </file>
+      <file name="protractor.js" type="protractor">
+        it('should select Greetings!', function() {
+          expect(element(by.id('greet')).getAttribute('selected')).toBeFalsy();
+          element(by.model('selected')).click();
+          expect(element(by.id('greet')).getAttribute('selected')).toBeTruthy();
+        });
+      </file>
+    </example>
+ *
+ * @element OPTION
+ * @param {expression} ngSelected If the {@link guide/expression expression} is truthy,
+ *     then special attribute "selected" will be set on the element
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngOpen
+ * @restrict A
+ * @priority 100
+ *
+ * @description
+ *
+ * Sets the `open` attribute on the element, if the expression inside `ngOpen` is truthy.
+ *
+ * A special directive is necessary because we cannot use interpolation inside the `open`
+ * attribute. See the {@link guide/interpolation interpolation guide} for more info.
+ *
+ * ## A note about browser compatibility
+ *
+ * Edge, Firefox, and Internet Explorer do not support the `details` element, it is
+ * recommended to use {@link ng.ngShow} and {@link ng.ngHide} instead.
+ *
+ * @example
+     <example>
+       <file name="index.html">
+         <label>Check me check multiple: <input type="checkbox" ng-model="open"></label><br/>
+         <details id="details" ng-open="open">
+            <summary>Show/Hide me</summary>
+         </details>
+       </file>
+       <file name="protractor.js" type="protractor">
+         it('should toggle open', function() {
+           expect(element(by.id('details')).getAttribute('open')).toBeFalsy();
+           element(by.model('open')).click();
+           expect(element(by.id('details')).getAttribute('open')).toBeTruthy();
+         });
+       </file>
+     </example>
+ *
+ * @element DETAILS
+ * @param {expression} ngOpen If the {@link guide/expression expression} is truthy,
+ *     then special attribute "open" will be set on the element
+ */
+
+var ngAttributeAliasDirectives = {};
+
+// boolean attrs are evaluated
+forEach(BOOLEAN_ATTR, function(propName, attrName) {
+  // binding to multiple is not supported
+  if (propName == "multiple") return;
+
+  function defaultLinkFn(scope, element, attr) {
+    scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) {
+      attr.$set(attrName, !!value);
+    });
+  }
+
+  var normalized = directiveNormalize('ng-' + attrName);
+  var linkFn = defaultLinkFn;
+
+  if (propName === 'checked') {
+    linkFn = function(scope, element, attr) {
+      // ensuring ngChecked doesn't interfere with ngModel when both are set on the same input
+      if (attr.ngModel !== attr[normalized]) {
+        defaultLinkFn(scope, element, attr);
+      }
+    };
+  }
+
+  ngAttributeAliasDirectives[normalized] = function() {
+    return {
+      restrict: 'A',
+      priority: 100,
+      link: linkFn
+    };
+  };
+});
+
+// aliased input attrs are evaluated
+forEach(ALIASED_ATTR, function(htmlAttr, ngAttr) {
+  ngAttributeAliasDirectives[ngAttr] = function() {
+    return {
+      priority: 100,
+      link: function(scope, element, attr) {
+        //special case ngPattern when a literal regular expression value
+        //is used as the expression (this way we don't have to watch anything).
+        if (ngAttr === "ngPattern" && attr.ngPattern.charAt(0) == "/") {
+          var match = attr.ngPattern.match(REGEX_STRING_REGEXP);
+          if (match) {
+            attr.$set("ngPattern", new RegExp(match[1], match[2]));
+            return;
+          }
+        }
+
+        scope.$watch(attr[ngAttr], function ngAttrAliasWatchAction(value) {
+          attr.$set(ngAttr, value);
+        });
+      }
+    };
+  };
+});
+
+// ng-src, ng-srcset, ng-href are interpolated
+forEach(['src', 'srcset', 'href'], function(attrName) {
+  var normalized = directiveNormalize('ng-' + attrName);
+  ngAttributeAliasDirectives[normalized] = function() {
+    return {
+      priority: 99, // it needs to run after the attributes are interpolated
+      link: function(scope, element, attr) {
+        var propName = attrName,
+            name = attrName;
+
+        if (attrName === 'href' &&
+            toString.call(element.prop('href')) === '[object SVGAnimatedString]') {
+          name = 'xlinkHref';
+          attr.$attr[name] = 'xlink:href';
+          propName = null;
+        }
+
+        attr.$observe(normalized, function(value) {
+          if (!value) {
+            if (attrName === 'href') {
+              attr.$set(name, null);
+            }
+            return;
+          }
+
+          attr.$set(name, value);
+
+          // on IE, if "ng:src" directive declaration is used and "src" attribute doesn't exist
+          // then calling element.setAttribute('src', 'foo') doesn't do anything, so we need
+          // to set the property as well to achieve the desired effect.
+          // we use attr[attrName] value since $set can sanitize the url.
+          if (msie && propName) element.prop(propName, attr[name]);
+        });
+      }
+    };
+  };
+});
+
+/* global -nullFormCtrl, -SUBMITTED_CLASS, addSetValidityMethod: true
+ */
+var nullFormCtrl = {
+  $addControl: noop,
+  $$renameControl: nullFormRenameControl,
+  $removeControl: noop,
+  $setValidity: noop,
+  $setDirty: noop,
+  $setPristine: noop,
+  $setSubmitted: noop
+},
+SUBMITTED_CLASS = 'ng-submitted';
+
+function nullFormRenameControl(control, name) {
+  control.$name = name;
+}
+
+/**
+ * @ngdoc type
+ * @name form.FormController
+ *
+ * @property {boolean} $pristine True if user has not interacted with the form yet.
+ * @property {boolean} $dirty True if user has already interacted with the form.
+ * @property {boolean} $valid True if all of the containing forms and controls are valid.
+ * @property {boolean} $invalid True if at least one containing control or form is invalid.
+ * @property {boolean} $pending True if at least one containing control or form is pending.
+ * @property {boolean} $submitted True if user has submitted the form even if its invalid.
+ *
+ * @property {Object} $error Is an object hash, containing references to controls or
+ *  forms with failing validators, where:
+ *
+ *  - keys are validation tokens (error names),
+ *  - values are arrays of controls or forms that have a failing validator for given error name.
+ *
+ *  Built-in validation tokens:
+ *
+ *  - `email`
+ *  - `max`
+ *  - `maxlength`
+ *  - `min`
+ *  - `minlength`
+ *  - `number`
+ *  - `pattern`
+ *  - `required`
+ *  - `url`
+ *  - `date`
+ *  - `datetimelocal`
+ *  - `time`
+ *  - `week`
+ *  - `month`
+ *
+ * @description
+ * `FormController` keeps track of all its controls and nested forms as well as the state of them,
+ * such as being valid/invalid or dirty/pristine.
+ *
+ * Each {@link ng.directive:form form} directive creates an instance
+ * of `FormController`.
+ *
+ */
+//asks for $scope to fool the BC controller module
+FormController.$inject = ['$element', '$attrs', '$scope', '$animate', '$interpolate'];
+function FormController(element, attrs, $scope, $animate, $interpolate) {
+  var form = this,
+      controls = [];
+
+  // init state
+  form.$error = {};
+  form.$$success = {};
+  form.$pending = undefined;
+  form.$name = $interpolate(attrs.name || attrs.ngForm || '')($scope);
+  form.$dirty = false;
+  form.$pristine = true;
+  form.$valid = true;
+  form.$invalid = false;
+  form.$submitted = false;
+  form.$$parentForm = nullFormCtrl;
+
+  /**
+   * @ngdoc method
+   * @name form.FormController#$rollbackViewValue
+   *
+   * @description
+   * Rollback all form controls pending updates to the `$modelValue`.
+   *
+   * Updates may be pending by a debounced event or because the input is waiting for a some future
+   * event defined in `ng-model-options`. This method is typically needed by the reset button of
+   * a form that uses `ng-model-options` to pend updates.
+   */
+  form.$rollbackViewValue = function() {
+    forEach(controls, function(control) {
+      control.$rollbackViewValue();
+    });
+  };
+
+  /**
+   * @ngdoc method
+   * @name form.FormController#$commitViewValue
+   *
+   * @description
+   * Commit all form controls pending updates to the `$modelValue`.
+   *
+   * Updates may be pending by a debounced event or because the input is waiting for a some future
+   * event defined in `ng-model-options`. This method is rarely needed as `NgModelController`
+   * usually handles calling this in response to input events.
+   */
+  form.$commitViewValue = function() {
+    forEach(controls, function(control) {
+      control.$commitViewValue();
+    });
+  };
+
+  /**
+   * @ngdoc method
+   * @name form.FormController#$addControl
+   * @param {object} control control object, either a {@link form.FormController} or an
+   * {@link ngModel.NgModelController}
+   *
+   * @description
+   * Register a control with the form. Input elements using ngModelController do this automatically
+   * when they are linked.
+   *
+   * Note that the current state of the control will not be reflected on the new parent form. This
+   * is not an issue with normal use, as freshly compiled and linked controls are in a `$pristine`
+   * state.
+   *
+   * However, if the method is used programmatically, for example by adding dynamically created controls,
+   * or controls that have been previously removed without destroying their corresponding DOM element,
+   * it's the developers responsibility to make sure the current state propagates to the parent form.
+   *
+   * For example, if an input control is added that is already `$dirty` and has `$error` properties,
+   * calling `$setDirty()` and `$validate()` afterwards will propagate the state to the parent form.
+   */
+  form.$addControl = function(control) {
+    // Breaking change - before, inputs whose name was "hasOwnProperty" were quietly ignored
+    // and not added to the scope.  Now we throw an error.
+    assertNotHasOwnProperty(control.$name, 'input');
+    controls.push(control);
+
+    if (control.$name) {
+      form[control.$name] = control;
+    }
+
+    control.$$parentForm = form;
+  };
+
+  // Private API: rename a form control
+  form.$$renameControl = function(control, newName) {
+    var oldName = control.$name;
+
+    if (form[oldName] === control) {
+      delete form[oldName];
+    }
+    form[newName] = control;
+    control.$name = newName;
+  };
+
+  /**
+   * @ngdoc method
+   * @name form.FormController#$removeControl
+   * @param {object} control control object, either a {@link form.FormController} or an
+   * {@link ngModel.NgModelController}
+   *
+   * @description
+   * Deregister a control from the form.
+   *
+   * Input elements using ngModelController do this automatically when they are destroyed.
+   *
+   * Note that only the removed control's validation state (`$errors`etc.) will be removed from the
+   * form. `$dirty`, `$submitted` states will not be changed, because the expected behavior can be
+   * different from case to case. For example, removing the only `$dirty` control from a form may or
+   * may not mean that the form is still `$dirty`.
+   */
+  form.$removeControl = function(control) {
+    if (control.$name && form[control.$name] === control) {
+      delete form[control.$name];
+    }
+    forEach(form.$pending, function(value, name) {
+      form.$setValidity(name, null, control);
+    });
+    forEach(form.$error, function(value, name) {
+      form.$setValidity(name, null, control);
+    });
+    forEach(form.$$success, function(value, name) {
+      form.$setValidity(name, null, control);
+    });
+
+    arrayRemove(controls, control);
+    control.$$parentForm = nullFormCtrl;
+  };
+
+
+  /**
+   * @ngdoc method
+   * @name form.FormController#$setValidity
+   *
+   * @description
+   * Sets the validity of a form control.
+   *
+   * This method will also propagate to parent forms.
+   */
+  addSetValidityMethod({
+    ctrl: this,
+    $element: element,
+    set: function(object, property, controller) {
+      var list = object[property];
+      if (!list) {
+        object[property] = [controller];
+      } else {
+        var index = list.indexOf(controller);
+        if (index === -1) {
+          list.push(controller);
+        }
+      }
+    },
+    unset: function(object, property, controller) {
+      var list = object[property];
+      if (!list) {
+        return;
+      }
+      arrayRemove(list, controller);
+      if (list.length === 0) {
+        delete object[property];
+      }
+    },
+    $animate: $animate
+  });
+
+  /**
+   * @ngdoc method
+   * @name form.FormController#$setDirty
+   *
+   * @description
+   * Sets the form to a dirty state.
+   *
+   * This method can be called to add the 'ng-dirty' class and set the form to a dirty
+   * state (ng-dirty class). This method will also propagate to parent forms.
+   */
+  form.$setDirty = function() {
+    $animate.removeClass(element, PRISTINE_CLASS);
+    $animate.addClass(element, DIRTY_CLASS);
+    form.$dirty = true;
+    form.$pristine = false;
+    form.$$parentForm.$setDirty();
+  };
+
+  /**
+   * @ngdoc method
+   * @name form.FormController#$setPristine
+   *
+   * @description
+   * Sets the form to its pristine state.
+   *
+   * This method can be called to remove the 'ng-dirty' class and set the form to its pristine
+   * state (ng-pristine class). This method will also propagate to all the controls contained
+   * in this form.
+   *
+   * Setting a form back to a pristine state is often useful when we want to 'reuse' a form after
+   * saving or resetting it.
+   */
+  form.$setPristine = function() {
+    $animate.setClass(element, PRISTINE_CLASS, DIRTY_CLASS + ' ' + SUBMITTED_CLASS);
+    form.$dirty = false;
+    form.$pristine = true;
+    form.$submitted = false;
+    forEach(controls, function(control) {
+      control.$setPristine();
+    });
+  };
+
+  /**
+   * @ngdoc method
+   * @name form.FormController#$setUntouched
+   *
+   * @description
+   * Sets the form to its untouched state.
+   *
+   * This method can be called to remove the 'ng-touched' class and set the form controls to their
+   * untouched state (ng-untouched class).
+   *
+   * Setting a form controls back to their untouched state is often useful when setting the form
+   * back to its pristine state.
+   */
+  form.$setUntouched = function() {
+    forEach(controls, function(control) {
+      control.$setUntouched();
+    });
+  };
+
+  /**
+   * @ngdoc method
+   * @name form.FormController#$setSubmitted
+   *
+   * @description
+   * Sets the form to its submitted state.
+   */
+  form.$setSubmitted = function() {
+    $animate.addClass(element, SUBMITTED_CLASS);
+    form.$submitted = true;
+    form.$$parentForm.$setSubmitted();
+  };
+}
+
+/**
+ * @ngdoc directive
+ * @name ngForm
+ * @restrict EAC
+ *
+ * @description
+ * Nestable alias of {@link ng.directive:form `form`} directive. HTML
+ * does not allow nesting of form elements. It is useful to nest forms, for example if the validity of a
+ * sub-group of controls needs to be determined.
+ *
+ * Note: the purpose of `ngForm` is to group controls,
+ * but not to be a replacement for the `<form>` tag with all of its capabilities
+ * (e.g. posting to the server, ...).
+ *
+ * @param {string=} ngForm|name Name of the form. If specified, the form controller will be published into
+ *                       related scope, under this name.
+ *
+ */
+
+ /**
+ * @ngdoc directive
+ * @name form
+ * @restrict E
+ *
+ * @description
+ * Directive that instantiates
+ * {@link form.FormController FormController}.
+ *
+ * If the `name` attribute is specified, the form controller is published onto the current scope under
+ * this name.
+ *
+ * # Alias: {@link ng.directive:ngForm `ngForm`}
+ *
+ * In Angular, forms can be nested. This means that the outer form is valid when all of the child
+ * forms are valid as well. However, browsers do not allow nesting of `<form>` elements, so
+ * Angular provides the {@link ng.directive:ngForm `ngForm`} directive, which behaves identically to
+ * `form` but can be nested. Nested forms can be useful, for example, if the validity of a sub-group
+ * of controls needs to be determined.
+ *
+ * # CSS classes
+ *  - `ng-valid` is set if the form is valid.
+ *  - `ng-invalid` is set if the form is invalid.
+ *  - `ng-pending` is set if the form is pending.
+ *  - `ng-pristine` is set if the form is pristine.
+ *  - `ng-dirty` is set if the form is dirty.
+ *  - `ng-submitted` is set if the form was submitted.
+ *
+ * Keep in mind that ngAnimate can detect each of these classes when added and removed.
+ *
+ *
+ * # Submitting a form and preventing the default action
+ *
+ * Since the role of forms in client-side Angular applications is different than in classical
+ * roundtrip apps, it is desirable for the browser not to translate the form submission into a full
+ * page reload that sends the data to the server. Instead some javascript logic should be triggered
+ * to handle the form submission in an application-specific way.
+ *
+ * For this reason, Angular prevents the default action (form submission to the server) unless the
+ * `<form>` element has an `action` attribute specified.
+ *
+ * You can use one of the following two ways to specify what javascript method should be called when
+ * a form is submitted:
+ *
+ * - {@link ng.directive:ngSubmit ngSubmit} directive on the form element
+ * - {@link ng.directive:ngClick ngClick} directive on the first
+  *  button or input field of type submit (input[type=submit])
+ *
+ * To prevent double execution of the handler, use only one of the {@link ng.directive:ngSubmit ngSubmit}
+ * or {@link ng.directive:ngClick ngClick} directives.
+ * This is because of the following form submission rules in the HTML specification:
+ *
+ * - If a form has only one input field then hitting enter in this field triggers form submit
+ * (`ngSubmit`)
+ * - if a form has 2+ input fields and no buttons or input[type=submit] then hitting enter
+ * doesn't trigger submit
+ * - if a form has one or more input fields and one or more buttons or input[type=submit] then
+ * hitting enter in any of the input fields will trigger the click handler on the *first* button or
+ * input[type=submit] (`ngClick`) *and* a submit handler on the enclosing form (`ngSubmit`)
+ *
+ * Any pending `ngModelOptions` changes will take place immediately when an enclosing form is
+ * submitted. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit`
+ * to have access to the updated model.
+ *
+ * ## Animation Hooks
+ *
+ * Animations in ngForm are triggered when any of the associated CSS classes are added and removed.
+ * These classes are: `.ng-pristine`, `.ng-dirty`, `.ng-invalid` and `.ng-valid` as well as any
+ * other validations that are performed within the form. Animations in ngForm are similar to how
+ * they work in ngClass and animations can be hooked into using CSS transitions, keyframes as well
+ * as JS animations.
+ *
+ * The following example shows a simple way to utilize CSS transitions to style a form element
+ * that has been rendered as invalid after it has been validated:
+ *
+ * <pre>
+ * //be sure to include ngAnimate as a module to hook into more
+ * //advanced animations
+ * .my-form {
+ *   transition:0.5s linear all;
+ *   background: white;
+ * }
+ * .my-form.ng-invalid {
+ *   background: red;
+ *   color:white;
+ * }
+ * </pre>
+ *
+ * @example
+    <example deps="angular-animate.js" animations="true" fixBase="true" module="formExample">
+      <file name="index.html">
+       <script>
+         angular.module('formExample', [])
+           .controller('FormController', ['$scope', function($scope) {
+             $scope.userType = 'guest';
+           }]);
+       </script>
+       <style>
+        .my-form {
+          transition:all linear 0.5s;
+          background: transparent;
+        }
+        .my-form.ng-invalid {
+          background: red;
+        }
+       </style>
+       <form name="myForm" ng-controller="FormController" class="my-form">
+         userType: <input name="input" ng-model="userType" required>
+         <span class="error" ng-show="myForm.input.$error.required">Required!</span><br>
+         <code>userType = {{userType}}</code><br>
+         <code>myForm.input.$valid = {{myForm.input.$valid}}</code><br>
+         <code>myForm.input.$error = {{myForm.input.$error}}</code><br>
+         <code>myForm.$valid = {{myForm.$valid}}</code><br>
+         <code>myForm.$error.required = {{!!myForm.$error.required}}</code><br>
+        </form>
+      </file>
+      <file name="protractor.js" type="protractor">
+        it('should initialize to model', function() {
+          var userType = element(by.binding('userType'));
+          var valid = element(by.binding('myForm.input.$valid'));
+
+          expect(userType.getText()).toContain('guest');
+          expect(valid.getText()).toContain('true');
+        });
+
+        it('should be invalid if empty', function() {
+          var userType = element(by.binding('userType'));
+          var valid = element(by.binding('myForm.input.$valid'));
+          var userInput = element(by.model('userType'));
+
+          userInput.clear();
+          userInput.sendKeys('');
+
+          expect(userType.getText()).toEqual('userType =');
+          expect(valid.getText()).toContain('false');
+        });
+      </file>
+    </example>
+ *
+ * @param {string=} name Name of the form. If specified, the form controller will be published into
+ *                       related scope, under this name.
+ */
+var formDirectiveFactory = function(isNgForm) {
+  return ['$timeout', '$parse', function($timeout, $parse) {
+    var formDirective = {
+      name: 'form',
+      restrict: isNgForm ? 'EAC' : 'E',
+      require: ['form', '^^?form'], //first is the form's own ctrl, second is an optional parent form
+      controller: FormController,
+      compile: function ngFormCompile(formElement, attr) {
+        // Setup initial state of the control
+        formElement.addClass(PRISTINE_CLASS).addClass(VALID_CLASS);
+
+        var nameAttr = attr.name ? 'name' : (isNgForm && attr.ngForm ? 'ngForm' : false);
+
+        return {
+          pre: function ngFormPreLink(scope, formElement, attr, ctrls) {
+            var controller = ctrls[0];
+
+            // if `action` attr is not present on the form, prevent the default action (submission)
+            if (!('action' in attr)) {
+              // we can't use jq events because if a form is destroyed during submission the default
+              // action is not prevented. see #1238
+              //
+              // IE 9 is not affected because it doesn't fire a submit event and try to do a full
+              // page reload if the form was destroyed by submission of the form via a click handler
+              // on a button in the form. Looks like an IE9 specific bug.
+              var handleFormSubmission = function(event) {
+                scope.$apply(function() {
+                  controller.$commitViewValue();
+                  controller.$setSubmitted();
+                });
+
+                event.preventDefault();
+              };
+
+              addEventListenerFn(formElement[0], 'submit', handleFormSubmission);
+
+              // unregister the preventDefault listener so that we don't not leak memory but in a
+              // way that will achieve the prevention of the default action.
+              formElement.on('$destroy', function() {
+                $timeout(function() {
+                  removeEventListenerFn(formElement[0], 'submit', handleFormSubmission);
+                }, 0, false);
+              });
+            }
+
+            var parentFormCtrl = ctrls[1] || controller.$$parentForm;
+            parentFormCtrl.$addControl(controller);
+
+            var setter = nameAttr ? getSetter(controller.$name) : noop;
+
+            if (nameAttr) {
+              setter(scope, controller);
+              attr.$observe(nameAttr, function(newValue) {
+                if (controller.$name === newValue) return;
+                setter(scope, undefined);
+                controller.$$parentForm.$$renameControl(controller, newValue);
+                setter = getSetter(controller.$name);
+                setter(scope, controller);
+              });
+            }
+            formElement.on('$destroy', function() {
+              controller.$$parentForm.$removeControl(controller);
+              setter(scope, undefined);
+              extend(controller, nullFormCtrl); //stop propagating child destruction handlers upwards
+            });
+          }
+        };
+      }
+    };
+
+    return formDirective;
+
+    function getSetter(expression) {
+      if (expression === '') {
+        //create an assignable expression, so forms with an empty name can be renamed later
+        return $parse('this[""]').assign;
+      }
+      return $parse(expression).assign || noop;
+    }
+  }];
+};
+
+var formDirective = formDirectiveFactory();
+var ngFormDirective = formDirectiveFactory(true);
+
+/* global VALID_CLASS: false,
+  INVALID_CLASS: false,
+  PRISTINE_CLASS: false,
+  DIRTY_CLASS: false,
+  UNTOUCHED_CLASS: false,
+  TOUCHED_CLASS: false,
+  ngModelMinErr: false,
+*/
+
+// Regex code was initially obtained from SO prior to modification: https://stackoverflow.com/questions/3143070/javascript-regex-iso-datetime#answer-3143231
+var ISO_DATE_REGEXP = /^\d{4,}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+(?:[+-][0-2]\d:[0-5]\d|Z)$/;
+// See valid URLs in RFC3987 (http://tools.ietf.org/html/rfc3987)
+// Note: We are being more lenient, because browsers are too.
+//   1. Scheme
+//   2. Slashes
+//   3. Username
+//   4. Password
+//   5. Hostname
+//   6. Port
+//   7. Path
+//   8. Query
+//   9. Fragment
+//                 1111111111111111 222   333333    44444        555555555555555555555555    666     77777777     8888888     999
+var URL_REGEXP = /^[a-z][a-z\d.+-]*:\/*(?:[^:@]+(?::[^@]+)?@)?(?:[^\s:/?#]+|\[[a-f\d:]+\])(?::\d+)?(?:\/[^?#]*)?(?:\?[^#]*)?(?:#.*)?$/i;
+/* jshint maxlen:220 */
+var EMAIL_REGEXP = /^(?=.{1,254}$)(?=.{1,64}@)[-!#$%&'*+\/0-9=?A-Z^_`a-z{|}~]+(\.[-!#$%&'*+\/0-9=?A-Z^_`a-z{|}~]+)*@[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?(\.[A-Za-z0-9]([A-Za-z0-9-]{0,61}[A-Za-z0-9])?)*$/;
+/* jshint maxlen:200 */
+var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))([eE][+-]?\d+)?\s*$/;
+var DATE_REGEXP = /^(\d{4,})-(\d{2})-(\d{2})$/;
+var DATETIMELOCAL_REGEXP = /^(\d{4,})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/;
+var WEEK_REGEXP = /^(\d{4,})-W(\d\d)$/;
+var MONTH_REGEXP = /^(\d{4,})-(\d\d)$/;
+var TIME_REGEXP = /^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/;
+
+var PARTIAL_VALIDATION_EVENTS = 'keydown wheel mousedown';
+var PARTIAL_VALIDATION_TYPES = createMap();
+forEach('date,datetime-local,month,time,week'.split(','), function(type) {
+  PARTIAL_VALIDATION_TYPES[type] = true;
+});
+
+var inputType = {
+
+  /**
+   * @ngdoc input
+   * @name input[text]
+   *
+   * @description
+   * Standard HTML text input with angular data binding, inherited by most of the `input` elements.
+   *
+   *
+   * @param {string} ngModel Assignable angular expression to data-bind to.
+   * @param {string=} name Property name of the form under which the control is published.
+   * @param {string=} required Adds `required` validation error key if the value is not entered.
+   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+   *    `required` when you want to data-bind to the `required` attribute.
+   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+   *    minlength.
+   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+   *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of
+   *    any length.
+   * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string
+   *    that contains the regular expression body that will be converted to a regular expression
+   *    as in the ngPattern directive.
+   * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}
+   *    does not match a RegExp found by evaluating the Angular expression given in the attribute value.
+   *    If the expression evaluates to a RegExp object, then this is used directly.
+   *    If the expression evaluates to a string, then it will be converted to a RegExp
+   *    after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+   *    `new RegExp('^abc$')`.<br />
+   *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+   *    start at the index of the last search's match, thus not taking the whole input value into
+   *    account.
+   * @param {string=} ngChange Angular expression to be executed when input changes due to user
+   *    interaction with the input element.
+   * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.
+   *    This parameter is ignored for input[type=password] controls, which will never trim the
+   *    input.
+   *
+   * @example
+      <example name="text-input-directive" module="textInputExample">
+        <file name="index.html">
+         <script>
+           angular.module('textInputExample', [])
+             .controller('ExampleController', ['$scope', function($scope) {
+               $scope.example = {
+                 text: 'guest',
+                 word: /^\s*\w*\s*$/
+               };
+             }]);
+         </script>
+         <form name="myForm" ng-controller="ExampleController">
+           <label>Single word:
+             <input type="text" name="input" ng-model="example.text"
+                    ng-pattern="example.word" required ng-trim="false">
+           </label>
+           <div role="alert">
+             <span class="error" ng-show="myForm.input.$error.required">
+               Required!</span>
+             <span class="error" ng-show="myForm.input.$error.pattern">
+               Single word only!</span>
+           </div>
+           <code>text = {{example.text}}</code><br/>
+           <code>myForm.input.$valid = {{myForm.input.$valid}}</code><br/>
+           <code>myForm.input.$error = {{myForm.input.$error}}</code><br/>
+           <code>myForm.$valid = {{myForm.$valid}}</code><br/>
+           <code>myForm.$error.required = {{!!myForm.$error.required}}</code><br/>
+          </form>
+        </file>
+        <file name="protractor.js" type="protractor">
+          var text = element(by.binding('example.text'));
+          var valid = element(by.binding('myForm.input.$valid'));
+          var input = element(by.model('example.text'));
+
+          it('should initialize to model', function() {
+            expect(text.getText()).toContain('guest');
+            expect(valid.getText()).toContain('true');
+          });
+
+          it('should be invalid if empty', function() {
+            input.clear();
+            input.sendKeys('');
+
+            expect(text.getText()).toEqual('text =');
+            expect(valid.getText()).toContain('false');
+          });
+
+          it('should be invalid if multi word', function() {
+            input.clear();
+            input.sendKeys('hello world');
+
+            expect(valid.getText()).toContain('false');
+          });
+        </file>
+      </example>
+   */
+  'text': textInputType,
+
+    /**
+     * @ngdoc input
+     * @name input[date]
+     *
+     * @description
+     * Input with date validation and transformation. In browsers that do not yet support
+     * the HTML5 date input, a text element will be used. In that case, text must be entered in a valid ISO-8601
+     * date format (yyyy-MM-dd), for example: `2009-01-06`. Since many
+     * modern browsers do not yet support this input type, it is important to provide cues to users on the
+     * expected input format via a placeholder or label.
+     *
+     * The model must always be a Date object, otherwise Angular will throw an error.
+     * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
+     *
+     * The timezone to be used to read/write the `Date` instance in the model can be defined using
+     * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.
+     *
+     * @param {string} ngModel Assignable angular expression to data-bind to.
+     * @param {string=} name Property name of the form under which the control is published.
+     * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`. This must be a
+     *   valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute
+     *   (e.g. `min="{{minDate | date:'yyyy-MM-dd'}}"`). Note that `min` will also add native HTML5
+     *   constraint validation.
+     * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`. This must be
+     *   a valid ISO date string (yyyy-MM-dd). You can also use interpolation inside this attribute
+     *   (e.g. `max="{{maxDate | date:'yyyy-MM-dd'}}"`). Note that `max` will also add native HTML5
+     *   constraint validation.
+     * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO date string
+     *   the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.
+     * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO date string
+     *   the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.
+     * @param {string=} required Sets `required` validation error key if the value is not entered.
+     * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+     *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+     *    `required` when you want to data-bind to the `required` attribute.
+     * @param {string=} ngChange Angular expression to be executed when input changes due to user
+     *    interaction with the input element.
+     *
+     * @example
+     <example name="date-input-directive" module="dateInputExample">
+     <file name="index.html">
+       <script>
+          angular.module('dateInputExample', [])
+            .controller('DateController', ['$scope', function($scope) {
+              $scope.example = {
+                value: new Date(2013, 9, 22)
+              };
+            }]);
+       </script>
+       <form name="myForm" ng-controller="DateController as dateCtrl">
+          <label for="exampleInput">Pick a date in 2013:</label>
+          <input type="date" id="exampleInput" name="input" ng-model="example.value"
+              placeholder="yyyy-MM-dd" min="2013-01-01" max="2013-12-31" required />
+          <div role="alert">
+            <span class="error" ng-show="myForm.input.$error.required">
+                Required!</span>
+            <span class="error" ng-show="myForm.input.$error.date">
+                Not a valid date!</span>
+           </div>
+           <tt>value = {{example.value | date: "yyyy-MM-dd"}}</tt><br/>
+           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+       </form>
+     </file>
+     <file name="protractor.js" type="protractor">
+        var value = element(by.binding('example.value | date: "yyyy-MM-dd"'));
+        var valid = element(by.binding('myForm.input.$valid'));
+        var input = element(by.model('example.value'));
+
+        // currently protractor/webdriver does not support
+        // sending keys to all known HTML5 input controls
+        // for various browsers (see https://github.com/angular/protractor/issues/562).
+        function setInput(val) {
+          // set the value of the element and force validation.
+          var scr = "var ipt = document.getElementById('exampleInput'); " +
+          "ipt.value = '" + val + "';" +
+          "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });";
+          browser.executeScript(scr);
+        }
+
+        it('should initialize to model', function() {
+          expect(value.getText()).toContain('2013-10-22');
+          expect(valid.getText()).toContain('myForm.input.$valid = true');
+        });
+
+        it('should be invalid if empty', function() {
+          setInput('');
+          expect(value.getText()).toEqual('value =');
+          expect(valid.getText()).toContain('myForm.input.$valid = false');
+        });
+
+        it('should be invalid if over max', function() {
+          setInput('2015-01-01');
+          expect(value.getText()).toContain('');
+          expect(valid.getText()).toContain('myForm.input.$valid = false');
+        });
+     </file>
+     </example>
+     */
+  'date': createDateInputType('date', DATE_REGEXP,
+         createDateParser(DATE_REGEXP, ['yyyy', 'MM', 'dd']),
+         'yyyy-MM-dd'),
+
+   /**
+    * @ngdoc input
+    * @name input[datetime-local]
+    *
+    * @description
+    * Input with datetime validation and transformation. In browsers that do not yet support
+    * the HTML5 date input, a text element will be used. In that case, the text must be entered in a valid ISO-8601
+    * local datetime format (yyyy-MM-ddTHH:mm:ss), for example: `2010-12-28T14:57:00`.
+    *
+    * The model must always be a Date object, otherwise Angular will throw an error.
+    * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
+    *
+    * The timezone to be used to read/write the `Date` instance in the model can be defined using
+    * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.
+    *
+    * @param {string} ngModel Assignable angular expression to data-bind to.
+    * @param {string=} name Property name of the form under which the control is published.
+    * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+    *   This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation
+    *   inside this attribute (e.g. `min="{{minDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}"`).
+    *   Note that `min` will also add native HTML5 constraint validation.
+    * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+    *   This must be a valid ISO datetime format (yyyy-MM-ddTHH:mm:ss). You can also use interpolation
+    *   inside this attribute (e.g. `max="{{maxDatetimeLocal | date:'yyyy-MM-ddTHH:mm:ss'}}"`).
+    *   Note that `max` will also add native HTML5 constraint validation.
+    * @param {(date|string)=} ngMin Sets the `min` validation error key to the Date / ISO datetime string
+    *   the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.
+    * @param {(date|string)=} ngMax Sets the `max` validation error key to the Date / ISO datetime string
+    *   the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.
+    * @param {string=} required Sets `required` validation error key if the value is not entered.
+    * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+    *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+    *    `required` when you want to data-bind to the `required` attribute.
+    * @param {string=} ngChange Angular expression to be executed when input changes due to user
+    *    interaction with the input element.
+    *
+    * @example
+    <example name="datetimelocal-input-directive" module="dateExample">
+    <file name="index.html">
+      <script>
+        angular.module('dateExample', [])
+          .controller('DateController', ['$scope', function($scope) {
+            $scope.example = {
+              value: new Date(2010, 11, 28, 14, 57)
+            };
+          }]);
+      </script>
+      <form name="myForm" ng-controller="DateController as dateCtrl">
+        <label for="exampleInput">Pick a date between in 2013:</label>
+        <input type="datetime-local" id="exampleInput" name="input" ng-model="example.value"
+            placeholder="yyyy-MM-ddTHH:mm:ss" min="2001-01-01T00:00:00" max="2013-12-31T00:00:00" required />
+        <div role="alert">
+          <span class="error" ng-show="myForm.input.$error.required">
+              Required!</span>
+          <span class="error" ng-show="myForm.input.$error.datetimelocal">
+              Not a valid date!</span>
+        </div>
+        <tt>value = {{example.value | date: "yyyy-MM-ddTHH:mm:ss"}}</tt><br/>
+        <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+        <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+        <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+        <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+      </form>
+    </file>
+    <file name="protractor.js" type="protractor">
+      var value = element(by.binding('example.value | date: "yyyy-MM-ddTHH:mm:ss"'));
+      var valid = element(by.binding('myForm.input.$valid'));
+      var input = element(by.model('example.value'));
+
+      // currently protractor/webdriver does not support
+      // sending keys to all known HTML5 input controls
+      // for various browsers (https://github.com/angular/protractor/issues/562).
+      function setInput(val) {
+        // set the value of the element and force validation.
+        var scr = "var ipt = document.getElementById('exampleInput'); " +
+        "ipt.value = '" + val + "';" +
+        "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });";
+        browser.executeScript(scr);
+      }
+
+      it('should initialize to model', function() {
+        expect(value.getText()).toContain('2010-12-28T14:57:00');
+        expect(valid.getText()).toContain('myForm.input.$valid = true');
+      });
+
+      it('should be invalid if empty', function() {
+        setInput('');
+        expect(value.getText()).toEqual('value =');
+        expect(valid.getText()).toContain('myForm.input.$valid = false');
+      });
+
+      it('should be invalid if over max', function() {
+        setInput('2015-01-01T23:59:00');
+        expect(value.getText()).toContain('');
+        expect(valid.getText()).toContain('myForm.input.$valid = false');
+      });
+    </file>
+    </example>
+    */
+  'datetime-local': createDateInputType('datetimelocal', DATETIMELOCAL_REGEXP,
+      createDateParser(DATETIMELOCAL_REGEXP, ['yyyy', 'MM', 'dd', 'HH', 'mm', 'ss', 'sss']),
+      'yyyy-MM-ddTHH:mm:ss.sss'),
+
+  /**
+   * @ngdoc input
+   * @name input[time]
+   *
+   * @description
+   * Input with time validation and transformation. In browsers that do not yet support
+   * the HTML5 time input, a text element will be used. In that case, the text must be entered in a valid ISO-8601
+   * local time format (HH:mm:ss), for example: `14:57:00`. Model must be a Date object. This binding will always output a
+   * Date object to the model of January 1, 1970, or local date `new Date(1970, 0, 1, HH, mm, ss)`.
+   *
+   * The model must always be a Date object, otherwise Angular will throw an error.
+   * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
+   *
+   * The timezone to be used to read/write the `Date` instance in the model can be defined using
+   * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.
+   *
+   * @param {string} ngModel Assignable angular expression to data-bind to.
+   * @param {string=} name Property name of the form under which the control is published.
+   * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+   *   This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this
+   *   attribute (e.g. `min="{{minTime | date:'HH:mm:ss'}}"`). Note that `min` will also add
+   *   native HTML5 constraint validation.
+   * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+   *   This must be a valid ISO time format (HH:mm:ss). You can also use interpolation inside this
+   *   attribute (e.g. `max="{{maxTime | date:'HH:mm:ss'}}"`). Note that `max` will also add
+   *   native HTML5 constraint validation.
+   * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO time string the
+   *   `ngMin` expression evaluates to. Note that it does not set the `min` attribute.
+   * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO time string the
+   *   `ngMax` expression evaluates to. Note that it does not set the `max` attribute.
+   * @param {string=} required Sets `required` validation error key if the value is not entered.
+   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+   *    `required` when you want to data-bind to the `required` attribute.
+   * @param {string=} ngChange Angular expression to be executed when input changes due to user
+   *    interaction with the input element.
+   *
+   * @example
+   <example name="time-input-directive" module="timeExample">
+   <file name="index.html">
+     <script>
+      angular.module('timeExample', [])
+        .controller('DateController', ['$scope', function($scope) {
+          $scope.example = {
+            value: new Date(1970, 0, 1, 14, 57, 0)
+          };
+        }]);
+     </script>
+     <form name="myForm" ng-controller="DateController as dateCtrl">
+        <label for="exampleInput">Pick a time between 8am and 5pm:</label>
+        <input type="time" id="exampleInput" name="input" ng-model="example.value"
+            placeholder="HH:mm:ss" min="08:00:00" max="17:00:00" required />
+        <div role="alert">
+          <span class="error" ng-show="myForm.input.$error.required">
+              Required!</span>
+          <span class="error" ng-show="myForm.input.$error.time">
+              Not a valid date!</span>
+        </div>
+        <tt>value = {{example.value | date: "HH:mm:ss"}}</tt><br/>
+        <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+        <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+        <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+        <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+     </form>
+   </file>
+   <file name="protractor.js" type="protractor">
+      var value = element(by.binding('example.value | date: "HH:mm:ss"'));
+      var valid = element(by.binding('myForm.input.$valid'));
+      var input = element(by.model('example.value'));
+
+      // currently protractor/webdriver does not support
+      // sending keys to all known HTML5 input controls
+      // for various browsers (https://github.com/angular/protractor/issues/562).
+      function setInput(val) {
+        // set the value of the element and force validation.
+        var scr = "var ipt = document.getElementById('exampleInput'); " +
+        "ipt.value = '" + val + "';" +
+        "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });";
+        browser.executeScript(scr);
+      }
+
+      it('should initialize to model', function() {
+        expect(value.getText()).toContain('14:57:00');
+        expect(valid.getText()).toContain('myForm.input.$valid = true');
+      });
+
+      it('should be invalid if empty', function() {
+        setInput('');
+        expect(value.getText()).toEqual('value =');
+        expect(valid.getText()).toContain('myForm.input.$valid = false');
+      });
+
+      it('should be invalid if over max', function() {
+        setInput('23:59:00');
+        expect(value.getText()).toContain('');
+        expect(valid.getText()).toContain('myForm.input.$valid = false');
+      });
+   </file>
+   </example>
+   */
+  'time': createDateInputType('time', TIME_REGEXP,
+      createDateParser(TIME_REGEXP, ['HH', 'mm', 'ss', 'sss']),
+     'HH:mm:ss.sss'),
+
+   /**
+    * @ngdoc input
+    * @name input[week]
+    *
+    * @description
+    * Input with week-of-the-year validation and transformation to Date. In browsers that do not yet support
+    * the HTML5 week input, a text element will be used. In that case, the text must be entered in a valid ISO-8601
+    * week format (yyyy-W##), for example: `2013-W02`.
+    *
+    * The model must always be a Date object, otherwise Angular will throw an error.
+    * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
+    *
+    * The timezone to be used to read/write the `Date` instance in the model can be defined using
+    * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.
+    *
+    * @param {string} ngModel Assignable angular expression to data-bind to.
+    * @param {string=} name Property name of the form under which the control is published.
+    * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+    *   This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this
+    *   attribute (e.g. `min="{{minWeek | date:'yyyy-Www'}}"`). Note that `min` will also add
+    *   native HTML5 constraint validation.
+    * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+    *   This must be a valid ISO week format (yyyy-W##). You can also use interpolation inside this
+    *   attribute (e.g. `max="{{maxWeek | date:'yyyy-Www'}}"`). Note that `max` will also add
+    *   native HTML5 constraint validation.
+    * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string
+    *   the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.
+    * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string
+    *   the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.
+    * @param {string=} required Sets `required` validation error key if the value is not entered.
+    * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+    *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+    *    `required` when you want to data-bind to the `required` attribute.
+    * @param {string=} ngChange Angular expression to be executed when input changes due to user
+    *    interaction with the input element.
+    *
+    * @example
+    <example name="week-input-directive" module="weekExample">
+    <file name="index.html">
+      <script>
+      angular.module('weekExample', [])
+        .controller('DateController', ['$scope', function($scope) {
+          $scope.example = {
+            value: new Date(2013, 0, 3)
+          };
+        }]);
+      </script>
+      <form name="myForm" ng-controller="DateController as dateCtrl">
+        <label>Pick a date between in 2013:
+          <input id="exampleInput" type="week" name="input" ng-model="example.value"
+                 placeholder="YYYY-W##" min="2012-W32"
+                 max="2013-W52" required />
+        </label>
+        <div role="alert">
+          <span class="error" ng-show="myForm.input.$error.required">
+              Required!</span>
+          <span class="error" ng-show="myForm.input.$error.week">
+              Not a valid date!</span>
+        </div>
+        <tt>value = {{example.value | date: "yyyy-Www"}}</tt><br/>
+        <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+        <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+        <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+        <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+      </form>
+    </file>
+    <file name="protractor.js" type="protractor">
+      var value = element(by.binding('example.value | date: "yyyy-Www"'));
+      var valid = element(by.binding('myForm.input.$valid'));
+      var input = element(by.model('example.value'));
+
+      // currently protractor/webdriver does not support
+      // sending keys to all known HTML5 input controls
+      // for various browsers (https://github.com/angular/protractor/issues/562).
+      function setInput(val) {
+        // set the value of the element and force validation.
+        var scr = "var ipt = document.getElementById('exampleInput'); " +
+        "ipt.value = '" + val + "';" +
+        "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });";
+        browser.executeScript(scr);
+      }
+
+      it('should initialize to model', function() {
+        expect(value.getText()).toContain('2013-W01');
+        expect(valid.getText()).toContain('myForm.input.$valid = true');
+      });
+
+      it('should be invalid if empty', function() {
+        setInput('');
+        expect(value.getText()).toEqual('value =');
+        expect(valid.getText()).toContain('myForm.input.$valid = false');
+      });
+
+      it('should be invalid if over max', function() {
+        setInput('2015-W01');
+        expect(value.getText()).toContain('');
+        expect(valid.getText()).toContain('myForm.input.$valid = false');
+      });
+    </file>
+    </example>
+    */
+  'week': createDateInputType('week', WEEK_REGEXP, weekParser, 'yyyy-Www'),
+
+  /**
+   * @ngdoc input
+   * @name input[month]
+   *
+   * @description
+   * Input with month validation and transformation. In browsers that do not yet support
+   * the HTML5 month input, a text element will be used. In that case, the text must be entered in a valid ISO-8601
+   * month format (yyyy-MM), for example: `2009-01`.
+   *
+   * The model must always be a Date object, otherwise Angular will throw an error.
+   * Invalid `Date` objects (dates whose `getTime()` is `NaN`) will be rendered as an empty string.
+   * If the model is not set to the first of the month, the next view to model update will set it
+   * to the first of the month.
+   *
+   * The timezone to be used to read/write the `Date` instance in the model can be defined using
+   * {@link ng.directive:ngModelOptions ngModelOptions}. By default, this is the timezone of the browser.
+   *
+   * @param {string} ngModel Assignable angular expression to data-bind to.
+   * @param {string=} name Property name of the form under which the control is published.
+   * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+   *   This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this
+   *   attribute (e.g. `min="{{minMonth | date:'yyyy-MM'}}"`). Note that `min` will also add
+   *   native HTML5 constraint validation.
+   * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+   *   This must be a valid ISO month format (yyyy-MM). You can also use interpolation inside this
+   *   attribute (e.g. `max="{{maxMonth | date:'yyyy-MM'}}"`). Note that `max` will also add
+   *   native HTML5 constraint validation.
+   * @param {(date|string)=} ngMin Sets the `min` validation constraint to the Date / ISO week string
+   *   the `ngMin` expression evaluates to. Note that it does not set the `min` attribute.
+   * @param {(date|string)=} ngMax Sets the `max` validation constraint to the Date / ISO week string
+   *   the `ngMax` expression evaluates to. Note that it does not set the `max` attribute.
+
+   * @param {string=} required Sets `required` validation error key if the value is not entered.
+   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+   *    `required` when you want to data-bind to the `required` attribute.
+   * @param {string=} ngChange Angular expression to be executed when input changes due to user
+   *    interaction with the input element.
+   *
+   * @example
+   <example name="month-input-directive" module="monthExample">
+   <file name="index.html">
+     <script>
+      angular.module('monthExample', [])
+        .controller('DateController', ['$scope', function($scope) {
+          $scope.example = {
+            value: new Date(2013, 9, 1)
+          };
+        }]);
+     </script>
+     <form name="myForm" ng-controller="DateController as dateCtrl">
+       <label for="exampleInput">Pick a month in 2013:</label>
+       <input id="exampleInput" type="month" name="input" ng-model="example.value"
+          placeholder="yyyy-MM" min="2013-01" max="2013-12" required />
+       <div role="alert">
+         <span class="error" ng-show="myForm.input.$error.required">
+            Required!</span>
+         <span class="error" ng-show="myForm.input.$error.month">
+            Not a valid month!</span>
+       </div>
+       <tt>value = {{example.value | date: "yyyy-MM"}}</tt><br/>
+       <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+       <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+       <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+       <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+     </form>
+   </file>
+   <file name="protractor.js" type="protractor">
+      var value = element(by.binding('example.value | date: "yyyy-MM"'));
+      var valid = element(by.binding('myForm.input.$valid'));
+      var input = element(by.model('example.value'));
+
+      // currently protractor/webdriver does not support
+      // sending keys to all known HTML5 input controls
+      // for various browsers (https://github.com/angular/protractor/issues/562).
+      function setInput(val) {
+        // set the value of the element and force validation.
+        var scr = "var ipt = document.getElementById('exampleInput'); " +
+        "ipt.value = '" + val + "';" +
+        "angular.element(ipt).scope().$apply(function(s) { s.myForm[ipt.name].$setViewValue('" + val + "'); });";
+        browser.executeScript(scr);
+      }
+
+      it('should initialize to model', function() {
+        expect(value.getText()).toContain('2013-10');
+        expect(valid.getText()).toContain('myForm.input.$valid = true');
+      });
+
+      it('should be invalid if empty', function() {
+        setInput('');
+        expect(value.getText()).toEqual('value =');
+        expect(valid.getText()).toContain('myForm.input.$valid = false');
+      });
+
+      it('should be invalid if over max', function() {
+        setInput('2015-01');
+        expect(value.getText()).toContain('');
+        expect(valid.getText()).toContain('myForm.input.$valid = false');
+      });
+   </file>
+   </example>
+   */
+  'month': createDateInputType('month', MONTH_REGEXP,
+     createDateParser(MONTH_REGEXP, ['yyyy', 'MM']),
+     'yyyy-MM'),
+
+  /**
+   * @ngdoc input
+   * @name input[number]
+   *
+   * @description
+   * Text input with number validation and transformation. Sets the `number` validation
+   * error if not a valid number.
+   *
+   * <div class="alert alert-warning">
+   * The model must always be of type `number` otherwise Angular will throw an error.
+   * Be aware that a string containing a number is not enough. See the {@link ngModel:numfmt}
+   * error docs for more information and an example of how to convert your model if necessary.
+   * </div>
+   *
+   * ## Issues with HTML5 constraint validation
+   *
+   * In browsers that follow the
+   * [HTML5 specification](https://html.spec.whatwg.org/multipage/forms.html#number-state-%28type=number%29),
+   * `input[number]` does not work as expected with {@link ngModelOptions `ngModelOptions.allowInvalid`}.
+   * If a non-number is entered in the input, the browser will report the value as an empty string,
+   * which means the view / model values in `ngModel` and subsequently the scope value
+   * will also be an empty string.
+   *
+   *
+   * @param {string} ngModel Assignable angular expression to data-bind to.
+   * @param {string=} name Property name of the form under which the control is published.
+   * @param {string=} min Sets the `min` validation error key if the value entered is less than `min`.
+   * @param {string=} max Sets the `max` validation error key if the value entered is greater than `max`.
+   * @param {string=} required Sets `required` validation error key if the value is not entered.
+   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+   *    `required` when you want to data-bind to the `required` attribute.
+   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+   *    minlength.
+   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+   *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of
+   *    any length.
+   * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string
+   *    that contains the regular expression body that will be converted to a regular expression
+   *    as in the ngPattern directive.
+   * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}
+   *    does not match a RegExp found by evaluating the Angular expression given in the attribute value.
+   *    If the expression evaluates to a RegExp object, then this is used directly.
+   *    If the expression evaluates to a string, then it will be converted to a RegExp
+   *    after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+   *    `new RegExp('^abc$')`.<br />
+   *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+   *    start at the index of the last search's match, thus not taking the whole input value into
+   *    account.
+   * @param {string=} ngChange Angular expression to be executed when input changes due to user
+   *    interaction with the input element.
+   *
+   * @example
+      <example name="number-input-directive" module="numberExample">
+        <file name="index.html">
+         <script>
+           angular.module('numberExample', [])
+             .controller('ExampleController', ['$scope', function($scope) {
+               $scope.example = {
+                 value: 12
+               };
+             }]);
+         </script>
+         <form name="myForm" ng-controller="ExampleController">
+           <label>Number:
+             <input type="number" name="input" ng-model="example.value"
+                    min="0" max="99" required>
+          </label>
+           <div role="alert">
+             <span class="error" ng-show="myForm.input.$error.required">
+               Required!</span>
+             <span class="error" ng-show="myForm.input.$error.number">
+               Not valid number!</span>
+           </div>
+           <tt>value = {{example.value}}</tt><br/>
+           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+          </form>
+        </file>
+        <file name="protractor.js" type="protractor">
+          var value = element(by.binding('example.value'));
+          var valid = element(by.binding('myForm.input.$valid'));
+          var input = element(by.model('example.value'));
+
+          it('should initialize to model', function() {
+            expect(value.getText()).toContain('12');
+            expect(valid.getText()).toContain('true');
+          });
+
+          it('should be invalid if empty', function() {
+            input.clear();
+            input.sendKeys('');
+            expect(value.getText()).toEqual('value =');
+            expect(valid.getText()).toContain('false');
+          });
+
+          it('should be invalid if over max', function() {
+            input.clear();
+            input.sendKeys('123');
+            expect(value.getText()).toEqual('value =');
+            expect(valid.getText()).toContain('false');
+          });
+        </file>
+      </example>
+   */
+  'number': numberInputType,
+
+
+  /**
+   * @ngdoc input
+   * @name input[url]
+   *
+   * @description
+   * Text input with URL validation. Sets the `url` validation error key if the content is not a
+   * valid URL.
+   *
+   * <div class="alert alert-warning">
+   * **Note:** `input[url]` uses a regex to validate urls that is derived from the regex
+   * used in Chromium. If you need stricter validation, you can use `ng-pattern` or modify
+   * the built-in validators (see the {@link guide/forms Forms guide})
+   * </div>
+   *
+   * @param {string} ngModel Assignable angular expression to data-bind to.
+   * @param {string=} name Property name of the form under which the control is published.
+   * @param {string=} required Sets `required` validation error key if the value is not entered.
+   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+   *    `required` when you want to data-bind to the `required` attribute.
+   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+   *    minlength.
+   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+   *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of
+   *    any length.
+   * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string
+   *    that contains the regular expression body that will be converted to a regular expression
+   *    as in the ngPattern directive.
+   * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}
+   *    does not match a RegExp found by evaluating the Angular expression given in the attribute value.
+   *    If the expression evaluates to a RegExp object, then this is used directly.
+   *    If the expression evaluates to a string, then it will be converted to a RegExp
+   *    after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+   *    `new RegExp('^abc$')`.<br />
+   *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+   *    start at the index of the last search's match, thus not taking the whole input value into
+   *    account.
+   * @param {string=} ngChange Angular expression to be executed when input changes due to user
+   *    interaction with the input element.
+   *
+   * @example
+      <example name="url-input-directive" module="urlExample">
+        <file name="index.html">
+         <script>
+           angular.module('urlExample', [])
+             .controller('ExampleController', ['$scope', function($scope) {
+               $scope.url = {
+                 text: 'http://google.com'
+               };
+             }]);
+         </script>
+         <form name="myForm" ng-controller="ExampleController">
+           <label>URL:
+             <input type="url" name="input" ng-model="url.text" required>
+           <label>
+           <div role="alert">
+             <span class="error" ng-show="myForm.input.$error.required">
+               Required!</span>
+             <span class="error" ng-show="myForm.input.$error.url">
+               Not valid url!</span>
+           </div>
+           <tt>text = {{url.text}}</tt><br/>
+           <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+           <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+           <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+           <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+           <tt>myForm.$error.url = {{!!myForm.$error.url}}</tt><br/>
+          </form>
+        </file>
+        <file name="protractor.js" type="protractor">
+          var text = element(by.binding('url.text'));
+          var valid = element(by.binding('myForm.input.$valid'));
+          var input = element(by.model('url.text'));
+
+          it('should initialize to model', function() {
+            expect(text.getText()).toContain('http://google.com');
+            expect(valid.getText()).toContain('true');
+          });
+
+          it('should be invalid if empty', function() {
+            input.clear();
+            input.sendKeys('');
+
+            expect(text.getText()).toEqual('text =');
+            expect(valid.getText()).toContain('false');
+          });
+
+          it('should be invalid if not url', function() {
+            input.clear();
+            input.sendKeys('box');
+
+            expect(valid.getText()).toContain('false');
+          });
+        </file>
+      </example>
+   */
+  'url': urlInputType,
+
+
+  /**
+   * @ngdoc input
+   * @name input[email]
+   *
+   * @description
+   * Text input with email validation. Sets the `email` validation error key if not a valid email
+   * address.
+   *
+   * <div class="alert alert-warning">
+   * **Note:** `input[email]` uses a regex to validate email addresses that is derived from the regex
+   * used in Chromium. If you need stricter validation (e.g. requiring a top-level domain), you can
+   * use `ng-pattern` or modify the built-in validators (see the {@link guide/forms Forms guide})
+   * </div>
+   *
+   * @param {string} ngModel Assignable angular expression to data-bind to.
+   * @param {string=} name Property name of the form under which the control is published.
+   * @param {string=} required Sets `required` validation error key if the value is not entered.
+   * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+   *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+   *    `required` when you want to data-bind to the `required` attribute.
+   * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+   *    minlength.
+   * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+   *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of
+   *    any length.
+   * @param {string=} pattern Similar to `ngPattern` except that the attribute value is the actual string
+   *    that contains the regular expression body that will be converted to a regular expression
+   *    as in the ngPattern directive.
+   * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}
+   *    does not match a RegExp found by evaluating the Angular expression given in the attribute value.
+   *    If the expression evaluates to a RegExp object, then this is used directly.
+   *    If the expression evaluates to a string, then it will be converted to a RegExp
+   *    after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+   *    `new RegExp('^abc$')`.<br />
+   *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+   *    start at the index of the last search's match, thus not taking the whole input value into
+   *    account.
+   * @param {string=} ngChange Angular expression to be executed when input changes due to user
+   *    interaction with the input element.
+   *
+   * @example
+      <example name="email-input-directive" module="emailExample">
+        <file name="index.html">
+         <script>
+           angular.module('emailExample', [])
+             .controller('ExampleController', ['$scope', function($scope) {
+               $scope.email = {
+                 text: 'me@example.com'
+               };
+             }]);
+         </script>
+           <form name="myForm" ng-controller="ExampleController">
+             <label>Email:
+               <input type="email" name="input" ng-model="email.text" required>
+             </label>
+             <div role="alert">
+               <span class="error" ng-show="myForm.input.$error.required">
+                 Required!</span>
+               <span class="error" ng-show="myForm.input.$error.email">
+                 Not valid email!</span>
+             </div>
+             <tt>text = {{email.text}}</tt><br/>
+             <tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
+             <tt>myForm.input.$error = {{myForm.input.$error}}</tt><br/>
+             <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+             <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+             <tt>myForm.$error.email = {{!!myForm.$error.email}}</tt><br/>
+           </form>
+         </file>
+        <file name="protractor.js" type="protractor">
+          var text = element(by.binding('email.text'));
+          var valid = element(by.binding('myForm.input.$valid'));
+          var input = element(by.model('email.text'));
+
+          it('should initialize to model', function() {
+            expect(text.getText()).toContain('me@example.com');
+            expect(valid.getText()).toContain('true');
+          });
+
+          it('should be invalid if empty', function() {
+            input.clear();
+            input.sendKeys('');
+            expect(text.getText()).toEqual('text =');
+            expect(valid.getText()).toContain('false');
+          });
+
+          it('should be invalid if not email', function() {
+            input.clear();
+            input.sendKeys('xxx');
+
+            expect(valid.getText()).toContain('false');
+          });
+        </file>
+      </example>
+   */
+  'email': emailInputType,
+
+
+  /**
+   * @ngdoc input
+   * @name input[radio]
+   *
+   * @description
+   * HTML radio button.
+   *
+   * @param {string} ngModel Assignable angular expression to data-bind to.
+   * @param {string} value The value to which the `ngModel` expression should be set when selected.
+   *    Note that `value` only supports `string` values, i.e. the scope model needs to be a string,
+   *    too. Use `ngValue` if you need complex models (`number`, `object`, ...).
+   * @param {string=} name Property name of the form under which the control is published.
+   * @param {string=} ngChange Angular expression to be executed when input changes due to user
+   *    interaction with the input element.
+   * @param {string} ngValue Angular expression to which `ngModel` will be be set when the radio
+   *    is selected. Should be used instead of the `value` attribute if you need
+   *    a non-string `ngModel` (`boolean`, `array`, ...).
+   *
+   * @example
+      <example name="radio-input-directive" module="radioExample">
+        <file name="index.html">
+         <script>
+           angular.module('radioExample', [])
+             .controller('ExampleController', ['$scope', function($scope) {
+               $scope.color = {
+                 name: 'blue'
+               };
+               $scope.specialValue = {
+                 "id": "12345",
+                 "value": "green"
+               };
+             }]);
+         </script>
+         <form name="myForm" ng-controller="ExampleController">
+           <label>
+             <input type="radio" ng-model="color.name" value="red">
+             Red
+           </label><br/>
+           <label>
+             <input type="radio" ng-model="color.name" ng-value="specialValue">
+             Green
+           </label><br/>
+           <label>
+             <input type="radio" ng-model="color.name" value="blue">
+             Blue
+           </label><br/>
+           <tt>color = {{color.name | json}}</tt><br/>
+          </form>
+          Note that `ng-value="specialValue"` sets radio item's value to be the value of `$scope.specialValue`.
+        </file>
+        <file name="protractor.js" type="protractor">
+          it('should change state', function() {
+            var color = element(by.binding('color.name'));
+
+            expect(color.getText()).toContain('blue');
+
+            element.all(by.model('color.name')).get(0).click();
+
+            expect(color.getText()).toContain('red');
+          });
+        </file>
+      </example>
+   */
+  'radio': radioInputType,
+
+
+  /**
+   * @ngdoc input
+   * @name input[checkbox]
+   *
+   * @description
+   * HTML checkbox.
+   *
+   * @param {string} ngModel Assignable angular expression to data-bind to.
+   * @param {string=} name Property name of the form under which the control is published.
+   * @param {expression=} ngTrueValue The value to which the expression should be set when selected.
+   * @param {expression=} ngFalseValue The value to which the expression should be set when not selected.
+   * @param {string=} ngChange Angular expression to be executed when input changes due to user
+   *    interaction with the input element.
+   *
+   * @example
+      <example name="checkbox-input-directive" module="checkboxExample">
+        <file name="index.html">
+         <script>
+           angular.module('checkboxExample', [])
+             .controller('ExampleController', ['$scope', function($scope) {
+               $scope.checkboxModel = {
+                value1 : true,
+                value2 : 'YES'
+              };
+             }]);
+         </script>
+         <form name="myForm" ng-controller="ExampleController">
+           <label>Value1:
+             <input type="checkbox" ng-model="checkboxModel.value1">
+           </label><br/>
+           <label>Value2:
+             <input type="checkbox" ng-model="checkboxModel.value2"
+                    ng-true-value="'YES'" ng-false-value="'NO'">
+            </label><br/>
+           <tt>value1 = {{checkboxModel.value1}}</tt><br/>
+           <tt>value2 = {{checkboxModel.value2}}</tt><br/>
+          </form>
+        </file>
+        <file name="protractor.js" type="protractor">
+          it('should change state', function() {
+            var value1 = element(by.binding('checkboxModel.value1'));
+            var value2 = element(by.binding('checkboxModel.value2'));
+
+            expect(value1.getText()).toContain('true');
+            expect(value2.getText()).toContain('YES');
+
+            element(by.model('checkboxModel.value1')).click();
+            element(by.model('checkboxModel.value2')).click();
+
+            expect(value1.getText()).toContain('false');
+            expect(value2.getText()).toContain('NO');
+          });
+        </file>
+      </example>
+   */
+  'checkbox': checkboxInputType,
+
+  'hidden': noop,
+  'button': noop,
+  'submit': noop,
+  'reset': noop,
+  'file': noop
+};
+
+function stringBasedInputType(ctrl) {
+  ctrl.$formatters.push(function(value) {
+    return ctrl.$isEmpty(value) ? value : value.toString();
+  });
+}
+
+function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+  baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
+  stringBasedInputType(ctrl);
+}
+
+function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+  var type = lowercase(element[0].type);
+
+  // In composition mode, users are still inputing intermediate text buffer,
+  // hold the listener until composition is done.
+  // More about composition events: https://developer.mozilla.org/en-US/docs/Web/API/CompositionEvent
+  if (!$sniffer.android) {
+    var composing = false;
+
+    element.on('compositionstart', function() {
+      composing = true;
+    });
+
+    element.on('compositionend', function() {
+      composing = false;
+      listener();
+    });
+  }
+
+  var timeout;
+
+  var listener = function(ev) {
+    if (timeout) {
+      $browser.defer.cancel(timeout);
+      timeout = null;
+    }
+    if (composing) return;
+    var value = element.val(),
+        event = ev && ev.type;
+
+    // By default we will trim the value
+    // If the attribute ng-trim exists we will avoid trimming
+    // If input type is 'password', the value is never trimmed
+    if (type !== 'password' && (!attr.ngTrim || attr.ngTrim !== 'false')) {
+      value = trim(value);
+    }
+
+    // If a control is suffering from bad input (due to native validators), browsers discard its
+    // value, so it may be necessary to revalidate (by calling $setViewValue again) even if the
+    // control's value is the same empty value twice in a row.
+    if (ctrl.$viewValue !== value || (value === '' && ctrl.$$hasNativeValidators)) {
+      ctrl.$setViewValue(value, event);
+    }
+  };
+
+  // if the browser does support "input" event, we are fine - except on IE9 which doesn't fire the
+  // input event on backspace, delete or cut
+  if ($sniffer.hasEvent('input')) {
+    element.on('input', listener);
+  } else {
+    var deferListener = function(ev, input, origValue) {
+      if (!timeout) {
+        timeout = $browser.defer(function() {
+          timeout = null;
+          if (!input || input.value !== origValue) {
+            listener(ev);
+          }
+        });
+      }
+    };
+
+    element.on('keydown', function(event) {
+      var key = event.keyCode;
+
+      // ignore
+      //    command            modifiers                   arrows
+      if (key === 91 || (15 < key && key < 19) || (37 <= key && key <= 40)) return;
+
+      deferListener(event, this, this.value);
+    });
+
+    // if user modifies input value using context menu in IE, we need "paste" and "cut" events to catch it
+    if ($sniffer.hasEvent('paste')) {
+      element.on('paste cut', deferListener);
+    }
+  }
+
+  // if user paste into input using mouse on older browser
+  // or form autocomplete on newer browser, we need "change" event to catch it
+  element.on('change', listener);
+
+  // Some native input types (date-family) have the ability to change validity without
+  // firing any input/change events.
+  // For these event types, when native validators are present and the browser supports the type,
+  // check for validity changes on various DOM events.
+  if (PARTIAL_VALIDATION_TYPES[type] && ctrl.$$hasNativeValidators && type === attr.type) {
+    element.on(PARTIAL_VALIDATION_EVENTS, function(ev) {
+      if (!timeout) {
+        var validity = this[VALIDITY_STATE_PROPERTY];
+        var origBadInput = validity.badInput;
+        var origTypeMismatch = validity.typeMismatch;
+        timeout = $browser.defer(function() {
+          timeout = null;
+          if (validity.badInput !== origBadInput || validity.typeMismatch !== origTypeMismatch) {
+            listener(ev);
+          }
+        });
+      }
+    });
+  }
+
+  ctrl.$render = function() {
+    // Workaround for Firefox validation #12102.
+    var value = ctrl.$isEmpty(ctrl.$viewValue) ? '' : ctrl.$viewValue;
+    if (element.val() !== value) {
+      element.val(value);
+    }
+  };
+}
+
+function weekParser(isoWeek, existingDate) {
+  if (isDate(isoWeek)) {
+    return isoWeek;
+  }
+
+  if (isString(isoWeek)) {
+    WEEK_REGEXP.lastIndex = 0;
+    var parts = WEEK_REGEXP.exec(isoWeek);
+    if (parts) {
+      var year = +parts[1],
+          week = +parts[2],
+          hours = 0,
+          minutes = 0,
+          seconds = 0,
+          milliseconds = 0,
+          firstThurs = getFirstThursdayOfYear(year),
+          addDays = (week - 1) * 7;
+
+      if (existingDate) {
+        hours = existingDate.getHours();
+        minutes = existingDate.getMinutes();
+        seconds = existingDate.getSeconds();
+        milliseconds = existingDate.getMilliseconds();
+      }
+
+      return new Date(year, 0, firstThurs.getDate() + addDays, hours, minutes, seconds, milliseconds);
+    }
+  }
+
+  return NaN;
+}
+
+function createDateParser(regexp, mapping) {
+  return function(iso, date) {
+    var parts, map;
+
+    if (isDate(iso)) {
+      return iso;
+    }
+
+    if (isString(iso)) {
+      // When a date is JSON'ified to wraps itself inside of an extra
+      // set of double quotes. This makes the date parsing code unable
+      // to match the date string and parse it as a date.
+      if (iso.charAt(0) == '"' && iso.charAt(iso.length - 1) == '"') {
+        iso = iso.substring(1, iso.length - 1);
+      }
+      if (ISO_DATE_REGEXP.test(iso)) {
+        return new Date(iso);
+      }
+      regexp.lastIndex = 0;
+      parts = regexp.exec(iso);
+
+      if (parts) {
+        parts.shift();
+        if (date) {
+          map = {
+            yyyy: date.getFullYear(),
+            MM: date.getMonth() + 1,
+            dd: date.getDate(),
+            HH: date.getHours(),
+            mm: date.getMinutes(),
+            ss: date.getSeconds(),
+            sss: date.getMilliseconds() / 1000
+          };
+        } else {
+          map = { yyyy: 1970, MM: 1, dd: 1, HH: 0, mm: 0, ss: 0, sss: 0 };
+        }
+
+        forEach(parts, function(part, index) {
+          if (index < mapping.length) {
+            map[mapping[index]] = +part;
+          }
+        });
+        return new Date(map.yyyy, map.MM - 1, map.dd, map.HH, map.mm, map.ss || 0, map.sss * 1000 || 0);
+      }
+    }
+
+    return NaN;
+  };
+}
+
+function createDateInputType(type, regexp, parseDate, format) {
+  return function dynamicDateInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter) {
+    badInputChecker(scope, element, attr, ctrl);
+    baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
+    var timezone = ctrl && ctrl.$options && ctrl.$options.timezone;
+    var previousDate;
+
+    ctrl.$$parserName = type;
+    ctrl.$parsers.push(function(value) {
+      if (ctrl.$isEmpty(value)) return null;
+      if (regexp.test(value)) {
+        // Note: We cannot read ctrl.$modelValue, as there might be a different
+        // parser/formatter in the processing chain so that the model
+        // contains some different data format!
+        var parsedDate = parseDate(value, previousDate);
+        if (timezone) {
+          parsedDate = convertTimezoneToLocal(parsedDate, timezone);
+        }
+        return parsedDate;
+      }
+      return undefined;
+    });
+
+    ctrl.$formatters.push(function(value) {
+      if (value && !isDate(value)) {
+        throw ngModelMinErr('datefmt', 'Expected `{0}` to be a date', value);
+      }
+      if (isValidDate(value)) {
+        previousDate = value;
+        if (previousDate && timezone) {
+          previousDate = convertTimezoneToLocal(previousDate, timezone, true);
+        }
+        return $filter('date')(value, format, timezone);
+      } else {
+        previousDate = null;
+        return '';
+      }
+    });
+
+    if (isDefined(attr.min) || attr.ngMin) {
+      var minVal;
+      ctrl.$validators.min = function(value) {
+        return !isValidDate(value) || isUndefined(minVal) || parseDate(value) >= minVal;
+      };
+      attr.$observe('min', function(val) {
+        minVal = parseObservedDateValue(val);
+        ctrl.$validate();
+      });
+    }
+
+    if (isDefined(attr.max) || attr.ngMax) {
+      var maxVal;
+      ctrl.$validators.max = function(value) {
+        return !isValidDate(value) || isUndefined(maxVal) || parseDate(value) <= maxVal;
+      };
+      attr.$observe('max', function(val) {
+        maxVal = parseObservedDateValue(val);
+        ctrl.$validate();
+      });
+    }
+
+    function isValidDate(value) {
+      // Invalid Date: getTime() returns NaN
+      return value && !(value.getTime && value.getTime() !== value.getTime());
+    }
+
+    function parseObservedDateValue(val) {
+      return isDefined(val) && !isDate(val) ? parseDate(val) || undefined : val;
+    }
+  };
+}
+
+function badInputChecker(scope, element, attr, ctrl) {
+  var node = element[0];
+  var nativeValidation = ctrl.$$hasNativeValidators = isObject(node.validity);
+  if (nativeValidation) {
+    ctrl.$parsers.push(function(value) {
+      var validity = element.prop(VALIDITY_STATE_PROPERTY) || {};
+      return validity.badInput || validity.typeMismatch ? undefined : value;
+    });
+  }
+}
+
+function numberInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+  badInputChecker(scope, element, attr, ctrl);
+  baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
+
+  ctrl.$$parserName = 'number';
+  ctrl.$parsers.push(function(value) {
+    if (ctrl.$isEmpty(value))      return null;
+    if (NUMBER_REGEXP.test(value)) return parseFloat(value);
+    return undefined;
+  });
+
+  ctrl.$formatters.push(function(value) {
+    if (!ctrl.$isEmpty(value)) {
+      if (!isNumber(value)) {
+        throw ngModelMinErr('numfmt', 'Expected `{0}` to be a number', value);
+      }
+      value = value.toString();
+    }
+    return value;
+  });
+
+  if (isDefined(attr.min) || attr.ngMin) {
+    var minVal;
+    ctrl.$validators.min = function(value) {
+      return ctrl.$isEmpty(value) || isUndefined(minVal) || value >= minVal;
+    };
+
+    attr.$observe('min', function(val) {
+      if (isDefined(val) && !isNumber(val)) {
+        val = parseFloat(val);
+      }
+      minVal = isNumber(val) && !isNaN(val) ? val : undefined;
+      // TODO(matsko): implement validateLater to reduce number of validations
+      ctrl.$validate();
+    });
+  }
+
+  if (isDefined(attr.max) || attr.ngMax) {
+    var maxVal;
+    ctrl.$validators.max = function(value) {
+      return ctrl.$isEmpty(value) || isUndefined(maxVal) || value <= maxVal;
+    };
+
+    attr.$observe('max', function(val) {
+      if (isDefined(val) && !isNumber(val)) {
+        val = parseFloat(val);
+      }
+      maxVal = isNumber(val) && !isNaN(val) ? val : undefined;
+      // TODO(matsko): implement validateLater to reduce number of validations
+      ctrl.$validate();
+    });
+  }
+}
+
+function urlInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+  // Note: no badInputChecker here by purpose as `url` is only a validation
+  // in browsers, i.e. we can always read out input.value even if it is not valid!
+  baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
+  stringBasedInputType(ctrl);
+
+  ctrl.$$parserName = 'url';
+  ctrl.$validators.url = function(modelValue, viewValue) {
+    var value = modelValue || viewValue;
+    return ctrl.$isEmpty(value) || URL_REGEXP.test(value);
+  };
+}
+
+function emailInputType(scope, element, attr, ctrl, $sniffer, $browser) {
+  // Note: no badInputChecker here by purpose as `url` is only a validation
+  // in browsers, i.e. we can always read out input.value even if it is not valid!
+  baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
+  stringBasedInputType(ctrl);
+
+  ctrl.$$parserName = 'email';
+  ctrl.$validators.email = function(modelValue, viewValue) {
+    var value = modelValue || viewValue;
+    return ctrl.$isEmpty(value) || EMAIL_REGEXP.test(value);
+  };
+}
+
+function radioInputType(scope, element, attr, ctrl) {
+  // make the name unique, if not defined
+  if (isUndefined(attr.name)) {
+    element.attr('name', nextUid());
+  }
+
+  var listener = function(ev) {
+    if (element[0].checked) {
+      ctrl.$setViewValue(attr.value, ev && ev.type);
+    }
+  };
+
+  element.on('click', listener);
+
+  ctrl.$render = function() {
+    var value = attr.value;
+    element[0].checked = (value == ctrl.$viewValue);
+  };
+
+  attr.$observe('value', ctrl.$render);
+}
+
+function parseConstantExpr($parse, context, name, expression, fallback) {
+  var parseFn;
+  if (isDefined(expression)) {
+    parseFn = $parse(expression);
+    if (!parseFn.constant) {
+      throw ngModelMinErr('constexpr', 'Expected constant expression for `{0}`, but saw ' +
+                                   '`{1}`.', name, expression);
+    }
+    return parseFn(context);
+  }
+  return fallback;
+}
+
+function checkboxInputType(scope, element, attr, ctrl, $sniffer, $browser, $filter, $parse) {
+  var trueValue = parseConstantExpr($parse, scope, 'ngTrueValue', attr.ngTrueValue, true);
+  var falseValue = parseConstantExpr($parse, scope, 'ngFalseValue', attr.ngFalseValue, false);
+
+  var listener = function(ev) {
+    ctrl.$setViewValue(element[0].checked, ev && ev.type);
+  };
+
+  element.on('click', listener);
+
+  ctrl.$render = function() {
+    element[0].checked = ctrl.$viewValue;
+  };
+
+  // Override the standard `$isEmpty` because the $viewValue of an empty checkbox is always set to `false`
+  // This is because of the parser below, which compares the `$modelValue` with `trueValue` to convert
+  // it to a boolean.
+  ctrl.$isEmpty = function(value) {
+    return value === false;
+  };
+
+  ctrl.$formatters.push(function(value) {
+    return equals(value, trueValue);
+  });
+
+  ctrl.$parsers.push(function(value) {
+    return value ? trueValue : falseValue;
+  });
+}
+
+
+/**
+ * @ngdoc directive
+ * @name textarea
+ * @restrict E
+ *
+ * @description
+ * HTML textarea element control with angular data-binding. The data-binding and validation
+ * properties of this element are exactly the same as those of the
+ * {@link ng.directive:input input element}.
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ *    `required` when you want to data-bind to the `required` attribute.
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ *    minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any
+ *    length.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}
+ *    does not match a RegExp found by evaluating the Angular expression given in the attribute value.
+ *    If the expression evaluates to a RegExp object, then this is used directly.
+ *    If the expression evaluates to a string, then it will be converted to a RegExp
+ *    after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+ *    `new RegExp('^abc$')`.<br />
+ *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ *    start at the index of the last search's match, thus not taking the whole input value into
+ *    account.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ *    interaction with the input element.
+ * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name input
+ * @restrict E
+ *
+ * @description
+ * HTML input element control. When used together with {@link ngModel `ngModel`}, it provides data-binding,
+ * input state control, and validation.
+ * Input control follows HTML5 input types and polyfills the HTML5 validation behavior for older browsers.
+ *
+ * <div class="alert alert-warning">
+ * **Note:** Not every feature offered is available for all input types.
+ * Specifically, data binding and event handling via `ng-model` is unsupported for `input[file]`.
+ * </div>
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {boolean=} ngRequired Sets `required` attribute if set to true
+ * @param {number=} ngMinlength Sets `minlength` validation error key if the value is shorter than
+ *    minlength.
+ * @param {number=} ngMaxlength Sets `maxlength` validation error key if the value is longer than
+ *    maxlength. Setting the attribute to a negative or non-numeric value, allows view values of any
+ *    length.
+ * @param {string=} ngPattern Sets `pattern` validation error key if the ngModel {@link ngModel.NgModelController#$viewValue $viewValue}
+ *    value does not match a RegExp found by evaluating the Angular expression given in the attribute value.
+ *    If the expression evaluates to a RegExp object, then this is used directly.
+ *    If the expression evaluates to a string, then it will be converted to a RegExp
+ *    after wrapping it in `^` and `$` characters. For instance, `"abc"` will be converted to
+ *    `new RegExp('^abc$')`.<br />
+ *    **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ *    start at the index of the last search's match, thus not taking the whole input value into
+ *    account.
+ * @param {string=} ngChange Angular expression to be executed when input changes due to user
+ *    interaction with the input element.
+ * @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.
+ *    This parameter is ignored for input[type=password] controls, which will never trim the
+ *    input.
+ *
+ * @example
+    <example name="input-directive" module="inputExample">
+      <file name="index.html">
+       <script>
+          angular.module('inputExample', [])
+            .controller('ExampleController', ['$scope', function($scope) {
+              $scope.user = {name: 'guest', last: 'visitor'};
+            }]);
+       </script>
+       <div ng-controller="ExampleController">
+         <form name="myForm">
+           <label>
+              User name:
+              <input type="text" name="userName" ng-model="user.name" required>
+           </label>
+           <div role="alert">
+             <span class="error" ng-show="myForm.userName.$error.required">
+              Required!</span>
+           </div>
+           <label>
+              Last name:
+              <input type="text" name="lastName" ng-model="user.last"
+              ng-minlength="3" ng-maxlength="10">
+           </label>
+           <div role="alert">
+             <span class="error" ng-show="myForm.lastName.$error.minlength">
+               Too short!</span>
+             <span class="error" ng-show="myForm.lastName.$error.maxlength">
+               Too long!</span>
+           </div>
+         </form>
+         <hr>
+         <tt>user = {{user}}</tt><br/>
+         <tt>myForm.userName.$valid = {{myForm.userName.$valid}}</tt><br/>
+         <tt>myForm.userName.$error = {{myForm.userName.$error}}</tt><br/>
+         <tt>myForm.lastName.$valid = {{myForm.lastName.$valid}}</tt><br/>
+         <tt>myForm.lastName.$error = {{myForm.lastName.$error}}</tt><br/>
+         <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+         <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+         <tt>myForm.$error.minlength = {{!!myForm.$error.minlength}}</tt><br/>
+         <tt>myForm.$error.maxlength = {{!!myForm.$error.maxlength}}</tt><br/>
+       </div>
+      </file>
+      <file name="protractor.js" type="protractor">
+        var user = element(by.exactBinding('user'));
+        var userNameValid = element(by.binding('myForm.userName.$valid'));
+        var lastNameValid = element(by.binding('myForm.lastName.$valid'));
+        var lastNameError = element(by.binding('myForm.lastName.$error'));
+        var formValid = element(by.binding('myForm.$valid'));
+        var userNameInput = element(by.model('user.name'));
+        var userLastInput = element(by.model('user.last'));
+
+        it('should initialize to model', function() {
+          expect(user.getText()).toContain('{"name":"guest","last":"visitor"}');
+          expect(userNameValid.getText()).toContain('true');
+          expect(formValid.getText()).toContain('true');
+        });
+
+        it('should be invalid if empty when required', function() {
+          userNameInput.clear();
+          userNameInput.sendKeys('');
+
+          expect(user.getText()).toContain('{"last":"visitor"}');
+          expect(userNameValid.getText()).toContain('false');
+          expect(formValid.getText()).toContain('false');
+        });
+
+        it('should be valid if empty when min length is set', function() {
+          userLastInput.clear();
+          userLastInput.sendKeys('');
+
+          expect(user.getText()).toContain('{"name":"guest","last":""}');
+          expect(lastNameValid.getText()).toContain('true');
+          expect(formValid.getText()).toContain('true');
+        });
+
+        it('should be invalid if less than required min length', function() {
+          userLastInput.clear();
+          userLastInput.sendKeys('xx');
+
+          expect(user.getText()).toContain('{"name":"guest"}');
+          expect(lastNameValid.getText()).toContain('false');
+          expect(lastNameError.getText()).toContain('minlength');
+          expect(formValid.getText()).toContain('false');
+        });
+
+        it('should be invalid if longer than max length', function() {
+          userLastInput.clear();
+          userLastInput.sendKeys('some ridiculously long name');
+
+          expect(user.getText()).toContain('{"name":"guest"}');
+          expect(lastNameValid.getText()).toContain('false');
+          expect(lastNameError.getText()).toContain('maxlength');
+          expect(formValid.getText()).toContain('false');
+        });
+      </file>
+    </example>
+ */
+var inputDirective = ['$browser', '$sniffer', '$filter', '$parse',
+    function($browser, $sniffer, $filter, $parse) {
+  return {
+    restrict: 'E',
+    require: ['?ngModel'],
+    link: {
+      pre: function(scope, element, attr, ctrls) {
+        if (ctrls[0]) {
+          (inputType[lowercase(attr.type)] || inputType.text)(scope, element, attr, ctrls[0], $sniffer,
+                                                              $browser, $filter, $parse);
+        }
+      }
+    }
+  };
+}];
+
+
+
+var CONSTANT_VALUE_REGEXP = /^(true|false|\d+)$/;
+/**
+ * @ngdoc directive
+ * @name ngValue
+ *
+ * @description
+ * Binds the given expression to the value of `<option>` or {@link input[radio] `input[radio]`},
+ * so that when the element is selected, the {@link ngModel `ngModel`} of that element is set to
+ * the bound value.
+ *
+ * `ngValue` is useful when dynamically generating lists of radio buttons using
+ * {@link ngRepeat `ngRepeat`}, as shown below.
+ *
+ * Likewise, `ngValue` can be used to generate `<option>` elements for
+ * the {@link select `select`} element. In that case however, only strings are supported
+ * for the `value `attribute, so the resulting `ngModel` will always be a string.
+ * Support for `select` models with non-string values is available via `ngOptions`.
+ *
+ * @element input
+ * @param {string=} ngValue angular expression, whose value will be bound to the `value` attribute
+ *   of the `input` element
+ *
+ * @example
+    <example name="ngValue-directive" module="valueExample">
+      <file name="index.html">
+       <script>
+          angular.module('valueExample', [])
+            .controller('ExampleController', ['$scope', function($scope) {
+              $scope.names = ['pizza', 'unicorns', 'robots'];
+              $scope.my = { favorite: 'unicorns' };
+            }]);
+       </script>
+        <form ng-controller="ExampleController">
+          <h2>Which is your favorite?</h2>
+            <label ng-repeat="name in names" for="{{name}}">
+              {{name}}
+              <input type="radio"
+                     ng-model="my.favorite"
+                     ng-value="name"
+                     id="{{name}}"
+                     name="favorite">
+            </label>
+          <div>You chose {{my.favorite}}</div>
+        </form>
+      </file>
+      <file name="protractor.js" type="protractor">
+        var favorite = element(by.binding('my.favorite'));
+
+        it('should initialize to model', function() {
+          expect(favorite.getText()).toContain('unicorns');
+        });
+        it('should bind the values to the inputs', function() {
+          element.all(by.model('my.favorite')).get(0).click();
+          expect(favorite.getText()).toContain('pizza');
+        });
+      </file>
+    </example>
+ */
+var ngValueDirective = function() {
+  return {
+    restrict: 'A',
+    priority: 100,
+    compile: function(tpl, tplAttr) {
+      if (CONSTANT_VALUE_REGEXP.test(tplAttr.ngValue)) {
+        return function ngValueConstantLink(scope, elm, attr) {
+          attr.$set('value', scope.$eval(attr.ngValue));
+        };
+      } else {
+        return function ngValueLink(scope, elm, attr) {
+          scope.$watch(attr.ngValue, function valueWatchAction(value) {
+            attr.$set('value', value);
+          });
+        };
+      }
+    }
+  };
+};
+
+/**
+ * @ngdoc directive
+ * @name ngBind
+ * @restrict AC
+ *
+ * @description
+ * The `ngBind` attribute tells Angular to replace the text content of the specified HTML element
+ * with the value of a given expression, and to update the text content when the value of that
+ * expression changes.
+ *
+ * Typically, you don't use `ngBind` directly, but instead you use the double curly markup like
+ * `{{ expression }}` which is similar but less verbose.
+ *
+ * It is preferable to use `ngBind` instead of `{{ expression }}` if a template is momentarily
+ * displayed by the browser in its raw state before Angular compiles it. Since `ngBind` is an
+ * element attribute, it makes the bindings invisible to the user while the page is loading.
+ *
+ * An alternative solution to this problem would be using the
+ * {@link ng.directive:ngCloak ngCloak} directive.
+ *
+ *
+ * @element ANY
+ * @param {expression} ngBind {@link guide/expression Expression} to evaluate.
+ *
+ * @example
+ * Enter a name in the Live Preview text box; the greeting below the text box changes instantly.
+   <example module="bindExample">
+     <file name="index.html">
+       <script>
+         angular.module('bindExample', [])
+           .controller('ExampleController', ['$scope', function($scope) {
+             $scope.name = 'Whirled';
+           }]);
+       </script>
+       <div ng-controller="ExampleController">
+         <label>Enter name: <input type="text" ng-model="name"></label><br>
+         Hello <span ng-bind="name"></span>!
+       </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+       it('should check ng-bind', function() {
+         var nameInput = element(by.model('name'));
+
+         expect(element(by.binding('name')).getText()).toBe('Whirled');
+         nameInput.clear();
+         nameInput.sendKeys('world');
+         expect(element(by.binding('name')).getText()).toBe('world');
+       });
+     </file>
+   </example>
+ */
+var ngBindDirective = ['$compile', function($compile) {
+  return {
+    restrict: 'AC',
+    compile: function ngBindCompile(templateElement) {
+      $compile.$$addBindingClass(templateElement);
+      return function ngBindLink(scope, element, attr) {
+        $compile.$$addBindingInfo(element, attr.ngBind);
+        element = element[0];
+        scope.$watch(attr.ngBind, function ngBindWatchAction(value) {
+          element.textContent = isUndefined(value) ? '' : value;
+        });
+      };
+    }
+  };
+}];
+
+
+/**
+ * @ngdoc directive
+ * @name ngBindTemplate
+ *
+ * @description
+ * The `ngBindTemplate` directive specifies that the element
+ * text content should be replaced with the interpolation of the template
+ * in the `ngBindTemplate` attribute.
+ * Unlike `ngBind`, the `ngBindTemplate` can contain multiple `{{` `}}`
+ * expressions. This directive is needed since some HTML elements
+ * (such as TITLE and OPTION) cannot contain SPAN elements.
+ *
+ * @element ANY
+ * @param {string} ngBindTemplate template of form
+ *   <tt>{{</tt> <tt>expression</tt> <tt>}}</tt> to eval.
+ *
+ * @example
+ * Try it here: enter text in text box and watch the greeting change.
+   <example module="bindExample">
+     <file name="index.html">
+       <script>
+         angular.module('bindExample', [])
+           .controller('ExampleController', ['$scope', function($scope) {
+             $scope.salutation = 'Hello';
+             $scope.name = 'World';
+           }]);
+       </script>
+       <div ng-controller="ExampleController">
+        <label>Salutation: <input type="text" ng-model="salutation"></label><br>
+        <label>Name: <input type="text" ng-model="name"></label><br>
+        <pre ng-bind-template="{{salutation}} {{name}}!"></pre>
+       </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+       it('should check ng-bind', function() {
+         var salutationElem = element(by.binding('salutation'));
+         var salutationInput = element(by.model('salutation'));
+         var nameInput = element(by.model('name'));
+
+         expect(salutationElem.getText()).toBe('Hello World!');
+
+         salutationInput.clear();
+         salutationInput.sendKeys('Greetings');
+         nameInput.clear();
+         nameInput.sendKeys('user');
+
+         expect(salutationElem.getText()).toBe('Greetings user!');
+       });
+     </file>
+   </example>
+ */
+var ngBindTemplateDirective = ['$interpolate', '$compile', function($interpolate, $compile) {
+  return {
+    compile: function ngBindTemplateCompile(templateElement) {
+      $compile.$$addBindingClass(templateElement);
+      return function ngBindTemplateLink(scope, element, attr) {
+        var interpolateFn = $interpolate(element.attr(attr.$attr.ngBindTemplate));
+        $compile.$$addBindingInfo(element, interpolateFn.expressions);
+        element = element[0];
+        attr.$observe('ngBindTemplate', function(value) {
+          element.textContent = isUndefined(value) ? '' : value;
+        });
+      };
+    }
+  };
+}];
+
+
+/**
+ * @ngdoc directive
+ * @name ngBindHtml
+ *
+ * @description
+ * Evaluates the expression and inserts the resulting HTML into the element in a secure way. By default,
+ * the resulting HTML content will be sanitized using the {@link ngSanitize.$sanitize $sanitize} service.
+ * To utilize this functionality, ensure that `$sanitize` is available, for example, by including {@link
+ * ngSanitize} in your module's dependencies (not in core Angular). In order to use {@link ngSanitize}
+ * in your module's dependencies, you need to include "angular-sanitize.js" in your application.
+ *
+ * You may also bypass sanitization for values you know are safe. To do so, bind to
+ * an explicitly trusted value via {@link ng.$sce#trustAsHtml $sce.trustAsHtml}.  See the example
+ * under {@link ng.$sce#show-me-an-example-using-sce- Strict Contextual Escaping (SCE)}.
+ *
+ * Note: If a `$sanitize` service is unavailable and the bound value isn't explicitly trusted, you
+ * will have an exception (instead of an exploit.)
+ *
+ * @element ANY
+ * @param {expression} ngBindHtml {@link guide/expression Expression} to evaluate.
+ *
+ * @example
+
+   <example module="bindHtmlExample" deps="angular-sanitize.js">
+     <file name="index.html">
+       <div ng-controller="ExampleController">
+        <p ng-bind-html="myHTML"></p>
+       </div>
+     </file>
+
+     <file name="script.js">
+       angular.module('bindHtmlExample', ['ngSanitize'])
+         .controller('ExampleController', ['$scope', function($scope) {
+           $scope.myHTML =
+              'I am an <code>HTML</code>string with ' +
+              '<a href="#">links!</a> and other <em>stuff</em>';
+         }]);
+     </file>
+
+     <file name="protractor.js" type="protractor">
+       it('should check ng-bind-html', function() {
+         expect(element(by.binding('myHTML')).getText()).toBe(
+             'I am an HTMLstring with links! and other stuff');
+       });
+     </file>
+   </example>
+ */
+var ngBindHtmlDirective = ['$sce', '$parse', '$compile', function($sce, $parse, $compile) {
+  return {
+    restrict: 'A',
+    compile: function ngBindHtmlCompile(tElement, tAttrs) {
+      var ngBindHtmlGetter = $parse(tAttrs.ngBindHtml);
+      var ngBindHtmlWatch = $parse(tAttrs.ngBindHtml, function sceValueOf(val) {
+        // Unwrap the value to compare the actual inner safe value, not the wrapper object.
+        return $sce.valueOf(val);
+      });
+      $compile.$$addBindingClass(tElement);
+
+      return function ngBindHtmlLink(scope, element, attr) {
+        $compile.$$addBindingInfo(element, attr.ngBindHtml);
+
+        scope.$watch(ngBindHtmlWatch, function ngBindHtmlWatchAction() {
+          // The watched value is the unwrapped value. To avoid re-escaping, use the direct getter.
+          var value = ngBindHtmlGetter(scope);
+          element.html($sce.getTrustedHtml(value) || '');
+        });
+      };
+    }
+  };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngChange
+ *
+ * @description
+ * Evaluate the given expression when the user changes the input.
+ * The expression is evaluated immediately, unlike the JavaScript onchange event
+ * which only triggers at the end of a change (usually, when the user leaves the
+ * form element or presses the return key).
+ *
+ * The `ngChange` expression is only evaluated when a change in the input value causes
+ * a new value to be committed to the model.
+ *
+ * It will not be evaluated:
+ * * if the value returned from the `$parsers` transformation pipeline has not changed
+ * * if the input has continued to be invalid since the model will stay `null`
+ * * if the model is changed programmatically and not by a change to the input value
+ *
+ *
+ * Note, this directive requires `ngModel` to be present.
+ *
+ * @element input
+ * @param {expression} ngChange {@link guide/expression Expression} to evaluate upon change
+ * in input value.
+ *
+ * @example
+ * <example name="ngChange-directive" module="changeExample">
+ *   <file name="index.html">
+ *     <script>
+ *       angular.module('changeExample', [])
+ *         .controller('ExampleController', ['$scope', function($scope) {
+ *           $scope.counter = 0;
+ *           $scope.change = function() {
+ *             $scope.counter++;
+ *           };
+ *         }]);
+ *     </script>
+ *     <div ng-controller="ExampleController">
+ *       <input type="checkbox" ng-model="confirmed" ng-change="change()" id="ng-change-example1" />
+ *       <input type="checkbox" ng-model="confirmed" id="ng-change-example2" />
+ *       <label for="ng-change-example2">Confirmed</label><br />
+ *       <tt>debug = {{confirmed}}</tt><br/>
+ *       <tt>counter = {{counter}}</tt><br/>
+ *     </div>
+ *   </file>
+ *   <file name="protractor.js" type="protractor">
+ *     var counter = element(by.binding('counter'));
+ *     var debug = element(by.binding('confirmed'));
+ *
+ *     it('should evaluate the expression if changing from view', function() {
+ *       expect(counter.getText()).toContain('0');
+ *
+ *       element(by.id('ng-change-example1')).click();
+ *
+ *       expect(counter.getText()).toContain('1');
+ *       expect(debug.getText()).toContain('true');
+ *     });
+ *
+ *     it('should not evaluate the expression if changing from model', function() {
+ *       element(by.id('ng-change-example2')).click();
+
+ *       expect(counter.getText()).toContain('0');
+ *       expect(debug.getText()).toContain('true');
+ *     });
+ *   </file>
+ * </example>
+ */
+var ngChangeDirective = valueFn({
+  restrict: 'A',
+  require: 'ngModel',
+  link: function(scope, element, attr, ctrl) {
+    ctrl.$viewChangeListeners.push(function() {
+      scope.$eval(attr.ngChange);
+    });
+  }
+});
+
+function classDirective(name, selector) {
+  name = 'ngClass' + name;
+  return ['$animate', function($animate) {
+    return {
+      restrict: 'AC',
+      link: function(scope, element, attr) {
+        var oldVal;
+
+        scope.$watch(attr[name], ngClassWatchAction, true);
+
+        attr.$observe('class', function(value) {
+          ngClassWatchAction(scope.$eval(attr[name]));
+        });
+
+
+        if (name !== 'ngClass') {
+          scope.$watch('$index', function($index, old$index) {
+            // jshint bitwise: false
+            var mod = $index & 1;
+            if (mod !== (old$index & 1)) {
+              var classes = arrayClasses(scope.$eval(attr[name]));
+              mod === selector ?
+                addClasses(classes) :
+                removeClasses(classes);
+            }
+          });
+        }
+
+        function addClasses(classes) {
+          var newClasses = digestClassCounts(classes, 1);
+          attr.$addClass(newClasses);
+        }
+
+        function removeClasses(classes) {
+          var newClasses = digestClassCounts(classes, -1);
+          attr.$removeClass(newClasses);
+        }
+
+        function digestClassCounts(classes, count) {
+          // Use createMap() to prevent class assumptions involving property
+          // names in Object.prototype
+          var classCounts = element.data('$classCounts') || createMap();
+          var classesToUpdate = [];
+          forEach(classes, function(className) {
+            if (count > 0 || classCounts[className]) {
+              classCounts[className] = (classCounts[className] || 0) + count;
+              if (classCounts[className] === +(count > 0)) {
+                classesToUpdate.push(className);
+              }
+            }
+          });
+          element.data('$classCounts', classCounts);
+          return classesToUpdate.join(' ');
+        }
+
+        function updateClasses(oldClasses, newClasses) {
+          var toAdd = arrayDifference(newClasses, oldClasses);
+          var toRemove = arrayDifference(oldClasses, newClasses);
+          toAdd = digestClassCounts(toAdd, 1);
+          toRemove = digestClassCounts(toRemove, -1);
+          if (toAdd && toAdd.length) {
+            $animate.addClass(element, toAdd);
+          }
+          if (toRemove && toRemove.length) {
+            $animate.removeClass(element, toRemove);
+          }
+        }
+
+        function ngClassWatchAction(newVal) {
+          // jshint bitwise: false
+          if (selector === true || (scope.$index & 1) === selector) {
+          // jshint bitwise: true
+            var newClasses = arrayClasses(newVal || []);
+            if (!oldVal) {
+              addClasses(newClasses);
+            } else if (!equals(newVal,oldVal)) {
+              var oldClasses = arrayClasses(oldVal);
+              updateClasses(oldClasses, newClasses);
+            }
+          }
+          if (isArray(newVal)) {
+            oldVal = newVal.map(function(v) { return shallowCopy(v); });
+          } else {
+            oldVal = shallowCopy(newVal);
+          }
+        }
+      }
+    };
+
+    function arrayDifference(tokens1, tokens2) {
+      var values = [];
+
+      outer:
+      for (var i = 0; i < tokens1.length; i++) {
+        var token = tokens1[i];
+        for (var j = 0; j < tokens2.length; j++) {
+          if (token == tokens2[j]) continue outer;
+        }
+        values.push(token);
+      }
+      return values;
+    }
+
+    function arrayClasses(classVal) {
+      var classes = [];
+      if (isArray(classVal)) {
+        forEach(classVal, function(v) {
+          classes = classes.concat(arrayClasses(v));
+        });
+        return classes;
+      } else if (isString(classVal)) {
+        return classVal.split(' ');
+      } else if (isObject(classVal)) {
+        forEach(classVal, function(v, k) {
+          if (v) {
+            classes = classes.concat(k.split(' '));
+          }
+        });
+        return classes;
+      }
+      return classVal;
+    }
+  }];
+}
+
+/**
+ * @ngdoc directive
+ * @name ngClass
+ * @restrict AC
+ *
+ * @description
+ * The `ngClass` directive allows you to dynamically set CSS classes on an HTML element by databinding
+ * an expression that represents all classes to be added.
+ *
+ * The directive operates in three different ways, depending on which of three types the expression
+ * evaluates to:
+ *
+ * 1. If the expression evaluates to a string, the string should be one or more space-delimited class
+ * names.
+ *
+ * 2. If the expression evaluates to an object, then for each key-value pair of the
+ * object with a truthy value the corresponding key is used as a class name.
+ *
+ * 3. If the expression evaluates to an array, each element of the array should either be a string as in
+ * type 1 or an object as in type 2. This means that you can mix strings and objects together in an array
+ * to give you more control over what CSS classes appear. See the code below for an example of this.
+ *
+ *
+ * The directive won't add duplicate classes if a particular class was already set.
+ *
+ * When the expression changes, the previously added classes are removed and only then are the
+ * new classes added.
+ *
+ * @knownIssue
+ * You should not use {@link guide/interpolation interpolation} in the value of the `class`
+ * attribute, when using the `ngClass` directive on the same element.
+ * See {@link guide/interpolation#known-issues here} for more info.
+ *
+ * @animations
+ * | Animation                        | Occurs                              |
+ * |----------------------------------|-------------------------------------|
+ * | {@link ng.$animate#addClass addClass}       | just before the class is applied to the element   |
+ * | {@link ng.$animate#removeClass removeClass} | just before the class is removed from the element |
+ *
+ * @element ANY
+ * @param {expression} ngClass {@link guide/expression Expression} to eval. The result
+ *   of the evaluation can be a string representing space delimited class
+ *   names, an array, or a map of class names to boolean values. In the case of a map, the
+ *   names of the properties whose values are truthy will be added as css classes to the
+ *   element.
+ *
+ * @example Example that demonstrates basic bindings via ngClass directive.
+   <example>
+     <file name="index.html">
+       <p ng-class="{strike: deleted, bold: important, 'has-error': error}">Map Syntax Example</p>
+       <label>
+          <input type="checkbox" ng-model="deleted">
+          deleted (apply "strike" class)
+       </label><br>
+       <label>
+          <input type="checkbox" ng-model="important">
+          important (apply "bold" class)
+       </label><br>
+       <label>
+          <input type="checkbox" ng-model="error">
+          error (apply "has-error" class)
+       </label>
+       <hr>
+       <p ng-class="style">Using String Syntax</p>
+       <input type="text" ng-model="style"
+              placeholder="Type: bold strike red" aria-label="Type: bold strike red">
+       <hr>
+       <p ng-class="[style1, style2, style3]">Using Array Syntax</p>
+       <input ng-model="style1"
+              placeholder="Type: bold, strike or red" aria-label="Type: bold, strike or red"><br>
+       <input ng-model="style2"
+              placeholder="Type: bold, strike or red" aria-label="Type: bold, strike or red 2"><br>
+       <input ng-model="style3"
+              placeholder="Type: bold, strike or red" aria-label="Type: bold, strike or red 3"><br>
+       <hr>
+       <p ng-class="[style4, {orange: warning}]">Using Array and Map Syntax</p>
+       <input ng-model="style4" placeholder="Type: bold, strike" aria-label="Type: bold, strike"><br>
+       <label><input type="checkbox" ng-model="warning"> warning (apply "orange" class)</label>
+     </file>
+     <file name="style.css">
+       .strike {
+           text-decoration: line-through;
+       }
+       .bold {
+           font-weight: bold;
+       }
+       .red {
+           color: red;
+       }
+       .has-error {
+           color: red;
+           background-color: yellow;
+       }
+       .orange {
+           color: orange;
+       }
+     </file>
+     <file name="protractor.js" type="protractor">
+       var ps = element.all(by.css('p'));
+
+       it('should let you toggle the class', function() {
+
+         expect(ps.first().getAttribute('class')).not.toMatch(/bold/);
+         expect(ps.first().getAttribute('class')).not.toMatch(/has-error/);
+
+         element(by.model('important')).click();
+         expect(ps.first().getAttribute('class')).toMatch(/bold/);
+
+         element(by.model('error')).click();
+         expect(ps.first().getAttribute('class')).toMatch(/has-error/);
+       });
+
+       it('should let you toggle string example', function() {
+         expect(ps.get(1).getAttribute('class')).toBe('');
+         element(by.model('style')).clear();
+         element(by.model('style')).sendKeys('red');
+         expect(ps.get(1).getAttribute('class')).toBe('red');
+       });
+
+       it('array example should have 3 classes', function() {
+         expect(ps.get(2).getAttribute('class')).toBe('');
+         element(by.model('style1')).sendKeys('bold');
+         element(by.model('style2')).sendKeys('strike');
+         element(by.model('style3')).sendKeys('red');
+         expect(ps.get(2).getAttribute('class')).toBe('bold strike red');
+       });
+
+       it('array with map example should have 2 classes', function() {
+         expect(ps.last().getAttribute('class')).toBe('');
+         element(by.model('style4')).sendKeys('bold');
+         element(by.model('warning')).click();
+         expect(ps.last().getAttribute('class')).toBe('bold orange');
+       });
+     </file>
+   </example>
+
+   ## Animations
+
+   The example below demonstrates how to perform animations using ngClass.
+
+   <example module="ngAnimate" deps="angular-animate.js" animations="true">
+     <file name="index.html">
+      <input id="setbtn" type="button" value="set" ng-click="myVar='my-class'">
+      <input id="clearbtn" type="button" value="clear" ng-click="myVar=''">
+      <br>
+      <span class="base-class" ng-class="myVar">Sample Text</span>
+     </file>
+     <file name="style.css">
+       .base-class {
+         transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+       }
+
+       .base-class.my-class {
+         color: red;
+         font-size:3em;
+       }
+     </file>
+     <file name="protractor.js" type="protractor">
+       it('should check ng-class', function() {
+         expect(element(by.css('.base-class')).getAttribute('class')).not.
+           toMatch(/my-class/);
+
+         element(by.id('setbtn')).click();
+
+         expect(element(by.css('.base-class')).getAttribute('class')).
+           toMatch(/my-class/);
+
+         element(by.id('clearbtn')).click();
+
+         expect(element(by.css('.base-class')).getAttribute('class')).not.
+           toMatch(/my-class/);
+       });
+     </file>
+   </example>
+
+
+   ## ngClass and pre-existing CSS3 Transitions/Animations
+   The ngClass directive still supports CSS3 Transitions/Animations even if they do not follow the ngAnimate CSS naming structure.
+   Upon animation ngAnimate will apply supplementary CSS classes to track the start and end of an animation, but this will not hinder
+   any pre-existing CSS transitions already on the element. To get an idea of what happens during a class-based animation, be sure
+   to view the step by step details of {@link $animate#addClass $animate.addClass} and
+   {@link $animate#removeClass $animate.removeClass}.
+ */
+var ngClassDirective = classDirective('', true);
+
+/**
+ * @ngdoc directive
+ * @name ngClassOdd
+ * @restrict AC
+ *
+ * @description
+ * The `ngClassOdd` and `ngClassEven` directives work exactly as
+ * {@link ng.directive:ngClass ngClass}, except they work in
+ * conjunction with `ngRepeat` and take effect only on odd (even) rows.
+ *
+ * This directive can be applied only within the scope of an
+ * {@link ng.directive:ngRepeat ngRepeat}.
+ *
+ * @element ANY
+ * @param {expression} ngClassOdd {@link guide/expression Expression} to eval. The result
+ *   of the evaluation can be a string representing space delimited class names or an array.
+ *
+ * @example
+   <example>
+     <file name="index.html">
+        <ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
+          <li ng-repeat="name in names">
+           <span ng-class-odd="'odd'" ng-class-even="'even'">
+             {{name}}
+           </span>
+          </li>
+        </ol>
+     </file>
+     <file name="style.css">
+       .odd {
+         color: red;
+       }
+       .even {
+         color: blue;
+       }
+     </file>
+     <file name="protractor.js" type="protractor">
+       it('should check ng-class-odd and ng-class-even', function() {
+         expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).
+           toMatch(/odd/);
+         expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).
+           toMatch(/even/);
+       });
+     </file>
+   </example>
+ */
+var ngClassOddDirective = classDirective('Odd', 0);
+
+/**
+ * @ngdoc directive
+ * @name ngClassEven
+ * @restrict AC
+ *
+ * @description
+ * The `ngClassOdd` and `ngClassEven` directives work exactly as
+ * {@link ng.directive:ngClass ngClass}, except they work in
+ * conjunction with `ngRepeat` and take effect only on odd (even) rows.
+ *
+ * This directive can be applied only within the scope of an
+ * {@link ng.directive:ngRepeat ngRepeat}.
+ *
+ * @element ANY
+ * @param {expression} ngClassEven {@link guide/expression Expression} to eval. The
+ *   result of the evaluation can be a string representing space delimited class names or an array.
+ *
+ * @example
+   <example>
+     <file name="index.html">
+        <ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
+          <li ng-repeat="name in names">
+           <span ng-class-odd="'odd'" ng-class-even="'even'">
+             {{name}} &nbsp; &nbsp; &nbsp;
+           </span>
+          </li>
+        </ol>
+     </file>
+     <file name="style.css">
+       .odd {
+         color: red;
+       }
+       .even {
+         color: blue;
+       }
+     </file>
+     <file name="protractor.js" type="protractor">
+       it('should check ng-class-odd and ng-class-even', function() {
+         expect(element(by.repeater('name in names').row(0).column('name')).getAttribute('class')).
+           toMatch(/odd/);
+         expect(element(by.repeater('name in names').row(1).column('name')).getAttribute('class')).
+           toMatch(/even/);
+       });
+     </file>
+   </example>
+ */
+var ngClassEvenDirective = classDirective('Even', 1);
+
+/**
+ * @ngdoc directive
+ * @name ngCloak
+ * @restrict AC
+ *
+ * @description
+ * The `ngCloak` directive is used to prevent the Angular html template from being briefly
+ * displayed by the browser in its raw (uncompiled) form while your application is loading. Use this
+ * directive to avoid the undesirable flicker effect caused by the html template display.
+ *
+ * The directive can be applied to the `<body>` element, but the preferred usage is to apply
+ * multiple `ngCloak` directives to small portions of the page to permit progressive rendering
+ * of the browser view.
+ *
+ * `ngCloak` works in cooperation with the following css rule embedded within `angular.js` and
+ * `angular.min.js`.
+ * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
+ *
+ * ```css
+ * [ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak], .ng-cloak, .x-ng-cloak {
+ *   display: none !important;
+ * }
+ * ```
+ *
+ * When this css rule is loaded by the browser, all html elements (including their children) that
+ * are tagged with the `ngCloak` directive are hidden. When Angular encounters this directive
+ * during the compilation of the template it deletes the `ngCloak` element attribute, making
+ * the compiled element visible.
+ *
+ * For the best result, the `angular.js` script must be loaded in the head section of the html
+ * document; alternatively, the css rule above must be included in the external stylesheet of the
+ * application.
+ *
+ * @element ANY
+ *
+ * @example
+   <example>
+     <file name="index.html">
+        <div id="template1" ng-cloak>{{ 'hello' }}</div>
+        <div id="template2" class="ng-cloak">{{ 'world' }}</div>
+     </file>
+     <file name="protractor.js" type="protractor">
+       it('should remove the template directive and css class', function() {
+         expect($('#template1').getAttribute('ng-cloak')).
+           toBeNull();
+         expect($('#template2').getAttribute('ng-cloak')).
+           toBeNull();
+       });
+     </file>
+   </example>
+ *
+ */
+var ngCloakDirective = ngDirective({
+  compile: function(element, attr) {
+    attr.$set('ngCloak', undefined);
+    element.removeClass('ng-cloak');
+  }
+});
+
+/**
+ * @ngdoc directive
+ * @name ngController
+ *
+ * @description
+ * The `ngController` directive attaches a controller class to the view. This is a key aspect of how angular
+ * supports the principles behind the Model-View-Controller design pattern.
+ *
+ * MVC components in angular:
+ *
+ * * Model — Models are the properties of a scope; scopes are attached to the DOM where scope properties
+ *   are accessed through bindings.
+ * * View — The template (HTML with data bindings) that is rendered into the View.
+ * * Controller — The `ngController` directive specifies a Controller class; the class contains business
+ *   logic behind the application to decorate the scope with functions and values
+ *
+ * Note that you can also attach controllers to the DOM by declaring it in a route definition
+ * via the {@link ngRoute.$route $route} service. A common mistake is to declare the controller
+ * again using `ng-controller` in the template itself.  This will cause the controller to be attached
+ * and executed twice.
+ *
+ * @element ANY
+ * @scope
+ * @priority 500
+ * @param {expression} ngController Name of a constructor function registered with the current
+ * {@link ng.$controllerProvider $controllerProvider} or an {@link guide/expression expression}
+ * that on the current scope evaluates to a constructor function.
+ *
+ * The controller instance can be published into a scope property by specifying
+ * `ng-controller="as propertyName"`.
+ *
+ * If the current `$controllerProvider` is configured to use globals (via
+ * {@link ng.$controllerProvider#allowGlobals `$controllerProvider.allowGlobals()` }), this may
+ * also be the name of a globally accessible constructor function (not recommended).
+ *
+ * @example
+ * Here is a simple form for editing user contact information. Adding, removing, clearing, and
+ * greeting are methods declared on the controller (see source tab). These methods can
+ * easily be called from the angular markup. Any changes to the data are automatically reflected
+ * in the View without the need for a manual update.
+ *
+ * Two different declaration styles are included below:
+ *
+ * * one binds methods and properties directly onto the controller using `this`:
+ * `ng-controller="SettingsController1 as settings"`
+ * * one injects `$scope` into the controller:
+ * `ng-controller="SettingsController2"`
+ *
+ * The second option is more common in the Angular community, and is generally used in boilerplates
+ * and in this guide. However, there are advantages to binding properties directly to the controller
+ * and avoiding scope.
+ *
+ * * Using `controller as` makes it obvious which controller you are accessing in the template when
+ * multiple controllers apply to an element.
+ * * If you are writing your controllers as classes you have easier access to the properties and
+ * methods, which will appear on the scope, from inside the controller code.
+ * * Since there is always a `.` in the bindings, you don't have to worry about prototypal
+ * inheritance masking primitives.
+ *
+ * This example demonstrates the `controller as` syntax.
+ *
+ * <example name="ngControllerAs" module="controllerAsExample">
+ *   <file name="index.html">
+ *    <div id="ctrl-as-exmpl" ng-controller="SettingsController1 as settings">
+ *      <label>Name: <input type="text" ng-model="settings.name"/></label>
+ *      <button ng-click="settings.greet()">greet</button><br/>
+ *      Contact:
+ *      <ul>
+ *        <li ng-repeat="contact in settings.contacts">
+ *          <select ng-model="contact.type" aria-label="Contact method" id="select_{{$index}}">
+ *             <option>phone</option>
+ *             <option>email</option>
+ *          </select>
+ *          <input type="text" ng-model="contact.value" aria-labelledby="select_{{$index}}" />
+ *          <button ng-click="settings.clearContact(contact)">clear</button>
+ *          <button ng-click="settings.removeContact(contact)" aria-label="Remove">X</button>
+ *        </li>
+ *        <li><button ng-click="settings.addContact()">add</button></li>
+ *     </ul>
+ *    </div>
+ *   </file>
+ *   <file name="app.js">
+ *    angular.module('controllerAsExample', [])
+ *      .controller('SettingsController1', SettingsController1);
+ *
+ *    function SettingsController1() {
+ *      this.name = "John Smith";
+ *      this.contacts = [
+ *        {type: 'phone', value: '408 555 1212'},
+ *        {type: 'email', value: 'john.smith@example.org'} ];
+ *    }
+ *
+ *    SettingsController1.prototype.greet = function() {
+ *      alert(this.name);
+ *    };
+ *
+ *    SettingsController1.prototype.addContact = function() {
+ *      this.contacts.push({type: 'email', value: 'yourname@example.org'});
+ *    };
+ *
+ *    SettingsController1.prototype.removeContact = function(contactToRemove) {
+ *     var index = this.contacts.indexOf(contactToRemove);
+ *      this.contacts.splice(index, 1);
+ *    };
+ *
+ *    SettingsController1.prototype.clearContact = function(contact) {
+ *      contact.type = 'phone';
+ *      contact.value = '';
+ *    };
+ *   </file>
+ *   <file name="protractor.js" type="protractor">
+ *     it('should check controller as', function() {
+ *       var container = element(by.id('ctrl-as-exmpl'));
+ *         expect(container.element(by.model('settings.name'))
+ *           .getAttribute('value')).toBe('John Smith');
+ *
+ *       var firstRepeat =
+ *           container.element(by.repeater('contact in settings.contacts').row(0));
+ *       var secondRepeat =
+ *           container.element(by.repeater('contact in settings.contacts').row(1));
+ *
+ *       expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
+ *           .toBe('408 555 1212');
+ *
+ *       expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))
+ *           .toBe('john.smith@example.org');
+ *
+ *       firstRepeat.element(by.buttonText('clear')).click();
+ *
+ *       expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
+ *           .toBe('');
+ *
+ *       container.element(by.buttonText('add')).click();
+ *
+ *       expect(container.element(by.repeater('contact in settings.contacts').row(2))
+ *           .element(by.model('contact.value'))
+ *           .getAttribute('value'))
+ *           .toBe('yourname@example.org');
+ *     });
+ *   </file>
+ * </example>
+ *
+ * This example demonstrates the "attach to `$scope`" style of controller.
+ *
+ * <example name="ngController" module="controllerExample">
+ *  <file name="index.html">
+ *   <div id="ctrl-exmpl" ng-controller="SettingsController2">
+ *     <label>Name: <input type="text" ng-model="name"/></label>
+ *     <button ng-click="greet()">greet</button><br/>
+ *     Contact:
+ *     <ul>
+ *       <li ng-repeat="contact in contacts">
+ *         <select ng-model="contact.type" id="select_{{$index}}">
+ *            <option>phone</option>
+ *            <option>email</option>
+ *         </select>
+ *         <input type="text" ng-model="contact.value" aria-labelledby="select_{{$index}}" />
+ *         <button ng-click="clearContact(contact)">clear</button>
+ *         <button ng-click="removeContact(contact)">X</button>
+ *       </li>
+ *       <li>[ <button ng-click="addContact()">add</button> ]</li>
+ *    </ul>
+ *   </div>
+ *  </file>
+ *  <file name="app.js">
+ *   angular.module('controllerExample', [])
+ *     .controller('SettingsController2', ['$scope', SettingsController2]);
+ *
+ *   function SettingsController2($scope) {
+ *     $scope.name = "John Smith";
+ *     $scope.contacts = [
+ *       {type:'phone', value:'408 555 1212'},
+ *       {type:'email', value:'john.smith@example.org'} ];
+ *
+ *     $scope.greet = function() {
+ *       alert($scope.name);
+ *     };
+ *
+ *     $scope.addContact = function() {
+ *       $scope.contacts.push({type:'email', value:'yourname@example.org'});
+ *     };
+ *
+ *     $scope.removeContact = function(contactToRemove) {
+ *       var index = $scope.contacts.indexOf(contactToRemove);
+ *       $scope.contacts.splice(index, 1);
+ *     };
+ *
+ *     $scope.clearContact = function(contact) {
+ *       contact.type = 'phone';
+ *       contact.value = '';
+ *     };
+ *   }
+ *  </file>
+ *  <file name="protractor.js" type="protractor">
+ *    it('should check controller', function() {
+ *      var container = element(by.id('ctrl-exmpl'));
+ *
+ *      expect(container.element(by.model('name'))
+ *          .getAttribute('value')).toBe('John Smith');
+ *
+ *      var firstRepeat =
+ *          container.element(by.repeater('contact in contacts').row(0));
+ *      var secondRepeat =
+ *          container.element(by.repeater('contact in contacts').row(1));
+ *
+ *      expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
+ *          .toBe('408 555 1212');
+ *      expect(secondRepeat.element(by.model('contact.value')).getAttribute('value'))
+ *          .toBe('john.smith@example.org');
+ *
+ *      firstRepeat.element(by.buttonText('clear')).click();
+ *
+ *      expect(firstRepeat.element(by.model('contact.value')).getAttribute('value'))
+ *          .toBe('');
+ *
+ *      container.element(by.buttonText('add')).click();
+ *
+ *      expect(container.element(by.repeater('contact in contacts').row(2))
+ *          .element(by.model('contact.value'))
+ *          .getAttribute('value'))
+ *          .toBe('yourname@example.org');
+ *    });
+ *  </file>
+ *</example>
+
+ */
+var ngControllerDirective = [function() {
+  return {
+    restrict: 'A',
+    scope: true,
+    controller: '@',
+    priority: 500
+  };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngCsp
+ *
+ * @element html
+ * @description
+ *
+ * Angular has some features that can break certain
+ * [CSP (Content Security Policy)](https://developer.mozilla.org/en/Security/CSP) rules.
+ *
+ * If you intend to implement these rules then you must tell Angular not to use these features.
+ *
+ * This is necessary when developing things like Google Chrome Extensions or Universal Windows Apps.
+ *
+ *
+ * The following rules affect Angular:
+ *
+ * * `unsafe-eval`: this rule forbids apps to use `eval` or `Function(string)` generated functions
+ * (among other things). Angular makes use of this in the {@link $parse} service to provide a 30%
+ * increase in the speed of evaluating Angular expressions.
+ *
+ * * `unsafe-inline`: this rule forbids apps from inject custom styles into the document. Angular
+ * makes use of this to include some CSS rules (e.g. {@link ngCloak} and {@link ngHide}).
+ * To make these directives work when a CSP rule is blocking inline styles, you must link to the
+ * `angular-csp.css` in your HTML manually.
+ *
+ * If you do not provide `ngCsp` then Angular tries to autodetect if CSP is blocking unsafe-eval
+ * and automatically deactivates this feature in the {@link $parse} service. This autodetection,
+ * however, triggers a CSP error to be logged in the console:
+ *
+ * ```
+ * Refused to evaluate a string as JavaScript because 'unsafe-eval' is not an allowed source of
+ * script in the following Content Security Policy directive: "default-src 'self'". Note that
+ * 'script-src' was not explicitly set, so 'default-src' is used as a fallback.
+ * ```
+ *
+ * This error is harmless but annoying. To prevent the error from showing up, put the `ngCsp`
+ * directive on an element of the HTML document that appears before the `<script>` tag that loads
+ * the `angular.js` file.
+ *
+ * *Note: This directive is only available in the `ng-csp` and `data-ng-csp` attribute form.*
+ *
+ * You can specify which of the CSP related Angular features should be deactivated by providing
+ * a value for the `ng-csp` attribute. The options are as follows:
+ *
+ * * no-inline-style: this stops Angular from injecting CSS styles into the DOM
+ *
+ * * no-unsafe-eval: this stops Angular from optimizing $parse with unsafe eval of strings
+ *
+ * You can use these values in the following combinations:
+ *
+ *
+ * * No declaration means that Angular will assume that you can do inline styles, but it will do
+ * a runtime check for unsafe-eval. E.g. `<body>`. This is backwardly compatible with previous versions
+ * of Angular.
+ *
+ * * A simple `ng-csp` (or `data-ng-csp`) attribute will tell Angular to deactivate both inline
+ * styles and unsafe eval. E.g. `<body ng-csp>`. This is backwardly compatible with previous versions
+ * of Angular.
+ *
+ * * Specifying only `no-unsafe-eval` tells Angular that we must not use eval, but that we can inject
+ * inline styles. E.g. `<body ng-csp="no-unsafe-eval">`.
+ *
+ * * Specifying only `no-inline-style` tells Angular that we must not inject styles, but that we can
+ * run eval - no automatic check for unsafe eval will occur. E.g. `<body ng-csp="no-inline-style">`
+ *
+ * * Specifying both `no-unsafe-eval` and `no-inline-style` tells Angular that we must not inject
+ * styles nor use eval, which is the same as an empty: ng-csp.
+ * E.g.`<body ng-csp="no-inline-style;no-unsafe-eval">`
+ *
+ * @example
+ * This example shows how to apply the `ngCsp` directive to the `html` tag.
+   ```html
+     <!doctype html>
+     <html ng-app ng-csp>
+     ...
+     ...
+     </html>
+   ```
+  * @example
+      // Note: the suffix `.csp` in the example name triggers
+      // csp mode in our http server!
+      <example name="example.csp" module="cspExample" ng-csp="true">
+        <file name="index.html">
+          <div ng-controller="MainController as ctrl">
+            <div>
+              <button ng-click="ctrl.inc()" id="inc">Increment</button>
+              <span id="counter">
+                {{ctrl.counter}}
+              </span>
+            </div>
+
+            <div>
+              <button ng-click="ctrl.evil()" id="evil">Evil</button>
+              <span id="evilError">
+                {{ctrl.evilError}}
+              </span>
+            </div>
+          </div>
+        </file>
+        <file name="script.js">
+           angular.module('cspExample', [])
+             .controller('MainController', function() {
+                this.counter = 0;
+                this.inc = function() {
+                  this.counter++;
+                };
+                this.evil = function() {
+                  // jshint evil:true
+                  try {
+                    eval('1+2');
+                  } catch (e) {
+                    this.evilError = e.message;
+                  }
+                };
+              });
+        </file>
+        <file name="protractor.js" type="protractor">
+          var util, webdriver;
+
+          var incBtn = element(by.id('inc'));
+          var counter = element(by.id('counter'));
+          var evilBtn = element(by.id('evil'));
+          var evilError = element(by.id('evilError'));
+
+          function getAndClearSevereErrors() {
+            return browser.manage().logs().get('browser').then(function(browserLog) {
+              return browserLog.filter(function(logEntry) {
+                return logEntry.level.value > webdriver.logging.Level.WARNING.value;
+              });
+            });
+          }
+
+          function clearErrors() {
+            getAndClearSevereErrors();
+          }
+
+          function expectNoErrors() {
+            getAndClearSevereErrors().then(function(filteredLog) {
+              expect(filteredLog.length).toEqual(0);
+              if (filteredLog.length) {
+                console.log('browser console errors: ' + util.inspect(filteredLog));
+              }
+            });
+          }
+
+          function expectError(regex) {
+            getAndClearSevereErrors().then(function(filteredLog) {
+              var found = false;
+              filteredLog.forEach(function(log) {
+                if (log.message.match(regex)) {
+                  found = true;
+                }
+              });
+              if (!found) {
+                throw new Error('expected an error that matches ' + regex);
+              }
+            });
+          }
+
+          beforeEach(function() {
+            util = require('util');
+            webdriver = require('protractor/node_modules/selenium-webdriver');
+          });
+
+          // For now, we only test on Chrome,
+          // as Safari does not load the page with Protractor's injected scripts,
+          // and Firefox webdriver always disables content security policy (#6358)
+          if (browser.params.browser !== 'chrome') {
+            return;
+          }
+
+          it('should not report errors when the page is loaded', function() {
+            // clear errors so we are not dependent on previous tests
+            clearErrors();
+            // Need to reload the page as the page is already loaded when
+            // we come here
+            browser.driver.getCurrentUrl().then(function(url) {
+              browser.get(url);
+            });
+            expectNoErrors();
+          });
+
+          it('should evaluate expressions', function() {
+            expect(counter.getText()).toEqual('0');
+            incBtn.click();
+            expect(counter.getText()).toEqual('1');
+            expectNoErrors();
+          });
+
+          it('should throw and report an error when using "eval"', function() {
+            evilBtn.click();
+            expect(evilError.getText()).toMatch(/Content Security Policy/);
+            expectError(/Content Security Policy/);
+          });
+        </file>
+      </example>
+  */
+
+// ngCsp is not implemented as a proper directive any more, because we need it be processed while we
+// bootstrap the system (before $parse is instantiated), for this reason we just have
+// the csp() fn that looks for the `ng-csp` attribute anywhere in the current doc
+
+/**
+ * @ngdoc directive
+ * @name ngClick
+ *
+ * @description
+ * The ngClick directive allows you to specify custom behavior when
+ * an element is clicked.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngClick {@link guide/expression Expression} to evaluate upon
+ * click. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+   <example>
+     <file name="index.html">
+      <button ng-click="count = count + 1" ng-init="count=0">
+        Increment
+      </button>
+      <span>
+        count: {{count}}
+      </span>
+     </file>
+     <file name="protractor.js" type="protractor">
+       it('should check ng-click', function() {
+         expect(element(by.binding('count')).getText()).toMatch('0');
+         element(by.css('button')).click();
+         expect(element(by.binding('count')).getText()).toMatch('1');
+       });
+     </file>
+   </example>
+ */
+/*
+ * A collection of directives that allows creation of custom event handlers that are defined as
+ * angular expressions and are compiled and executed within the current scope.
+ */
+var ngEventDirectives = {};
+
+// For events that might fire synchronously during DOM manipulation
+// we need to execute their event handlers asynchronously using $evalAsync,
+// so that they are not executed in an inconsistent state.
+var forceAsyncEvents = {
+  'blur': true,
+  'focus': true
+};
+forEach(
+  'click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste'.split(' '),
+  function(eventName) {
+    var directiveName = directiveNormalize('ng-' + eventName);
+    ngEventDirectives[directiveName] = ['$parse', '$rootScope', function($parse, $rootScope) {
+      return {
+        restrict: 'A',
+        compile: function($element, attr) {
+          // We expose the powerful $event object on the scope that provides access to the Window,
+          // etc. that isn't protected by the fast paths in $parse.  We explicitly request better
+          // checks at the cost of speed since event handler expressions are not executed as
+          // frequently as regular change detection.
+          var fn = $parse(attr[directiveName], /* interceptorFn */ null, /* expensiveChecks */ true);
+          return function ngEventHandler(scope, element) {
+            element.on(eventName, function(event) {
+              var callback = function() {
+                fn(scope, {$event:event});
+              };
+              if (forceAsyncEvents[eventName] && $rootScope.$$phase) {
+                scope.$evalAsync(callback);
+              } else {
+                scope.$apply(callback);
+              }
+            });
+          };
+        }
+      };
+    }];
+  }
+);
+
+/**
+ * @ngdoc directive
+ * @name ngDblclick
+ *
+ * @description
+ * The `ngDblclick` directive allows you to specify custom behavior on a dblclick event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngDblclick {@link guide/expression Expression} to evaluate upon
+ * a dblclick. (The Event object is available as `$event`)
+ *
+ * @example
+   <example>
+     <file name="index.html">
+      <button ng-dblclick="count = count + 1" ng-init="count=0">
+        Increment (on double click)
+      </button>
+      count: {{count}}
+     </file>
+   </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMousedown
+ *
+ * @description
+ * The ngMousedown directive allows you to specify custom behavior on mousedown event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon
+ * mousedown. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+   <example>
+     <file name="index.html">
+      <button ng-mousedown="count = count + 1" ng-init="count=0">
+        Increment (on mouse down)
+      </button>
+      count: {{count}}
+     </file>
+   </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMouseup
+ *
+ * @description
+ * Specify custom behavior on mouseup event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon
+ * mouseup. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+   <example>
+     <file name="index.html">
+      <button ng-mouseup="count = count + 1" ng-init="count=0">
+        Increment (on mouse up)
+      </button>
+      count: {{count}}
+     </file>
+   </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngMouseover
+ *
+ * @description
+ * Specify custom behavior on mouseover event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon
+ * mouseover. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+   <example>
+     <file name="index.html">
+      <button ng-mouseover="count = count + 1" ng-init="count=0">
+        Increment (when mouse is over)
+      </button>
+      count: {{count}}
+     </file>
+   </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMouseenter
+ *
+ * @description
+ * Specify custom behavior on mouseenter event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon
+ * mouseenter. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+   <example>
+     <file name="index.html">
+      <button ng-mouseenter="count = count + 1" ng-init="count=0">
+        Increment (when mouse enters)
+      </button>
+      count: {{count}}
+     </file>
+   </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMouseleave
+ *
+ * @description
+ * Specify custom behavior on mouseleave event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon
+ * mouseleave. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+   <example>
+     <file name="index.html">
+      <button ng-mouseleave="count = count + 1" ng-init="count=0">
+        Increment (when mouse leaves)
+      </button>
+      count: {{count}}
+     </file>
+   </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngMousemove
+ *
+ * @description
+ * Specify custom behavior on mousemove event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon
+ * mousemove. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+   <example>
+     <file name="index.html">
+      <button ng-mousemove="count = count + 1" ng-init="count=0">
+        Increment (when mouse moves)
+      </button>
+      count: {{count}}
+     </file>
+   </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngKeydown
+ *
+ * @description
+ * Specify custom behavior on keydown event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngKeydown {@link guide/expression Expression} to evaluate upon
+ * keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
+ *
+ * @example
+   <example>
+     <file name="index.html">
+      <input ng-keydown="count = count + 1" ng-init="count=0">
+      key down count: {{count}}
+     </file>
+   </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngKeyup
+ *
+ * @description
+ * Specify custom behavior on keyup event.
+ *
+ * @element ANY
+ * @priority 0
+ * @param {expression} ngKeyup {@link guide/expression Expression} to evaluate upon
+ * keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
+ *
+ * @example
+   <example>
+     <file name="index.html">
+       <p>Typing in the input box below updates the key count</p>
+       <input ng-keyup="count = count + 1" ng-init="count=0"> key up count: {{count}}
+
+       <p>Typing in the input box below updates the keycode</p>
+       <input ng-keyup="event=$event">
+       <p>event keyCode: {{ event.keyCode }}</p>
+       <p>event altKey: {{ event.altKey }}</p>
+     </file>
+   </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngKeypress
+ *
+ * @description
+ * Specify custom behavior on keypress event.
+ *
+ * @element ANY
+ * @param {expression} ngKeypress {@link guide/expression Expression} to evaluate upon
+ * keypress. ({@link guide/expression#-event- Event object is available as `$event`}
+ * and can be interrogated for keyCode, altKey, etc.)
+ *
+ * @example
+   <example>
+     <file name="index.html">
+      <input ng-keypress="count = count + 1" ng-init="count=0">
+      key press count: {{count}}
+     </file>
+   </example>
+ */
+
+
+/**
+ * @ngdoc directive
+ * @name ngSubmit
+ *
+ * @description
+ * Enables binding angular expressions to onsubmit events.
+ *
+ * Additionally it prevents the default action (which for form means sending the request to the
+ * server and reloading the current page), but only if the form does not contain `action`,
+ * `data-action`, or `x-action` attributes.
+ *
+ * <div class="alert alert-warning">
+ * **Warning:** Be careful not to cause "double-submission" by using both the `ngClick` and
+ * `ngSubmit` handlers together. See the
+ * {@link form#submitting-a-form-and-preventing-the-default-action `form` directive documentation}
+ * for a detailed discussion of when `ngSubmit` may be triggered.
+ * </div>
+ *
+ * @element form
+ * @priority 0
+ * @param {expression} ngSubmit {@link guide/expression Expression} to eval.
+ * ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+   <example module="submitExample">
+     <file name="index.html">
+      <script>
+        angular.module('submitExample', [])
+          .controller('ExampleController', ['$scope', function($scope) {
+            $scope.list = [];
+            $scope.text = 'hello';
+            $scope.submit = function() {
+              if ($scope.text) {
+                $scope.list.push(this.text);
+                $scope.text = '';
+              }
+            };
+          }]);
+      </script>
+      <form ng-submit="submit()" ng-controller="ExampleController">
+        Enter text and hit enter:
+        <input type="text" ng-model="text" name="text" />
+        <input type="submit" id="submit" value="Submit" />
+        <pre>list={{list}}</pre>
+      </form>
+     </file>
+     <file name="protractor.js" type="protractor">
+       it('should check ng-submit', function() {
+         expect(element(by.binding('list')).getText()).toBe('list=[]');
+         element(by.css('#submit')).click();
+         expect(element(by.binding('list')).getText()).toContain('hello');
+         expect(element(by.model('text')).getAttribute('value')).toBe('');
+       });
+       it('should ignore empty strings', function() {
+         expect(element(by.binding('list')).getText()).toBe('list=[]');
+         element(by.css('#submit')).click();
+         element(by.css('#submit')).click();
+         expect(element(by.binding('list')).getText()).toContain('hello');
+        });
+     </file>
+   </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngFocus
+ *
+ * @description
+ * Specify custom behavior on focus event.
+ *
+ * Note: As the `focus` event is executed synchronously when calling `input.focus()`
+ * AngularJS executes the expression using `scope.$evalAsync` if the event is fired
+ * during an `$apply` to ensure a consistent state.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngFocus {@link guide/expression Expression} to evaluate upon
+ * focus. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ * See {@link ng.directive:ngClick ngClick}
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngBlur
+ *
+ * @description
+ * Specify custom behavior on blur event.
+ *
+ * A [blur event](https://developer.mozilla.org/en-US/docs/Web/Events/blur) fires when
+ * an element has lost focus.
+ *
+ * Note: As the `blur` event is executed synchronously also during DOM manipulations
+ * (e.g. removing a focussed input),
+ * AngularJS executes the expression using `scope.$evalAsync` if the event is fired
+ * during an `$apply` to ensure a consistent state.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngBlur {@link guide/expression Expression} to evaluate upon
+ * blur. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+ * See {@link ng.directive:ngClick ngClick}
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngCopy
+ *
+ * @description
+ * Specify custom behavior on copy event.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngCopy {@link guide/expression Expression} to evaluate upon
+ * copy. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+   <example>
+     <file name="index.html">
+      <input ng-copy="copied=true" ng-init="copied=false; value='copy me'" ng-model="value">
+      copied: {{copied}}
+     </file>
+   </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngCut
+ *
+ * @description
+ * Specify custom behavior on cut event.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngCut {@link guide/expression Expression} to evaluate upon
+ * cut. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+   <example>
+     <file name="index.html">
+      <input ng-cut="cut=true" ng-init="cut=false; value='cut me'" ng-model="value">
+      cut: {{cut}}
+     </file>
+   </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngPaste
+ *
+ * @description
+ * Specify custom behavior on paste event.
+ *
+ * @element window, input, select, textarea, a
+ * @priority 0
+ * @param {expression} ngPaste {@link guide/expression Expression} to evaluate upon
+ * paste. ({@link guide/expression#-event- Event object is available as `$event`})
+ *
+ * @example
+   <example>
+     <file name="index.html">
+      <input ng-paste="paste=true" ng-init="paste=false" placeholder='paste here'>
+      pasted: {{paste}}
+     </file>
+   </example>
+ */
+
+/**
+ * @ngdoc directive
+ * @name ngIf
+ * @restrict A
+ * @multiElement
+ *
+ * @description
+ * The `ngIf` directive removes or recreates a portion of the DOM tree based on an
+ * {expression}. If the expression assigned to `ngIf` evaluates to a false
+ * value then the element is removed from the DOM, otherwise a clone of the
+ * element is reinserted into the DOM.
+ *
+ * `ngIf` differs from `ngShow` and `ngHide` in that `ngIf` completely removes and recreates the
+ * element in the DOM rather than changing its visibility via the `display` css property.  A common
+ * case when this difference is significant is when using css selectors that rely on an element's
+ * position within the DOM, such as the `:first-child` or `:last-child` pseudo-classes.
+ *
+ * Note that when an element is removed using `ngIf` its scope is destroyed and a new scope
+ * is created when the element is restored.  The scope created within `ngIf` inherits from
+ * its parent scope using
+ * [prototypal inheritance](https://github.com/angular/angular.js/wiki/Understanding-Scopes#javascript-prototypal-inheritance).
+ * An important implication of this is if `ngModel` is used within `ngIf` to bind to
+ * a javascript primitive defined in the parent scope. In this case any modifications made to the
+ * variable within the child scope will override (hide) the value in the parent scope.
+ *
+ * Also, `ngIf` recreates elements using their compiled state. An example of this behavior
+ * is if an element's class attribute is directly modified after it's compiled, using something like
+ * jQuery's `.addClass()` method, and the element is later removed. When `ngIf` recreates the element
+ * the added class will be lost because the original compiled state is used to regenerate the element.
+ *
+ * Additionally, you can provide animations via the `ngAnimate` module to animate the `enter`
+ * and `leave` effects.
+ *
+ * @animations
+ * | Animation                        | Occurs                               |
+ * |----------------------------------|-------------------------------------|
+ * | {@link ng.$animate#enter enter}  | just after the `ngIf` contents change and a new DOM element is created and injected into the `ngIf` container |
+ * | {@link ng.$animate#leave leave}  | just before the `ngIf` contents are removed from the DOM |
+ *
+ * @element ANY
+ * @scope
+ * @priority 600
+ * @param {expression} ngIf If the {@link guide/expression expression} is falsy then
+ *     the element is removed from the DOM tree. If it is truthy a copy of the compiled
+ *     element is added to the DOM tree.
+ *
+ * @example
+  <example module="ngAnimate" deps="angular-animate.js" animations="true">
+    <file name="index.html">
+      <label>Click me: <input type="checkbox" ng-model="checked" ng-init="checked=true" /></label><br/>
+      Show when checked:
+      <span ng-if="checked" class="animate-if">
+        This is removed when the checkbox is unchecked.
+      </span>
+    </file>
+    <file name="animations.css">
+      .animate-if {
+        background:white;
+        border:1px solid black;
+        padding:10px;
+      }
+
+      .animate-if.ng-enter, .animate-if.ng-leave {
+        transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+      }
+
+      .animate-if.ng-enter,
+      .animate-if.ng-leave.ng-leave-active {
+        opacity:0;
+      }
+
+      .animate-if.ng-leave,
+      .animate-if.ng-enter.ng-enter-active {
+        opacity:1;
+      }
+    </file>
+  </example>
+ */
+var ngIfDirective = ['$animate', '$compile', function($animate, $compile) {
+  return {
+    multiElement: true,
+    transclude: 'element',
+    priority: 600,
+    terminal: true,
+    restrict: 'A',
+    $$tlb: true,
+    link: function($scope, $element, $attr, ctrl, $transclude) {
+        var block, childScope, previousElements;
+        $scope.$watch($attr.ngIf, function ngIfWatchAction(value) {
+
+          if (value) {
+            if (!childScope) {
+              $transclude(function(clone, newScope) {
+                childScope = newScope;
+                clone[clone.length++] = $compile.$$createComment('end ngIf', $attr.ngIf);
+                // Note: We only need the first/last node of the cloned nodes.
+                // However, we need to keep the reference to the jqlite wrapper as it might be changed later
+                // by a directive with templateUrl when its template arrives.
+                block = {
+                  clone: clone
+                };
+                $animate.enter(clone, $element.parent(), $element);
+              });
+            }
+          } else {
+            if (previousElements) {
+              previousElements.remove();
+              previousElements = null;
+            }
+            if (childScope) {
+              childScope.$destroy();
+              childScope = null;
+            }
+            if (block) {
+              previousElements = getBlockNodes(block.clone);
+              $animate.leave(previousElements).then(function() {
+                previousElements = null;
+              });
+              block = null;
+            }
+          }
+        });
+    }
+  };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngInclude
+ * @restrict ECA
+ *
+ * @description
+ * Fetches, compiles and includes an external HTML fragment.
+ *
+ * By default, the template URL is restricted to the same domain and protocol as the
+ * application document. This is done by calling {@link $sce#getTrustedResourceUrl
+ * $sce.getTrustedResourceUrl} on it. To load templates from other domains or protocols
+ * you may either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist them} or
+ * {@link $sce#trustAsResourceUrl wrap them} as trusted values. Refer to Angular's {@link
+ * ng.$sce Strict Contextual Escaping}.
+ *
+ * In addition, the browser's
+ * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)
+ * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)
+ * policy may further restrict whether the template is successfully loaded.
+ * For example, `ngInclude` won't work for cross-domain requests on all browsers and for `file://`
+ * access on some browsers.
+ *
+ * @animations
+ * | Animation                        | Occurs                              |
+ * |----------------------------------|-------------------------------------|
+ * | {@link ng.$animate#enter enter}  | when the expression changes, on the new include |
+ * | {@link ng.$animate#leave leave}  | when the expression changes, on the old include |
+ *
+ * The enter and leave animation occur concurrently.
+ *
+ * @scope
+ * @priority 400
+ *
+ * @param {string} ngInclude|src angular expression evaluating to URL. If the source is a string constant,
+ *                 make sure you wrap it in **single** quotes, e.g. `src="'myPartialTemplate.html'"`.
+ * @param {string=} onload Expression to evaluate when a new partial is loaded.
+ *                  <div class="alert alert-warning">
+ *                  **Note:** When using onload on SVG elements in IE11, the browser will try to call
+ *                  a function with the name on the window element, which will usually throw a
+ *                  "function is undefined" error. To fix this, you can instead use `data-onload` or a
+ *                  different form that {@link guide/directive#normalization matches} `onload`.
+ *                  </div>
+   *
+ * @param {string=} autoscroll Whether `ngInclude` should call {@link ng.$anchorScroll
+ *                  $anchorScroll} to scroll the viewport after the content is loaded.
+ *
+ *                  - If the attribute is not set, disable scrolling.
+ *                  - If the attribute is set without value, enable scrolling.
+ *                  - Otherwise enable scrolling only if the expression evaluates to truthy value.
+ *
+ * @example
+  <example module="includeExample" deps="angular-animate.js" animations="true">
+    <file name="index.html">
+     <div ng-controller="ExampleController">
+       <select ng-model="template" ng-options="t.name for t in templates">
+        <option value="">(blank)</option>
+       </select>
+       url of the template: <code>{{template.url}}</code>
+       <hr/>
+       <div class="slide-animate-container">
+         <div class="slide-animate" ng-include="template.url"></div>
+       </div>
+     </div>
+    </file>
+    <file name="script.js">
+      angular.module('includeExample', ['ngAnimate'])
+        .controller('ExampleController', ['$scope', function($scope) {
+          $scope.templates =
+            [ { name: 'template1.html', url: 'template1.html'},
+              { name: 'template2.html', url: 'template2.html'} ];
+          $scope.template = $scope.templates[0];
+        }]);
+     </file>
+    <file name="template1.html">
+      Content of template1.html
+    </file>
+    <file name="template2.html">
+      Content of template2.html
+    </file>
+    <file name="animations.css">
+      .slide-animate-container {
+        position:relative;
+        background:white;
+        border:1px solid black;
+        height:40px;
+        overflow:hidden;
+      }
+
+      .slide-animate {
+        padding:10px;
+      }
+
+      .slide-animate.ng-enter, .slide-animate.ng-leave {
+        transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+
+        position:absolute;
+        top:0;
+        left:0;
+        right:0;
+        bottom:0;
+        display:block;
+        padding:10px;
+      }
+
+      .slide-animate.ng-enter {
+        top:-50px;
+      }
+      .slide-animate.ng-enter.ng-enter-active {
+        top:0;
+      }
+
+      .slide-animate.ng-leave {
+        top:0;
+      }
+      .slide-animate.ng-leave.ng-leave-active {
+        top:50px;
+      }
+    </file>
+    <file name="protractor.js" type="protractor">
+      var templateSelect = element(by.model('template'));
+      var includeElem = element(by.css('[ng-include]'));
+
+      it('should load template1.html', function() {
+        expect(includeElem.getText()).toMatch(/Content of template1.html/);
+      });
+
+      it('should load template2.html', function() {
+        if (browser.params.browser == 'firefox') {
+          // Firefox can't handle using selects
+          // See https://github.com/angular/protractor/issues/480
+          return;
+        }
+        templateSelect.click();
+        templateSelect.all(by.css('option')).get(2).click();
+        expect(includeElem.getText()).toMatch(/Content of template2.html/);
+      });
+
+      it('should change to blank', function() {
+        if (browser.params.browser == 'firefox') {
+          // Firefox can't handle using selects
+          return;
+        }
+        templateSelect.click();
+        templateSelect.all(by.css('option')).get(0).click();
+        expect(includeElem.isPresent()).toBe(false);
+      });
+    </file>
+  </example>
+ */
+
+
+/**
+ * @ngdoc event
+ * @name ngInclude#$includeContentRequested
+ * @eventType emit on the scope ngInclude was declared in
+ * @description
+ * Emitted every time the ngInclude content is requested.
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {String} src URL of content to load.
+ */
+
+
+/**
+ * @ngdoc event
+ * @name ngInclude#$includeContentLoaded
+ * @eventType emit on the current ngInclude scope
+ * @description
+ * Emitted every time the ngInclude content is reloaded.
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {String} src URL of content to load.
+ */
+
+
+/**
+ * @ngdoc event
+ * @name ngInclude#$includeContentError
+ * @eventType emit on the scope ngInclude was declared in
+ * @description
+ * Emitted when a template HTTP request yields an erroneous response (status < 200 || status > 299)
+ *
+ * @param {Object} angularEvent Synthetic event object.
+ * @param {String} src URL of content to load.
+ */
+var ngIncludeDirective = ['$templateRequest', '$anchorScroll', '$animate',
+                  function($templateRequest,   $anchorScroll,   $animate) {
+  return {
+    restrict: 'ECA',
+    priority: 400,
+    terminal: true,
+    transclude: 'element',
+    controller: angular.noop,
+    compile: function(element, attr) {
+      var srcExp = attr.ngInclude || attr.src,
+          onloadExp = attr.onload || '',
+          autoScrollExp = attr.autoscroll;
+
+      return function(scope, $element, $attr, ctrl, $transclude) {
+        var changeCounter = 0,
+            currentScope,
+            previousElement,
+            currentElement;
+
+        var cleanupLastIncludeContent = function() {
+          if (previousElement) {
+            previousElement.remove();
+            previousElement = null;
+          }
+          if (currentScope) {
+            currentScope.$destroy();
+            currentScope = null;
+          }
+          if (currentElement) {
+            $animate.leave(currentElement).then(function() {
+              previousElement = null;
+            });
+            previousElement = currentElement;
+            currentElement = null;
+          }
+        };
+
+        scope.$watch(srcExp, function ngIncludeWatchAction(src) {
+          var afterAnimation = function() {
+            if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) {
+              $anchorScroll();
+            }
+          };
+          var thisChangeId = ++changeCounter;
+
+          if (src) {
+            //set the 2nd param to true to ignore the template request error so that the inner
+            //contents and scope can be cleaned up.
+            $templateRequest(src, true).then(function(response) {
+              if (scope.$$destroyed) return;
+
+              if (thisChangeId !== changeCounter) return;
+              var newScope = scope.$new();
+              ctrl.template = response;
+
+              // Note: This will also link all children of ng-include that were contained in the original
+              // html. If that content contains controllers, ... they could pollute/change the scope.
+              // However, using ng-include on an element with additional content does not make sense...
+              // Note: We can't remove them in the cloneAttchFn of $transclude as that
+              // function is called before linking the content, which would apply child
+              // directives to non existing elements.
+              var clone = $transclude(newScope, function(clone) {
+                cleanupLastIncludeContent();
+                $animate.enter(clone, null, $element).then(afterAnimation);
+              });
+
+              currentScope = newScope;
+              currentElement = clone;
+
+              currentScope.$emit('$includeContentLoaded', src);
+              scope.$eval(onloadExp);
+            }, function() {
+              if (scope.$$destroyed) return;
+
+              if (thisChangeId === changeCounter) {
+                cleanupLastIncludeContent();
+                scope.$emit('$includeContentError', src);
+              }
+            });
+            scope.$emit('$includeContentRequested', src);
+          } else {
+            cleanupLastIncludeContent();
+            ctrl.template = null;
+          }
+        });
+      };
+    }
+  };
+}];
+
+// This directive is called during the $transclude call of the first `ngInclude` directive.
+// It will replace and compile the content of the element with the loaded template.
+// We need this directive so that the element content is already filled when
+// the link function of another directive on the same element as ngInclude
+// is called.
+var ngIncludeFillContentDirective = ['$compile',
+  function($compile) {
+    return {
+      restrict: 'ECA',
+      priority: -400,
+      require: 'ngInclude',
+      link: function(scope, $element, $attr, ctrl) {
+        if (toString.call($element[0]).match(/SVG/)) {
+          // WebKit: https://bugs.webkit.org/show_bug.cgi?id=135698 --- SVG elements do not
+          // support innerHTML, so detect this here and try to generate the contents
+          // specially.
+          $element.empty();
+          $compile(jqLiteBuildFragment(ctrl.template, window.document).childNodes)(scope,
+              function namespaceAdaptedClone(clone) {
+            $element.append(clone);
+          }, {futureParentElement: $element});
+          return;
+        }
+
+        $element.html(ctrl.template);
+        $compile($element.contents())(scope);
+      }
+    };
+  }];
+
+/**
+ * @ngdoc directive
+ * @name ngInit
+ * @restrict AC
+ *
+ * @description
+ * The `ngInit` directive allows you to evaluate an expression in the
+ * current scope.
+ *
+ * <div class="alert alert-danger">
+ * This directive can be abused to add unnecessary amounts of logic into your templates.
+ * There are only a few appropriate uses of `ngInit`, such as for aliasing special properties of
+ * {@link ng.directive:ngRepeat `ngRepeat`}, as seen in the demo below; and for injecting data via
+ * server side scripting. Besides these few cases, you should use {@link guide/controller controllers}
+ * rather than `ngInit` to initialize values on a scope.
+ * </div>
+ *
+ * <div class="alert alert-warning">
+ * **Note**: If you have assignment in `ngInit` along with a {@link ng.$filter `filter`}, make
+ * sure you have parentheses to ensure correct operator precedence:
+ * <pre class="prettyprint">
+ * `<div ng-init="test1 = ($index | toString)"></div>`
+ * </pre>
+ * </div>
+ *
+ * @priority 450
+ *
+ * @element ANY
+ * @param {expression} ngInit {@link guide/expression Expression} to eval.
+ *
+ * @example
+   <example module="initExample">
+     <file name="index.html">
+   <script>
+     angular.module('initExample', [])
+       .controller('ExampleController', ['$scope', function($scope) {
+         $scope.list = [['a', 'b'], ['c', 'd']];
+       }]);
+   </script>
+   <div ng-controller="ExampleController">
+     <div ng-repeat="innerList in list" ng-init="outerIndex = $index">
+       <div ng-repeat="value in innerList" ng-init="innerIndex = $index">
+          <span class="example-init">list[ {{outerIndex}} ][ {{innerIndex}} ] = {{value}};</span>
+       </div>
+     </div>
+   </div>
+     </file>
+     <file name="protractor.js" type="protractor">
+       it('should alias index positions', function() {
+         var elements = element.all(by.css('.example-init'));
+         expect(elements.get(0).getText()).toBe('list[ 0 ][ 0 ] = a;');
+         expect(elements.get(1).getText()).toBe('list[ 0 ][ 1 ] = b;');
+         expect(elements.get(2).getText()).toBe('list[ 1 ][ 0 ] = c;');
+         expect(elements.get(3).getText()).toBe('list[ 1 ][ 1 ] = d;');
+       });
+     </file>
+   </example>
+ */
+var ngInitDirective = ngDirective({
+  priority: 450,
+  compile: function() {
+    return {
+      pre: function(scope, element, attrs) {
+        scope.$eval(attrs.ngInit);
+      }
+    };
+  }
+});
+
+/**
+ * @ngdoc directive
+ * @name ngList
+ *
+ * @description
+ * Text input that converts between a delimited string and an array of strings. The default
+ * delimiter is a comma followed by a space - equivalent to `ng-list=", "`. You can specify a custom
+ * delimiter as the value of the `ngList` attribute - for example, `ng-list=" | "`.
+ *
+ * The behaviour of the directive is affected by the use of the `ngTrim` attribute.
+ * * If `ngTrim` is set to `"false"` then whitespace around both the separator and each
+ *   list item is respected. This implies that the user of the directive is responsible for
+ *   dealing with whitespace but also allows you to use whitespace as a delimiter, such as a
+ *   tab or newline character.
+ * * Otherwise whitespace around the delimiter is ignored when splitting (although it is respected
+ *   when joining the list items back together) and whitespace around each list item is stripped
+ *   before it is added to the model.
+ *
+ * ### Example with Validation
+ *
+ * <example name="ngList-directive" module="listExample">
+ *   <file name="app.js">
+ *      angular.module('listExample', [])
+ *        .controller('ExampleController', ['$scope', function($scope) {
+ *          $scope.names = ['morpheus', 'neo', 'trinity'];
+ *        }]);
+ *   </file>
+ *   <file name="index.html">
+ *    <form name="myForm" ng-controller="ExampleController">
+ *      <label>List: <input name="namesInput" ng-model="names" ng-list required></label>
+ *      <span role="alert">
+ *        <span class="error" ng-show="myForm.namesInput.$error.required">
+ *        Required!</span>
+ *      </span>
+ *      <br>
+ *      <tt>names = {{names}}</tt><br/>
+ *      <tt>myForm.namesInput.$valid = {{myForm.namesInput.$valid}}</tt><br/>
+ *      <tt>myForm.namesInput.$error = {{myForm.namesInput.$error}}</tt><br/>
+ *      <tt>myForm.$valid = {{myForm.$valid}}</tt><br/>
+ *      <tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br/>
+ *     </form>
+ *   </file>
+ *   <file name="protractor.js" type="protractor">
+ *     var listInput = element(by.model('names'));
+ *     var names = element(by.exactBinding('names'));
+ *     var valid = element(by.binding('myForm.namesInput.$valid'));
+ *     var error = element(by.css('span.error'));
+ *
+ *     it('should initialize to model', function() {
+ *       expect(names.getText()).toContain('["morpheus","neo","trinity"]');
+ *       expect(valid.getText()).toContain('true');
+ *       expect(error.getCssValue('display')).toBe('none');
+ *     });
+ *
+ *     it('should be invalid if empty', function() {
+ *       listInput.clear();
+ *       listInput.sendKeys('');
+ *
+ *       expect(names.getText()).toContain('');
+ *       expect(valid.getText()).toContain('false');
+ *       expect(error.getCssValue('display')).not.toBe('none');
+ *     });
+ *   </file>
+ * </example>
+ *
+ * ### Example - splitting on newline
+ * <example name="ngList-directive-newlines">
+ *   <file name="index.html">
+ *    <textarea ng-model="list" ng-list="&#10;" ng-trim="false"></textarea>
+ *    <pre>{{ list | json }}</pre>
+ *   </file>
+ *   <file name="protractor.js" type="protractor">
+ *     it("should split the text by newlines", function() {
+ *       var listInput = element(by.model('list'));
+ *       var output = element(by.binding('list | json'));
+ *       listInput.sendKeys('abc\ndef\nghi');
+ *       expect(output.getText()).toContain('[\n  "abc",\n  "def",\n  "ghi"\n]');
+ *     });
+ *   </file>
+ * </example>
+ *
+ * @element input
+ * @param {string=} ngList optional delimiter that should be used to split the value.
+ */
+var ngListDirective = function() {
+  return {
+    restrict: 'A',
+    priority: 100,
+    require: 'ngModel',
+    link: function(scope, element, attr, ctrl) {
+      // We want to control whitespace trimming so we use this convoluted approach
+      // to access the ngList attribute, which doesn't pre-trim the attribute
+      var ngList = element.attr(attr.$attr.ngList) || ', ';
+      var trimValues = attr.ngTrim !== 'false';
+      var separator = trimValues ? trim(ngList) : ngList;
+
+      var parse = function(viewValue) {
+        // If the viewValue is invalid (say required but empty) it will be `undefined`
+        if (isUndefined(viewValue)) return;
+
+        var list = [];
+
+        if (viewValue) {
+          forEach(viewValue.split(separator), function(value) {
+            if (value) list.push(trimValues ? trim(value) : value);
+          });
+        }
+
+        return list;
+      };
+
+      ctrl.$parsers.push(parse);
+      ctrl.$formatters.push(function(value) {
+        if (isArray(value)) {
+          return value.join(ngList);
+        }
+
+        return undefined;
+      });
+
+      // Override the standard $isEmpty because an empty array means the input is empty.
+      ctrl.$isEmpty = function(value) {
+        return !value || !value.length;
+      };
+    }
+  };
+};
+
+/* global VALID_CLASS: true,
+  INVALID_CLASS: true,
+  PRISTINE_CLASS: true,
+  DIRTY_CLASS: true,
+  UNTOUCHED_CLASS: true,
+  TOUCHED_CLASS: true,
+*/
+
+var VALID_CLASS = 'ng-valid',
+    INVALID_CLASS = 'ng-invalid',
+    PRISTINE_CLASS = 'ng-pristine',
+    DIRTY_CLASS = 'ng-dirty',
+    UNTOUCHED_CLASS = 'ng-untouched',
+    TOUCHED_CLASS = 'ng-touched',
+    PENDING_CLASS = 'ng-pending',
+    EMPTY_CLASS = 'ng-empty',
+    NOT_EMPTY_CLASS = 'ng-not-empty';
+
+var ngModelMinErr = minErr('ngModel');
+
+/**
+ * @ngdoc type
+ * @name ngModel.NgModelController
+ *
+ * @property {*} $viewValue The actual value from the control's view. For `input` elements, this is a
+ * String. See {@link ngModel.NgModelController#$setViewValue} for information about when the $viewValue
+ * is set.
+ * @property {*} $modelValue The value in the model that the control is bound to.
+ * @property {Array.<Function>} $parsers Array of functions to execute, as a pipeline, whenever
+       the control reads value from the DOM. The functions are called in array order, each passing
+       its return value through to the next. The last return value is forwarded to the
+       {@link ngModel.NgModelController#$validators `$validators`} collection.
+
+Parsers are used to sanitize / convert the {@link ngModel.NgModelController#$viewValue
+`$viewValue`}.
+
+Returning `undefined` from a parser means a parse error occurred. In that case,
+no {@link ngModel.NgModelController#$validators `$validators`} will run and the `ngModel`
+will be set to `undefined` unless {@link ngModelOptions `ngModelOptions.allowInvalid`}
+is set to `true`. The parse error is stored in `ngModel.$error.parse`.
+
+ *
+ * @property {Array.<Function>} $formatters Array of functions to execute, as a pipeline, whenever
+       the model value changes. The functions are called in reverse array order, each passing the value through to the
+       next. The last return value is used as the actual DOM value.
+       Used to format / convert values for display in the control.
+ * ```js
+ * function formatter(value) {
+ *   if (value) {
+ *     return value.toUpperCase();
+ *   }
+ * }
+ * ngModel.$formatters.push(formatter);
+ * ```
+ *
+ * @property {Object.<string, function>} $validators A collection of validators that are applied
+ *      whenever the model value changes. The key value within the object refers to the name of the
+ *      validator while the function refers to the validation operation. The validation operation is
+ *      provided with the model value as an argument and must return a true or false value depending
+ *      on the response of that validation.
+ *
+ * ```js
+ * ngModel.$validators.validCharacters = function(modelValue, viewValue) {
+ *   var value = modelValue || viewValue;
+ *   return /[0-9]+/.test(value) &&
+ *          /[a-z]+/.test(value) &&
+ *          /[A-Z]+/.test(value) &&
+ *          /\W+/.test(value);
+ * };
+ * ```
+ *
+ * @property {Object.<string, function>} $asyncValidators A collection of validations that are expected to
+ *      perform an asynchronous validation (e.g. a HTTP request). The validation function that is provided
+ *      is expected to return a promise when it is run during the model validation process. Once the promise
+ *      is delivered then the validation status will be set to true when fulfilled and false when rejected.
+ *      When the asynchronous validators are triggered, each of the validators will run in parallel and the model
+ *      value will only be updated once all validators have been fulfilled. As long as an asynchronous validator
+ *      is unfulfilled, its key will be added to the controllers `$pending` property. Also, all asynchronous validators
+ *      will only run once all synchronous validators have passed.
+ *
+ * Please note that if $http is used then it is important that the server returns a success HTTP response code
+ * in order to fulfill the validation and a status level of `4xx` in order to reject the validation.
+ *
+ * ```js
+ * ngModel.$asyncValidators.uniqueUsername = function(modelValue, viewValue) {
+ *   var value = modelValue || viewValue;
+ *
+ *   // Lookup user by username
+ *   return $http.get('/api/users/' + value).
+ *      then(function resolved() {
+ *        //username exists, this means validation fails
+ *        return $q.reject('exists');
+ *      }, function rejected() {
+ *        //username does not exist, therefore this validation passes
+ *        return true;
+ *      });
+ * };
+ * ```
+ *
+ * @property {Array.<Function>} $viewChangeListeners Array of functions to execute whenever the
+ *     view value has changed. It is called with no arguments, and its return value is ignored.
+ *     This can be used in place of additional $watches against the model value.
+ *
+ * @property {Object} $error An object hash with all failing validator ids as keys.
+ * @property {Object} $pending An object hash with all pending validator ids as keys.
+ *
+ * @property {boolean} $untouched True if control has not lost focus yet.
+ * @property {boolean} $touched True if control has lost focus.
+ * @property {boolean} $pristine True if user has not interacted with the control yet.
+ * @property {boolean} $dirty True if user has already interacted with the control.
+ * @property {boolean} $valid True if there is no error.
+ * @property {boolean} $invalid True if at least one error on the control.
+ * @property {string} $name The name attribute of the control.
+ *
+ * @description
+ *
+ * `NgModelController` provides API for the {@link ngModel `ngModel`} directive.
+ * The controller contains services for data-binding, validation, CSS updates, and value formatting
+ * and parsing. It purposefully does not contain any logic which deals with DOM rendering or
+ * listening to DOM events.
+ * Such DOM related logic should be provided by other directives which make use of
+ * `NgModelController` for data-binding to control elements.
+ * Angular provides this DOM logic for most {@link input `input`} elements.
+ * At the end of this page you can find a {@link ngModel.NgModelController#custom-control-example
+ * custom control example} that uses `ngModelController` to bind to `contenteditable` elements.
+ *
+ * @example
+ * ### Custom Control Example
+ * This example shows how to use `NgModelController` with a custom control to achieve
+ * data-binding. Notice how different directives (`contenteditable`, `ng-model`, and `required`)
+ * collaborate together to achieve the desired result.
+ *
+ * `contenteditable` is an HTML5 attribute, which tells the browser to let the element
+ * contents be edited in place by the user.
+ *
+ * We are using the {@link ng.service:$sce $sce} service here and include the {@link ngSanitize $sanitize}
+ * module to automatically remove "bad" content like inline event listener (e.g. `<span onclick="...">`).
+ * However, as we are using `$sce` the model can still decide to provide unsafe content if it marks
+ * that content using the `$sce` service.
+ *
+ * <example name="NgModelController" module="customControl" deps="angular-sanitize.js">
+    <file name="style.css">
+      [contenteditable] {
+        border: 1px solid black;
+        background-color: white;
+        min-height: 20px;
+      }
+
+      .ng-invalid {
+        border: 1px solid red;
+      }
+
+    </file>
+    <file name="script.js">
+      angular.module('customControl', ['ngSanitize']).
+        directive('contenteditable', ['$sce', function($sce) {
+          return {
+            restrict: 'A', // only activate on element attribute
+            require: '?ngModel', // get a hold of NgModelController
+            link: function(scope, element, attrs, ngModel) {
+              if (!ngModel) return; // do nothing if no ng-model
+
+              // Specify how UI should be updated
+              ngModel.$render = function() {
+                element.html($sce.getTrustedHtml(ngModel.$viewValue || ''));
+              };
+
+              // Listen for change events to enable binding
+              element.on('blur keyup change', function() {
+                scope.$evalAsync(read);
+              });
+              read(); // initialize
+
+              // Write data to the model
+              function read() {
+                var html = element.html();
+                // When we clear the content editable the browser leaves a <br> behind
+                // If strip-br attribute is provided then we strip this out
+                if ( attrs.stripBr && html == '<br>' ) {
+                  html = '';
+                }
+                ngModel.$setViewValue(html);
+              }
+            }
+          };
+        }]);
+    </file>
+    <file name="index.html">
+      <form name="myForm">
+       <div contenteditable
+            name="myWidget" ng-model="userContent"
+            strip-br="true"
+            required>Change me!</div>
+        <span ng-show="myForm.myWidget.$error.required">Required!</span>
+       <hr>
+       <textarea ng-model="userContent" aria-label="Dynamic textarea"></textarea>
+      </form>
+    </file>
+    <file name="protractor.js" type="protractor">
+    it('should data-bind and become invalid', function() {
+      if (browser.params.browser == 'safari' || browser.params.browser == 'firefox') {
+        // SafariDriver can't handle contenteditable
+        // and Firefox driver can't clear contenteditables very well
+        return;
+      }
+      var contentEditable = element(by.css('[contenteditable]'));
+      var content = 'Change me!';
+
+      expect(contentEditable.getText()).toEqual(content);
+
+      contentEditable.clear();
+      contentEditable.sendKeys(protractor.Key.BACK_SPACE);
+      expect(contentEditable.getText()).toEqual('');
+      expect(contentEditable.getAttribute('class')).toMatch(/ng-invalid-required/);
+    });
+    </file>
+ * </example>
+ *
+ *
+ */
+var NgModelController = ['$scope', '$exceptionHandler', '$attrs', '$element', '$parse', '$animate', '$timeout', '$rootScope', '$q', '$interpolate',
+    function($scope, $exceptionHandler, $attr, $element, $parse, $animate, $timeout, $rootScope, $q, $interpolate) {
+  this.$viewValue = Number.NaN;
+  this.$modelValue = Number.NaN;
+  this.$$rawModelValue = undefined; // stores the parsed modelValue / model set from scope regardless of validity.
+  this.$validators = {};
+  this.$asyncValidators = {};
+  this.$parsers = [];
+  this.$formatters = [];
+  this.$viewChangeListeners = [];
+  this.$untouched = true;
+  this.$touched = false;
+  this.$pristine = true;
+  this.$dirty = false;
+  this.$valid = true;
+  this.$invalid = false;
+  this.$error = {}; // keep invalid keys here
+  this.$$success = {}; // keep valid keys here
+  this.$pending = undefined; // keep pending keys here
+  this.$name = $interpolate($attr.name || '', false)($scope);
+  this.$$parentForm = nullFormCtrl;
+
+  var parsedNgModel = $parse($attr.ngModel),
+      parsedNgModelAssign = parsedNgModel.assign,
+      ngModelGet = parsedNgModel,
+      ngModelSet = parsedNgModelAssign,
+      pendingDebounce = null,
+      parserValid,
+      ctrl = this;
+
+  this.$$setOptions = function(options) {
+    ctrl.$options = options;
+    if (options && options.getterSetter) {
+      var invokeModelGetter = $parse($attr.ngModel + '()'),
+          invokeModelSetter = $parse($attr.ngModel + '($$$p)');
+
+      ngModelGet = function($scope) {
+        var modelValue = parsedNgModel($scope);
+        if (isFunction(modelValue)) {
+          modelValue = invokeModelGetter($scope);
+        }
+        return modelValue;
+      };
+      ngModelSet = function($scope, newValue) {
+        if (isFunction(parsedNgModel($scope))) {
+          invokeModelSetter($scope, {$$$p: newValue});
+        } else {
+          parsedNgModelAssign($scope, newValue);
+        }
+      };
+    } else if (!parsedNgModel.assign) {
+      throw ngModelMinErr('nonassign', "Expression '{0}' is non-assignable. Element: {1}",
+          $attr.ngModel, startingTag($element));
+    }
+  };
+
+  /**
+   * @ngdoc method
+   * @name ngModel.NgModelController#$render
+   *
+   * @description
+   * Called when the view needs to be updated. It is expected that the user of the ng-model
+   * directive will implement this method.
+   *
+   * The `$render()` method is invoked in the following situations:
+   *
+   * * `$rollbackViewValue()` is called.  If we are rolling back the view value to the last
+   *   committed value then `$render()` is called to update the input control.
+   * * The value referenced by `ng-model` is changed programmatically and both the `$modelValue` and
+   *   the `$viewValue` are different from last time.
+   *
+   * Since `ng-model` does not do a deep watch, `$render()` is only invoked if the values of
+   * `$modelValue` and `$viewValue` are actually different from their previous values. If `$modelValue`
+   * or `$viewValue` are objects (rather than a string or number) then `$render()` will not be
+   * invoked if you only change a property on the objects.
+   */
+  this.$render = noop;
+
+  /**
+   * @ngdoc method
+   * @name ngModel.NgModelController#$isEmpty
+   *
+   * @description
+   * This is called when we need to determine if the value of an input is empty.
+   *
+   * For instance, the required directive does this to work out if the input has data or not.
+   *
+   * The default `$isEmpty` function checks whether the value is `undefined`, `''`, `null` or `NaN`.
+   *
+   * You can override this for input directives whose concept of being empty is different from the
+   * default. The `checkboxInputType` directive does this because in its case a value of `false`
+   * implies empty.
+   *
+   * @param {*} value The value of the input to check for emptiness.
+   * @returns {boolean} True if `value` is "empty".
+   */
+  this.$isEmpty = function(value) {
+    return isUndefined(value) || value === '' || value === null || value !== value;
+  };
+
+  this.$$updateEmptyClasses = function(value) {
+    if (ctrl.$isEmpty(value)) {
+      $animate.removeClass($element, NOT_EMPTY_CLASS);
+      $animate.addClass($element, EMPTY_CLASS);
+    } else {
+      $animate.removeClass($element, EMPTY_CLASS);
+      $animate.addClass($element, NOT_EMPTY_CLASS);
+    }
+  };
+
+
+  var currentValidationRunId = 0;
+
+  /**
+   * @ngdoc method
+   * @name ngModel.NgModelController#$setValidity
+   *
+   * @description
+   * Change the validity state, and notify the form.
+   *
+   * This method can be called within $parsers/$formatters or a custom validation implementation.
+   * However, in most cases it should be sufficient to use the `ngModel.$validators` and
+   * `ngModel.$asyncValidators` collections which will call `$setValidity` automatically.
+   *
+   * @param {string} validationErrorKey Name of the validator. The `validationErrorKey` will be assigned
+   *        to either `$error[validationErrorKey]` or `$pending[validationErrorKey]`
+   *        (for unfulfilled `$asyncValidators`), so that it is available for data-binding.
+   *        The `validationErrorKey` should be in camelCase and will get converted into dash-case
+   *        for class name. Example: `myError` will result in `ng-valid-my-error` and `ng-invalid-my-error`
+   *        class and can be bound to as  `{{someForm.someControl.$error.myError}}` .
+   * @param {boolean} isValid Whether the current state is valid (true), invalid (false), pending (undefined),
+   *                          or skipped (null). Pending is used for unfulfilled `$asyncValidators`.
+   *                          Skipped is used by Angular when validators do not run because of parse errors and
+   *                          when `$asyncValidators` do not run because any of the `$validators` failed.
+   */
+  addSetValidityMethod({
+    ctrl: this,
+    $element: $element,
+    set: function(object, property) {
+      object[property] = true;
+    },
+    unset: function(object, property) {
+      delete object[property];
+    },
+    $animate: $animate
+  });
+
+  /**
+   * @ngdoc method
+   * @name ngModel.NgModelController#$setPristine
+   *
+   * @description
+   * Sets the control to its pristine state.
+   *
+   * This method can be called to remove the `ng-dirty` class and set the control to its pristine
+   * state (`ng-pristine` class). A model is considered to be pristine when the control
+   * has not been changed from when first compiled.
+   */
+  this.$setPristine = function() {
+    ctrl.$dirty = false;
+    ctrl.$pristine = true;
+    $animate.removeClass($element, DIRTY_CLASS);
+    $animate.addClass($element, PRISTINE_CLASS);
+  };
+
+  /**
+   * @ngdoc method
+   * @name ngModel.NgModelController#$setDirty
+   *
+   * @description
+   * Sets the control to its dirty state.
+   *
+   * This method can be called to remove the `ng-pristine` class and set the control to its dirty
+   * state (`ng-dirty` class). A model is considered to be dirty when the control has been changed
+   * from when first compiled.
+   */
+  this.$setDirty = function() {
+    ctrl.$dirty = true;
+    ctrl.$pristine = false;
+    $animate.removeClass($element, PRISTINE_CLASS);
+    $animate.addClass($element, DIRTY_CLASS);
+    ctrl.$$parentForm.$setDirty();
+  };
+
+  /**
+   * @ngdoc method
+   * @name ngModel.NgModelController#$setUntouched
+   *
+   * @description
+   * Sets the control to its untouched state.
+   *
+   * This method can be called to remove the `ng-touched` class and set the control to its
+   * untouched state (`ng-untouched` class). Upon compilation, a model is set as untouched
+   * by default, however this function can be used to restore that state if the model has
+   * already been touched by the user.
+   */
+  this.$setUntouched = function() {
+    ctrl.$touched = false;
+    ctrl.$untouched = true;
+    $animate.setClass($element, UNTOUCHED_CLASS, TOUCHED_CLASS);
+  };
+
+  /**
+   * @ngdoc method
+   * @name ngModel.NgModelController#$setTouched
+   *
+   * @description
+   * Sets the control to its touched state.
+   *
+   * This method can be called to remove the `ng-untouched` class and set the control to its
+   * touched state (`ng-touched` class). A model is considered to be touched when the user has
+   * first focused the control element and then shifted focus away from the control (blur event).
+   */
+  this.$setTouched = function() {
+    ctrl.$touched = true;
+    ctrl.$untouched = false;
+    $animate.setClass($element, TOUCHED_CLASS, UNTOUCHED_CLASS);
+  };
+
+  /**
+   * @ngdoc method
+   * @name ngModel.NgModelController#$rollbackViewValue
+   *
+   * @description
+   * Cancel an update and reset the input element's value to prevent an update to the `$modelValue`,
+   * which may be caused by a pending debounced event or because the input is waiting for a some
+   * future event.
+   *
+   * If you have an input that uses `ng-model-options` to set up debounced updates or updates that
+   * depend on special events such as blur, you can have a situation where there is a period when
+   * the `$viewValue` is out of sync with the ngModel's `$modelValue`.
+   *
+   * In this case, you can use `$rollbackViewValue()` to manually cancel the debounced / future update
+   * and reset the input to the last committed view value.
+   *
+   * It is also possible that you run into difficulties if you try to update the ngModel's `$modelValue`
+   * programmatically before these debounced/future events have resolved/occurred, because Angular's
+   * dirty checking mechanism is not able to tell whether the model has actually changed or not.
+   *
+   * The `$rollbackViewValue()` method should be called before programmatically changing the model of an
+   * input which may have such events pending. This is important in order to make sure that the
+   * input field will be updated with the new model value and any pending operations are cancelled.
+   *
+   * <example name="ng-model-cancel-update" module="cancel-update-example">
+   *   <file name="app.js">
+   *     angular.module('cancel-update-example', [])
+   *
+   *     .controller('CancelUpdateController', ['$scope', function($scope) {
+   *       $scope.model = {};
+   *
+   *       $scope.setEmpty = function(e, value, rollback) {
+   *         if (e.keyCode == 27) {
+   *           e.preventDefault();
+   *           if (rollback) {
+   *             $scope.myForm[value].$rollbackViewValue();
+   *           }
+   *           $scope.model[value] = '';
+   *         }
+   *       };
+   *     }]);
+   *   </file>
+   *   <file name="index.html">
+   *     <div ng-controller="CancelUpdateController">
+   *        <p>Both of these inputs are only updated if they are blurred. Hitting escape should
+   *        empty them. Follow these steps and observe the difference:</p>
+   *       <ol>
+   *         <li>Type something in the input. You will see that the model is not yet updated</li>
+   *         <li>Press the Escape key.
+   *           <ol>
+   *             <li> In the first example, nothing happens, because the model is already '', and no
+   *             update is detected. If you blur the input, the model will be set to the current view.
+   *             </li>
+   *             <li> In the second example, the pending update is cancelled, and the input is set back
+   *             to the last committed view value (''). Blurring the input does nothing.
+   *             </li>
+   *           </ol>
+   *         </li>
+   *       </ol>
+   *
+   *       <form name="myForm" ng-model-options="{ updateOn: 'blur' }">
+   *         <div>
+   *        <p id="inputDescription1">Without $rollbackViewValue():</p>
+   *         <input name="value1" aria-describedby="inputDescription1" ng-model="model.value1"
+   *                ng-keydown="setEmpty($event, 'value1')">
+   *         value1: "{{ model.value1 }}"
+   *         </div>
+   *
+   *         <div>
+   *        <p id="inputDescription2">With $rollbackViewValue():</p>
+   *         <input name="value2" aria-describedby="inputDescription2" ng-model="model.value2"
+   *                ng-keydown="setEmpty($event, 'value2', true)">
+   *         value2: "{{ model.value2 }}"
+   *         </div>
+   *       </form>
+   *     </div>
+   *   </file>
+       <file name="style.css">
+          div {
+            display: table-cell;
+          }
+          div:nth-child(1) {
+            padding-right: 30px;
+          }
+
+        </file>
+   * </example>
+   */
+  this.$rollbackViewValue = function() {
+    $timeout.cancel(pendingDebounce);
+    ctrl.$viewValue = ctrl.$$lastCommittedViewValue;
+    ctrl.$render();
+  };
+
+  /**
+   * @ngdoc method
+   * @name ngModel.NgModelController#$validate
+   *
+   * @description
+   * Runs each of the registered validators (first synchronous validators and then
+   * asynchronous validators).
+   * If the validity changes to invalid, the model will be set to `undefined`,
+   * unless {@link ngModelOptions `ngModelOptions.allowInvalid`} is `true`.
+   * If the validity changes to valid, it will set the model to the last available valid
+   * `$modelValue`, i.e. either the last parsed value or the last value set from the scope.
+   */
+  this.$validate = function() {
+    // ignore $validate before model is initialized
+    if (isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue)) {
+      return;
+    }
+
+    var viewValue = ctrl.$$lastCommittedViewValue;
+    // Note: we use the $$rawModelValue as $modelValue might have been
+    // set to undefined during a view -> model update that found validation
+    // errors. We can't parse the view here, since that could change
+    // the model although neither viewValue nor the model on the scope changed
+    var modelValue = ctrl.$$rawModelValue;
+
+    var prevValid = ctrl.$valid;
+    var prevModelValue = ctrl.$modelValue;
+
+    var allowInvalid = ctrl.$options && ctrl.$options.allowInvalid;
+
+    ctrl.$$runValidators(modelValue, viewValue, function(allValid) {
+      // If there was no change in validity, don't update the model
+      // This prevents changing an invalid modelValue to undefined
+      if (!allowInvalid && prevValid !== allValid) {
+        // Note: Don't check ctrl.$valid here, as we could have
+        // external validators (e.g. calculated on the server),
+        // that just call $setValidity and need the model value
+        // to calculate their validity.
+        ctrl.$modelValue = allValid ? modelValue : undefined;
+
+        if (ctrl.$modelValue !== prevModelValue) {
+          ctrl.$$writeModelToScope();
+        }
+      }
+    });
+
+  };
+
+  this.$$runValidators = function(modelValue, viewValue, doneCallback) {
+    currentValidationRunId++;
+    var localValidationRunId = currentValidationRunId;
+
+    // check parser error
+    if (!processParseErrors()) {
+      validationDone(false);
+      return;
+    }
+    if (!processSyncValidators()) {
+      validationDone(false);
+      return;
+    }
+    processAsyncValidators();
+
+    function processParseErrors() {
+      var errorKey = ctrl.$$parserName || 'parse';
+      if (isUndefined(parserValid)) {
+        setValidity(errorKey, null);
+      } else {
+        if (!parserValid) {
+          forEach(ctrl.$validators, function(v, name) {
+            setValidity(name, null);
+          });
+          forEach(ctrl.$asyncValidators, function(v, name) {
+            setValidity(name, null);
+          });
+        }
+        // Set the parse error last, to prevent unsetting it, should a $validators key == parserName
+        setValidity(errorKey, parserValid);
+        return parserValid;
+      }
+      return true;
+    }
+
+    function processSyncValidators() {
+      var syncValidatorsValid = true;
+      forEach(ctrl.$validators, function(validator, name) {
+        var result = validator(modelValue, viewValue);
+        syncValidatorsValid = syncValidatorsValid && result;
+        setValidity(name, result);
+      });
+      if (!syncValidatorsValid) {
+        forEach(ctrl.$asyncValidators, function(v, name) {
+          setValidity(name, null);
+        });
+        return false;
+      }
+      return true;
+    }
+
+    function processAsyncValidators() {
+      var validatorPromises = [];
+      var allValid = true;
+      forEach(ctrl.$asyncValidators, function(validator, name) {
+        var promise = validator(modelValue, viewValue);
+        if (!isPromiseLike(promise)) {
+          throw ngModelMinErr('nopromise',
+            "Expected asynchronous validator to return a promise but got '{0}' instead.", promise);
+        }
+        setValidity(name, undefined);
+        validatorPromises.push(promise.then(function() {
+          setValidity(name, true);
+        }, function() {
+          allValid = false;
+          setValidity(name, false);
+        }));
+      });
+      if (!validatorPromises.length) {
+        validationDone(true);
+      } else {
+        $q.all(validatorPromises).then(function() {
+          validationDone(allValid);
+        }, noop);
+      }
+    }
+
+    function setValidity(name, isValid) {
+      if (localValidationRunId === currentValidationRunId) {
+        ctrl.$setValidity(name, isValid);
+      }
+    }
+
+    function validationDone(allValid) {
+      if (localValidationRunId === currentValidationRunId) {
+
+        doneCallback(allValid);
+      }
+    }
+  };
+
+  /**
+   * @ngdoc method
+   * @name ngModel.NgModelController#$commitViewValue
+   *
+   * @description
+   * Commit a pending update to the `$modelValue`.
+   *
+   * Updates may be pending by a debounced event or because the input is waiting for a some future
+   * event defined in `ng-model-options`. this method is rarely needed as `NgModelController`
+   * usually handles calling this in response to input events.
+   */
+  this.$commitViewValue = function() {
+    var viewValue = ctrl.$viewValue;
+
+    $timeout.cancel(pendingDebounce);
+
+    // If the view value has not changed then we should just exit, except in the case where there is
+    // a native validator on the element. In this case the validation state may have changed even though
+    // the viewValue has stayed empty.
+    if (ctrl.$$lastCommittedViewValue === viewValue && (viewValue !== '' || !ctrl.$$hasNativeValidators)) {
+      return;
+    }
+    ctrl.$$updateEmptyClasses(viewValue);
+    ctrl.$$lastCommittedViewValue = viewValue;
+
+    // change to dirty
+    if (ctrl.$pristine) {
+      this.$setDirty();
+    }
+    this.$$parseAndValidate();
+  };
+
+  this.$$parseAndValidate = function() {
+    var viewValue = ctrl.$$lastCommittedViewValue;
+    var modelValue = viewValue;
+    parserValid = isUndefined(modelValue) ? undefined : true;
+
+    if (parserValid) {
+      for (var i = 0; i < ctrl.$parsers.length; i++) {
+        modelValue = ctrl.$parsers[i](modelValue);
+        if (isUndefined(modelValue)) {
+          parserValid = false;
+          break;
+        }
+      }
+    }
+    if (isNumber(ctrl.$modelValue) && isNaN(ctrl.$modelValue)) {
+      // ctrl.$modelValue has not been touched yet...
+      ctrl.$modelValue = ngModelGet($scope);
+    }
+    var prevModelValue = ctrl.$modelValue;
+    var allowInvalid = ctrl.$options && ctrl.$options.allowInvalid;
+    ctrl.$$rawModelValue = modelValue;
+
+    if (allowInvalid) {
+      ctrl.$modelValue = modelValue;
+      writeToModelIfNeeded();
+    }
+
+    // Pass the $$lastCommittedViewValue here, because the cached viewValue might be out of date.
+    // This can happen if e.g. $setViewValue is called from inside a parser
+    ctrl.$$runValidators(modelValue, ctrl.$$lastCommittedViewValue, function(allValid) {
+      if (!allowInvalid) {
+        // Note: Don't check ctrl.$valid here, as we could have
+        // external validators (e.g. calculated on the server),
+        // that just call $setValidity and need the model value
+        // to calculate their validity.
+        ctrl.$modelValue = allValid ? modelValue : undefined;
+        writeToModelIfNeeded();
+      }
+    });
+
+    function writeToModelIfNeeded() {
+      if (ctrl.$modelValue !== prevModelValue) {
+        ctrl.$$writeModelToScope();
+      }
+    }
+  };
+
+  this.$$writeModelToScope = function() {
+    ngModelSet($scope, ctrl.$modelValue);
+    forEach(ctrl.$viewChangeListeners, function(listener) {
+      try {
+        listener();
+      } catch (e) {
+        $exceptionHandler(e);
+      }
+    });
+  };
+
+  /**
+   * @ngdoc method
+   * @name ngModel.NgModelController#$setViewValue
+   *
+   * @description
+   * Update the view value.
+   *
+   * This method should be called when a control wants to change the view value; typically,
+   * this is done from within a DOM event handler. For example, the {@link ng.directive:input input}
+   * directive calls it when the value of the input changes and {@link ng.directive:select select}
+   * calls it when an option is selected.
+   *
+   * When `$setViewValue` is called, the new `value` will be staged for committing through the `$parsers`
+   * and `$validators` pipelines. If there are no special {@link ngModelOptions} specified then the staged
+   * value sent directly for processing, finally to be applied to `$modelValue` and then the
+   * **expression** specified in the `ng-model` attribute. Lastly, all the registered change listeners,
+   * in the `$viewChangeListeners` list, are called.
+   *
+   * In case the {@link ng.directive:ngModelOptions ngModelOptions} directive is used with `updateOn`
+   * and the `default` trigger is not listed, all those actions will remain pending until one of the
+   * `updateOn` events is triggered on the DOM element.
+   * All these actions will be debounced if the {@link ng.directive:ngModelOptions ngModelOptions}
+   * directive is used with a custom debounce for this particular event.
+   * Note that a `$digest` is only triggered once the `updateOn` events are fired, or if `debounce`
+   * is specified, once the timer runs out.
+   *
+   * When used with standard inputs, the view value will always be a string (which is in some cases
+   * parsed into another type, such as a `Date` object for `input[date]`.)
+   * However, custom controls might also pass objects to this method. In this case, we should make
+   * a copy of the object before passing it to `$setViewValue`. This is because `ngModel` does not
+   * perform a deep watch of objects, it only looks for a change of identity. If you only change
+   * the property of the object then ngModel will not realize that the object has changed and
+   * will not invoke the `$parsers` and `$validators` pipelines. For this reason, you should
+   * not change properties of the copy once it has been passed to `$setViewValue`.
+   * Otherwise you may cause the model value on the scope to change incorrectly.
+   *
+   * <div class="alert alert-info">
+   * In any case, the value passed to the method should always reflect the current value
+   * of the control. For example, if you are calling `$setViewValue` for an input element,
+   * you should pass the input DOM value. Otherwise, the control and the scope model become
+   * out of sync. It's also important to note that `$setViewValue` does not call `$render` or change
+   * the control's DOM value in any way. If we want to change the control's DOM value
+   * programmatically, we should update the `ngModel` scope expression. Its new value will be
+   * picked up by the model controller, which will run it through the `$formatters`, `$render` it
+   * to update the DOM, and finally call `$validate` on it.
+   * </div>
+   *
+   * @param {*} value value from the view.
+   * @param {string} trigger Event that triggered the update.
+   */
+  this.$setViewValue = function(value, trigger) {
+    ctrl.$viewValue = value;
+    if (!ctrl.$options || ctrl.$options.updateOnDefault) {
+      ctrl.$$debounceViewValueCommit(trigger);
+    }
+  };
+
+  this.$$debounceViewValueCommit = function(trigger) {
+    var debounceDelay = 0,
+        options = ctrl.$options,
+        debounce;
+
+    if (options && isDefined(options.debounce)) {
+      debounce = options.debounce;
+      if (isNumber(debounce)) {
+        debounceDelay = debounce;
+      } else if (isNumber(debounce[trigger])) {
+        debounceDelay = debounce[trigger];
+      } else if (isNumber(debounce['default'])) {
+        debounceDelay = debounce['default'];
+      }
+    }
+
+    $timeout.cancel(pendingDebounce);
+    if (debounceDelay) {
+      pendingDebounce = $timeout(function() {
+        ctrl.$commitViewValue();
+      }, debounceDelay);
+    } else if ($rootScope.$$phase) {
+      ctrl.$commitViewValue();
+    } else {
+      $scope.$apply(function() {
+        ctrl.$commitViewValue();
+      });
+    }
+  };
+
+  // model -> value
+  // Note: we cannot use a normal scope.$watch as we want to detect the following:
+  // 1. scope value is 'a'
+  // 2. user enters 'b'
+  // 3. ng-change kicks in and reverts scope value to 'a'
+  //    -> scope value did not change since the last digest as
+  //       ng-change executes in apply phase
+  // 4. view should be changed back to 'a'
+  $scope.$watch(function ngModelWatch() {
+    var modelValue = ngModelGet($scope);
+
+    // if scope model value and ngModel value are out of sync
+    // TODO(perf): why not move this to the action fn?
+    if (modelValue !== ctrl.$modelValue &&
+       // checks for NaN is needed to allow setting the model to NaN when there's an asyncValidator
+       (ctrl.$modelValue === ctrl.$modelValue || modelValue === modelValue)
+    ) {
+      ctrl.$modelValue = ctrl.$$rawModelValue = modelValue;
+      parserValid = undefined;
+
+      var formatters = ctrl.$formatters,
+          idx = formatters.length;
+
+      var viewValue = modelValue;
+      while (idx--) {
+        viewValue = formatters[idx](viewValue);
+      }
+      if (ctrl.$viewValue !== viewValue) {
+        ctrl.$$updateEmptyClasses(viewValue);
+        ctrl.$viewValue = ctrl.$$lastCommittedViewValue = viewValue;
+        ctrl.$render();
+
+        ctrl.$$runValidators(modelValue, viewValue, noop);
+      }
+    }
+
+    return modelValue;
+  });
+}];
+
+
+/**
+ * @ngdoc directive
+ * @name ngModel
+ *
+ * @element input
+ * @priority 1
+ *
+ * @description
+ * The `ngModel` directive binds an `input`,`select`, `textarea` (or custom form control) to a
+ * property on the scope using {@link ngModel.NgModelController NgModelController},
+ * which is created and exposed by this directive.
+ *
+ * `ngModel` is responsible for:
+ *
+ * - Binding the view into the model, which other directives such as `input`, `textarea` or `select`
+ *   require.
+ * - Providing validation behavior (i.e. required, number, email, url).
+ * - Keeping the state of the control (valid/invalid, dirty/pristine, touched/untouched, validation errors).
+ * - Setting related css classes on the element (`ng-valid`, `ng-invalid`, `ng-dirty`, `ng-pristine`, `ng-touched`,
+ *   `ng-untouched`, `ng-empty`, `ng-not-empty`) including animations.
+ * - Registering the control with its parent {@link ng.directive:form form}.
+ *
+ * Note: `ngModel` will try to bind to the property given by evaluating the expression on the
+ * current scope. If the property doesn't already exist on this scope, it will be created
+ * implicitly and added to the scope.
+ *
+ * For best practices on using `ngModel`, see:
+ *
+ *  - [Understanding Scopes](https://github.com/angular/angular.js/wiki/Understanding-Scopes)
+ *
+ * For basic examples, how to use `ngModel`, see:
+ *
+ *  - {@link ng.directive:input input}
+ *    - {@link input[text] text}
+ *    - {@link input[checkbox] checkbox}
+ *    - {@link input[radio] radio}
+ *    - {@link input[number] number}
+ *    - {@link input[email] email}
+ *    - {@link input[url] url}
+ *    - {@link input[date] date}
+ *    - {@link input[datetime-local] datetime-local}
+ *    - {@link input[time] time}
+ *    - {@link input[month] month}
+ *    - {@link input[week] week}
+ *  - {@link ng.directive:select select}
+ *  - {@link ng.directive:textarea textarea}
+ *
+ * # Complex Models (objects or collections)
+ *
+ * By default, `ngModel` watches the model by reference, not value. This is important to know when
+ * binding inputs to models that are objects (e.g. `Date`) or collections (e.g. arrays). If only properties of the
+ * object or collection change, `ngModel` will not be notified and so the input will not be  re-rendered.
+ *
+ * The model must be assigned an entirely new object or collection before a re-rendering will occur.
+ *
+ * Some directives have options that will cause them to use a custom `$watchCollection` on the model expression
+ * - for example, `ngOptions` will do so when a `track by` clause is included in the comprehension expression or
+ * if the select is given the `multiple` attribute.
+ *
+ * The `$watchCollection()` method only does a shallow comparison, meaning that changing properties deeper than the
+ * first level of the object (or only changing the properties of an item in the collection if it's an array) will still
+ * not trigger a re-rendering of the model.
+ *
+ * # CSS classes
+ * The following CSS classes are added and removed on the associated input/select/textarea element
+ * depending on the validity of the model.
+ *
+ *  - `ng-valid`: the model is valid
+ *  - `ng-invalid`: the model is invalid
+ *  - `ng-valid-[key]`: for each valid key added by `$setValidity`
+ *  - `ng-invalid-[key]`: for each invalid key added by `$setValidity`
+ *  - `ng-pristine`: the control hasn't been interacted with yet
+ *  - `ng-dirty`: the control has been interacted with
+ *  - `ng-touched`: the control has been blurred
+ *  - `ng-untouched`: the control hasn't been blurred
+ *  - `ng-pending`: any `$asyncValidators` are unfulfilled
+ *  - `ng-empty`: the view does not contain a value or the value is deemed "empty", as defined
+ *     by the {@link ngModel.NgModelController#$isEmpty} method
+ *  - `ng-not-empty`: the view contains a non-empty value
+ *
+ * Keep in mind that ngAnimate can detect each of these classes when added and removed.
+ *
+ * ## Animation Hooks
+ *
+ * Animations within models are triggered when any of the associated CSS classes are added and removed
+ * on the input element which is attached to the model. These classes include: `.ng-pristine`, `.ng-dirty`,
+ * `.ng-invalid` and `.ng-valid` as well as any other validations that are performed on the model itself.
+ * The animations that are triggered within ngModel are similar to how they work in ngClass and
+ * animations can be hooked into using CSS transitions, keyframes as well as JS animations.
+ *
+ * The following example shows a simple way to utilize CSS transitions to style an input element
+ * that has been rendered as invalid after it has been validated:
+ *
+ * <pre>
+ * //be sure to include ngAnimate as a module to hook into more
+ * //advanced animations
+ * .my-input {
+ *   transition:0.5s linear all;
+ *   background: white;
+ * }
+ * .my-input.ng-invalid {
+ *   background: red;
+ *   color:white;
+ * }
+ * </pre>
+ *
+ * @example
+ * <example deps="angular-animate.js" animations="true" fixBase="true" module="inputExample">
+     <file name="index.html">
+       <script>
+        angular.module('inputExample', [])
+          .controller('ExampleController', ['$scope', function($scope) {
+            $scope.val = '1';
+          }]);
+       </script>
+       <style>
+         .my-input {
+           transition:all linear 0.5s;
+           background: transparent;
+         }
+         .my-input.ng-invalid {
+           color:white;
+           background: red;
+         }
+       </style>
+       <p id="inputDescription">
+        Update input to see transitions when valid/invalid.
+        Integer is a valid value.
+       </p>
+       <form name="testForm" ng-controller="ExampleController">
+         <input ng-model="val" ng-pattern="/^\d+$/" name="anim" class="my-input"
+                aria-describedby="inputDescription" />
+       </form>
+     </file>
+ * </example>
+ *
+ * ## Binding to a getter/setter
+ *
+ * Sometimes it's helpful to bind `ngModel` to a getter/setter function.  A getter/setter is a
+ * function that returns a representation of the model when called with zero arguments, and sets
+ * the internal state of a model when called with an argument. It's sometimes useful to use this
+ * for models that have an internal representation that's different from what the model exposes
+ * to the view.
+ *
+ * <div class="alert alert-success">
+ * **Best Practice:** It's best to keep getters fast because Angular is likely to call them more
+ * frequently than other parts of your code.
+ * </div>
+ *
+ * You use this behavior by adding `ng-model-options="{ getterSetter: true }"` to an element that
+ * has `ng-model` attached to it. You can also add `ng-model-options="{ getterSetter: true }"` to
+ * a `<form>`, which will enable this behavior for all `<input>`s within it. See
+ * {@link ng.directive:ngModelOptions `ngModelOptions`} for more.
+ *
+ * The following example shows how to use `ngModel` with a getter/setter:
+ *
+ * @example
+ * <example name="ngModel-getter-setter" module="getterSetterExample">
+     <file name="index.html">
+       <div ng-controller="ExampleController">
+         <form name="userForm">
+           <label>Name:
+             <input type="text" name="userName"
+                    ng-model="user.name"
+                    ng-model-options="{ getterSetter: true }" />
+           </label>
+         </form>
+         <pre>user.name = <span ng-bind="user.name()"></span></pre>
+       </div>
+     </file>
+     <file name="app.js">
+       angular.module('getterSetterExample', [])
+         .controller('ExampleController', ['$scope', function($scope) {
+           var _name = 'Brian';
+           $scope.user = {
+             name: function(newName) {
+              // Note that newName can be undefined for two reasons:
+              // 1. Because it is called as a getter and thus called with no arguments
+              // 2. Because the property should actually be set to undefined. This happens e.g. if the
+              //    input is invalid
+              return arguments.length ? (_name = newName) : _name;
+             }
+           };
+         }]);
+     </file>
+ * </example>
+ */
+var ngModelDirective = ['$rootScope', function($rootScope) {
+  return {
+    restrict: 'A',
+    require: ['ngModel', '^?form', '^?ngModelOptions'],
+    controller: NgModelController,
+    // Prelink needs to run before any input directive
+    // so that we can set the NgModelOptions in NgModelController
+    // before anyone else uses it.
+    priority: 1,
+    compile: function ngModelCompile(element) {
+      // Setup initial state of the control
+      element.addClass(PRISTINE_CLASS).addClass(UNTOUCHED_CLASS).addClass(VALID_CLASS);
+
+      return {
+        pre: function ngModelPreLink(scope, element, attr, ctrls) {
+          var modelCtrl = ctrls[0],
+              formCtrl = ctrls[1] || modelCtrl.$$parentForm;
+
+          modelCtrl.$$setOptions(ctrls[2] && ctrls[2].$options);
+
+          // notify others, especially parent forms
+          formCtrl.$addControl(modelCtrl);
+
+          attr.$observe('name', function(newValue) {
+            if (modelCtrl.$name !== newValue) {
+              modelCtrl.$$parentForm.$$renameControl(modelCtrl, newValue);
+            }
+          });
+
+          scope.$on('$destroy', function() {
+            modelCtrl.$$parentForm.$removeControl(modelCtrl);
+          });
+        },
+        post: function ngModelPostLink(scope, element, attr, ctrls) {
+          var modelCtrl = ctrls[0];
+          if (modelCtrl.$options && modelCtrl.$options.updateOn) {
+            element.on(modelCtrl.$options.updateOn, function(ev) {
+              modelCtrl.$$debounceViewValueCommit(ev && ev.type);
+            });
+          }
+
+          element.on('blur', function() {
+            if (modelCtrl.$touched) return;
+
+            if ($rootScope.$$phase) {
+              scope.$evalAsync(modelCtrl.$setTouched);
+            } else {
+              scope.$apply(modelCtrl.$setTouched);
+            }
+          });
+        }
+      };
+    }
+  };
+}];
+
+var DEFAULT_REGEXP = /(\s+|^)default(\s+|$)/;
+
+/**
+ * @ngdoc directive
+ * @name ngModelOptions
+ *
+ * @description
+ * Allows tuning how model updates are done. Using `ngModelOptions` you can specify a custom list of
+ * events that will trigger a model update and/or a debouncing delay so that the actual update only
+ * takes place when a timer expires; this timer will be reset after another change takes place.
+ *
+ * Given the nature of `ngModelOptions`, the value displayed inside input fields in the view might
+ * be different from the value in the actual model. This means that if you update the model you
+ * should also invoke {@link ngModel.NgModelController `$rollbackViewValue`} on the relevant input field in
+ * order to make sure it is synchronized with the model and that any debounced action is canceled.
+ *
+ * The easiest way to reference the control's {@link ngModel.NgModelController `$rollbackViewValue`}
+ * method is by making sure the input is placed inside a form that has a `name` attribute. This is
+ * important because `form` controllers are published to the related scope under the name in their
+ * `name` attribute.
+ *
+ * Any pending changes will take place immediately when an enclosing form is submitted via the
+ * `submit` event. Note that `ngClick` events will occur before the model is updated. Use `ngSubmit`
+ * to have access to the updated model.
+ *
+ * `ngModelOptions` has an effect on the element it's declared on and its descendants.
+ *
+ * @param {Object} ngModelOptions options to apply to the current model. Valid keys are:
+ *   - `updateOn`: string specifying which event should the input be bound to. You can set several
+ *     events using an space delimited list. There is a special event called `default` that
+ *     matches the default events belonging of the control.
+ *   - `debounce`: integer value which contains the debounce model update value in milliseconds. A
+ *     value of 0 triggers an immediate update. If an object is supplied instead, you can specify a
+ *     custom value for each event. For example:
+ *     `ng-model-options="{ updateOn: 'default blur', debounce: { 'default': 500, 'blur': 0 } }"`
+ *   - `allowInvalid`: boolean value which indicates that the model can be set with values that did
+ *     not validate correctly instead of the default behavior of setting the model to undefined.
+ *   - `getterSetter`: boolean value which determines whether or not to treat functions bound to
+       `ngModel` as getters/setters.
+ *   - `timezone`: Defines the timezone to be used to read/write the `Date` instance in the model for
+ *     `<input type="date">`, `<input type="time">`, ... . It understands UTC/GMT and the
+ *     continental US time zone abbreviations, but for general use, use a time zone offset, for
+ *     example, `'+0430'` (4 hours, 30 minutes east of the Greenwich meridian)
+ *     If not specified, the timezone of the browser will be used.
+ *
+ * @example
+
+  The following example shows how to override immediate updates. Changes on the inputs within the
+  form will update the model only when the control loses focus (blur event). If `escape` key is
+  pressed while the input field is focused, the value is reset to the value in the current model.
+
+  <example name="ngModelOptions-directive-blur" module="optionsExample">
+    <file name="index.html">
+      <div ng-controller="ExampleController">
+        <form name="userForm">
+          <label>Name:
+            <input type="text" name="userName"
+                   ng-model="user.name"
+                   ng-model-options="{ updateOn: 'blur' }"
+                   ng-keyup="cancel($event)" />
+          </label><br />
+          <label>Other data:
+            <input type="text" ng-model="user.data" />
+          </label><br />
+        </form>
+        <pre>user.name = <span ng-bind="user.name"></span></pre>
+        <pre>user.data = <span ng-bind="user.data"></span></pre>
+      </div>
+    </file>
+    <file name="app.js">
+      angular.module('optionsExample', [])
+        .controller('ExampleController', ['$scope', function($scope) {
+          $scope.user = { name: 'John', data: '' };
+
+          $scope.cancel = function(e) {
+            if (e.keyCode == 27) {
+              $scope.userForm.userName.$rollbackViewValue();
+            }
+          };
+        }]);
+    </file>
+    <file name="protractor.js" type="protractor">
+      var model = element(by.binding('user.name'));
+      var input = element(by.model('user.name'));
+      var other = element(by.model('user.data'));
+
+      it('should allow custom events', function() {
+        input.sendKeys(' Doe');
+        input.click();
+        expect(model.getText()).toEqual('John');
+        other.click();
+        expect(model.getText()).toEqual('John Doe');
+      });
+
+      it('should $rollbackViewValue when model changes', function() {
+        input.sendKeys(' Doe');
+        expect(input.getAttribute('value')).toEqual('John Doe');
+        input.sendKeys(protractor.Key.ESCAPE);
+        expect(input.getAttribute('value')).toEqual('John');
+        other.click();
+        expect(model.getText()).toEqual('John');
+      });
+    </file>
+  </example>
+
+  This one shows how to debounce model changes. Model will be updated only 1 sec after last change.
+  If the `Clear` button is pressed, any debounced action is canceled and the value becomes empty.
+
+  <example name="ngModelOptions-directive-debounce" module="optionsExample">
+    <file name="index.html">
+      <div ng-controller="ExampleController">
+        <form name="userForm">
+          <label>Name:
+            <input type="text" name="userName"
+                   ng-model="user.name"
+                   ng-model-options="{ debounce: 1000 }" />
+          </label>
+          <button ng-click="userForm.userName.$rollbackViewValue(); user.name=''">Clear</button>
+          <br />
+        </form>
+        <pre>user.name = <span ng-bind="user.name"></span></pre>
+      </div>
+    </file>
+    <file name="app.js">
+      angular.module('optionsExample', [])
+        .controller('ExampleController', ['$scope', function($scope) {
+          $scope.user = { name: 'Igor' };
+        }]);
+    </file>
+  </example>
+
+  This one shows how to bind to getter/setters:
+
+  <example name="ngModelOptions-directive-getter-setter" module="getterSetterExample">
+    <file name="index.html">
+      <div ng-controller="ExampleController">
+        <form name="userForm">
+          <label>Name:
+            <input type="text" name="userName"
+                   ng-model="user.name"
+                   ng-model-options="{ getterSetter: true }" />
+          </label>
+        </form>
+        <pre>user.name = <span ng-bind="user.name()"></span></pre>
+      </div>
+    </file>
+    <file name="app.js">
+      angular.module('getterSetterExample', [])
+        .controller('ExampleController', ['$scope', function($scope) {
+          var _name = 'Brian';
+          $scope.user = {
+            name: function(newName) {
+              // Note that newName can be undefined for two reasons:
+              // 1. Because it is called as a getter and thus called with no arguments
+              // 2. Because the property should actually be set to undefined. This happens e.g. if the
+              //    input is invalid
+              return arguments.length ? (_name = newName) : _name;
+            }
+          };
+        }]);
+    </file>
+  </example>
+ */
+var ngModelOptionsDirective = function() {
+  return {
+    restrict: 'A',
+    controller: ['$scope', '$attrs', function($scope, $attrs) {
+      var that = this;
+      this.$options = copy($scope.$eval($attrs.ngModelOptions));
+      // Allow adding/overriding bound events
+      if (isDefined(this.$options.updateOn)) {
+        this.$options.updateOnDefault = false;
+        // extract "default" pseudo-event from list of events that can trigger a model update
+        this.$options.updateOn = trim(this.$options.updateOn.replace(DEFAULT_REGEXP, function() {
+          that.$options.updateOnDefault = true;
+          return ' ';
+        }));
+      } else {
+        this.$options.updateOnDefault = true;
+      }
+    }]
+  };
+};
+
+
+
+// helper methods
+function addSetValidityMethod(context) {
+  var ctrl = context.ctrl,
+      $element = context.$element,
+      classCache = {},
+      set = context.set,
+      unset = context.unset,
+      $animate = context.$animate;
+
+  classCache[INVALID_CLASS] = !(classCache[VALID_CLASS] = $element.hasClass(VALID_CLASS));
+
+  ctrl.$setValidity = setValidity;
+
+  function setValidity(validationErrorKey, state, controller) {
+    if (isUndefined(state)) {
+      createAndSet('$pending', validationErrorKey, controller);
+    } else {
+      unsetAndCleanup('$pending', validationErrorKey, controller);
+    }
+    if (!isBoolean(state)) {
+      unset(ctrl.$error, validationErrorKey, controller);
+      unset(ctrl.$$success, validationErrorKey, controller);
+    } else {
+      if (state) {
+        unset(ctrl.$error, validationErrorKey, controller);
+        set(ctrl.$$success, validationErrorKey, controller);
+      } else {
+        set(ctrl.$error, validationErrorKey, controller);
+        unset(ctrl.$$success, validationErrorKey, controller);
+      }
+    }
+    if (ctrl.$pending) {
+      cachedToggleClass(PENDING_CLASS, true);
+      ctrl.$valid = ctrl.$invalid = undefined;
+      toggleValidationCss('', null);
+    } else {
+      cachedToggleClass(PENDING_CLASS, false);
+      ctrl.$valid = isObjectEmpty(ctrl.$error);
+      ctrl.$invalid = !ctrl.$valid;
+      toggleValidationCss('', ctrl.$valid);
+    }
+
+    // re-read the state as the set/unset methods could have
+    // combined state in ctrl.$error[validationError] (used for forms),
+    // where setting/unsetting only increments/decrements the value,
+    // and does not replace it.
+    var combinedState;
+    if (ctrl.$pending && ctrl.$pending[validationErrorKey]) {
+      combinedState = undefined;
+    } else if (ctrl.$error[validationErrorKey]) {
+      combinedState = false;
+    } else if (ctrl.$$success[validationErrorKey]) {
+      combinedState = true;
+    } else {
+      combinedState = null;
+    }
+
+    toggleValidationCss(validationErrorKey, combinedState);
+    ctrl.$$parentForm.$setValidity(validationErrorKey, combinedState, ctrl);
+  }
+
+  function createAndSet(name, value, controller) {
+    if (!ctrl[name]) {
+      ctrl[name] = {};
+    }
+    set(ctrl[name], value, controller);
+  }
+
+  function unsetAndCleanup(name, value, controller) {
+    if (ctrl[name]) {
+      unset(ctrl[name], value, controller);
+    }
+    if (isObjectEmpty(ctrl[name])) {
+      ctrl[name] = undefined;
+    }
+  }
+
+  function cachedToggleClass(className, switchValue) {
+    if (switchValue && !classCache[className]) {
+      $animate.addClass($element, className);
+      classCache[className] = true;
+    } else if (!switchValue && classCache[className]) {
+      $animate.removeClass($element, className);
+      classCache[className] = false;
+    }
+  }
+
+  function toggleValidationCss(validationErrorKey, isValid) {
+    validationErrorKey = validationErrorKey ? '-' + snake_case(validationErrorKey, '-') : '';
+
+    cachedToggleClass(VALID_CLASS + validationErrorKey, isValid === true);
+    cachedToggleClass(INVALID_CLASS + validationErrorKey, isValid === false);
+  }
+}
+
+function isObjectEmpty(obj) {
+  if (obj) {
+    for (var prop in obj) {
+      if (obj.hasOwnProperty(prop)) {
+        return false;
+      }
+    }
+  }
+  return true;
+}
+
+/**
+ * @ngdoc directive
+ * @name ngNonBindable
+ * @restrict AC
+ * @priority 1000
+ *
+ * @description
+ * The `ngNonBindable` directive tells Angular not to compile or bind the contents of the current
+ * DOM element. This is useful if the element contains what appears to be Angular directives and
+ * bindings but which should be ignored by Angular. This could be the case if you have a site that
+ * displays snippets of code, for instance.
+ *
+ * @element ANY
+ *
+ * @example
+ * In this example there are two locations where a simple interpolation binding (`{{}}`) is present,
+ * but the one wrapped in `ngNonBindable` is left alone.
+ *
+ * @example
+    <example>
+      <file name="index.html">
+        <div>Normal: {{1 + 2}}</div>
+        <div ng-non-bindable>Ignored: {{1 + 2}}</div>
+      </file>
+      <file name="protractor.js" type="protractor">
+       it('should check ng-non-bindable', function() {
+         expect(element(by.binding('1 + 2')).getText()).toContain('3');
+         expect(element.all(by.css('div')).last().getText()).toMatch(/1 \+ 2/);
+       });
+      </file>
+    </example>
+ */
+var ngNonBindableDirective = ngDirective({ terminal: true, priority: 1000 });
+
+/* global jqLiteRemove */
+
+var ngOptionsMinErr = minErr('ngOptions');
+
+/**
+ * @ngdoc directive
+ * @name ngOptions
+ * @restrict A
+ *
+ * @description
+ *
+ * The `ngOptions` attribute can be used to dynamically generate a list of `<option>`
+ * elements for the `<select>` element using the array or object obtained by evaluating the
+ * `ngOptions` comprehension expression.
+ *
+ * In many cases, `ngRepeat` can be used on `<option>` elements instead of `ngOptions` to achieve a
+ * similar result. However, `ngOptions` provides some benefits such as reducing memory and
+ * increasing speed by not creating a new scope for each repeated instance, as well as providing
+ * more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the
+ * comprehension expression. `ngOptions` should be used when the `<select>` model needs to be bound
+ *  to a non-string value. This is because an option element can only be bound to string values at
+ * present.
+ *
+ * When an item in the `<select>` menu is selected, the array element or object property
+ * represented by the selected option will be bound to the model identified by the `ngModel`
+ * directive.
+ *
+ * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can
+ * be nested into the `<select>` element. This element will then represent the `null` or "not selected"
+ * option. See example below for demonstration.
+ *
+ * ## Complex Models (objects or collections)
+ *
+ * By default, `ngModel` watches the model by reference, not value. This is important to know when
+ * binding the select to a model that is an object or a collection.
+ *
+ * One issue occurs if you want to preselect an option. For example, if you set
+ * the model to an object that is equal to an object in your collection, `ngOptions` won't be able to set the selection,
+ * because the objects are not identical. So by default, you should always reference the item in your collection
+ * for preselections, e.g.: `$scope.selected = $scope.collection[3]`.
+ *
+ * Another solution is to use a `track by` clause, because then `ngOptions` will track the identity
+ * of the item not by reference, but by the result of the `track by` expression. For example, if your
+ * collection items have an id property, you would `track by item.id`.
+ *
+ * A different issue with objects or collections is that ngModel won't detect if an object property or
+ * a collection item changes. For that reason, `ngOptions` additionally watches the model using
+ * `$watchCollection`, when the expression contains a `track by` clause or the the select has the `multiple` attribute.
+ * This allows ngOptions to trigger a re-rendering of the options even if the actual object/collection
+ * has not changed identity, but only a property on the object or an item in the collection changes.
+ *
+ * Note that `$watchCollection` does a shallow comparison of the properties of the object (or the items in the collection
+ * if the model is an array). This means that changing a property deeper than the first level inside the
+ * object/collection will not trigger a re-rendering.
+ *
+ * ## `select` **`as`**
+ *
+ * Using `select` **`as`** will bind the result of the `select` expression to the model, but
+ * the value of the `<select>` and `<option>` html elements will be either the index (for array data sources)
+ * or property name (for object data sources) of the value within the collection. If a **`track by`** expression
+ * is used, the result of that expression will be set as the value of the `option` and `select` elements.
+ *
+ *
+ * ### `select` **`as`** and **`track by`**
+ *
+ * <div class="alert alert-warning">
+ * Be careful when using `select` **`as`** and **`track by`** in the same expression.
+ * </div>
+ *
+ * Given this array of items on the $scope:
+ *
+ * ```js
+ * $scope.items = [{
+ *   id: 1,
+ *   label: 'aLabel',
+ *   subItem: { name: 'aSubItem' }
+ * }, {
+ *   id: 2,
+ *   label: 'bLabel',
+ *   subItem: { name: 'bSubItem' }
+ * }];
+ * ```
+ *
+ * This will work:
+ *
+ * ```html
+ * <select ng-options="item as item.label for item in items track by item.id" ng-model="selected"></select>
+ * ```
+ * ```js
+ * $scope.selected = $scope.items[0];
+ * ```
+ *
+ * but this will not work:
+ *
+ * ```html
+ * <select ng-options="item.subItem as item.label for item in items track by item.id" ng-model="selected"></select>
+ * ```
+ * ```js
+ * $scope.selected = $scope.items[0].subItem;
+ * ```
+ *
+ * In both examples, the **`track by`** expression is applied successfully to each `item` in the
+ * `items` array. Because the selected option has been set programmatically in the controller, the
+ * **`track by`** expression is also applied to the `ngModel` value. In the first example, the
+ * `ngModel` value is `items[0]` and the **`track by`** expression evaluates to `items[0].id` with
+ * no issue. In the second example, the `ngModel` value is `items[0].subItem` and the **`track by`**
+ * expression evaluates to `items[0].subItem.id` (which is undefined). As a result, the model value
+ * is not matched against any `<option>` and the `<select>` appears as having no selected value.
+ *
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} required The control is considered valid only if value is entered.
+ * @param {string=} ngRequired Adds `required` attribute and `required` validation constraint to
+ *    the element when the ngRequired expression evaluates to true. Use `ngRequired` instead of
+ *    `required` when you want to data-bind to the `required` attribute.
+ * @param {comprehension_expression=} ngOptions in one of the following forms:
+ *
+ *   * for array data sources:
+ *     * `label` **`for`** `value` **`in`** `array`
+ *     * `select` **`as`** `label` **`for`** `value` **`in`** `array`
+ *     * `label` **`group by`** `group` **`for`** `value` **`in`** `array`
+ *     * `label` **`disable when`** `disable` **`for`** `value` **`in`** `array`
+ *     * `label` **`group by`** `group` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`
+ *     * `label` **`disable when`** `disable` **`for`** `value` **`in`** `array` **`track by`** `trackexpr`
+ *     * `label` **`for`** `value` **`in`** `array` | orderBy:`orderexpr` **`track by`** `trackexpr`
+ *        (for including a filter with `track by`)
+ *   * for object data sources:
+ *     * `label` **`for (`**`key` **`,`** `value`**`) in`** `object`
+ *     * `select` **`as`** `label` **`for (`**`key` **`,`** `value`**`) in`** `object`
+ *     * `label` **`group by`** `group` **`for (`**`key`**`,`** `value`**`) in`** `object`
+ *     * `label` **`disable when`** `disable` **`for (`**`key`**`,`** `value`**`) in`** `object`
+ *     * `select` **`as`** `label` **`group by`** `group`
+ *         **`for` `(`**`key`**`,`** `value`**`) in`** `object`
+ *     * `select` **`as`** `label` **`disable when`** `disable`
+ *         **`for` `(`**`key`**`,`** `value`**`) in`** `object`
+ *
+ * Where:
+ *
+ *   * `array` / `object`: an expression which evaluates to an array / object to iterate over.
+ *   * `value`: local variable which will refer to each item in the `array` or each property value
+ *      of `object` during iteration.
+ *   * `key`: local variable which will refer to a property name in `object` during iteration.
+ *   * `label`: The result of this expression will be the label for `<option>` element. The
+ *     `expression` will most likely refer to the `value` variable (e.g. `value.propertyName`).
+ *   * `select`: The result of this expression will be bound to the model of the parent `<select>`
+ *      element. If not specified, `select` expression will default to `value`.
+ *   * `group`: The result of this expression will be used to group options using the `<optgroup>`
+ *      DOM element.
+ *   * `disable`: The result of this expression will be used to disable the rendered `<option>`
+ *      element. Return `true` to disable.
+ *   * `trackexpr`: Used when working with an array of objects. The result of this expression will be
+ *      used to identify the objects in the array. The `trackexpr` will most likely refer to the
+ *     `value` variable (e.g. `value.propertyName`). With this the selection is preserved
+ *      even when the options are recreated (e.g. reloaded from the server).
+ *
+ * @example
+    <example module="selectExample">
+      <file name="index.html">
+        <script>
+        angular.module('selectExample', [])
+          .controller('ExampleController', ['$scope', function($scope) {
+            $scope.colors = [
+              {name:'black', shade:'dark'},
+              {name:'white', shade:'light', notAnOption: true},
+              {name:'red', shade:'dark'},
+              {name:'blue', shade:'dark', notAnOption: true},
+              {name:'yellow', shade:'light', notAnOption: false}
+            ];
+            $scope.myColor = $scope.colors[2]; // red
+          }]);
+        </script>
+        <div ng-controller="ExampleController">
+          <ul>
+            <li ng-repeat="color in colors">
+              <label>Name: <input ng-model="color.name"></label>
+              <label><input type="checkbox" ng-model="color.notAnOption"> Disabled?</label>
+              <button ng-click="colors.splice($index, 1)" aria-label="Remove">X</button>
+            </li>
+            <li>
+              <button ng-click="colors.push({})">add</button>
+            </li>
+          </ul>
+          <hr/>
+          <label>Color (null not allowed):
+            <select ng-model="myColor" ng-options="color.name for color in colors"></select>
+          </label><br/>
+          <label>Color (null allowed):
+          <span  class="nullable">
+            <select ng-model="myColor" ng-options="color.name for color in colors">
+              <option value="">-- choose color --</option>
+            </select>
+          </span></label><br/>
+
+          <label>Color grouped by shade:
+            <select ng-model="myColor" ng-options="color.name group by color.shade for color in colors">
+            </select>
+          </label><br/>
+
+          <label>Color grouped by shade, with some disabled:
+            <select ng-model="myColor"
+                  ng-options="color.name group by color.shade disable when color.notAnOption for color in colors">
+            </select>
+          </label><br/>
+
+
+
+          Select <button ng-click="myColor = { name:'not in list', shade: 'other' }">bogus</button>.
+          <br/>
+          <hr/>
+          Currently selected: {{ {selected_color:myColor} }}
+          <div style="border:solid 1px black; height:20px"
+               ng-style="{'background-color':myColor.name}">
+          </div>
+        </div>
+      </file>
+      <file name="protractor.js" type="protractor">
+         it('should check ng-options', function() {
+           expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('red');
+           element.all(by.model('myColor')).first().click();
+           element.all(by.css('select[ng-model="myColor"] option')).first().click();
+           expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('black');
+           element(by.css('.nullable select[ng-model="myColor"]')).click();
+           element.all(by.css('.nullable select[ng-model="myColor"] option')).first().click();
+           expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('null');
+         });
+      </file>
+    </example>
+ */
+
+// jshint maxlen: false
+//                     //00001111111111000000000002222222222000000000000000000000333333333300000000000000000000000004444444444400000000000005555555555555550000000006666666666666660000000777777777777777000000000000000888888888800000000000000000009999999999
+var NG_OPTIONS_REGEXP = /^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/;
+                        // 1: value expression (valueFn)
+                        // 2: label expression (displayFn)
+                        // 3: group by expression (groupByFn)
+                        // 4: disable when expression (disableWhenFn)
+                        // 5: array item variable name
+                        // 6: object item key variable name
+                        // 7: object item value variable name
+                        // 8: collection expression
+                        // 9: track by expression
+// jshint maxlen: 100
+
+
+var ngOptionsDirective = ['$compile', '$document', '$parse', function($compile, $document, $parse) {
+
+  function parseOptionsExpression(optionsExp, selectElement, scope) {
+
+    var match = optionsExp.match(NG_OPTIONS_REGEXP);
+    if (!(match)) {
+      throw ngOptionsMinErr('iexp',
+        "Expected expression in form of " +
+        "'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'" +
+        " but got '{0}'. Element: {1}",
+        optionsExp, startingTag(selectElement));
+    }
+
+    // Extract the parts from the ngOptions expression
+
+    // The variable name for the value of the item in the collection
+    var valueName = match[5] || match[7];
+    // The variable name for the key of the item in the collection
+    var keyName = match[6];
+
+    // An expression that generates the viewValue for an option if there is a label expression
+    var selectAs = / as /.test(match[0]) && match[1];
+    // An expression that is used to track the id of each object in the options collection
+    var trackBy = match[9];
+    // An expression that generates the viewValue for an option if there is no label expression
+    var valueFn = $parse(match[2] ? match[1] : valueName);
+    var selectAsFn = selectAs && $parse(selectAs);
+    var viewValueFn = selectAsFn || valueFn;
+    var trackByFn = trackBy && $parse(trackBy);
+
+    // Get the value by which we are going to track the option
+    // if we have a trackFn then use that (passing scope and locals)
+    // otherwise just hash the given viewValue
+    var getTrackByValueFn = trackBy ?
+                              function(value, locals) { return trackByFn(scope, locals); } :
+                              function getHashOfValue(value) { return hashKey(value); };
+    var getTrackByValue = function(value, key) {
+      return getTrackByValueFn(value, getLocals(value, key));
+    };
+
+    var displayFn = $parse(match[2] || match[1]);
+    var groupByFn = $parse(match[3] || '');
+    var disableWhenFn = $parse(match[4] || '');
+    var valuesFn = $parse(match[8]);
+
+    var locals = {};
+    var getLocals = keyName ? function(value, key) {
+      locals[keyName] = key;
+      locals[valueName] = value;
+      return locals;
+    } : function(value) {
+      locals[valueName] = value;
+      return locals;
+    };
+
+
+    function Option(selectValue, viewValue, label, group, disabled) {
+      this.selectValue = selectValue;
+      this.viewValue = viewValue;
+      this.label = label;
+      this.group = group;
+      this.disabled = disabled;
+    }
+
+    function getOptionValuesKeys(optionValues) {
+      var optionValuesKeys;
+
+      if (!keyName && isArrayLike(optionValues)) {
+        optionValuesKeys = optionValues;
+      } else {
+        // if object, extract keys, in enumeration order, unsorted
+        optionValuesKeys = [];
+        for (var itemKey in optionValues) {
+          if (optionValues.hasOwnProperty(itemKey) && itemKey.charAt(0) !== '$') {
+            optionValuesKeys.push(itemKey);
+          }
+        }
+      }
+      return optionValuesKeys;
+    }
+
+    return {
+      trackBy: trackBy,
+      getTrackByValue: getTrackByValue,
+      getWatchables: $parse(valuesFn, function(optionValues) {
+        // Create a collection of things that we would like to watch (watchedArray)
+        // so that they can all be watched using a single $watchCollection
+        // that only runs the handler once if anything changes
+        var watchedArray = [];
+        optionValues = optionValues || [];
+
+        var optionValuesKeys = getOptionValuesKeys(optionValues);
+        var optionValuesLength = optionValuesKeys.length;
+        for (var index = 0; index < optionValuesLength; index++) {
+          var key = (optionValues === optionValuesKeys) ? index : optionValuesKeys[index];
+          var value = optionValues[key];
+
+          var locals = getLocals(value, key);
+          var selectValue = getTrackByValueFn(value, locals);
+          watchedArray.push(selectValue);
+
+          // Only need to watch the displayFn if there is a specific label expression
+          if (match[2] || match[1]) {
+            var label = displayFn(scope, locals);
+            watchedArray.push(label);
+          }
+
+          // Only need to watch the disableWhenFn if there is a specific disable expression
+          if (match[4]) {
+            var disableWhen = disableWhenFn(scope, locals);
+            watchedArray.push(disableWhen);
+          }
+        }
+        return watchedArray;
+      }),
+
+      getOptions: function() {
+
+        var optionItems = [];
+        var selectValueMap = {};
+
+        // The option values were already computed in the `getWatchables` fn,
+        // which must have been called to trigger `getOptions`
+        var optionValues = valuesFn(scope) || [];
+        var optionValuesKeys = getOptionValuesKeys(optionValues);
+        var optionValuesLength = optionValuesKeys.length;
+
+        for (var index = 0; index < optionValuesLength; index++) {
+          var key = (optionValues === optionValuesKeys) ? index : optionValuesKeys[index];
+          var value = optionValues[key];
+          var locals = getLocals(value, key);
+          var viewValue = viewValueFn(scope, locals);
+          var selectValue = getTrackByValueFn(viewValue, locals);
+          var label = displayFn(scope, locals);
+          var group = groupByFn(scope, locals);
+          var disabled = disableWhenFn(scope, locals);
+          var optionItem = new Option(selectValue, viewValue, label, group, disabled);
+
+          optionItems.push(optionItem);
+          selectValueMap[selectValue] = optionItem;
+        }
+
+        return {
+          items: optionItems,
+          selectValueMap: selectValueMap,
+          getOptionFromViewValue: function(value) {
+            return selectValueMap[getTrackByValue(value)];
+          },
+          getViewValueFromOption: function(option) {
+            // If the viewValue could be an object that may be mutated by the application,
+            // we need to make a copy and not return the reference to the value on the option.
+            return trackBy ? angular.copy(option.viewValue) : option.viewValue;
+          }
+        };
+      }
+    };
+  }
+
+
+  // we can't just jqLite('<option>') since jqLite is not smart enough
+  // to create it in <select> and IE barfs otherwise.
+  var optionTemplate = window.document.createElement('option'),
+      optGroupTemplate = window.document.createElement('optgroup');
+
+    function ngOptionsPostLink(scope, selectElement, attr, ctrls) {
+
+      var selectCtrl = ctrls[0];
+      var ngModelCtrl = ctrls[1];
+      var multiple = attr.multiple;
+
+      // The emptyOption allows the application developer to provide their own custom "empty"
+      // option when the viewValue does not match any of the option values.
+      var emptyOption;
+      for (var i = 0, children = selectElement.children(), ii = children.length; i < ii; i++) {
+        if (children[i].value === '') {
+          emptyOption = children.eq(i);
+          break;
+        }
+      }
+
+      var providedEmptyOption = !!emptyOption;
+
+      var unknownOption = jqLite(optionTemplate.cloneNode(false));
+      unknownOption.val('?');
+
+      var options;
+      var ngOptions = parseOptionsExpression(attr.ngOptions, selectElement, scope);
+      // This stores the newly created options before they are appended to the select.
+      // Since the contents are removed from the fragment when it is appended,
+      // we only need to create it once.
+      var listFragment = $document[0].createDocumentFragment();
+
+      var renderEmptyOption = function() {
+        if (!providedEmptyOption) {
+          selectElement.prepend(emptyOption);
+        }
+        selectElement.val('');
+        emptyOption.prop('selected', true); // needed for IE
+        emptyOption.attr('selected', true);
+      };
+
+      var removeEmptyOption = function() {
+        if (!providedEmptyOption) {
+          emptyOption.remove();
+        }
+      };
+
+
+      var renderUnknownOption = function() {
+        selectElement.prepend(unknownOption);
+        selectElement.val('?');
+        unknownOption.prop('selected', true); // needed for IE
+        unknownOption.attr('selected', true);
+      };
+
+      var removeUnknownOption = function() {
+        unknownOption.remove();
+      };
+
+      // Update the controller methods for multiple selectable options
+      if (!multiple) {
+
+        selectCtrl.writeValue = function writeNgOptionsValue(value) {
+          var option = options.getOptionFromViewValue(value);
+
+          if (option) {
+            // Don't update the option when it is already selected.
+            // For example, the browser will select the first option by default. In that case,
+            // most properties are set automatically - except the `selected` attribute, which we
+            // set always
+
+            if (selectElement[0].value !== option.selectValue) {
+              removeUnknownOption();
+              removeEmptyOption();
+
+              selectElement[0].value = option.selectValue;
+              option.element.selected = true;
+            }
+
+            option.element.setAttribute('selected', 'selected');
+          } else {
+            if (value === null || providedEmptyOption) {
+              removeUnknownOption();
+              renderEmptyOption();
+            } else {
+              removeEmptyOption();
+              renderUnknownOption();
+            }
+          }
+        };
+
+        selectCtrl.readValue = function readNgOptionsValue() {
+
+          var selectedOption = options.selectValueMap[selectElement.val()];
+
+          if (selectedOption && !selectedOption.disabled) {
+            removeEmptyOption();
+            removeUnknownOption();
+            return options.getViewValueFromOption(selectedOption);
+          }
+          return null;
+        };
+
+        // If we are using `track by` then we must watch the tracked value on the model
+        // since ngModel only watches for object identity change
+        if (ngOptions.trackBy) {
+          scope.$watch(
+            function() { return ngOptions.getTrackByValue(ngModelCtrl.$viewValue); },
+            function() { ngModelCtrl.$render(); }
+          );
+        }
+
+      } else {
+
+        ngModelCtrl.$isEmpty = function(value) {
+          return !value || value.length === 0;
+        };
+
+
+        selectCtrl.writeValue = function writeNgOptionsMultiple(value) {
+          options.items.forEach(function(option) {
+            option.element.selected = false;
+          });
+
+          if (value) {
+            value.forEach(function(item) {
+              var option = options.getOptionFromViewValue(item);
+              if (option) option.element.selected = true;
+            });
+          }
+        };
+
+
+        selectCtrl.readValue = function readNgOptionsMultiple() {
+          var selectedValues = selectElement.val() || [],
+              selections = [];
+
+          forEach(selectedValues, function(value) {
+            var option = options.selectValueMap[value];
+            if (option && !option.disabled) selections.push(options.getViewValueFromOption(option));
+          });
+
+          return selections;
+        };
+
+        // If we are using `track by` then we must watch these tracked values on the model
+        // since ngModel only watches for object identity change
+        if (ngOptions.trackBy) {
+
+          scope.$watchCollection(function() {
+            if (isArray(ngModelCtrl.$viewValue)) {
+              return ngModelCtrl.$viewValue.map(function(value) {
+                return ngOptions.getTrackByValue(value);
+              });
+            }
+          }, function() {
+            ngModelCtrl.$render();
+          });
+
+        }
+      }
+
+
+      if (providedEmptyOption) {
+
+        // we need to remove it before calling selectElement.empty() because otherwise IE will
+        // remove the label from the element. wtf?
+        emptyOption.remove();
+
+        // compile the element since there might be bindings in it
+        $compile(emptyOption)(scope);
+
+        // remove the class, which is added automatically because we recompile the element and it
+        // becomes the compilation root
+        emptyOption.removeClass('ng-scope');
+      } else {
+        emptyOption = jqLite(optionTemplate.cloneNode(false));
+      }
+
+      selectElement.empty();
+
+      // We need to do this here to ensure that the options object is defined
+      // when we first hit it in writeNgOptionsValue
+      updateOptions();
+
+      // We will re-render the option elements if the option values or labels change
+      scope.$watchCollection(ngOptions.getWatchables, updateOptions);
+
+      // ------------------------------------------------------------------ //
+
+      function addOptionElement(option, parent) {
+        var optionElement = optionTemplate.cloneNode(false);
+        parent.appendChild(optionElement);
+        updateOptionElement(option, optionElement);
+      }
+
+
+      function updateOptionElement(option, element) {
+        option.element = element;
+        element.disabled = option.disabled;
+        // NOTE: The label must be set before the value, otherwise IE10/11/EDGE create unresponsive
+        // selects in certain circumstances when multiple selects are next to each other and display
+        // the option list in listbox style, i.e. the select is [multiple], or specifies a [size].
+        // See https://github.com/angular/angular.js/issues/11314 for more info.
+        // This is unfortunately untestable with unit / e2e tests
+        if (option.label !== element.label) {
+          element.label = option.label;
+          element.textContent = option.label;
+        }
+        if (option.value !== element.value) element.value = option.selectValue;
+      }
+
+      function updateOptions() {
+        var previousValue = options && selectCtrl.readValue();
+
+        // We must remove all current options, but cannot simply set innerHTML = null
+        // since the providedEmptyOption might have an ngIf on it that inserts comments which we
+        // must preserve.
+        // Instead, iterate over the current option elements and remove them or their optgroup
+        // parents
+        if (options) {
+
+          for (var i = options.items.length - 1; i >= 0; i--) {
+            var option = options.items[i];
+            if (isDefined(option.group)) {
+              jqLiteRemove(option.element.parentNode);
+            } else {
+              jqLiteRemove(option.element);
+            }
+          }
+        }
+
+        options = ngOptions.getOptions();
+
+        var groupElementMap = {};
+
+        // Ensure that the empty option is always there if it was explicitly provided
+        if (providedEmptyOption) {
+          selectElement.prepend(emptyOption);
+        }
+
+        options.items.forEach(function addOption(option) {
+          var groupElement;
+
+          if (isDefined(option.group)) {
+
+            // This option is to live in a group
+            // See if we have already created this group
+            groupElement = groupElementMap[option.group];
+
+            if (!groupElement) {
+
+              groupElement = optGroupTemplate.cloneNode(false);
+              listFragment.appendChild(groupElement);
+
+              // Update the label on the group element
+              // "null" is special cased because of Safari
+              groupElement.label = option.group === null ? 'null' : option.group;
+
+              // Store it for use later
+              groupElementMap[option.group] = groupElement;
+            }
+
+            addOptionElement(option, groupElement);
+
+          } else {
+
+            // This option is not in a group
+            addOptionElement(option, listFragment);
+          }
+        });
+
+        selectElement[0].appendChild(listFragment);
+
+        ngModelCtrl.$render();
+
+        // Check to see if the value has changed due to the update to the options
+        if (!ngModelCtrl.$isEmpty(previousValue)) {
+          var nextValue = selectCtrl.readValue();
+          var isNotPrimitive = ngOptions.trackBy || multiple;
+          if (isNotPrimitive ? !equals(previousValue, nextValue) : previousValue !== nextValue) {
+            ngModelCtrl.$setViewValue(nextValue);
+            ngModelCtrl.$render();
+          }
+        }
+
+      }
+  }
+
+  return {
+    restrict: 'A',
+    terminal: true,
+    require: ['select', 'ngModel'],
+    link: {
+      pre: function ngOptionsPreLink(scope, selectElement, attr, ctrls) {
+        // Deactivate the SelectController.register method to prevent
+        // option directives from accidentally registering themselves
+        // (and unwanted $destroy handlers etc.)
+        ctrls[0].registerOption = noop;
+      },
+      post: ngOptionsPostLink
+    }
+  };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngPluralize
+ * @restrict EA
+ *
+ * @description
+ * `ngPluralize` is a directive that displays messages according to en-US localization rules.
+ * These rules are bundled with angular.js, but can be overridden
+ * (see {@link guide/i18n Angular i18n} dev guide). You configure ngPluralize directive
+ * by specifying the mappings between
+ * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)
+ * and the strings to be displayed.
+ *
+ * # Plural categories and explicit number rules
+ * There are two
+ * [plural categories](http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/language_plural_rules.html)
+ * in Angular's default en-US locale: "one" and "other".
+ *
+ * While a plural category may match many numbers (for example, in en-US locale, "other" can match
+ * any number that is not 1), an explicit number rule can only match one number. For example, the
+ * explicit number rule for "3" matches the number 3. There are examples of plural categories
+ * and explicit number rules throughout the rest of this documentation.
+ *
+ * # Configuring ngPluralize
+ * You configure ngPluralize by providing 2 attributes: `count` and `when`.
+ * You can also provide an optional attribute, `offset`.
+ *
+ * The value of the `count` attribute can be either a string or an {@link guide/expression
+ * Angular expression}; these are evaluated on the current scope for its bound value.
+ *
+ * The `when` attribute specifies the mappings between plural categories and the actual
+ * string to be displayed. The value of the attribute should be a JSON object.
+ *
+ * The following example shows how to configure ngPluralize:
+ *
+ * ```html
+ * <ng-pluralize count="personCount"
+                 when="{'0': 'Nobody is viewing.',
+ *                      'one': '1 person is viewing.',
+ *                      'other': '{} people are viewing.'}">
+ * </ng-pluralize>
+ *```
+ *
+ * In the example, `"0: Nobody is viewing."` is an explicit number rule. If you did not
+ * specify this rule, 0 would be matched to the "other" category and "0 people are viewing"
+ * would be shown instead of "Nobody is viewing". You can specify an explicit number rule for
+ * other numbers, for example 12, so that instead of showing "12 people are viewing", you can
+ * show "a dozen people are viewing".
+ *
+ * You can use a set of closed braces (`{}`) as a placeholder for the number that you want substituted
+ * into pluralized strings. In the previous example, Angular will replace `{}` with
+ * <span ng-non-bindable>`{{personCount}}`</span>. The closed braces `{}` is a placeholder
+ * for <span ng-non-bindable>{{numberExpression}}</span>.
+ *
+ * If no rule is defined for a category, then an empty string is displayed and a warning is generated.
+ * Note that some locales define more categories than `one` and `other`. For example, fr-fr defines `few` and `many`.
+ *
+ * # Configuring ngPluralize with offset
+ * The `offset` attribute allows further customization of pluralized text, which can result in
+ * a better user experience. For example, instead of the message "4 people are viewing this document",
+ * you might display "John, Kate and 2 others are viewing this document".
+ * The offset attribute allows you to offset a number by any desired value.
+ * Let's take a look at an example:
+ *
+ * ```html
+ * <ng-pluralize count="personCount" offset=2
+ *               when="{'0': 'Nobody is viewing.',
+ *                      '1': '{{person1}} is viewing.',
+ *                      '2': '{{person1}} and {{person2}} are viewing.',
+ *                      'one': '{{person1}}, {{person2}} and one other person are viewing.',
+ *                      'other': '{{person1}}, {{person2}} and {} other people are viewing.'}">
+ * </ng-pluralize>
+ * ```
+ *
+ * Notice that we are still using two plural categories(one, other), but we added
+ * three explicit number rules 0, 1 and 2.
+ * When one person, perhaps John, views the document, "John is viewing" will be shown.
+ * When three people view the document, no explicit number rule is found, so
+ * an offset of 2 is taken off 3, and Angular uses 1 to decide the plural category.
+ * In this case, plural category 'one' is matched and "John, Mary and one other person are viewing"
+ * is shown.
+ *
+ * Note that when you specify offsets, you must provide explicit number rules for
+ * numbers from 0 up to and including the offset. If you use an offset of 3, for example,
+ * you must provide explicit number rules for 0, 1, 2 and 3. You must also provide plural strings for
+ * plural categories "one" and "other".
+ *
+ * @param {string|expression} count The variable to be bound to.
+ * @param {string} when The mapping between plural category to its corresponding strings.
+ * @param {number=} offset Offset to deduct from the total number.
+ *
+ * @example
+    <example module="pluralizeExample">
+      <file name="index.html">
+        <script>
+          angular.module('pluralizeExample', [])
+            .controller('ExampleController', ['$scope', function($scope) {
+              $scope.person1 = 'Igor';
+              $scope.person2 = 'Misko';
+              $scope.personCount = 1;
+            }]);
+        </script>
+        <div ng-controller="ExampleController">
+          <label>Person 1:<input type="text" ng-model="person1" value="Igor" /></label><br/>
+          <label>Person 2:<input type="text" ng-model="person2" value="Misko" /></label><br/>
+          <label>Number of People:<input type="text" ng-model="personCount" value="1" /></label><br/>
+
+          <!--- Example with simple pluralization rules for en locale --->
+          Without Offset:
+          <ng-pluralize count="personCount"
+                        when="{'0': 'Nobody is viewing.',
+                               'one': '1 person is viewing.',
+                               'other': '{} people are viewing.'}">
+          </ng-pluralize><br>
+
+          <!--- Example with offset --->
+          With Offset(2):
+          <ng-pluralize count="personCount" offset=2
+                        when="{'0': 'Nobody is viewing.',
+                               '1': '{{person1}} is viewing.',
+                               '2': '{{person1}} and {{person2}} are viewing.',
+                               'one': '{{person1}}, {{person2}} and one other person are viewing.',
+                               'other': '{{person1}}, {{person2}} and {} other people are viewing.'}">
+          </ng-pluralize>
+        </div>
+      </file>
+      <file name="protractor.js" type="protractor">
+        it('should show correct pluralized string', function() {
+          var withoutOffset = element.all(by.css('ng-pluralize')).get(0);
+          var withOffset = element.all(by.css('ng-pluralize')).get(1);
+          var countInput = element(by.model('personCount'));
+
+          expect(withoutOffset.getText()).toEqual('1 person is viewing.');
+          expect(withOffset.getText()).toEqual('Igor is viewing.');
+
+          countInput.clear();
+          countInput.sendKeys('0');
+
+          expect(withoutOffset.getText()).toEqual('Nobody is viewing.');
+          expect(withOffset.getText()).toEqual('Nobody is viewing.');
+
+          countInput.clear();
+          countInput.sendKeys('2');
+
+          expect(withoutOffset.getText()).toEqual('2 people are viewing.');
+          expect(withOffset.getText()).toEqual('Igor and Misko are viewing.');
+
+          countInput.clear();
+          countInput.sendKeys('3');
+
+          expect(withoutOffset.getText()).toEqual('3 people are viewing.');
+          expect(withOffset.getText()).toEqual('Igor, Misko and one other person are viewing.');
+
+          countInput.clear();
+          countInput.sendKeys('4');
+
+          expect(withoutOffset.getText()).toEqual('4 people are viewing.');
+          expect(withOffset.getText()).toEqual('Igor, Misko and 2 other people are viewing.');
+        });
+        it('should show data-bound names', function() {
+          var withOffset = element.all(by.css('ng-pluralize')).get(1);
+          var personCount = element(by.model('personCount'));
+          var person1 = element(by.model('person1'));
+          var person2 = element(by.model('person2'));
+          personCount.clear();
+          personCount.sendKeys('4');
+          person1.clear();
+          person1.sendKeys('Di');
+          person2.clear();
+          person2.sendKeys('Vojta');
+          expect(withOffset.getText()).toEqual('Di, Vojta and 2 other people are viewing.');
+        });
+      </file>
+    </example>
+ */
+var ngPluralizeDirective = ['$locale', '$interpolate', '$log', function($locale, $interpolate, $log) {
+  var BRACE = /{}/g,
+      IS_WHEN = /^when(Minus)?(.+)$/;
+
+  return {
+    link: function(scope, element, attr) {
+      var numberExp = attr.count,
+          whenExp = attr.$attr.when && element.attr(attr.$attr.when), // we have {{}} in attrs
+          offset = attr.offset || 0,
+          whens = scope.$eval(whenExp) || {},
+          whensExpFns = {},
+          startSymbol = $interpolate.startSymbol(),
+          endSymbol = $interpolate.endSymbol(),
+          braceReplacement = startSymbol + numberExp + '-' + offset + endSymbol,
+          watchRemover = angular.noop,
+          lastCount;
+
+      forEach(attr, function(expression, attributeName) {
+        var tmpMatch = IS_WHEN.exec(attributeName);
+        if (tmpMatch) {
+          var whenKey = (tmpMatch[1] ? '-' : '') + lowercase(tmpMatch[2]);
+          whens[whenKey] = element.attr(attr.$attr[attributeName]);
+        }
+      });
+      forEach(whens, function(expression, key) {
+        whensExpFns[key] = $interpolate(expression.replace(BRACE, braceReplacement));
+
+      });
+
+      scope.$watch(numberExp, function ngPluralizeWatchAction(newVal) {
+        var count = parseFloat(newVal);
+        var countIsNaN = isNaN(count);
+
+        if (!countIsNaN && !(count in whens)) {
+          // If an explicit number rule such as 1, 2, 3... is defined, just use it.
+          // Otherwise, check it against pluralization rules in $locale service.
+          count = $locale.pluralCat(count - offset);
+        }
+
+        // If both `count` and `lastCount` are NaN, we don't need to re-register a watch.
+        // In JS `NaN !== NaN`, so we have to explicitly check.
+        if ((count !== lastCount) && !(countIsNaN && isNumber(lastCount) && isNaN(lastCount))) {
+          watchRemover();
+          var whenExpFn = whensExpFns[count];
+          if (isUndefined(whenExpFn)) {
+            if (newVal != null) {
+              $log.debug("ngPluralize: no rule defined for '" + count + "' in " + whenExp);
+            }
+            watchRemover = noop;
+            updateElementText();
+          } else {
+            watchRemover = scope.$watch(whenExpFn, updateElementText);
+          }
+          lastCount = count;
+        }
+      });
+
+      function updateElementText(newText) {
+        element.text(newText || '');
+      }
+    }
+  };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngRepeat
+ * @multiElement
+ *
+ * @description
+ * The `ngRepeat` directive instantiates a template once per item from a collection. Each template
+ * instance gets its own scope, where the given loop variable is set to the current collection item,
+ * and `$index` is set to the item index or key.
+ *
+ * Special properties are exposed on the local scope of each template instance, including:
+ *
+ * | Variable  | Type            | Details                                                                     |
+ * |-----------|-----------------|-----------------------------------------------------------------------------|
+ * | `$index`  | {@type number}  | iterator offset of the repeated element (0..length-1)                       |
+ * | `$first`  | {@type boolean} | true if the repeated element is first in the iterator.                      |
+ * | `$middle` | {@type boolean} | true if the repeated element is between the first and last in the iterator. |
+ * | `$last`   | {@type boolean} | true if the repeated element is last in the iterator.                       |
+ * | `$even`   | {@type boolean} | true if the iterator position `$index` is even (otherwise false).           |
+ * | `$odd`    | {@type boolean} | true if the iterator position `$index` is odd (otherwise false).            |
+ *
+ * <div class="alert alert-info">
+ *   Creating aliases for these properties is possible with {@link ng.directive:ngInit `ngInit`}.
+ *   This may be useful when, for instance, nesting ngRepeats.
+ * </div>
+ *
+ *
+ * # Iterating over object properties
+ *
+ * It is possible to get `ngRepeat` to iterate over the properties of an object using the following
+ * syntax:
+ *
+ * ```js
+ * <div ng-repeat="(key, value) in myObj"> ... </div>
+ * ```
+ *
+ * However, there are a limitations compared to array iteration:
+ *
+ * - The JavaScript specification does not define the order of keys
+ *   returned for an object, so Angular relies on the order returned by the browser
+ *   when running `for key in myObj`. Browsers generally follow the strategy of providing
+ *   keys in the order in which they were defined, although there are exceptions when keys are deleted
+ *   and reinstated. See the
+ *   [MDN page on `delete` for more info](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/delete#Cross-browser_notes).
+ *
+ * - `ngRepeat` will silently *ignore* object keys starting with `$`, because
+ *   it's a prefix used by Angular for public (`$`) and private (`$$`) properties.
+ *
+ * - The built-in filters {@link ng.orderBy orderBy} and {@link ng.filter filter} do not work with
+ *   objects, and will throw an error if used with one.
+ *
+ * If you are hitting any of these limitations, the recommended workaround is to convert your object into an array
+ * that is sorted into the order that you prefer before providing it to `ngRepeat`. You could
+ * do this with a filter such as [toArrayFilter](http://ngmodules.org/modules/angular-toArrayFilter)
+ * or implement a `$watch` on the object yourself.
+ *
+ *
+ * # Tracking and Duplicates
+ *
+ * `ngRepeat` uses {@link $rootScope.Scope#$watchCollection $watchCollection} to detect changes in
+ * the collection. When a change happens, ngRepeat then makes the corresponding changes to the DOM:
+ *
+ * * When an item is added, a new instance of the template is added to the DOM.
+ * * When an item is removed, its template instance is removed from the DOM.
+ * * When items are reordered, their respective templates are reordered in the DOM.
+ *
+ * To minimize creation of DOM elements, `ngRepeat` uses a function
+ * to "keep track" of all items in the collection and their corresponding DOM elements.
+ * For example, if an item is added to the collection, ngRepeat will know that all other items
+ * already have DOM elements, and will not re-render them.
+ *
+ * The default tracking function (which tracks items by their identity) does not allow
+ * duplicate items in arrays. This is because when there are duplicates, it is not possible
+ * to maintain a one-to-one mapping between collection items and DOM elements.
+ *
+ * If you do need to repeat duplicate items, you can substitute the default tracking behavior
+ * with your own using the `track by` expression.
+ *
+ * For example, you may track items by the index of each item in the collection, using the
+ * special scope property `$index`:
+ * ```html
+ *    <div ng-repeat="n in [42, 42, 43, 43] track by $index">
+ *      {{n}}
+ *    </div>
+ * ```
+ *
+ * You may also use arbitrary expressions in `track by`, including references to custom functions
+ * on the scope:
+ * ```html
+ *    <div ng-repeat="n in [42, 42, 43, 43] track by myTrackingFunction(n)">
+ *      {{n}}
+ *    </div>
+ * ```
+ *
+ * <div class="alert alert-success">
+ * If you are working with objects that have an identifier property, you should track
+ * by the identifier instead of the whole object. Should you reload your data later, `ngRepeat`
+ * will not have to rebuild the DOM elements for items it has already rendered, even if the
+ * JavaScript objects in the collection have been substituted for new ones. For large collections,
+ * this significantly improves rendering performance. If you don't have a unique identifier,
+ * `track by $index` can also provide a performance boost.
+ * </div>
+ * ```html
+ *    <div ng-repeat="model in collection track by model.id">
+ *      {{model.name}}
+ *    </div>
+ * ```
+ *
+ * When no `track by` expression is provided, it is equivalent to tracking by the built-in
+ * `$id` function, which tracks items by their identity:
+ * ```html
+ *    <div ng-repeat="obj in collection track by $id(obj)">
+ *      {{obj.prop}}
+ *    </div>
+ * ```
+ *
+ * <div class="alert alert-warning">
+ * **Note:** `track by` must always be the last expression:
+ * </div>
+ * ```
+ * <div ng-repeat="model in collection | orderBy: 'id' as filtered_result track by model.id">
+ *     {{model.name}}
+ * </div>
+ * ```
+ *
+ * # Special repeat start and end points
+ * To repeat a series of elements instead of just one parent element, ngRepeat (as well as other ng directives) supports extending
+ * the range of the repeater by defining explicit start and end points by using **ng-repeat-start** and **ng-repeat-end** respectively.
+ * The **ng-repeat-start** directive works the same as **ng-repeat**, but will repeat all the HTML code (including the tag it's defined on)
+ * up to and including the ending HTML tag where **ng-repeat-end** is placed.
+ *
+ * The example below makes use of this feature:
+ * ```html
+ *   <header ng-repeat-start="item in items">
+ *     Header {{ item }}
+ *   </header>
+ *   <div class="body">
+ *     Body {{ item }}
+ *   </div>
+ *   <footer ng-repeat-end>
+ *     Footer {{ item }}
+ *   </footer>
+ * ```
+ *
+ * And with an input of {@type ['A','B']} for the items variable in the example above, the output will evaluate to:
+ * ```html
+ *   <header>
+ *     Header A
+ *   </header>
+ *   <div class="body">
+ *     Body A
+ *   </div>
+ *   <footer>
+ *     Footer A
+ *   </footer>
+ *   <header>
+ *     Header B
+ *   </header>
+ *   <div class="body">
+ *     Body B
+ *   </div>
+ *   <footer>
+ *     Footer B
+ *   </footer>
+ * ```
+ *
+ * The custom start and end points for ngRepeat also support all other HTML directive syntax flavors provided in AngularJS (such
+ * as **data-ng-repeat-start**, **x-ng-repeat-start** and **ng:repeat-start**).
+ *
+ * @animations
+ * | Animation                        | Occurs                              |
+ * |----------------------------------|-------------------------------------|
+ * | {@link ng.$animate#enter enter} | when a new item is added to the list or when an item is revealed after a filter |
+ * | {@link ng.$animate#leave leave} | when an item is removed from the list or when an item is filtered out |
+ * | {@link ng.$animate#move move } | when an adjacent item is filtered out causing a reorder or when the item contents are reordered |
+ *
+ * See the example below for defining CSS animations with ngRepeat.
+ *
+ * @element ANY
+ * @scope
+ * @priority 1000
+ * @param {repeat_expression} ngRepeat The expression indicating how to enumerate a collection. These
+ *   formats are currently supported:
+ *
+ *   * `variable in expression` – where variable is the user defined loop variable and `expression`
+ *     is a scope expression giving the collection to enumerate.
+ *
+ *     For example: `album in artist.albums`.
+ *
+ *   * `(key, value) in expression` – where `key` and `value` can be any user defined identifiers,
+ *     and `expression` is the scope expression giving the collection to enumerate.
+ *
+ *     For example: `(name, age) in {'adam':10, 'amalie':12}`.
+ *
+ *   * `variable in expression track by tracking_expression` – You can also provide an optional tracking expression
+ *     which can be used to associate the objects in the collection with the DOM elements. If no tracking expression
+ *     is specified, ng-repeat associates elements by identity. It is an error to have
+ *     more than one tracking expression value resolve to the same key. (This would mean that two distinct objects are
+ *     mapped to the same DOM element, which is not possible.)
+ *
+ *     Note that the tracking expression must come last, after any filters, and the alias expression.
+ *
+ *     For example: `item in items` is equivalent to `item in items track by $id(item)`. This implies that the DOM elements
+ *     will be associated by item identity in the array.
+ *
+ *     For example: `item in items track by $id(item)`. A built in `$id()` function can be used to assign a unique
+ *     `$$hashKey` property to each item in the array. This property is then used as a key to associated DOM elements
+ *     with the corresponding item in the array by identity. Moving the same object in array would move the DOM
+ *     element in the same way in the DOM.
+ *
+ *     For example: `item in items track by item.id` is a typical pattern when the items come from the database. In this
+ *     case the object identity does not matter. Two objects are considered equivalent as long as their `id`
+ *     property is same.
+ *
+ *     For example: `item in items | filter:searchText track by item.id` is a pattern that might be used to apply a filter
+ *     to items in conjunction with a tracking expression.
+ *
+ *   * `variable in expression as alias_expression` – You can also provide an optional alias expression which will then store the
+ *     intermediate results of the repeater after the filters have been applied. Typically this is used to render a special message
+ *     when a filter is active on the repeater, but the filtered result set is empty.
+ *
+ *     For example: `item in items | filter:x as results` will store the fragment of the repeated items as `results`, but only after
+ *     the items have been processed through the filter.
+ *
+ *     Please note that `as [variable name] is not an operator but rather a part of ngRepeat micro-syntax so it can be used only at the end
+ *     (and not as operator, inside an expression).
+ *
+ *     For example: `item in items | filter : x | orderBy : order | limitTo : limit as results` .
+ *
+ * @example
+ * This example uses `ngRepeat` to display a list of people. A filter is used to restrict the displayed
+ * results by name. New (entering) and removed (leaving) items are animated.
+  <example module="ngRepeat" name="ngRepeat" deps="angular-animate.js" animations="true">
+    <file name="index.html">
+      <div ng-controller="repeatController">
+        I have {{friends.length}} friends. They are:
+        <input type="search" ng-model="q" placeholder="filter friends..." aria-label="filter friends" />
+        <ul class="example-animate-container">
+          <li class="animate-repeat" ng-repeat="friend in friends | filter:q as results">
+            [{{$index + 1}}] {{friend.name}} who is {{friend.age}} years old.
+          </li>
+          <li class="animate-repeat" ng-if="results.length == 0">
+            <strong>No results found...</strong>
+          </li>
+        </ul>
+      </div>
+    </file>
+    <file name="script.js">
+      angular.module('ngRepeat', ['ngAnimate']).controller('repeatController', function($scope) {
+        $scope.friends = [
+          {name:'John', age:25, gender:'boy'},
+          {name:'Jessie', age:30, gender:'girl'},
+          {name:'Johanna', age:28, gender:'girl'},
+          {name:'Joy', age:15, gender:'girl'},
+          {name:'Mary', age:28, gender:'girl'},
+          {name:'Peter', age:95, gender:'boy'},
+          {name:'Sebastian', age:50, gender:'boy'},
+          {name:'Erika', age:27, gender:'girl'},
+          {name:'Patrick', age:40, gender:'boy'},
+          {name:'Samantha', age:60, gender:'girl'}
+        ];
+      });
+    </file>
+    <file name="animations.css">
+      .example-animate-container {
+        background:white;
+        border:1px solid black;
+        list-style:none;
+        margin:0;
+        padding:0 10px;
+      }
+
+      .animate-repeat {
+        line-height:30px;
+        list-style:none;
+        box-sizing:border-box;
+      }
+
+      .animate-repeat.ng-move,
+      .animate-repeat.ng-enter,
+      .animate-repeat.ng-leave {
+        transition:all linear 0.5s;
+      }
+
+      .animate-repeat.ng-leave.ng-leave-active,
+      .animate-repeat.ng-move,
+      .animate-repeat.ng-enter {
+        opacity:0;
+        max-height:0;
+      }
+
+      .animate-repeat.ng-leave,
+      .animate-repeat.ng-move.ng-move-active,
+      .animate-repeat.ng-enter.ng-enter-active {
+        opacity:1;
+        max-height:30px;
+      }
+    </file>
+    <file name="protractor.js" type="protractor">
+      var friends = element.all(by.repeater('friend in friends'));
+
+      it('should render initial data set', function() {
+        expect(friends.count()).toBe(10);
+        expect(friends.get(0).getText()).toEqual('[1] John who is 25 years old.');
+        expect(friends.get(1).getText()).toEqual('[2] Jessie who is 30 years old.');
+        expect(friends.last().getText()).toEqual('[10] Samantha who is 60 years old.');
+        expect(element(by.binding('friends.length')).getText())
+            .toMatch("I have 10 friends. They are:");
+      });
+
+       it('should update repeater when filter predicate changes', function() {
+         expect(friends.count()).toBe(10);
+
+         element(by.model('q')).sendKeys('ma');
+
+         expect(friends.count()).toBe(2);
+         expect(friends.get(0).getText()).toEqual('[1] Mary who is 28 years old.');
+         expect(friends.last().getText()).toEqual('[2] Samantha who is 60 years old.');
+       });
+      </file>
+    </example>
+ */
+var ngRepeatDirective = ['$parse', '$animate', '$compile', function($parse, $animate, $compile) {
+  var NG_REMOVED = '$$NG_REMOVED';
+  var ngRepeatMinErr = minErr('ngRepeat');
+
+  var updateScope = function(scope, index, valueIdentifier, value, keyIdentifier, key, arrayLength) {
+    // TODO(perf): generate setters to shave off ~40ms or 1-1.5%
+    scope[valueIdentifier] = value;
+    if (keyIdentifier) scope[keyIdentifier] = key;
+    scope.$index = index;
+    scope.$first = (index === 0);
+    scope.$last = (index === (arrayLength - 1));
+    scope.$middle = !(scope.$first || scope.$last);
+    // jshint bitwise: false
+    scope.$odd = !(scope.$even = (index&1) === 0);
+    // jshint bitwise: true
+  };
+
+  var getBlockStart = function(block) {
+    return block.clone[0];
+  };
+
+  var getBlockEnd = function(block) {
+    return block.clone[block.clone.length - 1];
+  };
+
+
+  return {
+    restrict: 'A',
+    multiElement: true,
+    transclude: 'element',
+    priority: 1000,
+    terminal: true,
+    $$tlb: true,
+    compile: function ngRepeatCompile($element, $attr) {
+      var expression = $attr.ngRepeat;
+      var ngRepeatEndComment = $compile.$$createComment('end ngRepeat', expression);
+
+      var match = expression.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);
+
+      if (!match) {
+        throw ngRepeatMinErr('iexp', "Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",
+            expression);
+      }
+
+      var lhs = match[1];
+      var rhs = match[2];
+      var aliasAs = match[3];
+      var trackByExp = match[4];
+
+      match = lhs.match(/^(?:(\s*[\$\w]+)|\(\s*([\$\w]+)\s*,\s*([\$\w]+)\s*\))$/);
+
+      if (!match) {
+        throw ngRepeatMinErr('iidexp', "'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.",
+            lhs);
+      }
+      var valueIdentifier = match[3] || match[1];
+      var keyIdentifier = match[2];
+
+      if (aliasAs && (!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(aliasAs) ||
+          /^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent|\$root|\$id)$/.test(aliasAs))) {
+        throw ngRepeatMinErr('badident', "alias '{0}' is invalid --- must be a valid JS identifier which is not a reserved name.",
+          aliasAs);
+      }
+
+      var trackByExpGetter, trackByIdExpFn, trackByIdArrayFn, trackByIdObjFn;
+      var hashFnLocals = {$id: hashKey};
+
+      if (trackByExp) {
+        trackByExpGetter = $parse(trackByExp);
+      } else {
+        trackByIdArrayFn = function(key, value) {
+          return hashKey(value);
+        };
+        trackByIdObjFn = function(key) {
+          return key;
+        };
+      }
+
+      return function ngRepeatLink($scope, $element, $attr, ctrl, $transclude) {
+
+        if (trackByExpGetter) {
+          trackByIdExpFn = function(key, value, index) {
+            // assign key, value, and $index to the locals so that they can be used in hash functions
+            if (keyIdentifier) hashFnLocals[keyIdentifier] = key;
+            hashFnLocals[valueIdentifier] = value;
+            hashFnLocals.$index = index;
+            return trackByExpGetter($scope, hashFnLocals);
+          };
+        }
+
+        // Store a list of elements from previous run. This is a hash where key is the item from the
+        // iterator, and the value is objects with following properties.
+        //   - scope: bound scope
+        //   - element: previous element.
+        //   - index: position
+        //
+        // We are using no-proto object so that we don't need to guard against inherited props via
+        // hasOwnProperty.
+        var lastBlockMap = createMap();
+
+        //watch props
+        $scope.$watchCollection(rhs, function ngRepeatAction(collection) {
+          var index, length,
+              previousNode = $element[0],     // node that cloned nodes should be inserted after
+                                              // initialized to the comment node anchor
+              nextNode,
+              // Same as lastBlockMap but it has the current state. It will become the
+              // lastBlockMap on the next iteration.
+              nextBlockMap = createMap(),
+              collectionLength,
+              key, value, // key/value of iteration
+              trackById,
+              trackByIdFn,
+              collectionKeys,
+              block,       // last object information {scope, element, id}
+              nextBlockOrder,
+              elementsToRemove;
+
+          if (aliasAs) {
+            $scope[aliasAs] = collection;
+          }
+
+          if (isArrayLike(collection)) {
+            collectionKeys = collection;
+            trackByIdFn = trackByIdExpFn || trackByIdArrayFn;
+          } else {
+            trackByIdFn = trackByIdExpFn || trackByIdObjFn;
+            // if object, extract keys, in enumeration order, unsorted
+            collectionKeys = [];
+            for (var itemKey in collection) {
+              if (hasOwnProperty.call(collection, itemKey) && itemKey.charAt(0) !== '$') {
+                collectionKeys.push(itemKey);
+              }
+            }
+          }
+
+          collectionLength = collectionKeys.length;
+          nextBlockOrder = new Array(collectionLength);
+
+          // locate existing items
+          for (index = 0; index < collectionLength; index++) {
+            key = (collection === collectionKeys) ? index : collectionKeys[index];
+            value = collection[key];
+            trackById = trackByIdFn(key, value, index);
+            if (lastBlockMap[trackById]) {
+              // found previously seen block
+              block = lastBlockMap[trackById];
+              delete lastBlockMap[trackById];
+              nextBlockMap[trackById] = block;
+              nextBlockOrder[index] = block;
+            } else if (nextBlockMap[trackById]) {
+              // if collision detected. restore lastBlockMap and throw an error
+              forEach(nextBlockOrder, function(block) {
+                if (block && block.scope) lastBlockMap[block.id] = block;
+              });
+              throw ngRepeatMinErr('dupes',
+                  "Duplicates in a repeater are not allowed. Use 'track by' expression to specify unique keys. Repeater: {0}, Duplicate key: {1}, Duplicate value: {2}",
+                  expression, trackById, value);
+            } else {
+              // new never before seen block
+              nextBlockOrder[index] = {id: trackById, scope: undefined, clone: undefined};
+              nextBlockMap[trackById] = true;
+            }
+          }
+
+          // remove leftover items
+          for (var blockKey in lastBlockMap) {
+            block = lastBlockMap[blockKey];
+            elementsToRemove = getBlockNodes(block.clone);
+            $animate.leave(elementsToRemove);
+            if (elementsToRemove[0].parentNode) {
+              // if the element was not removed yet because of pending animation, mark it as deleted
+              // so that we can ignore it later
+              for (index = 0, length = elementsToRemove.length; index < length; index++) {
+                elementsToRemove[index][NG_REMOVED] = true;
+              }
+            }
+            block.scope.$destroy();
+          }
+
+          // we are not using forEach for perf reasons (trying to avoid #call)
+          for (index = 0; index < collectionLength; index++) {
+            key = (collection === collectionKeys) ? index : collectionKeys[index];
+            value = collection[key];
+            block = nextBlockOrder[index];
+
+            if (block.scope) {
+              // if we have already seen this object, then we need to reuse the
+              // associated scope/element
+
+              nextNode = previousNode;
+
+              // skip nodes that are already pending removal via leave animation
+              do {
+                nextNode = nextNode.nextSibling;
+              } while (nextNode && nextNode[NG_REMOVED]);
+
+              if (getBlockStart(block) != nextNode) {
+                // existing item which got moved
+                $animate.move(getBlockNodes(block.clone), null, previousNode);
+              }
+              previousNode = getBlockEnd(block);
+              updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength);
+            } else {
+              // new item which we don't know about
+              $transclude(function ngRepeatTransclude(clone, scope) {
+                block.scope = scope;
+                // http://jsperf.com/clone-vs-createcomment
+                var endNode = ngRepeatEndComment.cloneNode(false);
+                clone[clone.length++] = endNode;
+
+                $animate.enter(clone, null, previousNode);
+                previousNode = endNode;
+                // Note: We only need the first/last node of the cloned nodes.
+                // However, we need to keep the reference to the jqlite wrapper as it might be changed later
+                // by a directive with templateUrl when its template arrives.
+                block.clone = clone;
+                nextBlockMap[block.id] = block;
+                updateScope(block.scope, index, valueIdentifier, value, keyIdentifier, key, collectionLength);
+              });
+            }
+          }
+          lastBlockMap = nextBlockMap;
+        });
+      };
+    }
+  };
+}];
+
+var NG_HIDE_CLASS = 'ng-hide';
+var NG_HIDE_IN_PROGRESS_CLASS = 'ng-hide-animate';
+/**
+ * @ngdoc directive
+ * @name ngShow
+ * @multiElement
+ *
+ * @description
+ * The `ngShow` directive shows or hides the given HTML element based on the expression
+ * provided to the `ngShow` attribute. The element is shown or hidden by removing or adding
+ * the `.ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined
+ * in AngularJS and sets the display style to none (using an !important flag).
+ * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
+ *
+ * ```html
+ * <!-- when $scope.myValue is truthy (element is visible) -->
+ * <div ng-show="myValue"></div>
+ *
+ * <!-- when $scope.myValue is falsy (element is hidden) -->
+ * <div ng-show="myValue" class="ng-hide"></div>
+ * ```
+ *
+ * When the `ngShow` expression evaluates to a falsy value then the `.ng-hide` CSS class is added to the class
+ * attribute on the element causing it to become hidden. When truthy, the `.ng-hide` CSS class is removed
+ * from the element causing the element not to appear hidden.
+ *
+ * ## Why is !important used?
+ *
+ * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector
+ * can be easily overridden by heavier selectors. For example, something as simple
+ * as changing the display style on a HTML list item would make hidden elements appear visible.
+ * This also becomes a bigger issue when dealing with CSS frameworks.
+ *
+ * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector
+ * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the
+ * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.
+ *
+ * ### Overriding `.ng-hide`
+ *
+ * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change
+ * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`
+ * class CSS. Note that the selector that needs to be used is actually `.ng-hide:not(.ng-hide-animate)` to cope
+ * with extra animation classes that can be added.
+ *
+ * ```css
+ * .ng-hide:not(.ng-hide-animate) {
+ *   /&#42; this is just another form of hiding an element &#42;/
+ *   display: block!important;
+ *   position: absolute;
+ *   top: -9999px;
+ *   left: -9999px;
+ * }
+ * ```
+ *
+ * By default you don't need to override in CSS anything and the animations will work around the display style.
+ *
+ * ## A note about animations with `ngShow`
+ *
+ * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression
+ * is true and false. This system works like the animation system present with ngClass except that
+ * you must also include the !important flag to override the display property
+ * so that you can perform an animation when the element is hidden during the time of the animation.
+ *
+ * ```css
+ * //
+ * //a working example can be found at the bottom of this page
+ * //
+ * .my-element.ng-hide-add, .my-element.ng-hide-remove {
+ *   /&#42; this is required as of 1.3x to properly
+ *      apply all styling in a show/hide animation &#42;/
+ *   transition: 0s linear all;
+ * }
+ *
+ * .my-element.ng-hide-add-active,
+ * .my-element.ng-hide-remove-active {
+ *   /&#42; the transition is defined in the active class &#42;/
+ *   transition: 1s linear all;
+ * }
+ *
+ * .my-element.ng-hide-add { ... }
+ * .my-element.ng-hide-add.ng-hide-add-active { ... }
+ * .my-element.ng-hide-remove { ... }
+ * .my-element.ng-hide-remove.ng-hide-remove-active { ... }
+ * ```
+ *
+ * Keep in mind that, as of AngularJS version 1.3, there is no need to change the display
+ * property to block during animation states--ngAnimate will handle the style toggling automatically for you.
+ *
+ * @animations
+ * | Animation                        | Occurs                              |
+ * |----------------------------------|-------------------------------------|
+ * | {@link $animate#addClass addClass} `.ng-hide`  | after the `ngShow` expression evaluates to a non truthy value and just before the contents are set to hidden |
+ * | {@link $animate#removeClass removeClass}  `.ng-hide`  | after the `ngShow` expression evaluates to a truthy value and just before contents are set to visible |
+ *
+ * @element ANY
+ * @param {expression} ngShow If the {@link guide/expression expression} is truthy
+ *     then the element is shown or hidden respectively.
+ *
+ * @example
+  <example module="ngAnimate" deps="angular-animate.js" animations="true">
+    <file name="index.html">
+      Click me: <input type="checkbox" ng-model="checked" aria-label="Toggle ngHide"><br/>
+      <div>
+        Show:
+        <div class="check-element animate-show" ng-show="checked">
+          <span class="glyphicon glyphicon-thumbs-up"></span> I show up when your checkbox is checked.
+        </div>
+      </div>
+      <div>
+        Hide:
+        <div class="check-element animate-show" ng-hide="checked">
+          <span class="glyphicon glyphicon-thumbs-down"></span> I hide when your checkbox is checked.
+        </div>
+      </div>
+    </file>
+    <file name="glyphicons.css">
+      @import url(../../components/bootstrap-3.1.1/css/bootstrap.css);
+    </file>
+    <file name="animations.css">
+      .animate-show {
+        line-height: 20px;
+        opacity: 1;
+        padding: 10px;
+        border: 1px solid black;
+        background: white;
+      }
+
+      .animate-show.ng-hide-add, .animate-show.ng-hide-remove {
+        transition: all linear 0.5s;
+      }
+
+      .animate-show.ng-hide {
+        line-height: 0;
+        opacity: 0;
+        padding: 0 10px;
+      }
+
+      .check-element {
+        padding: 10px;
+        border: 1px solid black;
+        background: white;
+      }
+    </file>
+    <file name="protractor.js" type="protractor">
+      var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));
+      var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));
+
+      it('should check ng-show / ng-hide', function() {
+        expect(thumbsUp.isDisplayed()).toBeFalsy();
+        expect(thumbsDown.isDisplayed()).toBeTruthy();
+
+        element(by.model('checked')).click();
+
+        expect(thumbsUp.isDisplayed()).toBeTruthy();
+        expect(thumbsDown.isDisplayed()).toBeFalsy();
+      });
+    </file>
+  </example>
+ */
+var ngShowDirective = ['$animate', function($animate) {
+  return {
+    restrict: 'A',
+    multiElement: true,
+    link: function(scope, element, attr) {
+      scope.$watch(attr.ngShow, function ngShowWatchAction(value) {
+        // we're adding a temporary, animation-specific class for ng-hide since this way
+        // we can control when the element is actually displayed on screen without having
+        // to have a global/greedy CSS selector that breaks when other animations are run.
+        // Read: https://github.com/angular/angular.js/issues/9103#issuecomment-58335845
+        $animate[value ? 'removeClass' : 'addClass'](element, NG_HIDE_CLASS, {
+          tempClasses: NG_HIDE_IN_PROGRESS_CLASS
+        });
+      });
+    }
+  };
+}];
+
+
+/**
+ * @ngdoc directive
+ * @name ngHide
+ * @multiElement
+ *
+ * @description
+ * The `ngHide` directive shows or hides the given HTML element based on the expression
+ * provided to the `ngHide` attribute. The element is shown or hidden by removing or adding
+ * the `ng-hide` CSS class onto the element. The `.ng-hide` CSS class is predefined
+ * in AngularJS and sets the display style to none (using an !important flag).
+ * For CSP mode please add `angular-csp.css` to your html file (see {@link ng.directive:ngCsp ngCsp}).
+ *
+ * ```html
+ * <!-- when $scope.myValue is truthy (element is hidden) -->
+ * <div ng-hide="myValue" class="ng-hide"></div>
+ *
+ * <!-- when $scope.myValue is falsy (element is visible) -->
+ * <div ng-hide="myValue"></div>
+ * ```
+ *
+ * When the `ngHide` expression evaluates to a truthy value then the `.ng-hide` CSS class is added to the class
+ * attribute on the element causing it to become hidden. When falsy, the `.ng-hide` CSS class is removed
+ * from the element causing the element not to appear hidden.
+ *
+ * ## Why is !important used?
+ *
+ * You may be wondering why !important is used for the `.ng-hide` CSS class. This is because the `.ng-hide` selector
+ * can be easily overridden by heavier selectors. For example, something as simple
+ * as changing the display style on a HTML list item would make hidden elements appear visible.
+ * This also becomes a bigger issue when dealing with CSS frameworks.
+ *
+ * By using !important, the show and hide behavior will work as expected despite any clash between CSS selector
+ * specificity (when !important isn't used with any conflicting styles). If a developer chooses to override the
+ * styling to change how to hide an element then it is just a matter of using !important in their own CSS code.
+ *
+ * ### Overriding `.ng-hide`
+ *
+ * By default, the `.ng-hide` class will style the element with `display: none!important`. If you wish to change
+ * the hide behavior with ngShow/ngHide then this can be achieved by restating the styles for the `.ng-hide`
+ * class in CSS:
+ *
+ * ```css
+ * .ng-hide {
+ *   /&#42; this is just another form of hiding an element &#42;/
+ *   display: block!important;
+ *   position: absolute;
+ *   top: -9999px;
+ *   left: -9999px;
+ * }
+ * ```
+ *
+ * By default you don't need to override in CSS anything and the animations will work around the display style.
+ *
+ * ## A note about animations with `ngHide`
+ *
+ * Animations in ngShow/ngHide work with the show and hide events that are triggered when the directive expression
+ * is true and false. This system works like the animation system present with ngClass, except that the `.ng-hide`
+ * CSS class is added and removed for you instead of your own CSS class.
+ *
+ * ```css
+ * //
+ * //a working example can be found at the bottom of this page
+ * //
+ * .my-element.ng-hide-add, .my-element.ng-hide-remove {
+ *   transition: 0.5s linear all;
+ * }
+ *
+ * .my-element.ng-hide-add { ... }
+ * .my-element.ng-hide-add.ng-hide-add-active { ... }
+ * .my-element.ng-hide-remove { ... }
+ * .my-element.ng-hide-remove.ng-hide-remove-active { ... }
+ * ```
+ *
+ * Keep in mind that, as of AngularJS version 1.3, there is no need to change the display
+ * property to block during animation states--ngAnimate will handle the style toggling automatically for you.
+ *
+ * @animations
+ * | Animation                        | Occurs                              |
+ * |----------------------------------|-------------------------------------|
+ * | {@link $animate#addClass addClass} `.ng-hide`  | after the `ngHide` expression evaluates to a truthy value and just before the contents are set to hidden |
+ * | {@link $animate#removeClass removeClass}  `.ng-hide`  | after the `ngHide` expression evaluates to a non truthy value and just before contents are set to visible |
+ *
+ *
+ * @element ANY
+ * @param {expression} ngHide If the {@link guide/expression expression} is truthy then
+ *     the element is shown or hidden respectively.
+ *
+ * @example
+  <example module="ngAnimate" deps="angular-animate.js" animations="true">
+    <file name="index.html">
+      Click me: <input type="checkbox" ng-model="checked" aria-label="Toggle ngShow"><br/>
+      <div>
+        Show:
+        <div class="check-element animate-hide" ng-show="checked">
+          <span class="glyphicon glyphicon-thumbs-up"></span> I show up when your checkbox is checked.
+        </div>
+      </div>
+      <div>
+        Hide:
+        <div class="check-element animate-hide" ng-hide="checked">
+          <span class="glyphicon glyphicon-thumbs-down"></span> I hide when your checkbox is checked.
+        </div>
+      </div>
+    </file>
+    <file name="glyphicons.css">
+      @import url(../../components/bootstrap-3.1.1/css/bootstrap.css);
+    </file>
+    <file name="animations.css">
+      .animate-hide {
+        transition: all linear 0.5s;
+        line-height: 20px;
+        opacity: 1;
+        padding: 10px;
+        border: 1px solid black;
+        background: white;
+      }
+
+      .animate-hide.ng-hide {
+        line-height: 0;
+        opacity: 0;
+        padding: 0 10px;
+      }
+
+      .check-element {
+        padding: 10px;
+        border: 1px solid black;
+        background: white;
+      }
+    </file>
+    <file name="protractor.js" type="protractor">
+      var thumbsUp = element(by.css('span.glyphicon-thumbs-up'));
+      var thumbsDown = element(by.css('span.glyphicon-thumbs-down'));
+
+      it('should check ng-show / ng-hide', function() {
+        expect(thumbsUp.isDisplayed()).toBeFalsy();
+        expect(thumbsDown.isDisplayed()).toBeTruthy();
+
+        element(by.model('checked')).click();
+
+        expect(thumbsUp.isDisplayed()).toBeTruthy();
+        expect(thumbsDown.isDisplayed()).toBeFalsy();
+      });
+    </file>
+  </example>
+ */
+var ngHideDirective = ['$animate', function($animate) {
+  return {
+    restrict: 'A',
+    multiElement: true,
+    link: function(scope, element, attr) {
+      scope.$watch(attr.ngHide, function ngHideWatchAction(value) {
+        // The comment inside of the ngShowDirective explains why we add and
+        // remove a temporary class for the show/hide animation
+        $animate[value ? 'addClass' : 'removeClass'](element,NG_HIDE_CLASS, {
+          tempClasses: NG_HIDE_IN_PROGRESS_CLASS
+        });
+      });
+    }
+  };
+}];
+
+/**
+ * @ngdoc directive
+ * @name ngStyle
+ * @restrict AC
+ *
+ * @description
+ * The `ngStyle` directive allows you to set CSS style on an HTML element conditionally.
+ *
+ * @knownIssue
+ * You should not use {@link guide/interpolation interpolation} in the value of the `style`
+ * attribute, when using the `ngStyle` directive on the same element.
+ * See {@link guide/interpolation#known-issues here} for more info.
+ *
+ * @element ANY
+ * @param {expression} ngStyle
+ *
+ * {@link guide/expression Expression} which evals to an
+ * object whose keys are CSS style names and values are corresponding values for those CSS
+ * keys.
+ *
+ * Since some CSS style names are not valid keys for an object, they must be quoted.
+ * See the 'background-color' style in the example below.
+ *
+ * @example
+   <example>
+     <file name="index.html">
+        <input type="button" value="set color" ng-click="myStyle={color:'red'}">
+        <input type="button" value="set background" ng-click="myStyle={'background-color':'blue'}">
+        <input type="button" value="clear" ng-click="myStyle={}">
+        <br/>
+        <span ng-style="myStyle">Sample Text</span>
+        <pre>myStyle={{myStyle}}</pre>
+     </file>
+     <file name="style.css">
+       span {
+         color: black;
+       }
+     </file>
+     <file name="protractor.js" type="protractor">
+       var colorSpan = element(by.css('span'));
+
+       it('should check ng-style', function() {
+         expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');
+         element(by.css('input[value=\'set color\']')).click();
+         expect(colorSpan.getCssValue('color')).toBe('rgba(255, 0, 0, 1)');
+         element(by.css('input[value=clear]')).click();
+         expect(colorSpan.getCssValue('color')).toBe('rgba(0, 0, 0, 1)');
+       });
+     </file>
+   </example>
+ */
+var ngStyleDirective = ngDirective(function(scope, element, attr) {
+  scope.$watch(attr.ngStyle, function ngStyleWatchAction(newStyles, oldStyles) {
+    if (oldStyles && (newStyles !== oldStyles)) {
+      forEach(oldStyles, function(val, style) { element.css(style, '');});
+    }
+    if (newStyles) element.css(newStyles);
+  }, true);
+});
+
+/**
+ * @ngdoc directive
+ * @name ngSwitch
+ * @restrict EA
+ *
+ * @description
+ * The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression.
+ * Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location
+ * as specified in the template.
+ *
+ * The directive itself works similar to ngInclude, however, instead of downloading template code (or loading it
+ * from the template cache), `ngSwitch` simply chooses one of the nested elements and makes it visible based on which element
+ * matches the value obtained from the evaluated expression. In other words, you define a container element
+ * (where you place the directive), place an expression on the **`on="..."` attribute**
+ * (or the **`ng-switch="..."` attribute**), define any inner elements inside of the directive and place
+ * a when attribute per element. The when attribute is used to inform ngSwitch which element to display when the on
+ * expression is evaluated. If a matching expression is not found via a when attribute then an element with the default
+ * attribute is displayed.
+ *
+ * <div class="alert alert-info">
+ * Be aware that the attribute values to match against cannot be expressions. They are interpreted
+ * as literal string values to match against.
+ * For example, **`ng-switch-when="someVal"`** will match against the string `"someVal"` not against the
+ * value of the expression `$scope.someVal`.
+ * </div>
+
+ * @animations
+ * | Animation                        | Occurs                              |
+ * |----------------------------------|-------------------------------------|
+ * | {@link ng.$animate#enter enter}  | after the ngSwitch contents change and the matched child element is placed inside the container |
+ * | {@link ng.$animate#leave leave}  | after the ngSwitch contents change and just before the former contents are removed from the DOM |
+ *
+ * @usage
+ *
+ * ```
+ * <ANY ng-switch="expression">
+ *   <ANY ng-switch-when="matchValue1">...</ANY>
+ *   <ANY ng-switch-when="matchValue2">...</ANY>
+ *   <ANY ng-switch-default>...</ANY>
+ * </ANY>
+ * ```
+ *
+ *
+ * @scope
+ * @priority 1200
+ * @param {*} ngSwitch|on expression to match against <code>ng-switch-when</code>.
+ * On child elements add:
+ *
+ * * `ngSwitchWhen`: the case statement to match against. If match then this
+ *   case will be displayed. If the same match appears multiple times, all the
+ *   elements will be displayed.
+ * * `ngSwitchDefault`: the default case when no other case match. If there
+ *   are multiple default cases, all of them will be displayed when no other
+ *   case match.
+ *
+ *
+ * @example
+  <example module="switchExample" deps="angular-animate.js" animations="true">
+    <file name="index.html">
+      <div ng-controller="ExampleController">
+        <select ng-model="selection" ng-options="item for item in items">
+        </select>
+        <code>selection={{selection}}</code>
+        <hr/>
+        <div class="animate-switch-container"
+          ng-switch on="selection">
+            <div class="animate-switch" ng-switch-when="settings">Settings Div</div>
+            <div class="animate-switch" ng-switch-when="home">Home Span</div>
+            <div class="animate-switch" ng-switch-default>default</div>
+        </div>
+      </div>
+    </file>
+    <file name="script.js">
+      angular.module('switchExample', ['ngAnimate'])
+        .controller('ExampleController', ['$scope', function($scope) {
+          $scope.items = ['settings', 'home', 'other'];
+          $scope.selection = $scope.items[0];
+        }]);
+    </file>
+    <file name="animations.css">
+      .animate-switch-container {
+        position:relative;
+        background:white;
+        border:1px solid black;
+        height:40px;
+        overflow:hidden;
+      }
+
+      .animate-switch {
+        padding:10px;
+      }
+
+      .animate-switch.ng-animate {
+        transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
+
+        position:absolute;
+        top:0;
+        left:0;
+        right:0;
+        bottom:0;
+      }
+
+      .animate-switch.ng-leave.ng-leave-active,
+      .animate-switch.ng-enter {
+        top:-50px;
+      }
+      .animate-switch.ng-leave,
+      .animate-switch.ng-enter.ng-enter-active {
+        top:0;
+      }
+    </file>
+    <file name="protractor.js" type="protractor">
+      var switchElem = element(by.css('[ng-switch]'));
+      var select = element(by.model('selection'));
+
+      it('should start in settings', function() {
+        expect(switchElem.getText()).toMatch(/Settings Div/);
+      });
+      it('should change to home', function() {
+        select.all(by.css('option')).get(1).click();
+        expect(switchElem.getText()).toMatch(/Home Span/);
+      });
+      it('should select default', function() {
+        select.all(by.css('option')).get(2).click();
+        expect(switchElem.getText()).toMatch(/default/);
+      });
+    </file>
+  </example>
+ */
+var ngSwitchDirective = ['$animate', '$compile', function($animate, $compile) {
+  return {
+    require: 'ngSwitch',
+
+    // asks for $scope to fool the BC controller module
+    controller: ['$scope', function ngSwitchController() {
+     this.cases = {};
+    }],
+    link: function(scope, element, attr, ngSwitchController) {
+      var watchExpr = attr.ngSwitch || attr.on,
+          selectedTranscludes = [],
+          selectedElements = [],
+          previousLeaveAnimations = [],
+          selectedScopes = [];
+
+      var spliceFactory = function(array, index) {
+          return function() { array.splice(index, 1); };
+      };
+
+      scope.$watch(watchExpr, function ngSwitchWatchAction(value) {
+        var i, ii;
+        for (i = 0, ii = previousLeaveAnimations.length; i < ii; ++i) {
+          $animate.cancel(previousLeaveAnimations[i]);
+        }
+        previousLeaveAnimations.length = 0;
+
+        for (i = 0, ii = selectedScopes.length; i < ii; ++i) {
+          var selected = getBlockNodes(selectedElements[i].clone);
+          selectedScopes[i].$destroy();
+          var promise = previousLeaveAnimations[i] = $animate.leave(selected);
+          promise.then(spliceFactory(previousLeaveAnimations, i));
+        }
+
+        selectedElements.length = 0;
+        selectedScopes.length = 0;
+
+        if ((selectedTranscludes = ngSwitchController.cases['!' + value] || ngSwitchController.cases['?'])) {
+          forEach(selectedTranscludes, function(selectedTransclude) {
+            selectedTransclude.transclude(function(caseElement, selectedScope) {
+              selectedScopes.push(selectedScope);
+              var anchor = selectedTransclude.element;
+              caseElement[caseElement.length++] = $compile.$$createComment('end ngSwitchWhen');
+              var block = { clone: caseElement };
+
+              selectedElements.push(block);
+              $animate.enter(caseElement, anchor.parent(), anchor);
+            });
+          });
+        }
+      });
+    }
+  };
+}];
+
+var ngSwitchWhenDirective = ngDirective({
+  transclude: 'element',
+  priority: 1200,
+  require: '^ngSwitch',
+  multiElement: true,
+  link: function(scope, element, attrs, ctrl, $transclude) {
+    ctrl.cases['!' + attrs.ngSwitchWhen] = (ctrl.cases['!' + attrs.ngSwitchWhen] || []);
+    ctrl.cases['!' + attrs.ngSwitchWhen].push({ transclude: $transclude, element: element });
+  }
+});
+
+var ngSwitchDefaultDirective = ngDirective({
+  transclude: 'element',
+  priority: 1200,
+  require: '^ngSwitch',
+  multiElement: true,
+  link: function(scope, element, attr, ctrl, $transclude) {
+    ctrl.cases['?'] = (ctrl.cases['?'] || []);
+    ctrl.cases['?'].push({ transclude: $transclude, element: element });
+   }
+});
+
+/**
+ * @ngdoc directive
+ * @name ngTransclude
+ * @restrict EAC
+ *
+ * @description
+ * Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.
+ *
+ * You can specify that you want to insert a named transclusion slot, instead of the default slot, by providing the slot name
+ * as the value of the `ng-transclude` or `ng-transclude-slot` attribute.
+ *
+ * If the transcluded content is not empty (i.e. contains one or more DOM nodes, including whitespace text nodes), any existing
+ * content of this element will be removed before the transcluded content is inserted.
+ * If the transcluded content is empty, the existing content is left intact. This lets you provide fallback content in the case
+ * that no transcluded content is provided.
+ *
+ * @element ANY
+ *
+ * @param {string} ngTransclude|ngTranscludeSlot the name of the slot to insert at this point. If this is not provided, is empty
+ *                                               or its value is the same as the name of the attribute then the default slot is used.
+ *
+ * @example
+ * ### Basic transclusion
+ * This example demonstrates basic transclusion of content into a component directive.
+ * <example name="simpleTranscludeExample" module="transcludeExample">
+ *   <file name="index.html">
+ *     <script>
+ *       angular.module('transcludeExample', [])
+ *        .directive('pane', function(){
+ *           return {
+ *             restrict: 'E',
+ *             transclude: true,
+ *             scope: { title:'@' },
+ *             template: '<div style="border: 1px solid black;">' +
+ *                         '<div style="background-color: gray">{{title}}</div>' +
+ *                         '<ng-transclude></ng-transclude>' +
+ *                       '</div>'
+ *           };
+ *       })
+ *       .controller('ExampleController', ['$scope', function($scope) {
+ *         $scope.title = 'Lorem Ipsum';
+ *         $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';
+ *       }]);
+ *     </script>
+ *     <div ng-controller="ExampleController">
+ *       <input ng-model="title" aria-label="title"> <br/>
+ *       <textarea ng-model="text" aria-label="text"></textarea> <br/>
+ *       <pane title="{{title}}">{{text}}</pane>
+ *     </div>
+ *   </file>
+ *   <file name="protractor.js" type="protractor">
+ *      it('should have transcluded', function() {
+ *        var titleElement = element(by.model('title'));
+ *        titleElement.clear();
+ *        titleElement.sendKeys('TITLE');
+ *        var textElement = element(by.model('text'));
+ *        textElement.clear();
+ *        textElement.sendKeys('TEXT');
+ *        expect(element(by.binding('title')).getText()).toEqual('TITLE');
+ *        expect(element(by.binding('text')).getText()).toEqual('TEXT');
+ *      });
+ *   </file>
+ * </example>
+ *
+ * @example
+ * ### Transclude fallback content
+ * This example shows how to use `NgTransclude` with fallback content, that
+ * is displayed if no transcluded content is provided.
+ *
+ * <example module="transcludeFallbackContentExample">
+ * <file name="index.html">
+ * <script>
+ * angular.module('transcludeFallbackContentExample', [])
+ * .directive('myButton', function(){
+ *             return {
+ *               restrict: 'E',
+ *               transclude: true,
+ *               scope: true,
+ *               template: '<button style="cursor: pointer;">' +
+ *                           '<ng-transclude>' +
+ *                             '<b style="color: red;">Button1</b>' +
+ *                           '</ng-transclude>' +
+ *                         '</button>'
+ *             };
+ *         });
+ * </script>
+ * <!-- fallback button content -->
+ * <my-button id="fallback"></my-button>
+ * <!-- modified button content -->
+ * <my-button id="modified">
+ *   <i style="color: green;">Button2</i>
+ * </my-button>
+ * </file>
+ * <file name="protractor.js" type="protractor">
+ * it('should have different transclude element content', function() {
+ *          expect(element(by.id('fallback')).getText()).toBe('Button1');
+ *          expect(element(by.id('modified')).getText()).toBe('Button2');
+ *        });
+ * </file>
+ * </example>
+ *
+ * @example
+ * ### Multi-slot transclusion
+ * This example demonstrates using multi-slot transclusion in a component directive.
+ * <example name="multiSlotTranscludeExample" module="multiSlotTranscludeExample">
+ *   <file name="index.html">
+ *    <style>
+ *      .title, .footer {
+ *        background-color: gray
+ *      }
+ *    </style>
+ *    <div ng-controller="ExampleController">
+ *      <input ng-model="title" aria-label="title"> <br/>
+ *      <textarea ng-model="text" aria-label="text"></textarea> <br/>
+ *      <pane>
+ *        <pane-title><a ng-href="{{link}}">{{title}}</a></pane-title>
+ *        <pane-body><p>{{text}}</p></pane-body>
+ *      </pane>
+ *    </div>
+ *   </file>
+ *   <file name="app.js">
+ *    angular.module('multiSlotTranscludeExample', [])
+ *     .directive('pane', function(){
+ *        return {
+ *          restrict: 'E',
+ *          transclude: {
+ *            'title': '?paneTitle',
+ *            'body': 'paneBody',
+ *            'footer': '?paneFooter'
+ *          },
+ *          template: '<div style="border: 1px solid black;">' +
+ *                      '<div class="title" ng-transclude="title">Fallback Title</div>' +
+ *                      '<div ng-transclude="body"></div>' +
+ *                      '<div class="footer" ng-transclude="footer">Fallback Footer</div>' +
+ *                    '</div>'
+ *        };
+ *    })
+ *    .controller('ExampleController', ['$scope', function($scope) {
+ *      $scope.title = 'Lorem Ipsum';
+ *      $scope.link = "https://google.com";
+ *      $scope.text = 'Neque porro quisquam est qui dolorem ipsum quia dolor...';
+ *    }]);
+ *   </file>
+ *   <file name="protractor.js" type="protractor">
+ *      it('should have transcluded the title and the body', function() {
+ *        var titleElement = element(by.model('title'));
+ *        titleElement.clear();
+ *        titleElement.sendKeys('TITLE');
+ *        var textElement = element(by.model('text'));
+ *        textElement.clear();
+ *        textElement.sendKeys('TEXT');
+ *        expect(element(by.css('.title')).getText()).toEqual('TITLE');
+ *        expect(element(by.binding('text')).getText()).toEqual('TEXT');
+ *        expect(element(by.css('.footer')).getText()).toEqual('Fallback Footer');
+ *      });
+ *   </file>
+ * </example>
+ */
+var ngTranscludeMinErr = minErr('ngTransclude');
+var ngTranscludeDirective = ['$compile', function($compile) {
+  return {
+    restrict: 'EAC',
+    terminal: true,
+    compile: function ngTranscludeCompile(tElement) {
+
+      // Remove and cache any original content to act as a fallback
+      var fallbackLinkFn = $compile(tElement.contents());
+      tElement.empty();
+
+      return function ngTranscludePostLink($scope, $element, $attrs, controller, $transclude) {
+
+        if (!$transclude) {
+          throw ngTranscludeMinErr('orphan',
+          'Illegal use of ngTransclude directive in the template! ' +
+          'No parent directive that requires a transclusion found. ' +
+          'Element: {0}',
+          startingTag($element));
+        }
+
+
+        // If the attribute is of the form: `ng-transclude="ng-transclude"` then treat it like the default
+        if ($attrs.ngTransclude === $attrs.$attr.ngTransclude) {
+          $attrs.ngTransclude = '';
+        }
+        var slotName = $attrs.ngTransclude || $attrs.ngTranscludeSlot;
+
+        // If the slot is required and no transclusion content is provided then this call will throw an error
+        $transclude(ngTranscludeCloneAttachFn, null, slotName);
+
+        // If the slot is optional and no transclusion content is provided then use the fallback content
+        if (slotName && !$transclude.isSlotFilled(slotName)) {
+          useFallbackContent();
+        }
+
+        function ngTranscludeCloneAttachFn(clone, transcludedScope) {
+          if (clone.length) {
+            $element.append(clone);
+          } else {
+            useFallbackContent();
+            // There is nothing linked against the transcluded scope since no content was available,
+            // so it should be safe to clean up the generated scope.
+            transcludedScope.$destroy();
+          }
+        }
+
+        function useFallbackContent() {
+          // Since this is the fallback content rather than the transcluded content,
+          // we link against the scope of this directive rather than the transcluded scope
+          fallbackLinkFn($scope, function(clone) {
+            $element.append(clone);
+          });
+        }
+      };
+    }
+  };
+}];
+
+/**
+ * @ngdoc directive
+ * @name script
+ * @restrict E
+ *
+ * @description
+ * Load the content of a `<script>` element into {@link ng.$templateCache `$templateCache`}, so that the
+ * template can be used by {@link ng.directive:ngInclude `ngInclude`},
+ * {@link ngRoute.directive:ngView `ngView`}, or {@link guide/directive directives}. The type of the
+ * `<script>` element must be specified as `text/ng-template`, and a cache name for the template must be
+ * assigned through the element's `id`, which can then be used as a directive's `templateUrl`.
+ *
+ * @param {string} type Must be set to `'text/ng-template'`.
+ * @param {string} id Cache name of the template.
+ *
+ * @example
+  <example>
+    <file name="index.html">
+      <script type="text/ng-template" id="/tpl.html">
+        Content of the template.
+      </script>
+
+      <a ng-click="currentTpl='/tpl.html'" id="tpl-link">Load inlined template</a>
+      <div id="tpl-content" ng-include src="currentTpl"></div>
+    </file>
+    <file name="protractor.js" type="protractor">
+      it('should load template defined inside script tag', function() {
+        element(by.css('#tpl-link')).click();
+        expect(element(by.css('#tpl-content')).getText()).toMatch(/Content of the template/);
+      });
+    </file>
+  </example>
+ */
+var scriptDirective = ['$templateCache', function($templateCache) {
+  return {
+    restrict: 'E',
+    terminal: true,
+    compile: function(element, attr) {
+      if (attr.type == 'text/ng-template') {
+        var templateUrl = attr.id,
+            text = element[0].text;
+
+        $templateCache.put(templateUrl, text);
+      }
+    }
+  };
+}];
+
+var noopNgModelController = { $setViewValue: noop, $render: noop };
+
+function chromeHack(optionElement) {
+  // Workaround for https://code.google.com/p/chromium/issues/detail?id=381459
+  // Adding an <option selected="selected"> element to a <select required="required"> should
+  // automatically select the new element
+  if (optionElement[0].hasAttribute('selected')) {
+    optionElement[0].selected = true;
+  }
+}
+
+/**
+ * @ngdoc type
+ * @name  select.SelectController
+ * @description
+ * The controller for the `<select>` directive. This provides support for reading
+ * and writing the selected value(s) of the control and also coordinates dynamically
+ * added `<option>` elements, perhaps by an `ngRepeat` directive.
+ */
+var SelectController =
+        ['$element', '$scope', function($element, $scope) {
+
+  var self = this,
+      optionsMap = new HashMap();
+
+  // If the ngModel doesn't get provided then provide a dummy noop version to prevent errors
+  self.ngModelCtrl = noopNgModelController;
+
+  // The "unknown" option is one that is prepended to the list if the viewValue
+  // does not match any of the options. When it is rendered the value of the unknown
+  // option is '? XXX ?' where XXX is the hashKey of the value that is not known.
+  //
+  // We can't just jqLite('<option>') since jqLite is not smart enough
+  // to create it in <select> and IE barfs otherwise.
+  self.unknownOption = jqLite(window.document.createElement('option'));
+  self.renderUnknownOption = function(val) {
+    var unknownVal = '? ' + hashKey(val) + ' ?';
+    self.unknownOption.val(unknownVal);
+    $element.prepend(self.unknownOption);
+    $element.val(unknownVal);
+  };
+
+  $scope.$on('$destroy', function() {
+    // disable unknown option so that we don't do work when the whole select is being destroyed
+    self.renderUnknownOption = noop;
+  });
+
+  self.removeUnknownOption = function() {
+    if (self.unknownOption.parent()) self.unknownOption.remove();
+  };
+
+
+  // Read the value of the select control, the implementation of this changes depending
+  // upon whether the select can have multiple values and whether ngOptions is at work.
+  self.readValue = function readSingleValue() {
+    self.removeUnknownOption();
+    return $element.val();
+  };
+
+
+  // Write the value to the select control, the implementation of this changes depending
+  // upon whether the select can have multiple values and whether ngOptions is at work.
+  self.writeValue = function writeSingleValue(value) {
+    if (self.hasOption(value)) {
+      self.removeUnknownOption();
+      $element.val(value);
+      if (value === '') self.emptyOption.prop('selected', true); // to make IE9 happy
+    } else {
+      if (value == null && self.emptyOption) {
+        self.removeUnknownOption();
+        $element.val('');
+      } else {
+        self.renderUnknownOption(value);
+      }
+    }
+  };
+
+
+  // Tell the select control that an option, with the given value, has been added
+  self.addOption = function(value, element) {
+    // Skip comment nodes, as they only pollute the `optionsMap`
+    if (element[0].nodeType === NODE_TYPE_COMMENT) return;
+
+    assertNotHasOwnProperty(value, '"option value"');
+    if (value === '') {
+      self.emptyOption = element;
+    }
+    var count = optionsMap.get(value) || 0;
+    optionsMap.put(value, count + 1);
+    self.ngModelCtrl.$render();
+    chromeHack(element);
+  };
+
+  // Tell the select control that an option, with the given value, has been removed
+  self.removeOption = function(value) {
+    var count = optionsMap.get(value);
+    if (count) {
+      if (count === 1) {
+        optionsMap.remove(value);
+        if (value === '') {
+          self.emptyOption = undefined;
+        }
+      } else {
+        optionsMap.put(value, count - 1);
+      }
+    }
+  };
+
+  // Check whether the select control has an option matching the given value
+  self.hasOption = function(value) {
+    return !!optionsMap.get(value);
+  };
+
+
+  self.registerOption = function(optionScope, optionElement, optionAttrs, interpolateValueFn, interpolateTextFn) {
+
+    if (interpolateValueFn) {
+      // The value attribute is interpolated
+      var oldVal;
+      optionAttrs.$observe('value', function valueAttributeObserveAction(newVal) {
+        if (isDefined(oldVal)) {
+          self.removeOption(oldVal);
+        }
+        oldVal = newVal;
+        self.addOption(newVal, optionElement);
+      });
+    } else if (interpolateTextFn) {
+      // The text content is interpolated
+      optionScope.$watch(interpolateTextFn, function interpolateWatchAction(newVal, oldVal) {
+        optionAttrs.$set('value', newVal);
+        if (oldVal !== newVal) {
+          self.removeOption(oldVal);
+        }
+        self.addOption(newVal, optionElement);
+      });
+    } else {
+      // The value attribute is static
+      self.addOption(optionAttrs.value, optionElement);
+    }
+
+    optionElement.on('$destroy', function() {
+      self.removeOption(optionAttrs.value);
+      self.ngModelCtrl.$render();
+    });
+  };
+}];
+
+/**
+ * @ngdoc directive
+ * @name select
+ * @restrict E
+ *
+ * @description
+ * HTML `SELECT` element with angular data-binding.
+ *
+ * The `select` directive is used together with {@link ngModel `ngModel`} to provide data-binding
+ * between the scope and the `<select>` control (including setting default values).
+ * It also handles dynamic `<option>` elements, which can be added using the {@link ngRepeat `ngRepeat}` or
+ * {@link ngOptions `ngOptions`} directives.
+ *
+ * When an item in the `<select>` menu is selected, the value of the selected option will be bound
+ * to the model identified by the `ngModel` directive. With static or repeated options, this is
+ * the content of the `value` attribute or the textContent of the `<option>`, if the value attribute is missing.
+ * If you want dynamic value attributes, you can use interpolation inside the value attribute.
+ *
+ * <div class="alert alert-warning">
+ * Note that the value of a `select` directive used without `ngOptions` is always a string.
+ * When the model needs to be bound to a non-string value, you must either explicitly convert it
+ * using a directive (see example below) or use `ngOptions` to specify the set of options.
+ * This is because an option element can only be bound to string values at present.
+ * </div>
+ *
+ * If the viewValue of `ngModel` does not match any of the options, then the control
+ * will automatically add an "unknown" option, which it then removes when the mismatch is resolved.
+ *
+ * Optionally, a single hard-coded `<option>` element, with the value set to an empty string, can
+ * be nested into the `<select>` element. This element will then represent the `null` or "not selected"
+ * option. See example below for demonstration.
+ *
+ * <div class="alert alert-info">
+ * In many cases, `ngRepeat` can be used on `<option>` elements instead of {@link ng.directive:ngOptions
+ * ngOptions} to achieve a similar result. However, `ngOptions` provides some benefits, such as
+ * more flexibility in how the `<select>`'s model is assigned via the `select` **`as`** part of the
+ * comprehension expression, and additionally in reducing memory and increasing speed by not creating
+ * a new scope for each repeated instance.
+ * </div>
+ *
+ *
+ * @param {string} ngModel Assignable angular expression to data-bind to.
+ * @param {string=} name Property name of the form under which the control is published.
+ * @param {string=} multiple Allows multiple options to be selected. The selected values will be
+ *     bound to the model as an array.
+ * @param {string=} required Sets `required` validation error key if the value is not entered.
+ * @param {string=} ngRequired Adds required attribute and required validation constraint to
+ * the element when the ngRequired expression evaluates to true. Use ngRequired instead of required
+ * when you want to data-bind to the required attribute.
+ * @param {string=} ngChange Angular expression to be executed when selected option(s) changes due to user
+ *    interaction with the select element.
+ * @param {string=} ngOptions sets the options that the select is populated with and defines what is
+ * set on the model on selection. See {@link ngOptions `ngOptions`}.
+ *
+ * @example
+ * ### Simple `select` elements with static options
+ *
+ * <example name="static-select" module="staticSelect">
+ * <file name="index.html">
+ * <div ng-controller="ExampleController">
+ *   <form name="myForm">
+ *     <label for="singleSelect"> Single select: </label><br>
+ *     <select name="singleSelect" ng-model="data.singleSelect">
+ *       <option value="option-1">Option 1</option>
+ *       <option value="option-2">Option 2</option>
+ *     </select><br>
+ *
+ *     <label for="singleSelect"> Single select with "not selected" option and dynamic option values: </label><br>
+ *     <select name="singleSelect" id="singleSelect" ng-model="data.singleSelect">
+ *       <option value="">---Please select---</option> <!-- not selected / blank option -->
+ *       <option value="{{data.option1}}">Option 1</option> <!-- interpolation -->
+ *       <option value="option-2">Option 2</option>
+ *     </select><br>
+ *     <button ng-click="forceUnknownOption()">Force unknown option</button><br>
+ *     <tt>singleSelect = {{data.singleSelect}}</tt>
+ *
+ *     <hr>
+ *     <label for="multipleSelect"> Multiple select: </label><br>
+ *     <select name="multipleSelect" id="multipleSelect" ng-model="data.multipleSelect" multiple>
+ *       <option value="option-1">Option 1</option>
+ *       <option value="option-2">Option 2</option>
+ *       <option value="option-3">Option 3</option>
+ *     </select><br>
+ *     <tt>multipleSelect = {{data.multipleSelect}}</tt><br/>
+ *   </form>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ *  angular.module('staticSelect', [])
+ *    .controller('ExampleController', ['$scope', function($scope) {
+ *      $scope.data = {
+ *       singleSelect: null,
+ *       multipleSelect: [],
+ *       option1: 'option-1',
+ *      };
+ *
+ *      $scope.forceUnknownOption = function() {
+ *        $scope.data.singleSelect = 'nonsense';
+ *      };
+ *   }]);
+ * </file>
+ *</example>
+ *
+ * ### Using `ngRepeat` to generate `select` options
+ * <example name="ngrepeat-select" module="ngrepeatSelect">
+ * <file name="index.html">
+ * <div ng-controller="ExampleController">
+ *   <form name="myForm">
+ *     <label for="repeatSelect"> Repeat select: </label>
+ *     <select name="repeatSelect" id="repeatSelect" ng-model="data.repeatSelect">
+ *       <option ng-repeat="option in data.availableOptions" value="{{option.id}}">{{option.name}}</option>
+ *     </select>
+ *   </form>
+ *   <hr>
+ *   <tt>repeatSelect = {{data.repeatSelect}}</tt><br/>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ *  angular.module('ngrepeatSelect', [])
+ *    .controller('ExampleController', ['$scope', function($scope) {
+ *      $scope.data = {
+ *       repeatSelect: null,
+ *       availableOptions: [
+ *         {id: '1', name: 'Option A'},
+ *         {id: '2', name: 'Option B'},
+ *         {id: '3', name: 'Option C'}
+ *       ],
+ *      };
+ *   }]);
+ * </file>
+ *</example>
+ *
+ *
+ * ### Using `select` with `ngOptions` and setting a default value
+ * See the {@link ngOptions ngOptions documentation} for more `ngOptions` usage examples.
+ *
+ * <example name="select-with-default-values" module="defaultValueSelect">
+ * <file name="index.html">
+ * <div ng-controller="ExampleController">
+ *   <form name="myForm">
+ *     <label for="mySelect">Make a choice:</label>
+ *     <select name="mySelect" id="mySelect"
+ *       ng-options="option.name for option in data.availableOptions track by option.id"
+ *       ng-model="data.selectedOption"></select>
+ *   </form>
+ *   <hr>
+ *   <tt>option = {{data.selectedOption}}</tt><br/>
+ * </div>
+ * </file>
+ * <file name="app.js">
+ *  angular.module('defaultValueSelect', [])
+ *    .controller('ExampleController', ['$scope', function($scope) {
+ *      $scope.data = {
+ *       availableOptions: [
+ *         {id: '1', name: 'Option A'},
+ *         {id: '2', name: 'Option B'},
+ *         {id: '3', name: 'Option C'}
+ *       ],
+ *       selectedOption: {id: '3', name: 'Option C'} //This sets the default value of the select in the ui
+ *       };
+ *   }]);
+ * </file>
+ *</example>
+ *
+ *
+ * ### Binding `select` to a non-string value via `ngModel` parsing / formatting
+ *
+ * <example name="select-with-non-string-options" module="nonStringSelect">
+ *   <file name="index.html">
+ *     <select ng-model="model.id" convert-to-number>
+ *       <option value="0">Zero</option>
+ *       <option value="1">One</option>
+ *       <option value="2">Two</option>
+ *     </select>
+ *     {{ model }}
+ *   </file>
+ *   <file name="app.js">
+ *     angular.module('nonStringSelect', [])
+ *       .run(function($rootScope) {
+ *         $rootScope.model = { id: 2 };
+ *       })
+ *       .directive('convertToNumber', function() {
+ *         return {
+ *           require: 'ngModel',
+ *           link: function(scope, element, attrs, ngModel) {
+ *             ngModel.$parsers.push(function(val) {
+ *               return parseInt(val, 10);
+ *             });
+ *             ngModel.$formatters.push(function(val) {
+ *               return '' + val;
+ *             });
+ *           }
+ *         };
+ *       });
+ *   </file>
+ *   <file name="protractor.js" type="protractor">
+ *     it('should initialize to model', function() {
+ *       var select = element(by.css('select'));
+ *       expect(element(by.model('model.id')).$('option:checked').getText()).toEqual('Two');
+ *     });
+ *   </file>
+ * </example>
+ *
+ */
+var selectDirective = function() {
+
+  return {
+    restrict: 'E',
+    require: ['select', '?ngModel'],
+    controller: SelectController,
+    priority: 1,
+    link: {
+      pre: selectPreLink,
+      post: selectPostLink
+    }
+  };
+
+  function selectPreLink(scope, element, attr, ctrls) {
+
+      // if ngModel is not defined, we don't need to do anything
+      var ngModelCtrl = ctrls[1];
+      if (!ngModelCtrl) return;
+
+      var selectCtrl = ctrls[0];
+
+      selectCtrl.ngModelCtrl = ngModelCtrl;
+
+      // When the selected item(s) changes we delegate getting the value of the select control
+      // to the `readValue` method, which can be changed if the select can have multiple
+      // selected values or if the options are being generated by `ngOptions`
+      element.on('change', function() {
+        scope.$apply(function() {
+          ngModelCtrl.$setViewValue(selectCtrl.readValue());
+        });
+      });
+
+      // If the select allows multiple values then we need to modify how we read and write
+      // values from and to the control; also what it means for the value to be empty and
+      // we have to add an extra watch since ngModel doesn't work well with arrays - it
+      // doesn't trigger rendering if only an item in the array changes.
+      if (attr.multiple) {
+
+        // Read value now needs to check each option to see if it is selected
+        selectCtrl.readValue = function readMultipleValue() {
+          var array = [];
+          forEach(element.find('option'), function(option) {
+            if (option.selected) {
+              array.push(option.value);
+            }
+          });
+          return array;
+        };
+
+        // Write value now needs to set the selected property of each matching option
+        selectCtrl.writeValue = function writeMultipleValue(value) {
+          var items = new HashMap(value);
+          forEach(element.find('option'), function(option) {
+            option.selected = isDefined(items.get(option.value));
+          });
+        };
+
+        // we have to do it on each watch since ngModel watches reference, but
+        // we need to work of an array, so we need to see if anything was inserted/removed
+        var lastView, lastViewRef = NaN;
+        scope.$watch(function selectMultipleWatch() {
+          if (lastViewRef === ngModelCtrl.$viewValue && !equals(lastView, ngModelCtrl.$viewValue)) {
+            lastView = shallowCopy(ngModelCtrl.$viewValue);
+            ngModelCtrl.$render();
+          }
+          lastViewRef = ngModelCtrl.$viewValue;
+        });
+
+        // If we are a multiple select then value is now a collection
+        // so the meaning of $isEmpty changes
+        ngModelCtrl.$isEmpty = function(value) {
+          return !value || value.length === 0;
+        };
+
+      }
+    }
+
+    function selectPostLink(scope, element, attrs, ctrls) {
+      // if ngModel is not defined, we don't need to do anything
+      var ngModelCtrl = ctrls[1];
+      if (!ngModelCtrl) return;
+
+      var selectCtrl = ctrls[0];
+
+      // We delegate rendering to the `writeValue` method, which can be changed
+      // if the select can have multiple selected values or if the options are being
+      // generated by `ngOptions`.
+      // This must be done in the postLink fn to prevent $render to be called before
+      // all nodes have been linked correctly.
+      ngModelCtrl.$render = function() {
+        selectCtrl.writeValue(ngModelCtrl.$viewValue);
+      };
+    }
+};
+
+
+// The option directive is purely designed to communicate the existence (or lack of)
+// of dynamically created (and destroyed) option elements to their containing select
+// directive via its controller.
+var optionDirective = ['$interpolate', function($interpolate) {
+  return {
+    restrict: 'E',
+    priority: 100,
+    compile: function(element, attr) {
+      if (isDefined(attr.value)) {
+        // If the value attribute is defined, check if it contains an interpolation
+        var interpolateValueFn = $interpolate(attr.value, true);
+      } else {
+        // If the value attribute is not defined then we fall back to the
+        // text content of the option element, which may be interpolated
+        var interpolateTextFn = $interpolate(element.text(), true);
+        if (!interpolateTextFn) {
+          attr.$set('value', element.text());
+        }
+      }
+
+      return function(scope, element, attr) {
+        // This is an optimization over using ^^ since we don't want to have to search
+        // all the way to the root of the DOM for every single option element
+        var selectCtrlName = '$selectController',
+            parent = element.parent(),
+            selectCtrl = parent.data(selectCtrlName) ||
+              parent.parent().data(selectCtrlName); // in case we are in optgroup
+
+        if (selectCtrl) {
+          selectCtrl.registerOption(scope, element, attr, interpolateValueFn, interpolateTextFn);
+        }
+      };
+    }
+  };
+}];
+
+var styleDirective = valueFn({
+  restrict: 'E',
+  terminal: false
+});
+
+/**
+ * @ngdoc directive
+ * @name ngRequired
+ * @restrict A
+ *
+ * @description
+ *
+ * ngRequired adds the required {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.
+ * It is most often used for {@link input `input`} and {@link select `select`} controls, but can also be
+ * applied to custom controls.
+ *
+ * The directive sets the `required` attribute on the element if the Angular expression inside
+ * `ngRequired` evaluates to true. A special directive for setting `required` is necessary because we
+ * cannot use interpolation inside `required`. See the {@link guide/interpolation interpolation guide}
+ * for more info.
+ *
+ * The validator will set the `required` error key to true if the `required` attribute is set and
+ * calling {@link ngModel.NgModelController#$isEmpty `NgModelController.$isEmpty`} with the
+ * {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`} returns `true`. For example, the
+ * `$isEmpty()` implementation for `input[text]` checks the length of the `$viewValue`. When developing
+ * custom controls, `$isEmpty()` can be overwritten to account for a $viewValue that is not string-based.
+ *
+ * @example
+ * <example name="ngRequiredDirective" module="ngRequiredExample">
+ *   <file name="index.html">
+ *     <script>
+ *       angular.module('ngRequiredExample', [])
+ *         .controller('ExampleController', ['$scope', function($scope) {
+ *           $scope.required = true;
+ *         }]);
+ *     </script>
+ *     <div ng-controller="ExampleController">
+ *       <form name="form">
+ *         <label for="required">Toggle required: </label>
+ *         <input type="checkbox" ng-model="required" id="required" />
+ *         <br>
+ *         <label for="input">This input must be filled if `required` is true: </label>
+ *         <input type="text" ng-model="model" id="input" name="input" ng-required="required" /><br>
+ *         <hr>
+ *         required error set? = <code>{{form.input.$error.required}}</code><br>
+ *         model = <code>{{model}}</code>
+ *       </form>
+ *     </div>
+ *   </file>
+ *   <file name="protractor.js" type="protractor">
+       var required = element(by.binding('form.input.$error.required'));
+       var model = element(by.binding('model'));
+       var input = element(by.id('input'));
+
+       it('should set the required error', function() {
+         expect(required.getText()).toContain('true');
+
+         input.sendKeys('123');
+         expect(required.getText()).not.toContain('true');
+         expect(model.getText()).toContain('123');
+       });
+ *   </file>
+ * </example>
+ */
+var requiredDirective = function() {
+  return {
+    restrict: 'A',
+    require: '?ngModel',
+    link: function(scope, elm, attr, ctrl) {
+      if (!ctrl) return;
+      attr.required = true; // force truthy in case we are on non input element
+
+      ctrl.$validators.required = function(modelValue, viewValue) {
+        return !attr.required || !ctrl.$isEmpty(viewValue);
+      };
+
+      attr.$observe('required', function() {
+        ctrl.$validate();
+      });
+    }
+  };
+};
+
+/**
+ * @ngdoc directive
+ * @name ngPattern
+ *
+ * @description
+ *
+ * ngPattern adds the pattern {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.
+ * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.
+ *
+ * The validator sets the `pattern` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}
+ * does not match a RegExp which is obtained by evaluating the Angular expression given in the
+ * `ngPattern` attribute value:
+ * * If the expression evaluates to a RegExp object, then this is used directly.
+ * * If the expression evaluates to a string, then it will be converted to a RegExp after wrapping it
+ * in `^` and `$` characters. For instance, `"abc"` will be converted to `new RegExp('^abc$')`.
+ *
+ * <div class="alert alert-info">
+ * **Note:** Avoid using the `g` flag on the RegExp, as it will cause each successive search to
+ * start at the index of the last search's match, thus not taking the whole input value into
+ * account.
+ * </div>
+ *
+ * <div class="alert alert-info">
+ * **Note:** This directive is also added when the plain `pattern` attribute is used, with two
+ * differences:
+ * <ol>
+ *   <li>
+ *     `ngPattern` does not set the `pattern` attribute and therefore HTML5 constraint validation is
+ *     not available.
+ *   </li>
+ *   <li>
+ *     The `ngPattern` attribute must be an expression, while the `pattern` value must be
+ *     interpolated.
+ *   </li>
+ * </ol>
+ * </div>
+ *
+ * @example
+ * <example name="ngPatternDirective" module="ngPatternExample">
+ *   <file name="index.html">
+ *     <script>
+ *       angular.module('ngPatternExample', [])
+ *         .controller('ExampleController', ['$scope', function($scope) {
+ *           $scope.regex = '\\d+';
+ *         }]);
+ *     </script>
+ *     <div ng-controller="ExampleController">
+ *       <form name="form">
+ *         <label for="regex">Set a pattern (regex string): </label>
+ *         <input type="text" ng-model="regex" id="regex" />
+ *         <br>
+ *         <label for="input">This input is restricted by the current pattern: </label>
+ *         <input type="text" ng-model="model" id="input" name="input" ng-pattern="regex" /><br>
+ *         <hr>
+ *         input valid? = <code>{{form.input.$valid}}</code><br>
+ *         model = <code>{{model}}</code>
+ *       </form>
+ *     </div>
+ *   </file>
+ *   <file name="protractor.js" type="protractor">
+       var model = element(by.binding('model'));
+       var input = element(by.id('input'));
+
+       it('should validate the input with the default pattern', function() {
+         input.sendKeys('aaa');
+         expect(model.getText()).not.toContain('aaa');
+
+         input.clear().then(function() {
+           input.sendKeys('123');
+           expect(model.getText()).toContain('123');
+         });
+       });
+ *   </file>
+ * </example>
+ */
+var patternDirective = function() {
+  return {
+    restrict: 'A',
+    require: '?ngModel',
+    link: function(scope, elm, attr, ctrl) {
+      if (!ctrl) return;
+
+      var regexp, patternExp = attr.ngPattern || attr.pattern;
+      attr.$observe('pattern', function(regex) {
+        if (isString(regex) && regex.length > 0) {
+          regex = new RegExp('^' + regex + '$');
+        }
+
+        if (regex && !regex.test) {
+          throw minErr('ngPattern')('noregexp',
+            'Expected {0} to be a RegExp but was {1}. Element: {2}', patternExp,
+            regex, startingTag(elm));
+        }
+
+        regexp = regex || undefined;
+        ctrl.$validate();
+      });
+
+      ctrl.$validators.pattern = function(modelValue, viewValue) {
+        // HTML5 pattern constraint validates the input value, so we validate the viewValue
+        return ctrl.$isEmpty(viewValue) || isUndefined(regexp) || regexp.test(viewValue);
+      };
+    }
+  };
+};
+
+/**
+ * @ngdoc directive
+ * @name ngMaxlength
+ *
+ * @description
+ *
+ * ngMaxlength adds the maxlength {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.
+ * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.
+ *
+ * The validator sets the `maxlength` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}
+ * is longer than the integer obtained by evaluating the Angular expression given in the
+ * `ngMaxlength` attribute value.
+ *
+ * <div class="alert alert-info">
+ * **Note:** This directive is also added when the plain `maxlength` attribute is used, with two
+ * differences:
+ * <ol>
+ *   <li>
+ *     `ngMaxlength` does not set the `maxlength` attribute and therefore HTML5 constraint
+ *     validation is not available.
+ *   </li>
+ *   <li>
+ *     The `ngMaxlength` attribute must be an expression, while the `maxlength` value must be
+ *     interpolated.
+ *   </li>
+ * </ol>
+ * </div>
+ *
+ * @example
+ * <example name="ngMaxlengthDirective" module="ngMaxlengthExample">
+ *   <file name="index.html">
+ *     <script>
+ *       angular.module('ngMaxlengthExample', [])
+ *         .controller('ExampleController', ['$scope', function($scope) {
+ *           $scope.maxlength = 5;
+ *         }]);
+ *     </script>
+ *     <div ng-controller="ExampleController">
+ *       <form name="form">
+ *         <label for="maxlength">Set a maxlength: </label>
+ *         <input type="number" ng-model="maxlength" id="maxlength" />
+ *         <br>
+ *         <label for="input">This input is restricted by the current maxlength: </label>
+ *         <input type="text" ng-model="model" id="input" name="input" ng-maxlength="maxlength" /><br>
+ *         <hr>
+ *         input valid? = <code>{{form.input.$valid}}</code><br>
+ *         model = <code>{{model}}</code>
+ *       </form>
+ *     </div>
+ *   </file>
+ *   <file name="protractor.js" type="protractor">
+       var model = element(by.binding('model'));
+       var input = element(by.id('input'));
+
+       it('should validate the input with the default maxlength', function() {
+         input.sendKeys('abcdef');
+         expect(model.getText()).not.toContain('abcdef');
+
+         input.clear().then(function() {
+           input.sendKeys('abcde');
+           expect(model.getText()).toContain('abcde');
+         });
+       });
+ *   </file>
+ * </example>
+ */
+var maxlengthDirective = function() {
+  return {
+    restrict: 'A',
+    require: '?ngModel',
+    link: function(scope, elm, attr, ctrl) {
+      if (!ctrl) return;
+
+      var maxlength = -1;
+      attr.$observe('maxlength', function(value) {
+        var intVal = toInt(value);
+        maxlength = isNaN(intVal) ? -1 : intVal;
+        ctrl.$validate();
+      });
+      ctrl.$validators.maxlength = function(modelValue, viewValue) {
+        return (maxlength < 0) || ctrl.$isEmpty(viewValue) || (viewValue.length <= maxlength);
+      };
+    }
+  };
+};
+
+/**
+ * @ngdoc directive
+ * @name ngMinlength
+ *
+ * @description
+ *
+ * ngMinlength adds the minlength {@link ngModel.NgModelController#$validators `validator`} to {@link ngModel `ngModel`}.
+ * It is most often used for text-based {@link input `input`} controls, but can also be applied to custom text-based controls.
+ *
+ * The validator sets the `minlength` error key if the {@link ngModel.NgModelController#$viewValue `ngModel.$viewValue`}
+ * is shorter than the integer obtained by evaluating the Angular expression given in the
+ * `ngMinlength` attribute value.
+ *
+ * <div class="alert alert-info">
+ * **Note:** This directive is also added when the plain `minlength` attribute is used, with two
+ * differences:
+ * <ol>
+ *   <li>
+ *     `ngMinlength` does not set the `minlength` attribute and therefore HTML5 constraint
+ *     validation is not available.
+ *   </li>
+ *   <li>
+ *     The `ngMinlength` value must be an expression, while the `minlength` value must be
+ *     interpolated.
+ *   </li>
+ * </ol>
+ * </div>
+ *
+ * @example
+ * <example name="ngMinlengthDirective" module="ngMinlengthExample">
+ *   <file name="index.html">
+ *     <script>
+ *       angular.module('ngMinlengthExample', [])
+ *         .controller('ExampleController', ['$scope', function($scope) {
+ *           $scope.minlength = 3;
+ *         }]);
+ *     </script>
+ *     <div ng-controller="ExampleController">
+ *       <form name="form">
+ *         <label for="minlength">Set a minlength: </label>
+ *         <input type="number" ng-model="minlength" id="minlength" />
+ *         <br>
+ *         <label for="input">This input is restricted by the current minlength: </label>
+ *         <input type="text" ng-model="model" id="input" name="input" ng-minlength="minlength" /><br>
+ *         <hr>
+ *         input valid? = <code>{{form.input.$valid}}</code><br>
+ *         model = <code>{{model}}</code>
+ *       </form>
+ *     </div>
+ *   </file>
+ *   <file name="protractor.js" type="protractor">
+       var model = element(by.binding('model'));
+       var input = element(by.id('input'));
+
+       it('should validate the input with the default minlength', function() {
+         input.sendKeys('ab');
+         expect(model.getText()).not.toContain('ab');
+
+         input.sendKeys('abc');
+         expect(model.getText()).toContain('abc');
+       });
+ *   </file>
+ * </example>
+ */
+var minlengthDirective = function() {
+  return {
+    restrict: 'A',
+    require: '?ngModel',
+    link: function(scope, elm, attr, ctrl) {
+      if (!ctrl) return;
+
+      var minlength = 0;
+      attr.$observe('minlength', function(value) {
+        minlength = toInt(value) || 0;
+        ctrl.$validate();
+      });
+      ctrl.$validators.minlength = function(modelValue, viewValue) {
+        return ctrl.$isEmpty(viewValue) || viewValue.length >= minlength;
+      };
+    }
+  };
+};
+
+if (window.angular.bootstrap) {
+  //AngularJS is already loaded, so we can return here...
+  if (window.console) {
+    console.log('WARNING: Tried to load angular more than once.');
+  }
+  return;
+}
+
+//try to bind to jquery now so that one can write jqLite(document).ready()
+//but we will rebind on bootstrap again.
+bindJQuery();
+
+publishExternalAPI(angular);
+
+angular.module("ngLocale", [], ["$provide", function($provide) {
+var PLURAL_CATEGORY = {ZERO: "zero", ONE: "one", TWO: "two", FEW: "few", MANY: "many", OTHER: "other"};
+function getDecimals(n) {
+  n = n + '';
+  var i = n.indexOf('.');
+  return (i == -1) ? 0 : n.length - i - 1;
+}
+
+function getVF(n, opt_precision) {
+  var v = opt_precision;
+
+  if (undefined === v) {
+    v = Math.min(getDecimals(n), 3);
+  }
+
+  var base = Math.pow(10, v);
+  var f = ((n * base) | 0) % base;
+  return {v: v, f: f};
+}
+
+$provide.value("$locale", {
+  "DATETIME_FORMATS": {
+    "AMPMS": [
+      "AM",
+      "PM"
+    ],
+    "DAY": [
+      "Sunday",
+      "Monday",
+      "Tuesday",
+      "Wednesday",
+      "Thursday",
+      "Friday",
+      "Saturday"
+    ],
+    "ERANAMES": [
+      "Before Christ",
+      "Anno Domini"
+    ],
+    "ERAS": [
+      "BC",
+      "AD"
+    ],
+    "FIRSTDAYOFWEEK": 6,
+    "MONTH": [
+      "January",
+      "February",
+      "March",
+      "April",
+      "May",
+      "June",
+      "July",
+      "August",
+      "September",
+      "October",
+      "November",
+      "December"
+    ],
+    "SHORTDAY": [
+      "Sun",
+      "Mon",
+      "Tue",
+      "Wed",
+      "Thu",
+      "Fri",
+      "Sat"
+    ],
+    "SHORTMONTH": [
+      "Jan",
+      "Feb",
+      "Mar",
+      "Apr",
+      "May",
+      "Jun",
+      "Jul",
+      "Aug",
+      "Sep",
+      "Oct",
+      "Nov",
+      "Dec"
+    ],
+    "STANDALONEMONTH": [
+      "January",
+      "February",
+      "March",
+      "April",
+      "May",
+      "June",
+      "July",
+      "August",
+      "September",
+      "October",
+      "November",
+      "December"
+    ],
+    "WEEKENDRANGE": [
+      5,
+      6
+    ],
+    "fullDate": "EEEE, MMMM d, y",
+    "longDate": "MMMM d, y",
+    "medium": "MMM d, y h:mm:ss a",
+    "mediumDate": "MMM d, y",
+    "mediumTime": "h:mm:ss a",
+    "short": "M/d/yy h:mm a",
+    "shortDate": "M/d/yy",
+    "shortTime": "h:mm a"
+  },
+  "NUMBER_FORMATS": {
+    "CURRENCY_SYM": "$",
+    "DECIMAL_SEP": ".",
+    "GROUP_SEP": ",",
+    "PATTERNS": [
+      {
+        "gSize": 3,
+        "lgSize": 3,
+        "maxFrac": 3,
+        "minFrac": 0,
+        "minInt": 1,
+        "negPre": "-",
+        "negSuf": "",
+        "posPre": "",
+        "posSuf": ""
+      },
+      {
+        "gSize": 3,
+        "lgSize": 3,
+        "maxFrac": 2,
+        "minFrac": 2,
+        "minInt": 1,
+        "negPre": "-\u00a4",
+        "negSuf": "",
+        "posPre": "\u00a4",
+        "posSuf": ""
+      }
+    ]
+  },
+  "id": "en-us",
+  "localeID": "en_US",
+  "pluralCat": function(n, opt_precision) {  var i = n | 0;  var vf = getVF(n, opt_precision);  if (i == 1 && vf.v == 0) {    return PLURAL_CATEGORY.ONE;  }  return PLURAL_CATEGORY.OTHER;}
+});
+}]);
+
+  jqLite(window.document).ready(function() {
+    angularInit(window.document, bootstrap);
+  });
+
+})(window);
+
+!window.angular.$$csp().noInlineStyle && window.angular.element(document.head).prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-hide-animate){display:none !important;}ng\\:form{display:block;}.ng-animate-shim{visibility:hidden;}.ng-anchor{position:absolute;}</style>');
\ No newline at end of file
diff --git a/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/js/comparator.js b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/js/comparator.js
new file mode 100644
index 0000000..31d1a0d
--- /dev/null
+++ b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/js/comparator.js
@@ -0,0 +1,269 @@
+//add contains method to String
+String.prototype.contains = function(it) { return this.indexOf(it) != -1; };
+
+//angular module & controller
+var gemDelegate = angular.module('gemDelegate', ['angularBootstrapNavTree','ngAnimate']);
+
+gemDelegate.controller('delegationController', function($scope, $http, $window) {
+
+	var tree;
+
+	var filteredElements = ["ty", "ri", "pi", "ct", "lt", "lbl", "cnd",
+		"acpi", "et", "owner", "_xmlns:m2m", "_xmlns:hd", "_rn", "__prefix" ];
+
+	$scope.my_tree = tree = {};
+	$scope.my_tree2 = tree2 = {};
+	$scope.devices = [];
+
+	$scope.imgPath = "dot.png";
+
+	$scope.urlBase = window.location.protocol + "//" + window.location.host;
+
+	$scope.my_data = [];
+
+	$scope.my_data2 = [];
+	
+	$scope.context = $window.context;
+
+	$scope.my_tree_handler1 = function(branch) {
+		//alert(branch.label);
+		$scope.selectedItem1 = branch.label;
+	};
+	$scope.my_tree_handler2 = function(branch) {
+		//alert(branch.label);
+		$scope.selectedItem2 = branch.label;
+	};  
+
+	$scope.updateTree1 = function () {
+		$scope.my_data.pop();
+		$scope.buildTree($scope.selectedDevice,$scope.my_data);
+		$scope.my_tree.expand_all();
+	}
+
+	$scope.updateTree2 = function () {
+		$scope.my_data2.pop();
+		$scope.buildTree($scope.selectedDevice2,$scope.my_data2);
+		$scope.my_tree2.expand_all();
+	}
+
+	$scope.getDevices = function() {
+
+		var req = {
+				method: 'GET',
+				url: $scope.urlBase+'/~' + $scope.context + '/?fu=1&lbl=object.type/device',
+				headers: {
+					'Accept': 'application/xml',
+					'X-M2M-Origin':'admin:admin'
+				}
+		};
+		$http(req).success(function (response, status, headers, config) {
+			//alert(response);
+			var x2js = new X2JS();
+			var jsonData = x2js.xml_str2json(response);
+			//alert(jsonData.cb.ch[1].__text);
+			var key = $scope.getRootKey(jsonData);
+			
+			var devices = jsonData[key].__text.split(" ");
+			//get devices 
+
+
+			for (i=0; i<devices.length; i++) {
+				var myDevice = devices[i];
+				var device = {'id':'', 'name':'','desc':'','link':myDevice,'modules':[],'properties':[]};
+				//fill device list
+				$scope.devices.push (device);
+				
+				req.url = $scope.urlBase+'/~'+myDevice+'?rcn=7';
+				req.data = device;
+				$http(req).success(function (response, status, headers, config)  {
+					
+					var x2js = new X2JS();
+					var jsonData = x2js.xml_str2json(response);					
+					var key = $scope.getRootKey(jsonData);
+					
+					var label = jsonData[key].lbl;
+					var id = $scope.getIdFromLabel (label);
+					config.data.id = id;
+					config.data.name = $scope.getNameFromLabel(label);
+					config.data.desc = jsonData[key].cnd;
+					
+					var tags = jsonData[key];
+					for (tagKey in tags) {
+						//starts with prop
+						if (tagKey.lastIndexOf('prop', 0) === 0) {
+							if (typeof tags[tagKey].__text !== "undefined") {
+								var propName = tagKey.substring(4);
+								config.data.properties.push({'name':propName,'value':tags[tagKey].__text});
+							}
+						}
+					}
+					
+					req.url = $scope.urlBase+'/~' + $scope.context +'/?fu=1&lbl=object.type/module&lbl=device.id/'+id;
+					req.data = config.data;
+					
+					//get all the modules for the given device
+					$http(req).success(function (response, status, headers, config) {
+						
+						var x2js = new X2JS();
+						var jsonData = x2js.xml_str2json(response);	
+						var key = $scope.getRootKey(jsonData);
+						
+						var modules = jsonData[key].__text.split(" ");
+						
+						for (i=0; i<modules.length; i++) {
+							
+							//create the module object and push it in the device array
+							var module = {'id':'','name':'','colorClass':'','attributes':[]};
+							config.data.modules.push(module);
+							
+							req.url = $scope.urlBase+'/~'+modules[i]+'?rcn=7'
+							req.data = module;							
+							
+							$http(req).success(function (response, status, headers, config) {
+								
+								var x2js = new X2JS();
+								var jsonData = x2js.xml_str2json(response);	
+								var key = $scope.getRootKey(jsonData);
+								var root = jsonData[key];
+								
+								//fill the module name
+								var tab = root.cnd.split(".");
+								
+								config.data.name = tab[tab.length -1];
+								//fill the class with the module name to define the text color. see css file.
+								config.data.colorClass = tab[tab.length -1];
+								
+								config.data.datapoints = [];
+								config.data.actions = [];
+								
+								//create the attributes
+								for (var childKey in root){
+
+//									if(root[childKey]._type !=null && childKey!=='propOwner') {
+									if (! $scope.arrayContains(filteredElements, childKey)) {
+										var datapoint = {'name':childKey,'value':root[childKey]};
+										//fill datapoints in the module
+										config.data.datapoints.push(datapoint);
+									} else if (root[childKey]._ty !=null) {
+										var action = {'name':root[childKey]._rn,'value':''};
+										config.data.actions.push(action);
+									}
+								}
+							}).error(function (response, status, headers, config)  {});
+						}
+					}).error(function (response, status, headers, config)  {});
+				}).error(function (response, status, headers, config)  {});
+			}
+		}).error(function (response, status, headers, config) {
+			// called asynchronously if an error occurs
+			// or server returns response with an error status.
+		});
+	};
+
+	$scope.buildTree = function (device,tree) {
+		//var device = {'id':myDevice._rn, 'name':name,'link':myDevice.__text,'modules':[]};
+		//var module = {'id':modules[i]._rn,'name':name,'attributes':[]}
+
+		var Moduleschildren = [];
+		var module, attribute,properties;
+		var propChildren = [];
+		var deviceChildren = [];
+		
+		for( i=0; i<device.properties.length; i++) {
+			propChildren.push({'label':device.properties[i].name+':'+device.properties[i].value});
+		}
+		for (i=0; i<device.modules.length; i++) {
+			var module = device.modules[i];
+			var classes = [module.colorClass];
+			var datapointsTree = [];
+			var actionsTree = []
+			for (j=0; j<module.datapoints.length; j++) {    			   
+				datapoint = module.datapoints[j];
+				//40 chars max
+				var value ='';
+				if (typeof datapoint.value != "undefined") {
+					value = datapoint.value.substring(0,70);
+					if (datapoint.value.length>70)
+						value += ' ...';
+				}
+				datapointsTree.push({'label': datapoint.name +': '+value,'classes': classes});
+			}
+			for (j=0; j<module.actions.length; j++) {
+				action = module.actions[j]; 
+				actionsTree.push({'label': action.name,'classes': classes});
+			}
+			
+			moduleChildren = [];
+			if (datapointsTree.length != 0) {
+				moduleChildren.push({'label':'datapoints','children': datapointsTree,'classes':classes});
+			}
+			if (actionsTree.length != 0) {
+				moduleChildren.push({'label':'actions','children': actionsTree,'classes':classes});
+			}
+			Moduleschildren.push({'label':module.name,'children': moduleChildren,'classes':classes});
+		}
+
+		if (moduleChildren.length != 0) {
+            Moduleschildren.sort(function(a,b) {return (a.label > b.label) ? 1 : ((b.label > a.label) ? -1 : 0);} );
+			deviceChildren.push({'label':'modules','children': Moduleschildren});
+		}
+        
+        if (propChildren.length != 0) {
+            propChildren.sort(function(a,b) {return (a.label > b.label) ? 1 : ((b.label > a.label) ? -1 : 0);} );
+			deviceChildren.push({'label':'properties','children': propChildren});
+		}
+					
+		var deviceTree = {
+				label: device.desc,
+				children: deviceChildren
+		}
+
+		tree.push(deviceTree);
+	}
+	
+	$scope.getIdFromLabel = function(label) {
+		var tab = label.split(' ');
+		for (i=0; i<tab.length; i++) {
+			if (tab[i].contains('id/')) {
+				return tab[i].replace('id/','');
+			}
+		}		
+		return null;
+	}
+
+	$scope.getNameFromLabel = function(label) {
+		var tab = label.split(' ');
+		for (i=0; i<tab.length; i++) {
+			if (tab[i].contains('name/')) {
+				return tab[i].replace('name/','');
+			}
+		}		
+		return null;
+	}
+	
+	$scope.arrayContains = function (array, label) {
+		for (i = 0; i < array.length; i++) {
+			if (label === array[i]) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	$scope.getRootKey = function(rootObj) {
+		for (var key in rootObj){
+			return key;
+		}		
+		return null;
+	}
+	
+	$scope.initContext = function(newContext) {
+		console.log(newContext);
+	}
+	
+	var init = function () {
+		$scope.getDevices();
+	}
+	init();
+
+});
diff --git a/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/js/xml2json.min.js b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/js/xml2json.min.js
new file mode 100644
index 0000000..e8f9d0a
--- /dev/null
+++ b/org.eclipse.om2m.sdt.comparator.xml/src/main/resources/webapps/js/xml2json.min.js
@@ -0,0 +1 @@
+(function(a,b){if(typeof define==="function"&&define.amd){define([],b);}else{if(typeof exports==="object"){module.exports=b();}else{a.X2JS=b();}}}(this,function(){return function(z){var t="1.2.0";z=z||{};i();u();function i(){if(z.escapeMode===undefined){z.escapeMode=true;}z.attributePrefix=z.attributePrefix||"_";z.arrayAccessForm=z.arrayAccessForm||"none";z.emptyNodeForm=z.emptyNodeForm||"text";if(z.enableToStringFunc===undefined){z.enableToStringFunc=true;}z.arrayAccessFormPaths=z.arrayAccessFormPaths||[];if(z.skipEmptyTextNodesForObj===undefined){z.skipEmptyTextNodesForObj=true;}if(z.stripWhitespaces===undefined){z.stripWhitespaces=true;}z.datetimeAccessFormPaths=z.datetimeAccessFormPaths||[];if(z.useDoubleQuotes===undefined){z.useDoubleQuotes=false;}z.xmlElementsFilter=z.xmlElementsFilter||[];z.jsonPropertiesFilter=z.jsonPropertiesFilter||[];if(z.keepCData===undefined){z.keepCData=false;}}var h={ELEMENT_NODE:1,TEXT_NODE:3,CDATA_SECTION_NODE:4,COMMENT_NODE:8,DOCUMENT_NODE:9};function u(){}function x(B){var C=B.localName;if(C==null){C=B.baseName;}if(C==null||C==""){C=B.nodeName;}return C;}function r(B){return B.prefix;}function s(B){if(typeof(B)=="string"){return B.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;");}else{return B;}}function k(B){return B.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&");}function w(C,F,D,E){var B=0;for(;B<C.length;B++){var G=C[B];if(typeof G==="string"){if(G==E){break;}}else{if(G instanceof RegExp){if(G.test(E)){break;}}else{if(typeof G==="function"){if(G(F,D,E)){break;}}}}}return B!=C.length;}function n(D,B,C){switch(z.arrayAccessForm){case"property":if(!(D[B] instanceof Array)){D[B+"_asArray"]=[D[B]];}else{D[B+"_asArray"]=D[B];}break;}if(!(D[B] instanceof Array)&&z.arrayAccessFormPaths.length>0){if(w(z.arrayAccessFormPaths,D,B,C)){D[B]=[D[B]];}}}function a(G){var E=G.split(/[-T:+Z]/g);var F=new Date(E[0],E[1]-1,E[2]);var D=E[5].split(".");F.setHours(E[3],E[4],D[0]);if(D.length>1){F.setMilliseconds(D[1]);}if(E[6]&&E[7]){var C=E[6]*60+Number(E[7]);var B=/\d\d-\d\d:\d\d$/.test(G)?"-":"+";C=0+(B=="-"?-1*C:C);F.setMinutes(F.getMinutes()-C-F.getTimezoneOffset());}else{if(G.indexOf("Z",G.length-1)!==-1){F=new Date(Date.UTC(F.getFullYear(),F.getMonth(),F.getDate(),F.getHours(),F.getMinutes(),F.getSeconds(),F.getMilliseconds()));}}return F;}function q(D,B,C){if(z.datetimeAccessFormPaths.length>0){var E=C.split(".#")[0];if(w(z.datetimeAccessFormPaths,D,B,E)){return a(D);}else{return D;}}else{return D;}}function b(E,C,B,D){if(C==h.ELEMENT_NODE&&z.xmlElementsFilter.length>0){return w(z.xmlElementsFilter,E,B,D);}else{return true;}}function A(D,J){if(D.nodeType==h.DOCUMENT_NODE){var K=new Object;var B=D.childNodes;for(var L=0;L<B.length;L++){var C=B.item(L);if(C.nodeType==h.ELEMENT_NODE){var I=x(C);K[I]=A(C,I);}}return K;}else{if(D.nodeType==h.ELEMENT_NODE){var K=new Object;K.__cnt=0;var B=D.childNodes;for(var L=0;L<B.length;L++){var C=B.item(L);var I=x(C);if(C.nodeType!=h.COMMENT_NODE){var H=J+"."+I;if(b(K,C.nodeType,I,H)){K.__cnt++;if(K[I]==null){K[I]=A(C,H);n(K,I,H);}else{if(K[I]!=null){if(!(K[I] instanceof Array)){K[I]=[K[I]];n(K,I,H);}}(K[I])[K[I].length]=A(C,H);}}}}for(var E=0;E<D.attributes.length;E++){var F=D.attributes.item(E);K.__cnt++;K[z.attributePrefix+F.name]=F.value;}var G=r(D);if(G!=null&&G!=""){K.__cnt++;K.__prefix=G;}if(K["#text"]!=null){K.__text=K["#text"];if(K.__text instanceof Array){K.__text=K.__text.join("\n");}if(z.stripWhitespaces){K.__text=K.__text.trim();}delete K["#text"];if(z.arrayAccessForm=="property"){delete K["#text_asArray"];}K.__text=q(K.__text,I,J+"."+I);}if(K["#cdata-section"]!=null){K.__cdata=K["#cdata-section"];delete K["#cdata-section"];if(z.arrayAccessForm=="property"){delete K["#cdata-section_asArray"];}}if(K.__cnt==0&&z.emptyNodeForm=="text"){K="";}else{if(K.__cnt==1&&K.__text!=null){K=K.__text;}else{if(K.__cnt==1&&K.__cdata!=null&&!z.keepCData){K=K.__cdata;}else{if(K.__cnt>1&&K.__text!=null&&z.skipEmptyTextNodesForObj){if((z.stripWhitespaces&&K.__text=="")||(K.__text.trim()=="")){delete K.__text;}}}}}delete K.__cnt;if(z.enableToStringFunc&&(K.__text!=null||K.__cdata!=null)){K.toString=function(){return(this.__text!=null?this.__text:"")+(this.__cdata!=null?this.__cdata:"");};}return K;}else{if(D.nodeType==h.TEXT_NODE||D.nodeType==h.CDATA_SECTION_NODE){return D.nodeValue;}}}}function o(I,F,H,C){var E="<"+((I!=null&&I.__prefix!=null)?(I.__prefix+":"):"")+F;if(H!=null){for(var G=0;G<H.length;G++){var D=H[G];var B=I[D];if(z.escapeMode){B=s(B);}E+=" "+D.substr(z.attributePrefix.length)+"=";if(z.useDoubleQuotes){E+='"'+B+'"';}else{E+="'"+B+"'";}}}if(!C){E+=">";}else{E+="/>";}return E;}function j(C,B){return"</"+(C.__prefix!=null?(C.__prefix+":"):"")+B+">";}function v(C,B){return C.indexOf(B,C.length-B.length)!==-1;}function y(C,B){if((z.arrayAccessForm=="property"&&v(B.toString(),("_asArray")))||B.toString().indexOf(z.attributePrefix)==0||B.toString().indexOf("__")==0||(C[B] instanceof Function)){return true;}else{return false;}}function m(D){var C=0;if(D instanceof Object){for(var B in D){if(y(D,B)){continue;}C++;}}return C;}function l(D,B,C){return z.jsonPropertiesFilter.length==0||C==""||w(z.jsonPropertiesFilter,D,B,C);}function c(D){var C=[];if(D instanceof Object){for(var B in D){if(B.toString().indexOf("__")==-1&&B.toString().indexOf(z.attributePrefix)==0){C.push(B);}}}return C;}function g(C){var B="";if(C.__cdata!=null){B+="<![CDATA["+C.__cdata+"]]>";}if(C.__text!=null){if(z.escapeMode){B+=s(C.__text);}else{B+=C.__text;}}return B;}function d(C){var B="";if(C instanceof Object){B+=g(C);}else{if(C!=null){if(z.escapeMode){B+=s(C);}else{B+=C;}}}return B;}function p(C,B){if(C===""){return B;}else{return C+"."+B;}}function f(D,G,F,E){var B="";if(D.length==0){B+=o(D,G,F,true);}else{for(var C=0;C<D.length;C++){B+=o(D[C],G,c(D[C]),false);B+=e(D[C],p(E,G));B+=j(D[C],G);}}return B;}function e(I,H){var B="";var F=m(I);if(F>0){for(var E in I){if(y(I,E)||(H!=""&&!l(I,E,p(H,E)))){continue;}var D=I[E];var G=c(D);if(D==null||D==undefined){B+=o(D,E,G,true);}else{if(D instanceof Object){if(D instanceof Array){B+=f(D,E,G,H);}else{if(D instanceof Date){B+=o(D,E,G,false);B+=D.toISOString();B+=j(D,E);}else{var C=m(D);if(C>0||D.__text!=null||D.__cdata!=null){B+=o(D,E,G,false);B+=e(D,p(H,E));B+=j(D,E);}else{B+=o(D,E,G,true);}}}}else{B+=o(D,E,G,false);B+=d(D);B+=j(D,E);}}}}B+=d(I);return B;}this.parseXmlString=function(D){var F=window.ActiveXObject||"ActiveXObject" in window;if(D===undefined){return null;}var E;if(window.DOMParser){var G=new window.DOMParser();var B=null;if(!F){try{B=G.parseFromString("INVALID","text/xml").getElementsByTagName("parsererror")[0].namespaceURI;}catch(C){B=null;}}try{E=G.parseFromString(D,"text/xml");if(B!=null&&E.getElementsByTagNameNS(B,"parsererror").length>0){E=null;}}catch(C){E=null;}}else{if(D.indexOf("<?")==0){D=D.substr(D.indexOf("?>")+2);}E=new ActiveXObject("Microsoft.XMLDOM");E.async="false";E.loadXML(D);}return E;};this.asArray=function(B){if(B===undefined||B==null){return[];}else{if(B instanceof Array){return B;}else{return[B];}}};this.toXmlDateTime=function(B){if(B instanceof Date){return B.toISOString();}else{if(typeof(B)==="number"){return new Date(B).toISOString();}else{return null;}}};this.asDateTime=function(B){if(typeof(B)=="string"){return a(B);}else{return B;}};this.xml2json=function(B){return A(B);};this.xml_str2json=function(B){var C=this.parseXmlString(B);if(C!=null){return this.xml2json(C);}else{return null;}};this.json2xml_str=function(B){return e(B,"");};this.json2xml=function(C){var B=this.json2xml_str(C);return this.parseXmlString(B);};this.getVersion=function(){return t;};};}));
\ No newline at end of file
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Action.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Action.java
index 4ed8865..2ceab42 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Action.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Action.java
@@ -21,21 +21,40 @@
 	
 	private DataType type;
 
-	private String definition;
-
-	private Device owner;
+	private final String definition;
+	private final String longDefinitionName;
+	private final String shortDefinitionName;
 	
+	private Device owner;
 
-	public Action(final String name, final String definition) {
-		super(definition + "__" + name);
+	private Module parent;
+
+	public Action(final String id, final Identifiers identifiers) {
+		super(identifiers.getDefinition() + "__" + id);
 		optional = false;
 		this.args = new HashMap<String, Arg>();
-		this.definition = definition;
+		this.definition = identifiers.getDefinition();
+		this.longDefinitionName = identifiers.getLongName();
+		this.shortDefinitionName = identifiers.getShortName();
 	}
 	
 	public String getDefinition() {
 		return definition;
 	}
+	
+	/**
+	 * @return the longDefinitionName
+	 */
+	public String getLongDefinitionName() {
+		return longDefinitionName;
+	}
+
+	/**
+	 * @return the shortDefinitionName
+	 */
+	public String getShortDefinitionName() {
+		return shortDefinitionName;
+	}
 
 	public DataType getDataType() {
 		return type;
@@ -92,4 +111,12 @@
 		return owner;
 	}
 
+	void setParent(Module parent) {
+		this.parent = parent;
+	}
+
+	public Module getParent() {
+		return parent;
+	}
+
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/DataPoint.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/DataPoint.java
index c39f1d8..bfee5c3 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/DataPoint.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/DataPoint.java
@@ -18,15 +18,22 @@
 	private DataType type;
 	
 	private Device owner;
+	
+	private Module parent;
+	
+	private String longDefinitionType;
+	private String shortDefinitionType;
 
-	public DataPoint(final String name, final DataType type) {
-		super(name);
+	public DataPoint(final Identifiers name, final DataType type) {
+		super(name.getShortName());
 		if (type == null)
 			throw new IllegalArgumentException();
 		this.type = type;
 		optional = false;
 		readable = true;
 		writable = true;
+		longDefinitionType = name.getLongName();
+		shortDefinitionType = name.getShortName();
 	}
 
 	public DataType getDataType() {
@@ -74,5 +81,27 @@
 	public Device getOwner() {
 		return owner;
 	}
+	
+	void setParent(Module parent) {
+		this.parent = parent;
+	}
+
+	public Module getParent() {
+		return parent;
+	}
+	
+	/**
+	 * @return the longDefinitionType
+	 */
+	public String getLongDefinitionType() {
+		return longDefinitionType;
+	}
+
+	/**
+	 * @return the shortDefinitionType
+	 */
+	public String getShortDefinitionType() {
+		return shortDefinitionType;
+	}
 
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Device.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Device.java
index 8a95f17..563cf4c 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Device.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Device.java
@@ -11,7 +11,6 @@
 import java.util.HashMap;
 import java.util.Map;
 
-import org.eclipse.om2m.sdt.types.SimpleType;
 import org.eclipse.om2m.sdt.utils.Logger;
 
 public class Device extends Element {
@@ -23,19 +22,24 @@
 	private Map<String, SubDevice> devices;
 
 	private String definition;
+	
+	private String longDefinitionName;
+	private String shortDefinitionName;
 
-	public Device(final String id, final Domain domain, final String definition) {
-		super(definition + "__" + id);
+	public Device(final String id, final Domain domain, final Identifiers identifiers) {
+		super(identifiers.getDefinition() + "__" + id);
 		if (domain.getDevice(getName()) != null)
 			throw new IllegalArgumentException("Already a device with name " 
 					+ getName() + " in domain " + domain);
-		this.definition = definition;
+		this.definition = identifiers.getDefinition();
+		this.longDefinitionName = identifiers.getLongName();
+		this.shortDefinitionName = identifiers.getShortName();
 		modules = new HashMap<String, Module>();
 		properties = new HashMap<String, Property>();
 		devices = new HashMap<String, SubDevice>();
 		domain.addDevice(this);
 	}
-
+	
 	public String getId() {
 		return getName();
 	}
@@ -47,6 +51,14 @@
 	public String getDefinition() {
 		return definition;
 	}
+	
+	public String getLongDefinitionName() {
+		return longDefinitionName;
+	}
+	
+	public String getShortDefinitionName() {
+		return shortDefinitionName;
+	}
 
 	public Collection<String> getModuleNames() {
 		return modules.keySet();
@@ -84,25 +96,20 @@
 	public Property getProperty(final String name) {
 		return properties.get(name);
 	}
+	
+	public Property getProperty(final String name, boolean shortName) {
+		if (shortName)
+			return properties.get(name);
+		for (Property prop : properties.values())
+			if (prop.getName().equals(name))
+				return prop;
+		return null;
+	}
 
 	public void addProperty(Property property) {
 		this.properties.put(property.getName(), property);
 	}
 
-	public void setProperty(String name, String value) {
-		setProperty(name, value, null);
-	}
-
-	public void setProperty(String name, String value, String type) {
-		Property prop = getProperty(name);
-		if (prop == null) {
-			prop = new Property(name);
-			if (type != null)
-				prop.setType(SimpleType.getSimpleType(type));
-		}
-		prop.setValue(value);
-	}
-
 	public void removeProperty(final String name) {
 		this.properties.remove(name);
 	}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Element.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Element.java
index 1abbaf9..eed5c6b 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Element.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Element.java
@@ -17,7 +17,7 @@
 
 	public Element(final String name) {
 		if ((name == null) || name.equals(""))
-			throw new IllegalArgumentException("Name cannot be null or empty");
+			throw new IllegalArgumentException("Name cannot be null or empty: " + name);
 		this.name = name;
 	}
 
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Identifiers.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Identifiers.java
new file mode 100644
index 0000000..e91e8be
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Identifiers.java
@@ -0,0 +1,11 @@
+package org.eclipse.om2m.sdt;
+
+import org.eclipse.om2m.sdt.types.DataType;
+
+public interface Identifiers {
+	
+	String getDefinition();
+	String getShortName();
+	String getLongName();
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Module.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Module.java
index 090f27e..3b28bd0 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Module.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Module.java
@@ -7,17 +7,91 @@
  *******************************************************************************/
 package org.eclipse.om2m.sdt;
 
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.om2m.sdt.datapoints.ValuedDataPoint;
+import org.eclipse.om2m.sdt.exceptions.AccessException;
+import org.eclipse.om2m.sdt.exceptions.DataPointException;
+
 public class Module extends ModuleClass {
 	
-	private String definition;
+	static public interface DatapointHandler {
+		void setValues(Map<String, Object> values) throws DataPointException, AccessException;
+		public Map<String, Object> getValues(List<String> names) throws DataPointException, AccessException;
+	}
+	
+	private final String definition;
+	private final String longDefinitionName;
+	private final String shortDefinitionName;
+	
+	private DatapointHandler handler = new DatapointHandler() {
+		@Override
+		public void setValues(Map<String, Object> values)
+				throws DataPointException, AccessException {
+			Module.this.dosetValues(values);
+		}
+		@Override
+		public Map<String, Object> getValues(List<String> names)
+				throws DataPointException, AccessException {
+			return Module.this.dogetValues(names);
+		}
+	};
 
-	public Module(final String name, final Domain domain, final String definition) {
-		super(definition + "__" + name, domain);
-		this.definition = definition;
+	public Module(final String id, final Domain domain, final Identifiers ids) {
+		super(ids.getDefinition() + "__" + id, domain);
+		this.definition = ids.getDefinition();
+		this.longDefinitionName = ids.getLongName();
+		this.shortDefinitionName = ids.getShortName();
 	}
 	
 	public String getDefinition() {
 		return definition;
 	}
 
+	/**
+	 * @return the longDefinitionName
+	 */
+	public String getLongDefinitionName() {
+		return longDefinitionName;
+	}
+
+	/**
+	 * @return the shortDefinitionName
+	 */
+	public String getShortDefinitionName() {
+		return shortDefinitionName;
+	}
+	
+	public void setDatapointHandler(DatapointHandler handler) {
+		this.handler = handler;
+	}
+	
+	public DatapointHandler getDatapointHandler() {
+		return handler;
+	}
+	
+	@SuppressWarnings("unchecked")
+	private void dosetValues(Map<String, Object> values) throws DataPointException, AccessException {
+		for (Map.Entry<String, Object> entry : values.entrySet()) {
+			DataPoint dp = getDataPointByShortName(entry.getKey());
+			if (dp != null) { // Ignore unknown datapoints
+				((ValuedDataPoint<Object>)dp).setValue(entry.getValue());
+			}
+		}
+	}
+	
+	@SuppressWarnings("unchecked")
+	private Map<String, Object> dogetValues(List<String> names) throws DataPointException, AccessException {
+		Map<String, Object> ret = new HashMap<String, Object>();
+		for (String name : names) {
+			DataPoint dp = getDataPointByShortName(name);
+			if (dp != null) { // Ignore unknown datapoints
+				ret.put(name, ((ValuedDataPoint<Object>)dp).getValue());
+			}
+		}
+		return ret;
+	}
+	
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/ModuleClass.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/ModuleClass.java
index 1470a38..5eddb15 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/ModuleClass.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/ModuleClass.java
@@ -18,6 +18,21 @@
 
 public abstract class ModuleClass extends Element {
 	
+	static private final Identifiers OWNER = new Identifiers() {
+		@Override
+		public String getShortName() {
+			return "owner";
+		}
+		@Override
+		public String getLongName() {
+			return "owner";
+		}
+		@Override
+		public String getDefinition() {
+			return "owner";
+		}
+	};
+	
 	private Extended extended;
 	
 	private boolean optional;
@@ -25,6 +40,7 @@
 	private Map<String, Action> actions;
 
 	private Map<String, DataPoint> dataPoints;
+	private Map<String, DataPoint> dataPointsByShortDefinitionType;
 
 	private Map<String, Event> events;
 
@@ -32,16 +48,17 @@
 	
 	private Device owner;
 	
-	ModuleClass(final String name, final Domain domain) {
-		super(name);
-		if (domain.getModule(name) != null) {
-			String msg = "Already a module with name " + name + " in domain " + domain;
+	ModuleClass(final String id, final Domain domain) {
+		super(id);
+		if (domain.getModule(id) != null) {
+			String msg = "Already a module with name " + id + " in domain " + domain;
 			Logger.warning(msg);
 			throw new IllegalArgumentException(msg);
 		}
 		optional = false;
 		this.actions = new HashMap<String, Action>();
 		this.dataPoints = new HashMap<String, DataPoint>();
+		this.dataPointsByShortDefinitionType = new HashMap<String, DataPoint>();
 		this.events = new HashMap<String, Event>();
 		this.properties = new HashMap<String, Property>();
 		domain.addModule(this);
@@ -78,6 +95,7 @@
 			Logger.warning(msg);
 			throw new IllegalArgumentException(msg);
 		}
+		action.setParent((Module) this);
 		action.setOwner(owner);
 		actions.put(action.getName(), action);
 	}
@@ -97,6 +115,10 @@
 	public DataPoint getDataPoint(final String name) {
 		return dataPoints.get(name);
 	}
+	
+	public DataPoint getDataPointByShortName(final String shortDefinitionType) {
+		return dataPointsByShortDefinitionType.get(shortDefinitionType);
+	}
 
 	public void addDataPoint(final DataPoint dp) {
 		if (dataPoints.get(dp.getName()) != null) {
@@ -104,14 +126,24 @@
 			Logger.warning(msg);
 			throw new IllegalArgumentException(msg);
 		}
+		dp.setParent((Module) this);
+		if (dp.getShortDefinitionType() == null) {
+			String msg = "Short definition type is null of " + dp.getName() + " in module " + getName();
+			Logger.warning(msg);
+			throw new IllegalArgumentException(msg);
+		}
 		dataPoints.put(dp.getName(), dp);
-		if (owner != null) {
+		dataPointsByShortDefinitionType.put(dp.getShortDefinitionType(), dp);
+		if (owner!= null) {
 			dp.setOwner(owner);
 		}
 	}
 
 	public void removeDataPoint(final String name) {
-		dataPoints.remove(name);
+		DataPoint dp = dataPoints.remove(name);
+		if (dp != null) {
+			dataPointsByShortDefinitionType.remove(dp.getShortDefinitionType());
+		}
 	}
 
 	public Collection<String> getEventNames() {
@@ -179,20 +211,18 @@
 	public Property getProperty(final String name) {
 		return properties.get(name);
 	}
-
-	public void addProperty(final Property arg) {
-		if (properties.get(arg.getName()) != null)
-			throw new IllegalArgumentException();
-		properties.put(arg.getName(), arg);
+	
+	public Property getPropertyByShortName(final String shortDefinitionType) {
+		for(Property property : properties.values()) {
+			if (property.getShortName().equals(shortDefinitionType)) {
+				return property;
+			}
+		}
+		return null;
 	}
 
-	public void setProperty(String name, String value) {
-		Property prop = getProperty(name);
-		if (prop == null) {
-			prop = new Property(name);
-			properties.put(name, prop);
-		}
-		prop.setValue(value);
+	public void addProperty(final Property arg) {
+		properties.put(arg.getName(), arg);
 	}
 
 	public void removeProperty(final String name) {
@@ -222,7 +252,7 @@
 	
 	void setOwner(Device owner) {
 		this.owner = owner;
-		setProperty("propOwner", owner.getPid());
+		addProperty(new Property(OWNER, owner.getPid()));
 		for (DataPoint dp : dataPoints.values()) {
 			dp.setOwner(owner);
 		}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Property.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Property.java
index 7970a37..7d4826a 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Property.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/Property.java
@@ -11,19 +11,22 @@
 
 public class Property extends Element {
 	
+	private final String shortName;
+	
 	private boolean optional;
 	
 	private String value;
 	
 	private SimpleType type;
 
-	public Property(final String name) {
-		super(name);
+	public Property(final Identifiers name) {
+		super(name.getLongName());
 		optional = false;
 		type = SimpleType.String;
+		this.shortName = name.getShortName();
 	}
 
-	public Property(final String name, final String value) {
+	public Property(final Identifiers name, final String value) {
 		this(name);
 		setValue(value);
 	}
@@ -31,6 +34,10 @@
 	public String getName() {
 		return name;
 	}
+	
+	public String getShortName() {
+		return shortName;
+	}
 
 	public SimpleType getType() {
 		return type;
@@ -65,8 +72,8 @@
 	
 	@Override
 	public String toString() {
-		return "<" + getClass().getSimpleName() + " \"" + name + "\"="
-			+ ((value == null) ? value : "\"" + value + "\"") + "/>";
+		return "<" + getClass().getSimpleName() + " \"" + name + "/" + shortName
+			+ "\"=" + ((value == null) ? value : "\"" + value + "\"") + "/>";
 	}
 
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/args/Command.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/args/Command.java
index 26c64b5..70a1b3c 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/args/Command.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/args/Command.java
@@ -13,18 +13,19 @@
 
 import org.eclipse.om2m.sdt.Action;
 import org.eclipse.om2m.sdt.Arg;
+import org.eclipse.om2m.sdt.Identifiers;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.ActionException;
 import org.eclipse.om2m.sdt.utils.Activator;
 
 public abstract class Command extends Action {
 
-	public Command(String name, String definition) {
-		super(name, definition);
+	public Command(String name, final Identifiers identifiers) {
+		super(name, identifiers);
 	}
 
-	public Command(String name, String definition, Collection<Arg> args) {
-		super(name, definition);
+	public Command(String name, Collection<Arg> args, final Identifiers identifiers) {
+		super(name, identifiers);
 		if (args != null)
 			for (Arg arg : args)
 				addArg(arg);
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/AbstractDateDataPoint.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/AbstractDateDataPoint.java
index a368426..9d04158 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/AbstractDateDataPoint.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/AbstractDateDataPoint.java
@@ -11,6 +11,7 @@
 import java.text.ParseException;
 import java.util.Date;
 
+import org.eclipse.om2m.sdt.Identifiers;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
 import org.eclipse.om2m.sdt.types.DataType;
@@ -23,7 +24,7 @@
 	
 	private DateFormat df;
 
-	protected AbstractDateDataPoint(String name, DataType type) {
+	protected AbstractDateDataPoint(Identifiers name, DataType type) {
 		super(name, type);
 		if (type.equals(DataType.Date)) {
 			df = dateFormat;
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/ArrayDataPoint.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/ArrayDataPoint.java
index 0dee76c..bfb6840 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/ArrayDataPoint.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/ArrayDataPoint.java
@@ -9,12 +9,13 @@
 
 import java.util.List;
 
+import org.eclipse.om2m.sdt.Identifiers;
 import org.eclipse.om2m.sdt.types.Array;
 import org.eclipse.om2m.sdt.types.DataType;
 
 public abstract class ArrayDataPoint<T> extends ValuedDataPoint<List<T>> {
 
-	public ArrayDataPoint(String name) {
+	public ArrayDataPoint(Identifiers name) {
 		super(name, new DataType("array", new Array<T>()));
 	}
 
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/BlobDataPoint.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/BlobDataPoint.java
index c8404bf..2bd18d9 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/BlobDataPoint.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/BlobDataPoint.java
@@ -7,11 +7,12 @@
  *******************************************************************************/
 package org.eclipse.om2m.sdt.datapoints;
 
+import org.eclipse.om2m.sdt.Identifiers;
 import org.eclipse.om2m.sdt.types.DataType;
 
 public abstract class BlobDataPoint extends ValuedDataPoint<byte[]> {
 
-	public BlobDataPoint(String name) {
+	public BlobDataPoint(Identifiers name) {
 		super(name, DataType.Blob);
 	}
 	
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/BooleanDataPoint.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/BooleanDataPoint.java
index 3056175..1d80a20 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/BooleanDataPoint.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/BooleanDataPoint.java
@@ -7,12 +7,13 @@
  *******************************************************************************/
 package org.eclipse.om2m.sdt.datapoints;
 
+import org.eclipse.om2m.sdt.Identifiers;
 import org.eclipse.om2m.sdt.types.DataType;
 
 public abstract class BooleanDataPoint extends ValuedDataPoint<Boolean> {
 
-	public BooleanDataPoint(String name) {
-		super(name, DataType.Boolean);
+	public BooleanDataPoint(Identifiers type) {
+		super(type, DataType.Boolean);
 	}
 
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/ByteDataPoint.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/ByteDataPoint.java
index efdf201..2f05274 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/ByteDataPoint.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/ByteDataPoint.java
@@ -7,11 +7,12 @@
  *******************************************************************************/
 package org.eclipse.om2m.sdt.datapoints;
 
+import org.eclipse.om2m.sdt.Identifiers;
 import org.eclipse.om2m.sdt.types.DataType;
 
 public abstract class ByteDataPoint extends ValuedDataPoint<Byte> {
 
-	public ByteDataPoint(String name) {
+	public ByteDataPoint(Identifiers name) {
 		super(name, DataType.Byte);
 	}
 
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/ClonedEnum.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/ClonedEnum.java
new file mode 100644
index 0000000..559c41b
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/ClonedEnum.java
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.datapoints;
+
+import org.eclipse.om2m.sdt.Identifiers;
+import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.types.DataType;
+
+public abstract class ClonedEnum extends EnumDataPoint<Integer> {
+
+	private EnumDataPoint<Integer> dp;
+	
+	public ClonedEnum(Identifiers names, DataType type, EnumDataPoint<Integer> dp) {
+		super(names, type);
+		this.dp = dp;
+	}
+	
+	@Override
+	protected void doSetValue(Integer val) throws DataPointException {
+		dp.doSetValue(val);
+	}
+	
+	@Override
+	protected Integer doGetValue() throws DataPointException {
+		return dp.doGetValue();
+	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/DateDataPoint.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/DateDataPoint.java
index 4dc7cfe..201c2ac 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/DateDataPoint.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/DateDataPoint.java
@@ -7,11 +7,12 @@
  *******************************************************************************/
 package org.eclipse.om2m.sdt.datapoints;
 
+import org.eclipse.om2m.sdt.Identifiers;
 import org.eclipse.om2m.sdt.types.DataType;
 
 public abstract class DateDataPoint extends AbstractDateDataPoint {
 
-	public DateDataPoint(String name) {
+	public DateDataPoint(Identifiers name) {
 		super(name, DataType.Date);
 	}
 
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/DateTimeDataPoint.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/DateTimeDataPoint.java
index fe79b8e..79115ec 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/DateTimeDataPoint.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/DateTimeDataPoint.java
@@ -7,11 +7,12 @@
  *******************************************************************************/
 package org.eclipse.om2m.sdt.datapoints;
 
+import org.eclipse.om2m.sdt.Identifiers;
 import org.eclipse.om2m.sdt.types.DataType;
 
 public abstract class DateTimeDataPoint extends AbstractDateDataPoint {
 
-	public DateTimeDataPoint(String name) {
+	public DateTimeDataPoint(Identifiers name) {
 		super(name, DataType.Datetime);
 	}
 
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/EnumDataPoint.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/EnumDataPoint.java
index 5b63398..5aa7300 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/EnumDataPoint.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/EnumDataPoint.java
@@ -12,21 +12,36 @@
 import java.util.Collection;
 import java.util.List;
 
+import org.eclipse.om2m.sdt.Identifiers;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
 import org.eclipse.om2m.sdt.types.DataType;
 
 public abstract class EnumDataPoint<T> extends ValuedDataPoint<T> {
 	
+	static final private Identifiers anon = new Identifiers() {
+		@Override
+		public String getShortName() {
+			return "enum";
+		}
+		@Override
+		public String getLongName() {
+			return "enumDataPoint";
+		}
+		@Override
+		public String getDefinition() {
+			return "enum";
+		}
+	};
+
 	private List<T> values;
 
-	public EnumDataPoint(String name) {
-		super(name, DataType.Enum);
-		values = new ArrayList<T>();
+	public EnumDataPoint(Identifiers name) {
+		this(name, DataType.Enum);
 	}
 	
-	public EnumDataPoint(String name, DataType type) {
-		super(name, type);
+	public EnumDataPoint(Identifiers name, DataType type) {
+		super((name == null) ? anon : name, type);
 		values = new ArrayList<T>();
 	}
 	
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/FloatDataPoint.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/FloatDataPoint.java
index f0b3f3f..830870c 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/FloatDataPoint.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/FloatDataPoint.java
@@ -7,11 +7,12 @@
  *******************************************************************************/
 package org.eclipse.om2m.sdt.datapoints;
 
+import org.eclipse.om2m.sdt.Identifiers;
 import org.eclipse.om2m.sdt.types.DataType;
 
 public abstract class FloatDataPoint extends ValuedDataPoint<Float> {
 
-	public FloatDataPoint(String name) {
+	public FloatDataPoint(Identifiers name) {
 		super(name, DataType.Float);
 	}
 
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/IntegerDataPoint.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/IntegerDataPoint.java
index 95eb163..6d86420 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/IntegerDataPoint.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/IntegerDataPoint.java
@@ -7,11 +7,12 @@
  *******************************************************************************/
 package org.eclipse.om2m.sdt.datapoints;
 
+import org.eclipse.om2m.sdt.Identifiers;
 import org.eclipse.om2m.sdt.types.DataType;
 
 public abstract class IntegerDataPoint extends ValuedDataPoint<Integer> {
 
-	public IntegerDataPoint(String name) {
+	public IntegerDataPoint(Identifiers name) {
 		super(name, DataType.Integer);
 	}
 	
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/StringDataPoint.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/StringDataPoint.java
index f652c82..8bad178 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/StringDataPoint.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/StringDataPoint.java
@@ -7,11 +7,12 @@
  *******************************************************************************/
 package org.eclipse.om2m.sdt.datapoints;
 
+import org.eclipse.om2m.sdt.Identifiers;
 import org.eclipse.om2m.sdt.types.DataType;
 
 public abstract class StringDataPoint extends ValuedDataPoint<String> {
 
-	public StringDataPoint(String name) {
+	public StringDataPoint(Identifiers name) {
 		super(name, DataType.String);
 	}
 	
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/TimeDataPoint.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/TimeDataPoint.java
index 7627817..1dbb694 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/TimeDataPoint.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/TimeDataPoint.java
@@ -7,11 +7,12 @@
  *******************************************************************************/
 package org.eclipse.om2m.sdt.datapoints;
 
+import org.eclipse.om2m.sdt.Identifiers;
 import org.eclipse.om2m.sdt.types.DataType;
 
 public abstract class TimeDataPoint extends AbstractDateDataPoint {
 
-	public TimeDataPoint(String name) {
+	public TimeDataPoint(Identifiers name) {
 		super(name, DataType.Time);
 	}
 
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/UriDataPoint.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/UriDataPoint.java
index 57cfc70..6573871 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/UriDataPoint.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/UriDataPoint.java
@@ -10,13 +10,14 @@
 import java.net.URI;
 import java.net.URISyntaxException;
 
+import org.eclipse.om2m.sdt.Identifiers;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
 import org.eclipse.om2m.sdt.types.DataType;
 
 public abstract class UriDataPoint extends ValuedDataPoint<URI> {
 
-	public UriDataPoint(String name) {
+	public UriDataPoint(Identifiers name) {
 		super(name, DataType.Uri);
 	}
 	
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/ValuedDataPoint.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/ValuedDataPoint.java
index f2e41a1..cd16d8e 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/ValuedDataPoint.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.api/src/main/java/org/eclipse/om2m/sdt/datapoints/ValuedDataPoint.java
@@ -8,6 +8,7 @@
 package org.eclipse.om2m.sdt.datapoints;
 
 import org.eclipse.om2m.sdt.DataPoint;
+import org.eclipse.om2m.sdt.Identifiers;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
 import org.eclipse.om2m.sdt.types.DataType;
@@ -15,7 +16,7 @@
 
 public abstract class ValuedDataPoint<T> extends DataPoint {
 
-	public ValuedDataPoint(String name, DataType type) {
+	public ValuedDataPoint(Identifiers name, DataType type) {
 		super(name, type);
 	}
 
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/.gitignore b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/.gitignore
new file mode 100644
index 0000000..7fb5d66
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/.gitignore
@@ -0,0 +1 @@
+.settings
\ No newline at end of file
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/.project b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/.project
new file mode 100644
index 0000000..95d24dc
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/.project
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>oneM2M.SDT.Applications</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.m2e.core.maven2Builder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.m2e.core.maven2Nature</nature>
+	</natures>
+</projectDescription>
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/.gitignore b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/.gitignore
new file mode 100644
index 0000000..b981306
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/.gitignore
@@ -0,0 +1,4 @@
+/target/
+.settings
+.project
+.classpath
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/META-INF/MANIFEST.MF b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..c278cca
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/META-INF/MANIFEST.MF
@@ -0,0 +1,31 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.om2m.sdt.home.monitoring
+Bundle-SymbolicName: org.eclipse.om2m.sdt.home.monitoring
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-Activator: org.eclipse.om2m.sdt.home.monitoring.Activator
+Bundle-ClassPath: .,
+ lib/json-simple-1.1.1.jar
+Import-Package: javax.servlet,
+ javax.servlet.http,
+ org.apache.commons.codec.binary,
+ org.apache.commons.logging,
+ org.eclipse.om2m.commons.constants,
+ org.eclipse.om2m.commons.resource,
+ org.eclipse.om2m.core.service,
+ org.eclipse.om2m.interworking.service,
+ org.eclipse.om2m.sdt,
+ org.eclipse.om2m.sdt.args,
+ org.eclipse.om2m.sdt.datapoints,
+ org.eclipse.om2m.sdt.exceptions,
+ org.eclipse.om2m.sdt.home.devices,
+ org.eclipse.om2m.sdt.home.driver,
+ org.eclipse.om2m.sdt.home.modules,
+ org.eclipse.om2m.sdt.home.types,
+ org.eclipse.om2m.sdt.types,
+ org.osgi.framework,
+ org.osgi.service.cm,
+ org.osgi.service.http,
+ org.osgi.service.log,
+ org.osgi.util.tracker
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/build.properties b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/build.properties
new file mode 100644
index 0000000..940bbe7
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/build.properties
@@ -0,0 +1,24 @@
+###############################################################################
+# Copyright (c) 2013-2016 LAAS-CNRS (www.laas.fr)
+# 7 Colonel Roche 31077 Toulouse - France
+# 
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+# 
+# Initial Contributors:
+# 	Thierry Monteil : Project manager, technical co-manager
+# 	Mahdi Ben Alaya : Technical co-manager
+# 	Samir Medjiah : Technical co-manager
+# 	Khalil Drira : Strategy expert
+# 	Guillaume Garzone : Developer
+# 	François Aïssaoui : Developer
+# 
+# New contributors :
+###############################################################################
+source.. = src/main/java/
+output.. = bin/
+bin.includes = META-INF/,\
+               .,\
+               lib/json-simple-1.1.1.jar
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/lib/json-simple-1.1.1.jar b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/lib/json-simple-1.1.1.jar
new file mode 100644
index 0000000..dfd5856
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/lib/json-simple-1.1.1.jar
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/pom.xml b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/pom.xml
new file mode 100644
index 0000000..7a159aa
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/pom.xml
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Copyright (c) 2014, 2016 Orange.
+    All rights reserved. This program and the accompanying materials
+    are made available under the terms of the Eclipse Public License v1.0
+    which accompanies this distribution, and is available at
+    http://www.eclipse.org/legal/epl-v10.html
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+	<modelVersion>4.0.0</modelVersion>
+
+	<artifactId>org.eclipse.om2m.sdt.home.monitoring</artifactId>
+	<packaging>eclipse-plugin</packaging>
+	<!--name>org.eclipse.om2m.sdt.home.monitoring</name-->
+
+	<parent>
+		<groupId>org.eclipse.om2m</groupId>
+		<artifactId>org.eclipse.om2m.sdt.home.applications</artifactId>
+		<version>1.0.0-SNAPSHOT</version>
+	</parent>
+	
+	<!-- dependencies>
+
+		<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>servlet-api</artifactId>
+			<version>2.2</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.eclipse.om2m</groupId>
+			<artifactId>org.eclipse.om2m.core.service</artifactId>
+			<version>${mn-cse.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.eclipse.om2m</groupId>
+			<artifactId>org.eclipse.om2m.commons</artifactId>
+			<version>${mn-cse.version}</version>
+		</dependency>
+				
+		<dependency>
+			<groupId>commons-codec</groupId>
+			<artifactId>commons-codec</artifactId>
+			<version>1.4</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>osgi_R4_core</artifactId>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.osgi</groupId>
+			<artifactId>osgi_R4_compendium</artifactId>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>commons-logging</groupId>
+			<artifactId>commons-logging-api</artifactId>
+			<version>1.1</version>
+		</dependency>
+
+	</dependencies -->
+
+</project>
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/Activator.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/Activator.java
new file mode 100644
index 0000000..a63419e
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/Activator.java
@@ -0,0 +1,130 @@
+package org.eclipse.om2m.sdt.home.monitoring;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.om2m.core.service.CseService;
+import org.eclipse.om2m.interworking.service.InterworkingService;
+import org.eclipse.om2m.sdt.home.monitoring.servlet.CredentialsServlet;
+import org.eclipse.om2m.sdt.home.monitoring.servlet.HomeServlet;
+import org.eclipse.om2m.sdt.home.monitoring.servlet.InCseContextServlet;
+import org.eclipse.om2m.sdt.home.monitoring.servlet.LoginServlet;
+import org.eclipse.om2m.sdt.home.monitoring.servlet.LogoutServlet;
+import org.eclipse.om2m.sdt.home.monitoring.util.AeRegistration;
+import org.eclipse.om2m.sdt.home.monitoring.util.Constants;
+import org.eclipse.om2m.sdt.home.monitoring.util.ResourceDiscovery;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.cm.ConfigurationException;
+import org.osgi.service.cm.ManagedService;
+import org.osgi.service.http.HttpService;
+import org.osgi.util.tracker.ServiceTracker;
+
+
+public class Activator implements BundleActivator , ManagedService {
+	/** logger */
+	private static Log LOGGER = LogFactory.getLog(Activator.class);
+	public static String globalContext = System.getProperty("org.eclipse.om2m.globalContext","");
+	public static String uiContext = /*System.getProperty("org.eclipse.om2m.webInterfaceContext","/")*/"";
+	public static String sep ="/";
+	public static String CAMERAURL ="";
+	/** HTTP service tracker */
+	private ServiceTracker httpServiceTracker;
+	private ServiceTracker sclServiceTracker;
+
+	@Override
+	public void start(BundleContext context) throws Exception {
+		initCseServiceTracker(context) ;
+
+		if (uiContext.equals("/")) {
+			sep="";
+		}
+
+		httpServiceTracker = new ServiceTracker(context, HttpService.class.getName(), null) {
+			
+			public void removedService(ServiceReference reference, Object service) {
+				LOGGER.info("HttpService removed");
+				try {
+					LOGGER.info("Unregister " + uiContext + sep + " http context");
+					((HttpService) service).unregister(uiContext + sep + Constants.APPNAME);
+				} catch (IllegalArgumentException e) {
+					LOGGER.error("Error unregistring webapp servlet",e);
+				}
+			}
+
+			public Object addingService(ServiceReference reference) {
+				LOGGER.info("HttpService discovered");
+				HttpService httpService = (HttpService) context.getService(reference);
+				try {
+					LOGGER.info("Register test " + uiContext + sep + "Home_Monitoring_Application http context");
+					httpService.registerServlet(uiContext + sep + Constants.APPNAME, 
+							new HomeServlet(context), null, null);
+					httpService.registerServlet(uiContext + sep + Constants.APPNAME + "/in-cse/context", 
+							new InCseContextServlet(), null, null);
+					httpService.registerServlet(uiContext + sep + Constants.APPNAME + "/security/login", 
+							new LoginServlet(context), null, null);
+					httpService.registerServlet(uiContext + sep + Constants.APPNAME + "/security/cred", 
+							new CredentialsServlet(context), null, null);
+					httpService.registerServlet(uiContext + sep + Constants.APPNAME + "/security/logout", 
+							new LogoutServlet(context), null, null);
+					httpService.registerResources(uiContext + sep + Constants.APPNAME + "/webapps", 
+							uiContext + sep + "webapps", null);
+				} catch (Exception e) {
+					LOGGER.error("Error registring webapp servlet",e);
+				}
+				return httpService;
+			}
+		};
+		httpServiceTracker.open();
+		Dictionary<String,String> dic= new Hashtable();
+		dic.put("service.pid", "home.monitoring.application");
+		context.registerService(ManagedService.class.getName(), new Activator(), dic);
+	}
+
+	@Override
+	public void stop(BundleContext context) throws Exception {
+		try {
+			sclServiceTracker.close();
+			httpServiceTracker.close();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+
+	private void initCseServiceTracker(final BundleContext bundleContext) {
+		sclServiceTracker = new ServiceTracker(bundleContext, CseService.class.getName(), null) {
+			private ServiceRegistration sr;
+			
+			public void removedService(ServiceReference reference, Object service) {
+            	
+				sr.unregister();
+				AeRegistration.getInstance().deleteAe();
+				AeRegistration.getInstance().setCseService(null);
+				
+				LOGGER.info("CSEService removed");
+			}
+			public Object addingService(ServiceReference reference) {
+				LOGGER.info("CSEService Tracker found");
+				CseService cseService = (CseService) this.context.getService(reference); 
+				AeRegistration.getInstance().setCseService(cseService);
+            	AeRegistration.getInstance().createAe();
+            	sr = bundleContext.registerService(InterworkingService.class, AeRegistration.getInstance(), null);
+				ResourceDiscovery.initCseService(cseService);
+				return cseService;
+			}
+		};
+		sclServiceTracker.open();
+	}
+
+	@Override
+	public void updated(Dictionary dictionary) throws ConfigurationException {
+		if (dictionary != null) {
+			CAMERAURL=dictionary.get("ip.camera.url").toString();
+		}
+	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/servlet/CredentialsServlet.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/servlet/CredentialsServlet.java
new file mode 100644
index 0000000..80840a6
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/servlet/CredentialsServlet.java
@@ -0,0 +1,53 @@
+package org.eclipse.om2m.sdt.home.monitoring.servlet;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.json.simple.JSONObject;
+import org.osgi.framework.BundleContext;
+
+public class CredentialsServlet extends HttpServlet {
+
+	private static final long serialVersionUID = 1L;
+
+	public CredentialsServlet(BundleContext context) {
+	}
+
+	@Override
+	protected void doGet(HttpServletRequest request, HttpServletResponse response)
+			throws ServletException, IOException {
+		String sessionId = request.getParameter(SessionManager.SESSION_ID_PARAMETER);
+
+		if ((sessionId == null) || (!SessionManager.getInstance().checkTokenExists(sessionId))) {
+			// no valid session =>
+			response.sendError(HttpServletResponse.SC_FORBIDDEN);
+			return;
+		}
+
+		SessionManager.Session session = SessionManager.getInstance().getSession(sessionId);
+		if (session == null) {
+			// no valid session =>
+						response.sendError(HttpServletResponse.SC_FORBIDDEN);
+						return;
+		}
+
+		String name = session.getName();
+		String password = session.getPassword();
+		String cred = name + ':' + password;
+
+		response.setContentType("application/json");
+		PrintWriter out = response.getWriter();
+		JSONObject jsonObject = new JSONObject();
+		jsonObject.put("name", name);
+		jsonObject.put("credentials", cred);
+
+		out.write(jsonObject.toJSONString());
+	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/servlet/HomeServlet.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/servlet/HomeServlet.java
new file mode 100644
index 0000000..9807ac6
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/servlet/HomeServlet.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2013-2014 LAAS-CNRS (www.laas.fr)
+ * 7 Colonel Roche 31077 Toulouse - France
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *     Thierry Monteil (Project co-founder) - Management and initial specification,
+ *         conception and documentation.
+ *     Mahdi Ben Alaya (Project co-founder) - Management and initial specification,
+ *         conception, implementation, test and documentation.
+ *     Christophe Chassot - Management and initial specification.
+ *     Khalil Drira - Management and initial specification.
+ *     Yassine Banouar - Initial specification, conception, implementation, test
+ *         and documentation.
+ ******************************************************************************/
+package org.eclipse.om2m.sdt.home.monitoring.servlet;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.eclipse.om2m.sdt.home.monitoring.util.Constants;
+import org.osgi.framework.BundleContext;
+
+
+public class HomeServlet extends HttpServlet {
+
+	private static final long serialVersionUID = 1L;
+
+	public HomeServlet(BundleContext context) {
+	}
+
+	@Override
+	protected void doGet(HttpServletRequest request,
+			HttpServletResponse response) throws ServletException, IOException {
+		// check session
+		String sessionId = request.getParameter(SessionManager.SESSION_ID_PARAMETER);
+		
+		if ((sessionId != null) && SessionManager.getInstance().checkTokenExists(sessionId)) {
+			response.sendRedirect("/" + Constants.APPNAME + "/monitor/home");
+		} else {
+			response.sendRedirect("/" + Constants.APPNAME + "/webapps/login.html");	
+		}
+
+	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/servlet/InCseContextServlet.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/servlet/InCseContextServlet.java
new file mode 100644
index 0000000..e5bdfb8
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/servlet/InCseContextServlet.java
@@ -0,0 +1,99 @@
+package org.eclipse.om2m.sdt.home.monitoring.servlet;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.om2m.commons.constants.Constants;
+import org.eclipse.om2m.sdt.home.monitoring.util.AeRegistration;
+import org.json.simple.JSONArray;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+
+public class InCseContextServlet extends HttpServlet {
+
+	private static Log LOGGER = LogFactory.getLog(InCseContextServlet.class);
+	
+	private static final long serialVersionUID = 1L;
+	private static final String RESOURCE_ID = "resourceId";
+	private static final String GET_NOTIFICATIONS= "/notifications";
+
+	public InCseContextServlet() {
+	}
+
+	@Override
+	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+		String sessionId = req.getParameter(SessionManager.SESSION_ID_PARAMETER);
+		if (!SessionManager.getInstance().checkTokenExists(sessionId)) {
+			resp.sendError(HttpServletResponse.SC_FORBIDDEN);
+			return;
+		}
+		
+		String pathInfo = req.getPathInfo();
+		if (pathInfo == null) {
+			String cseId = Constants.CSE_ID;
+			String cseName = Constants.CSE_NAME;
+			resp.setStatus(HttpServletResponse.SC_OK);
+			resp.getWriter().print("~/" + cseId + "/" + cseName);
+		} else if (GET_NOTIFICATIONS.equals(pathInfo)) {
+			// retrieve notifications
+			List<JSONObject> notifications = AeRegistration.getInstance().getNotificationsAndClears(sessionId);
+			JSONArray globalJson = new JSONArray();
+			for(JSONObject notification : notifications) {
+				globalJson.add(notification);
+			}
+			resp.setHeader("Content-Type", "application/json");
+			resp.getWriter().print(globalJson.toJSONString());
+			resp.setStatus(HttpServletResponse.SC_OK);
+		}
+	}
+
+	@Override
+	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+		
+		LOGGER.info("doPost(subscribeTo)");
+
+		JSONParser parser = new JSONParser();
+		JSONObject jsonObject = null;
+		try {
+			jsonObject = (JSONObject) parser.parse(req.getReader());
+		} catch (ParseException e) {
+			resp.sendError(HttpServletResponse.SC_NOT_ACCEPTABLE,
+					"json payload is incorrect: valid format is {'resourceId':'url'}");
+			return;
+		} catch (ClassCastException e) {
+			resp.sendError(HttpServletResponse.SC_NOT_ACCEPTABLE,
+					"json payload is incorrect: valid format is {'resourceId':'url'}");
+			return;
+		}
+		
+		String resourceId = null;
+		String sessionId = null;
+		try {
+			resourceId = (String) jsonObject.get(RESOURCE_ID);
+			sessionId = (String) jsonObject.get(SessionManager.SESSION_ID_PARAMETER);
+			if (!AeRegistration.getInstance().createSubscription(resourceId, sessionId)) {
+				resp.sendError(HttpServletResponse.SC_NOT_ACCEPTABLE,
+						"unable to create subscription");
+				return;
+			}
+		} catch (ClassCastException e) {
+			resp.sendError(HttpServletResponse.SC_NOT_ACCEPTABLE,
+					"json payload is incorrect: valid format is {'resourceId':'url'}");
+			return;
+		}
+		LOGGER.debug("doPost(subscribeTo=" + resourceId + ")");
+		
+		resp.setStatus(HttpServletResponse.SC_OK);
+
+	}
+	
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/servlet/LoginServlet.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/servlet/LoginServlet.java
new file mode 100644
index 0000000..5514831
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/servlet/LoginServlet.java
@@ -0,0 +1,38 @@
+package org.eclipse.om2m.sdt.home.monitoring.servlet;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.eclipse.om2m.sdt.home.monitoring.util.AuthFillter;
+import org.eclipse.om2m.sdt.home.monitoring.util.Constants;
+import org.osgi.framework.BundleContext;
+
+
+public class LoginServlet extends HttpServlet {
+
+	private static final long serialVersionUID = 1L;
+
+	public LoginServlet(BundleContext context) {
+	}
+
+	@Override
+	protected void doPost(HttpServletRequest request, HttpServletResponse response) 
+			throws ServletException, IOException {
+		
+		SessionManager.Session session = null;
+		if ((session = AuthFillter.validateUserCredentials(request, response)) != null) {	
+			response.sendRedirect("/" + Constants.APPNAME + "/webapps/monitor.html?" + SessionManager.SESSION_ID_PARAMETER + "=" + session.getId());
+		} else {
+			response.sendRedirect("/" + Constants.APPNAME + "/webapps/login.html?message=error");
+		}
+	}
+	
+	
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/servlet/LogoutServlet.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/servlet/LogoutServlet.java
new file mode 100644
index 0000000..b695755
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/servlet/LogoutServlet.java
@@ -0,0 +1,38 @@
+package org.eclipse.om2m.sdt.home.monitoring.servlet;
+
+import java.io.IOException;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.eclipse.om2m.sdt.home.monitoring.util.AeRegistration;
+import org.eclipse.om2m.sdt.home.monitoring.util.Constants;
+import org.osgi.framework.BundleContext;
+
+
+public class LogoutServlet extends HttpServlet {
+	
+	private static final long serialVersionUID = 1L;
+
+	public LogoutServlet(BundleContext context) {
+	}
+
+	@Override
+	protected void doGet(HttpServletRequest request, HttpServletResponse response) 
+			throws ServletException, IOException {
+		
+		String sessionId = request.getParameter(SessionManager.SESSION_ID_PARAMETER);
+		
+		SessionManager.Session session = null;
+		if (sessionId != null) {
+			session = SessionManager.getInstance().removeSession(sessionId);
+			AeRegistration.getInstance().deassociateSubscriptionAndSessions(session.getId());
+		}
+		
+		response.sendRedirect("/" + Constants.APPNAME + "/webapps/login.html");
+	}
+	
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/servlet/SessionManager.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/servlet/SessionManager.java
new file mode 100644
index 0000000..58c9c84
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/servlet/SessionManager.java
@@ -0,0 +1,93 @@
+package org.eclipse.om2m.sdt.home.monitoring.servlet;

+

+import java.util.HashMap;

+import java.util.Map;

+import java.util.UUID;

+

+public class SessionManager {

+	

+	public static final String SESSION_ID_PARAMETER = "sessionId";

+	

+	private static final SessionManager INSTANCE = new SessionManager();

+	

+	private final Map<String /* session id */, Session> openedSessions;

+

+	public static SessionManager getInstance() {

+		return INSTANCE;

+	}

+	

+	/**

+	 * Make private default constructor

+	 */

+	private SessionManager() {

+		openedSessions = new HashMap();

+	}

+	

+	

+	public Session createNewSession(String name, String password) {

+		Session session = new Session(name, password);

+		synchronized (openedSessions) {

+			openedSessions.put(session.getId(), session);

+		}

+		return session;

+	}

+

+	

+	public Session removeSession(String token) {

+		synchronized (openedSessions) {

+			return openedSessions.remove(token);

+		}

+	}

+	

+	public boolean checkTokenExists(String pToken) {

+		synchronized (openedSessions) {

+			return openedSessions.containsKey(pToken);

+		}

+	}

+	

+	public Session getSession(String sessionId) {

+		synchronized (openedSessions) {

+			return openedSessions.get(sessionId);

+		}

+	}

+	

+	

+	public class Session {

+		private final String name;

+		private final String password;

+		private final String id;

+		

+		public Session(final String pName, final String pPassword) {

+			this.name = pName;

+			this.id = UUID.randomUUID().toString();

+			this.password = pPassword;

+		}

+		

+		

+

+		/**

+		 * @return the name

+		 */

+		public String getName() {

+			return name;

+		}

+

+		/**

+		 * @return the password

+		 */

+		public String getPassword() {

+			return password;

+		}

+

+		/**

+		 * @return the id

+		 */

+		public String getId() {

+			return id;

+		}

+		

+		

+	}

+	

+

+}

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/util/AeRegistration.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/util/AeRegistration.java
new file mode 100644
index 0000000..4d667c1
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/util/AeRegistration.java
@@ -0,0 +1,421 @@
+package org.eclipse.om2m.sdt.home.monitoring.util;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.om2m.commons.constants.AccessControl;
+import org.eclipse.om2m.commons.constants.Constants;
+import org.eclipse.om2m.commons.constants.MimeMediaType;
+import org.eclipse.om2m.commons.constants.NotificationContentType;
+import org.eclipse.om2m.commons.constants.Operation;
+import org.eclipse.om2m.commons.constants.ResourceType;
+import org.eclipse.om2m.commons.constants.ResponseStatusCode;
+import org.eclipse.om2m.commons.resource.AE;
+import org.eclipse.om2m.commons.resource.AccessControlPolicy;
+import org.eclipse.om2m.commons.resource.AccessControlRule;
+import org.eclipse.om2m.commons.resource.RequestPrimitive;
+import org.eclipse.om2m.commons.resource.ResponsePrimitive;
+import org.eclipse.om2m.commons.resource.SetOfAcrs;
+import org.eclipse.om2m.commons.resource.Subscription;
+import org.eclipse.om2m.core.service.CseService;
+import org.eclipse.om2m.interworking.service.InterworkingService;
+import org.eclipse.om2m.sdt.home.monitoring.servlet.SessionManager;
+import org.json.simple.JSONObject;
+import org.json.simple.parser.JSONParser;
+import org.json.simple.parser.ParseException;
+
+public class AeRegistration implements InterworkingService {
+
+	private static Log LOGGER = LogFactory.getLog(AeRegistration.class);
+
+	private static final String HOME_MONITORING_NAME = "SDT_Home_Monitoring_Application";
+	private static final String ACP_HOME_MONITORING_NAME = HOME_MONITORING_NAME + "_ACP";
+	private static final String HOME_MONITORING_RESOURCE_ID = "ResourceID/SDT_Home_Monitoring_Application";
+	private static final String RESOURCE_TYPE = "ResourceType/Application";
+	private static final String POA = "HomeMonitoringPOA";
+
+	private static final AeRegistration INSTANCE = new AeRegistration();
+
+	private CseService cseService;
+	private AE registeredApplication;
+	private AccessControlPolicy registeredAcp;
+
+	private Map<String /* sessionId */, Set<String> /* list of subscriptions */> subscriptionsPerSessions;
+	private Map<String /* sessionId */, List<JSONObject>> notifications;
+
+	private Map<String /* subscription's ri */, String /* resourceId */> subscriptions;
+	private Map<String /* resource id */, String /* subscription ri */> subscribedToResourcesSet;
+
+	/**
+	 * Retrieves instance
+	 * 
+	 * @return instance
+	 */
+	public static AeRegistration getInstance() {
+		return INSTANCE;
+	}
+
+	/**
+	 * Make private the default constructor
+	 */
+	private AeRegistration() {
+		notifications = new HashMap<>();
+		subscriptions = new HashMap();
+		subscribedToResourcesSet = new HashMap();
+		subscriptionsPerSessions = new HashMap<>();
+	}
+
+	/**
+	 * Set current cse service
+	 * 
+	 * @param pCseService
+	 *            cseService instance or null
+	 */
+	public void setCseService(CseService pCseService) {
+		cseService = pCseService;
+	}
+
+	/**
+	 * Create an AE in the INCSE
+	 * 
+	 * @return true if the AE has been successfully created
+	 */
+	public boolean createAe() {
+		if (cseService == null) {
+			// KO
+			return false;
+		}
+		if (!createACP()) {
+			return false;
+		}
+
+		RequestPrimitive request = new RequestPrimitive();
+
+		AE ae = new AE();
+		ae.setName(HOME_MONITORING_NAME);
+		ae.setAppName(HOME_MONITORING_NAME);
+		ae.setAppID(HOME_MONITORING_NAME);
+		ae.setRequestReachability(Boolean.TRUE);
+		ae.getLabels().add(HOME_MONITORING_RESOURCE_ID);
+		ae.getLabels().add(RESOURCE_TYPE);
+		ae.getAccessControlPolicyIDs().add(registeredAcp.getResourceID());
+		ae.getPointOfAccess().add(POA);
+
+		request.setOperation(Operation.CREATE);
+		request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
+		request.setTargetId("/" + Constants.CSE_ID + "/" + Constants.CSE_NAME);
+		request.setResourceType(ResourceType.AE);
+		request.setReturnContentType(MimeMediaType.OBJ);
+		request.setRequestContentType(MimeMediaType.OBJ);
+		request.setContent(ae);
+
+		ResponsePrimitive response = cseService.doRequest(request);
+
+		// check response status code
+		if (!ResponseStatusCode.CREATED.equals(response.getResponseStatusCode())) {
+			// KO
+			return false;
+		}
+
+		// retrieve created application
+		try {
+			registeredApplication = (AE) response.getContent();
+		} catch (ClassCastException e) {
+			// ko
+			return false;
+		}
+		// ok
+		return true;
+	}
+
+	public void deleteAe() {
+		deleteAllSubscriptions();
+
+		if (registeredApplication == null) {
+			return;
+		}
+		if (cseService == null) { // KO
+			return;
+		}
+
+		RequestPrimitive request = new RequestPrimitive();
+		request.setOperation(Operation.DELETE);
+		request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
+		request.setTargetId(registeredApplication.getResourceID());
+
+		cseService.doRequest(request);
+		deleteAcp();
+	}
+
+	private boolean createACP() {
+		LOGGER.info("createACP");
+		RequestPrimitive request = new RequestPrimitive();
+
+		AccessControlPolicy acp = new AccessControlPolicy();
+		acp.setName(ACP_HOME_MONITORING_NAME);
+		acp.setPrivileges(new SetOfAcrs());
+		AccessControlRule adminAccessControlRule = new AccessControlRule();
+		adminAccessControlRule.setAccessControlOperations(AccessControl.ALL);
+		adminAccessControlRule.getAccessControlOriginators().add(Constants.ADMIN_REQUESTING_ENTITY);
+		acp.getPrivileges().getAccessControlRule().add(adminAccessControlRule);
+		acp.setSelfPrivileges(new SetOfAcrs());
+		acp.getSelfPrivileges().getAccessControlRule().add(adminAccessControlRule);
+
+		request.setOperation(Operation.CREATE);
+		request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
+		request.setTargetId("/" + Constants.CSE_ID + "/" + Constants.CSE_NAME);
+		request.setResourceType(ResourceType.ACCESS_CONTROL_POLICY);
+		request.setReturnContentType(MimeMediaType.OBJ);
+		request.setRequestContentType(MimeMediaType.OBJ);
+		request.setContent(acp);
+
+		ResponsePrimitive response = cseService.doRequest(request);
+		// check response status code
+		BigInteger code = response.getResponseStatusCode();
+		if (!ResponseStatusCode.CREATED.equals(code)) {
+			// KO
+			LOGGER.info("createACP KO " + code);
+			return false;
+		}
+
+		// retrieve created application
+		try {
+			registeredAcp = (AccessControlPolicy) response.getContent();
+			// ok
+			LOGGER.info("createACP OK " + registeredAcp);
+			return true;
+		} catch (ClassCastException e) {
+			LOGGER.info("createACP KO " + e);
+			return false;
+		}
+	}
+
+	public void deleteAcp() {
+		if (registeredAcp == null) {
+			return;
+		}
+
+		LOGGER.info("deleteAcp " + registeredAcp);
+		RequestPrimitive request = new RequestPrimitive();
+		request.setOperation(Operation.DELETE);
+		request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
+		request.setTargetId(registeredAcp.getResourceID());
+		cseService.doRequest(request);
+	}
+
+	@Override
+	public ResponsePrimitive doExecute(RequestPrimitive request) {
+		ResponsePrimitive response = new ResponsePrimitive(request);
+
+		if (!request.getOperation().equals(Operation.NOTIFY)) {
+			response.setResponseStatusCode(ResponseStatusCode.NOT_IMPLEMENTED);
+			return response;
+		}
+
+		// store notifications
+		String content = null;
+		JSONParser parser = new JSONParser();
+		JSONObject notification = null;
+		try {
+			content = (String) request.getContent();
+			notification = (JSONObject) parser.parse(content);
+		} catch (ClassCastException | ParseException e) {
+			response.setResponseStatusCode(ResponseStatusCode.BAD_REQUEST);
+			return response;
+		}
+
+		// add in list
+		addNotification(notification);
+
+		response.setResponseStatusCode(ResponseStatusCode.OK);
+		return response;
+	}
+
+	@Override
+	public String getAPOCPath() {
+		return POA;
+	}
+
+	public List<JSONObject> getNotificationsAndClears(String sessionId) {
+		List<JSONObject> notificationsToBeReturned = new ArrayList<>();
+		List<JSONObject> notifsPerSession;
+		// retrieve list of notifs based on sessionId
+		synchronized (notifications) {
+			notifsPerSession = notifications.get(sessionId);
+		}
+
+		if (notifsPerSession != null) {
+			synchronized (notifsPerSession) {
+				notificationsToBeReturned.addAll(notifsPerSession);
+				notifsPerSession.clear();
+			}
+		}
+
+		return notificationsToBeReturned;
+	}
+
+	private void addNotification(JSONObject notification) {
+		LOGGER.debug("add notification from subscription ");
+
+		String subscriptionId = (String) ((JSONObject) notification.get("m2m:sgn")).get("m2m:sur");
+
+		for (Entry<String, Set<String>> entry : subscriptionsPerSessions.entrySet()) {
+			if (entry.getValue().contains(subscriptionId)) {
+				addNotification(entry.getKey(), notification);
+			}
+		}
+
+	}
+
+	private void addNotification(String sessionId, JSONObject notification) {
+		List<JSONObject> notifsPerSession = null;
+		synchronized (notifications) {
+			notifsPerSession = notifications.get(sessionId);
+			if (notifsPerSession == null) {
+				notifsPerSession = new ArrayList<>();
+				notifications.put(sessionId, notifsPerSession);
+			}
+		}
+		synchronized (notifsPerSession) {
+			notifsPerSession.add(notification);
+		}
+	}
+
+	public boolean createSubscription(String resourceId, String sessionId) {
+
+		if ((resourceId == null) || (sessionId == null)
+				|| (!SessionManager.getInstance().checkTokenExists(sessionId))) {
+			return false;
+		}
+
+		// check if a subscription exists for this device
+		String subscriptionId = null;
+		if ((subscriptionId = checkIfSubscriptionExists(resourceId)) != null) {
+			// associate this session with this subscription
+			associateSubscriptionAndSession(subscriptionId, sessionId);
+
+			return true;
+		}
+
+		Subscription subscription = new Subscription();
+		subscription.setNotificationContentType(NotificationContentType.WHOLE_RESOURCE);
+		subscription.getNotificationURI().add(registeredApplication.getResourceID());
+
+		RequestPrimitive request = new RequestPrimitive();
+		request.setOperation(Operation.CREATE);
+		request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
+		request.setTargetId(resourceId);
+		request.setResourceType(ResourceType.SUBSCRIPTION);
+		request.setReturnContentType(MimeMediaType.JSON);
+		request.setRequestContentType(MimeMediaType.OBJ);
+		request.setContent(subscription);
+
+		ResponsePrimitive response = cseService.doRequest(request);
+
+		// check response status code
+		if (!ResponseStatusCode.CREATED.equals(response.getResponseStatusCode())) {
+			// KO
+			return false;
+		} else {
+			String content = (String) response.getContent();
+			JSONParser parser = new JSONParser();
+			try {
+				JSONObject createdSubscription = (JSONObject) parser.parse(content);
+				subscriptionId = (String) ((JSONObject) createdSubscription.get("m2m:sub")).get("ri");
+				addSubscription(subscriptionId, resourceId);
+				// associate this session with this subscription
+				associateSubscriptionAndSession(subscriptionId, sessionId);
+			} catch (ParseException e) {
+				LOGGER.error("unable to parse subscription json payload", e);
+				return false;
+			} catch (NullPointerException e) {
+				LOGGER.error("unable to retrieve subscription object", e);
+				return false;
+			} catch (ClassCastException e) {
+				LOGGER.error("unable to cast subscription object", e);
+				return false;
+			}
+			return true;
+		}
+	}
+
+	private void deleteSubscription(String subscriptionId) {
+		RequestPrimitive request = new RequestPrimitive();
+		request.setOperation(Operation.DELETE);
+		request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
+		request.setTargetId(subscriptionId);
+		request.setResourceType(ResourceType.SUBSCRIPTION);
+		request.setReturnContentType(MimeMediaType.OBJ);
+		request.setRequestContentType(MimeMediaType.OBJ);
+
+		ResponsePrimitive response = cseService.doRequest(request);
+	}
+
+	private void addSubscription(String subscriptionId, String resourceId) {
+		synchronized (subscriptions) {
+			subscriptions.put(subscriptionId, resourceId);
+		}
+		synchronized (subscribedToResourcesSet) {
+			subscribedToResourcesSet.put(resourceId, subscriptionId);
+		}
+	}
+
+	private void deleteAllSubscriptions() {
+		synchronized (subscriptions) {
+			for (String subId : subscriptions.keySet()) {
+				deleteSubscription(subId);
+			}
+			subscriptions.clear();
+		}
+
+		synchronized (subscribedToResourcesSet) {
+			subscribedToResourcesSet.clear();
+		}
+	}
+
+	private String checkIfSubscriptionExists(String subscribedToResourceId) {
+		synchronized (subscribedToResourcesSet) {
+			return subscribedToResourcesSet.get(subscribedToResourceId);
+		}
+	}
+
+	private void associateSubscriptionAndSession(String subscriptionId, String sessionId) {
+		Set<String> subscriptionIds = null;
+		synchronized (subscriptionsPerSessions) {
+			subscriptionIds = subscriptionsPerSessions.get(sessionId);
+			if (subscriptionIds == null) {
+				subscriptionIds = new HashSet<String>();
+				subscriptionsPerSessions.put(sessionId, subscriptionIds);
+			}
+		}
+
+		synchronized (subscriptionIds) {
+			subscriptionIds.add(subscriptionId);
+		}
+	}
+
+	public void deassociateSubscriptionAndSessions(String sessionId) {
+		synchronized (subscriptionsPerSessions) {
+			subscriptionsPerSessions.remove(sessionId);
+		}
+
+		List<JSONObject> notifsPerSession = null;
+		synchronized (notifications) {
+			notifsPerSession = notifications.remove(sessionId);
+		}
+
+		if (notifsPerSession != null) {
+			synchronized (notifsPerSession) {
+				notifsPerSession.clear();
+			}
+		}
+	}
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/util/AuthFillter.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/util/AuthFillter.java
new file mode 100644
index 0000000..e37ff4a
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/util/AuthFillter.java
@@ -0,0 +1,55 @@
+package org.eclipse.om2m.sdt.home.monitoring.util;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.om2m.sdt.home.monitoring.servlet.SessionManager;
+
+public class AuthFillter {
+	
+	private static Log LOGGER = LogFactory.getLog(AuthFillter.class);
+
+	public static SessionManager.Session validateUserCredentials(HttpServletRequest request, HttpServletResponse response) throws IOException {
+		boolean isValid=false;
+		String name = "";
+		String password = "";
+		if (request.getParameter("name") != null && request.getParameter("password") != null) {
+			name = request.getParameter("name");
+			password = request.getParameter("password");
+			LOGGER.debug("parameters " + name + "/" + password);
+		} else if (request.getHeader("Authorization") != null) {
+			LOGGER.debug("Headers Authorization " + request.getHeader("Authorization") 
+					+ "/X-Requested-With " + request.getHeader("X-Requested-With"));
+			response.addHeader("WWW-Authenticate", "Basic");
+			response.addHeader("Authorization", request.getHeader("Authorization"));
+			if (request.getHeader("X-Requested-With") != null)
+				response.addHeader("X-Requested-With", request.getHeader("X-Requested-With"));
+			String authHeader = request.getHeader("Authorization");
+			String cred = new String(Base64.decodeBase64(authHeader.substring(6).getBytes()));
+			int idx = cred.indexOf(":");
+			name = cred.substring(0, idx);
+			password = cred.substring(idx + 1);
+		}
+		String result = ResourceDiscovery.validateUserCredentials(name, password);
+		if (result != null) {
+			
+			// create new session
+			return SessionManager.getInstance().createNewSession(name, password);
+		}
+
+		if (! isValid && request.getHeader("X-Requested-With") != null) {
+			response.addHeader("WWW-Authenticate", "Basic");
+			LOGGER.debug("X-Requested-With " + name + "/" + password + " auth=" + isValid);
+			response.sendError(HttpServletResponse.SC_UNAUTHORIZED, null);
+		}
+		LOGGER.debug(name + "/" + password + " auth=" + isValid);
+		return null;
+	}
+	
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/util/Constants.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/util/Constants.java
new file mode 100644
index 0000000..597c646
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/util/Constants.java
@@ -0,0 +1,9 @@
+package org.eclipse.om2m.sdt.home.monitoring.util;
+
+public class Constants {
+	
+	public static final String ResourceID = "SDT_Home_Monitoring_Application";
+	
+	public static final String APPNAME = "Home_Monitoring_Application";
+	
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/util/FileUtil.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/util/FileUtil.java
new file mode 100644
index 0000000..0b2ab35
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/util/FileUtil.java
@@ -0,0 +1,38 @@
+package org.eclipse.om2m.sdt.home.monitoring.util;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.net.URL;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.om2m.sdt.home.monitoring.servlet.HomeServlet;
+import org.osgi.framework.BundleContext;
+
+
+public class FileUtil {
+
+	private static Log LOGGER = LogFactory.getLog(HomeServlet.class);
+
+	public static String getFileAsString(final String path,BundleContext context) {
+		String res = "";
+		if (context != null) {				
+			URL url = context.getBundle().getResource(path);
+			LOGGER.info("url ="+url);
+			BufferedReader br = null;
+			try {
+				br = new BufferedReader(new InputStreamReader(url.openConnection().getInputStream()));
+				while (br.ready()) {
+					res += br.readLine();
+				}
+			} catch (Exception e) {		
+				e.printStackTrace();
+			} finally {
+				try { br.close(); } 
+				catch (Exception ignored) {}
+			}
+		}
+		return res;
+	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/util/ResourceDiscovery.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/util/ResourceDiscovery.java
new file mode 100644
index 0000000..7bfa786
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/java/org/eclipse/om2m/sdt/home/monitoring/util/ResourceDiscovery.java
@@ -0,0 +1,287 @@
+package org.eclipse.om2m.sdt.home.monitoring.util;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.om2m.commons.constants.FilterUsage;
+import org.eclipse.om2m.commons.constants.MimeMediaType;
+import org.eclipse.om2m.commons.constants.Operation;
+import org.eclipse.om2m.commons.constants.ResponseStatusCode;
+import org.eclipse.om2m.commons.resource.FilterCriteria;
+import org.eclipse.om2m.commons.resource.RequestPrimitive;
+import org.eclipse.om2m.commons.resource.ResponsePrimitive;
+import org.eclipse.om2m.commons.resource.URIList;
+import org.eclipse.om2m.core.service.CseService;
+
+public class ResourceDiscovery {
+
+	public static CseService cseService;
+	private static Log LOGGER = LogFactory.getLog(ResourceDiscovery.class);
+	// DISCOVERY parameter
+	private static final String SEARCH_STRING_DISCOVERY_PARAMETER = "searchString";
+
+	// SEARCHSTRING
+	private static final String RESOURCE_ID_SEARCH_STRING = "ResourceID/";
+	private static final String RESOURCE_TYPE_APPLICATION_SEARCH_STRING = "ResourceType/Application";
+
+	public static void initCseService(CseService pCseService) {
+		cseService = pCseService;
+	}
+
+	public static String validateUserCredentials(String name, String password) {
+		LOGGER.info("validateUserCredentials " + name + "/" + password);
+		RequestPrimitive request = new RequestPrimitive();
+		request.setReturnContentType(MimeMediaType.OBJ);
+		request.setRequestContentType(MimeMediaType.OBJ);
+		request.setFrom(name + ":" + password);
+		request.setFilterCriteria(new FilterCriteria());
+		request.setOperation(Operation.RETRIEVE);
+		request.getFilterCriteria().setFilterUsage(FilterUsage.DISCOVERY_CRITERIA);
+		request.getFilterCriteria().getLabels().add(RESOURCE_ID_SEARCH_STRING + Constants.ResourceID);
+		request.getFilterCriteria().getLabels().add(RESOURCE_TYPE_APPLICATION_SEARCH_STRING);
+		request.setTargetId("/" + org.eclipse.om2m.commons.constants.Constants.CSE_ID
+				+ "/" + org.eclipse.om2m.commons.constants.Constants.CSE_NAME);
+		ResponsePrimitive response = cseService.doRequest(request);
+		if (! ResponseStatusCode.OK.equals(response.getResponseStatusCode())) {
+			LOGGER.info("KO");
+			return null;
+		}
+		URIList uriList = (URIList) response.getContent();
+		LOGGER.info("OK " + uriList);
+		return ((uriList == null) || uriList.getListOfUri().isEmpty()) ? null
+				: uriList.getListOfUri().get(0);
+	}
+
+//	public static List<String> retrievesAllDevices(String name, String password) {
+//		LOGGER.info("retrievesAllDevices");
+//		RequestPrimitive request = new RequestPrimitive();
+//		request.setTargetId(org.eclipse.om2m.commons.constants.Constants.SP_RELATIVE_URI_SEPARATOR
+//				+ "/" + org.eclipse.om2m.commons.constants.Constants.CSE_ID
+//				+ "/" + org.eclipse.om2m.commons.constants.Constants.CSE_NAME
+//				/*+ "/" + MN_CSE_NAME*/);
+//		request.setReturnContentType(MimeMediaType.OBJ);
+//		request.setRequestContentType(MimeMediaType.OBJ);
+//		request.setOperation(Operation.RETRIEVE);
+//		request.setFilterCriteria(new FilterCriteria());
+//		request.getFilterCriteria().setFilterUsage(FilterUsage.DISCOVERY_CRITERIA);
+//		request.getFilterCriteria().getLabels().add("object.type/device");
+//		request.setFrom(name + ":" + password);
+//
+//		ResponsePrimitive response = cseService.doRequest(request);
+//		if (ResponseStatusCode.OK.equals(response.getResponseStatusCode())) {
+//			URIList uriList = (URIList) response.getContent();
+//			return uriList.getListOfUri();
+//		}
+//
+//		return new ArrayList<String>();
+//	}
+//
+//	public static String retrievesAllDevicesWithState(String name, String password) {
+//		LOGGER.info("retrievesAllDevicesWithState");
+//		List<String> deviceUris = retrievesAllDevices(name, password);
+//		String jsonString = "";
+//		// iterate over the list of device uri.
+//		for (String deviceUri : deviceUris) {
+//			Resource deviceFlex = retrieveDevice(deviceUri, name, password);
+//			if (deviceFlex != null) {
+//				String deviceId = null;
+//				List<String> labels = getLabels(deviceFlex);
+//				if (deviceFlex != null) {
+//					for (String label : labels) {
+//						if (label.startsWith("id/")) {
+//							deviceId = label.substring(3);
+//						}
+//					}
+//				}
+//
+//				String deviceName = getLabelValue(labels, "name");
+//				String moduleUri = findDeviceStateModule((Resource)deviceFlex);
+//				String stateAttribute = findStateAttribute(findStateModuleDefinition(getDefinition(deviceFlex)));
+//				String deviceState = retrieveDeviceState(moduleUri, name, password);
+//
+//				jsonString += (!jsonString.isEmpty() ? "," : "") + "{\"id\":\""
+//						+ deviceId + "\"," + "\"name\":\"" + deviceName
+//						+ "\",\"state\":" + deviceState + ",\"moduleUri\":\""
+//						+ moduleUri + "\",\"attributeName\":\""
+//						+ stateAttribute + "\"}";
+//			}
+//		}
+//		LOGGER.info("retrievesAllDevicesWithState " + jsonString);
+//		return jsonString.length() > 0 ? "[" + jsonString + "]" : "{}";
+//	}
+//
+//	private static String findStateModuleDefinition(String deviceCntDef) {
+//		if (deviceCntDef != null) {
+//			if (deviceCntDef.equals(DeviceType.deviceLight.getDefinition())
+//					|| deviceCntDef.equals(DeviceType.deviceGasValve.getDefinition()))
+//				return ModuleType.binarySwitch.getDefinition();
+//			if (deviceCntDef.equals(DeviceType.deviceWaterValve.getDefinition()))
+//				return ModuleType.liquidLevel.getDefinition();
+//			if (deviceCntDef.equals(DeviceType.deviceFloodDetector.getDefinition()))
+//				return ModuleType.waterSensor.getDefinition();
+//			if (deviceCntDef.equals(DeviceType.deviceSmokeDetector.getDefinition()))
+//				return ModuleType.smokeSensor.getDefinition();
+////			switch (deviceCntDef.toLowerCase()) {
+////			case "org.onem2m.home.device.devicelight":
+////			case "org.onem2m.home.device.devicegasvalve":
+////				return "org.onem2m.home.moduleclass.binaryswitch";
+////			case "org.onem2m.home.device.devicewatervalve":
+////				return "org.onem2m.home.moduleclass.waterlevel";
+////			case "org.onem2m.home.device.deviceflooddetector":
+////				return "org.onem2m.home.moduleclass.watersensor";
+////			case "org.onem2m.home.device.devicesmokedetector":
+////				return "org.onem2m.home.moduleclass.smokesensor";
+////			}
+//		}
+//		return null;
+//	}
+//
+//	private static String findStateAttribute(String moduleFlexCntDef) {
+//		if (moduleFlexCntDef != null) {
+//			if (moduleFlexCntDef.equals(ModuleType.smokeSensor.getDefinition())
+//					|| moduleFlexCntDef.equals(ModuleType.waterSensor.getDefinition()))
+//				return DatapointType.alarm.getShortName();
+//			if (moduleFlexCntDef.equals(ModuleType.binarySwitch.getDefinition()))
+//				return DatapointType.powerState.getShortName();
+//			if (moduleFlexCntDef.equals(ModuleType.liquidLevel.getDefinition()))
+//				return DatapointType.liquidLevel.getShortName();
+////			switch (moduleFlexCntDef.toLowerCase()) {
+////			case "org.onem2m.home.moduleclass.binaryswitch":
+////				return "powerState";
+////			case "org.onem2m.home.moduleclass.watersensor":
+////			case "org.onem2m.home.moduleclass.smokesensor":
+////				return "alarm";
+////			case "org.onem2m.home.moduleclass.waterlevel":
+////				return "liquidlevel";
+////			}
+//		}
+//		return null;
+//	}
+//
+//	private static String findDeviceStateModule(Resource deviceFlex) {
+//		String deviceDefinition = getDefinition(deviceFlex);
+//		List<ChildResourceRef> childResourceRefs = null;
+//		if (deviceFlex instanceof AbstractFlexContainer) {
+//			childResourceRefs = ((AbstractFlexContainer) deviceFlex).getChildResource();
+//		} else if (deviceFlex instanceof FlexContainerAnnc) {
+//			childResourceRefs = ((FlexContainerAnnc) deviceFlex).getChildResource();
+//		}
+//		String stateModule = null;
+//		if (deviceDefinition != null) {
+//			stateModule = findStateModuleDefinition(deviceDefinition); 
+//		}
+//
+//		if ((stateModule != null)  && (childResourceRefs != null)) {
+//			String moduleUri = null;
+//			for (ChildResourceRef ref : childResourceRefs) {
+//				if (ref.getType().equals(BigInteger.valueOf(ResourceType.FLEXCONTAINER_ANNC)) 
+//						|| ref.getType().equals(BigInteger.valueOf(ResourceType.FLEXCONTAINER))) {
+//					if (ref.getResourceName().toLowerCase().contains(stateModule)) {
+//						moduleUri = ref.getValue();
+//						break;
+//					}
+//				}
+//			}
+//			return moduleUri;
+//		}
+//		return null;
+//	}
+//
+//	public static String retrieveDeviceState(String moduleUri, String name, String password) {
+//		if (moduleUri != null) {
+//			LOGGER.info("retrieveDeviceState " + moduleUri);
+//			RequestPrimitive request = new RequestPrimitive();
+//			request.setFrom(name + ":" + password);
+//			request.setReturnContentType(MimeMediaType.OBJ);
+//			request.setRequestContentType(MimeMediaType.OBJ);
+//			request.setOperation(Operation.RETRIEVE);
+//			request.setTargetId(moduleUri);
+//			request.setResultContent(ResultContent.ORIGINAL_RES);
+//			ResponsePrimitive response = cseService.doRequest(request);
+//			AbstractFlexContainer moduleFlex = null;
+//			if (ResponseStatusCode.OK.equals(response.getResponseStatusCode())) {
+//				moduleFlex = (AbstractFlexContainer) response.getContent();
+//			}
+//			if (moduleFlex != null) {
+//				String stateAttribute = findStateAttribute(moduleFlex.getContainerDefinition());
+//				if (stateAttribute != null) {
+//					CustomAttribute stateCustomAttribute = moduleFlex.getCustomAttribute(stateAttribute);
+//					if (stateCustomAttribute != null) {
+//						String ret = stateCustomAttribute.getCustomAttributeValue();
+//						LOGGER.info("OK " + ret);
+//						return ret;
+//					}
+//				}
+//			}
+//		}
+//		LOGGER.info("KO");
+//		return null;
+//	}
+//
+//	private static Resource retrieveDevice(String deviceUri, String name, String password) {
+//		RequestPrimitive request = new RequestPrimitive();
+//		request.setOperation(Operation.RETRIEVE);
+//		request.setReturnContentType(MimeMediaType.OBJ);
+//		request.setRequestContentType(MimeMediaType.OBJ);
+//		request.setFrom(name + ":" + password);
+//		request.setTargetId(deviceUri);
+//		request.setResultContent(ResultContent.ATTRIBUTES_AND_CHILD_REF);
+//
+//		ResponsePrimitive response = cseService.doRequest(request);
+//		return (Resource) (ResponseStatusCode.OK.equals(response.getResponseStatusCode())
+//				? response.getContent() : null);
+//	}
+//
+//	public static String changeDeviceState(String name, String password,
+//			String moduleUri, String attributeName, boolean state) {
+//		LOGGER.info("changeDeviceState " + attributeName + "/" + state + " " + moduleUri);
+//		FlexContainer moduleFlexContainer = new FlexContainer();
+//		CustomAttribute customAttribute = new CustomAttribute();
+//		customAttribute.setCustomAttributeName(attributeName);
+//		customAttribute.setCustomAttributeType("xs:boolean");
+//		customAttribute.setCustomAttributeValue(Boolean.toString(state));
+//		moduleFlexContainer.getCustomAttributes().add(customAttribute);
+//
+//		RequestPrimitive request = new RequestPrimitive();
+//		request.setContent(moduleFlexContainer);
+//		request.setReturnContentType(MimeMediaType.OBJ);
+//		request.setRequestContentType(MimeMediaType.OBJ);
+//		request.setResultContent(ResultContent.ORIGINAL_RES);
+//		request.setOperation(Operation.UPDATE);
+//		request.setFrom(name + ":" + password);
+//		request.setTargetId(moduleUri);
+//
+//		ResponsePrimitive response = cseService.doRequest(request);
+//		return response.getResponseStatusCode().toString();
+//	}
+//
+//	private static String getLabelValue(final List <String> labels, final String labelName) {
+//		if (labels != null) {
+//			for (String label : labels) {
+//				if (label.startsWith(labelName)) {
+//					return label.substring(labelName.length() + 1);
+//				}
+//			}
+//		}
+//		return null;
+//	}
+//
+//	private static List<String> getLabels(Resource flex) {
+//		if (flex instanceof FlexContainerAnnc) {
+//			return ((FlexContainerAnnc) flex).getLabels();
+//		} else if (flex instanceof AbstractFlexContainer) {
+//			return ((AbstractFlexContainer) flex).getLabels();
+//		}
+//		return new ArrayList<String>();
+//	}
+//
+//	private static String getDefinition(Resource flex) {
+//		if (flex instanceof AbstractFlexContainer) {
+//			return ((AbstractFlexContainer) flex).getContainerDefinition();
+//		}
+//		if (flex instanceof FlexContainerAnnc) {
+//			return ((FlexContainerAnnc) flex).getContainerDefinition();
+//		}
+//		return null;
+//	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/css/angular-ui-switch.css b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/css/angular-ui-switch.css
new file mode 100644
index 0000000..0224289
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/css/angular-ui-switch.css
@@ -0,0 +1,83 @@
+.switch {
+      background: #df3b3a;
+    /* border: 1px solid #dfdfdf; */
+    position: relative;
+    display: inline-block;
+    box-sizing: content-box;
+    overflow: visible;
+    width: 52px;
+    height: 24px;
+    padding: 0px;
+    margin: 0px;
+    border-radius: 20px;
+    cursor: pointer;
+    /* box-shadow: rgb(223, 223, 223) 0px 0px 0px 0px inset; */
+    transition: 0.3s ease-out all;
+    -webkit-transition: 0.3s ease-out all;
+    top: -1px;
+    float: right;
+}
+/*adding a wide width for larger switch text*/
+.switch.wide {
+  width:80px;
+}
+.switch small {
+ 	 background: #fff;
+    border-radius: 100%;
+    /* box-shadow: 0 1px 3px rgba(0,0,0,0.4); */
+    width: 20px;
+    height: 20px;
+    position: absolute;
+    top: 2px;
+    left: 2px;
+    transition: 0.3s ease-out all;
+    -webkit-transition: 0.3s ease-out all;
+}
+.switch.checked {
+  background: rgb(100, 189, 99);
+  border-color: rgb(100, 189, 99);
+}
+.switch.checked small {
+  left: 30px;
+}
+/*wider switch text moves small further to the right*/
+.switch.wide.checked small {
+  left:52px;
+}
+/*styles for switch-text*/
+.switch .switch-text {
+  font-family:Arial, Helvetica, sans-serif;
+  font-size:13px;
+}
+
+.switch .off {
+  display:block;
+  position: absolute;
+  right: 10%;
+  top: 25%;
+  z-index: 0;
+  color:#A9A9A9;
+}
+
+.switch .on {
+  display:none;
+   z-index: 0;
+  color:#fff;
+  position: absolute;
+  top: 25%;
+  left: 9%;
+}
+
+.switch.checked .off {
+  display:none;
+}
+
+.switch.checked .on {
+  display:block;
+
+}
+
+.switch.disabled {
+  opacity: .50;
+  cursor: not-allowed;
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/css/bootstrap-3.0.1.min.css b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/css/bootstrap-3.0.1.min.css
new file mode 100644
index 0000000..871123f
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/css/bootstrap-3.0.1.min.css
@@ -0,0 +1,9 @@
+/*!
+ * Bootstrap v3.0.1 by @fat and @mdo
+ * Copyright 2013 Twitter, Inc.
+ * Licensed under http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Designed and built with all the love in the world by @mdo and @fat.
+ */
+
+/*! normalize.css v2.1.3 | MIT License | git.io/normalize */article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}audio,canvas,video{display:inline-block}audio:not([controls]){display:none;height:0}[hidden],template{display:none}html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}a{background:transparent}a:focus{outline:thin dotted}a:active,a:hover{outline:0}h1{margin:.67em 0;font-size:2em}abbr[title]{border-bottom:1px dotted}b,strong{font-weight:bold}dfn{font-style:italic}hr{height:0;-moz-box-sizing:content-box;box-sizing:content-box}mark{color:#000;background:#ff0}code,kbd,pre,samp{font-family:monospace,serif;font-size:1em}pre{white-space:pre-wrap}q{quotes:"\201C" "\201D" "\2018" "\2019"}small{font-size:80%}sub,sup{position:relative;font-size:75%;line-height:0;vertical-align:baseline}sup{top:-0.5em}sub{bottom:-0.25em}img{border:0}svg:not(:root){overflow:hidden}figure{margin:0}fieldset{padding:.35em .625em .75em;margin:0 2px;border:1px solid #c0c0c0}legend{padding:0;border:0}button,input,select,textarea{margin:0;font-family:inherit;font-size:100%}button,input{line-height:normal}button,select{text-transform:none}button,html input[type="button"],input[type="reset"],input[type="submit"]{cursor:pointer;-webkit-appearance:button}button[disabled],html input[disabled]{cursor:default}input[type="checkbox"],input[type="radio"]{padding:0;box-sizing:border-box}input[type="search"]{-webkit-box-sizing:content-box;-moz-box-sizing:content-box;box-sizing:content-box;-webkit-appearance:textfield}input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}button::-moz-focus-inner,input::-moz-focus-inner{padding:0;border:0}textarea{overflow:auto;vertical-align:top}table{border-collapse:collapse;border-spacing:0}@media print{*{color:#000!important;text-shadow:none!important;background:transparent!important;box-shadow:none!important}a,a:visited{text-decoration:underline}a[href]:after{content:" (" attr(href) ")"}abbr[title]:after{content:" (" attr(title) ")"}a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100%!important}@page{margin:2cm .5cm}p,h2,h3{orphans:3;widows:3}h2,h3{page-break-after:avoid}select{background:#fff!important}.navbar{display:none}.table td,.table th{background-color:#fff!important}.btn>.caret,.dropup>.btn>.caret{border-top-color:#000!important}.label{border:1px solid #000}.table{border-collapse:collapse!important}.table-bordered th,.table-bordered td{border:1px solid #ddd!important}}*,*:before,*:after{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}html{font-size:62.5%;-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:14px;line-height:1.428571429;color:#333;background-color:#fff}input,button,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit}a{color:#428bca;text-decoration:none}a:hover,a:focus{color:#2a6496;text-decoration:underline}a:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}img{vertical-align:middle}.img-responsive{display:block;height:auto;max-width:100%}.img-rounded{border-radius:6px}.img-thumbnail{display:inline-block;height:auto;max-width:100%;padding:4px;line-height:1.428571429;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.img-circle{border-radius:50%}hr{margin-top:20px;margin-bottom:20px;border:0;border-top:1px solid #eee}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0,0,0,0);border:0}p{margin:0 0 10px}.lead{margin-bottom:20px;font-size:16px;font-weight:200;line-height:1.4}@media(min-width:768px){.lead{font-size:21px}}small,.small{font-size:85%}cite{font-style:normal}.text-muted{color:#999}.text-primary{color:#428bca}.text-primary:hover{color:#3071a9}.text-warning{color:#c09853}.text-warning:hover{color:#a47e3c}.text-danger{color:#b94a48}.text-danger:hover{color:#953b39}.text-success{color:#468847}.text-success:hover{color:#356635}.text-info{color:#3a87ad}.text-info:hover{color:#2d6987}.text-left{text-align:left}.text-right{text-align:right}.text-center{text-align:center}h1,h2,h3,h4,h5,h6,.h1,.h2,.h3,.h4,.h5,.h6{font-family:"Helvetica Neue",Helvetica,Arial,sans-serif;font-weight:500;line-height:1.1;color:inherit}h1 small,h2 small,h3 small,h4 small,h5 small,h6 small,.h1 small,.h2 small,.h3 small,.h4 small,.h5 small,.h6 small,h1 .small,h2 .small,h3 .small,h4 .small,h5 .small,h6 .small,.h1 .small,.h2 .small,.h3 .small,.h4 .small,.h5 .small,.h6 .small{font-weight:normal;line-height:1;color:#999}h1,h2,h3{margin-top:20px;margin-bottom:10px}h1 small,h2 small,h3 small,h1 .small,h2 .small,h3 .small{font-size:65%}h4,h5,h6{margin-top:10px;margin-bottom:10px}h4 small,h5 small,h6 small,h4 .small,h5 .small,h6 .small{font-size:75%}h1,.h1{font-size:36px}h2,.h2{font-size:30px}h3,.h3{font-size:24px}h4,.h4{font-size:18px}h5,.h5{font-size:14px}h6,.h6{font-size:12px}.page-header{padding-bottom:9px;margin:40px 0 20px;border-bottom:1px solid #eee}ul,ol{margin-top:0;margin-bottom:10px}ul ul,ol ul,ul ol,ol ol{margin-bottom:0}.list-unstyled{padding-left:0;list-style:none}.list-inline{padding-left:0;list-style:none}.list-inline>li{display:inline-block;padding-right:5px;padding-left:5px}.list-inline>li:first-child{padding-left:0}dl{margin-bottom:20px}dt,dd{line-height:1.428571429}dt{font-weight:bold}dd{margin-left:0}@media(min-width:768px){.dl-horizontal dt{float:left;width:160px;overflow:hidden;clear:left;text-align:right;text-overflow:ellipsis;white-space:nowrap}.dl-horizontal dd{margin-left:180px}.dl-horizontal dd:before,.dl-horizontal dd:after{display:table;content:" "}.dl-horizontal dd:after{clear:both}.dl-horizontal dd:before,.dl-horizontal dd:after{display:table;content:" "}.dl-horizontal dd:after{clear:both}}abbr[title],abbr[data-original-title]{cursor:help;border-bottom:1px dotted #999}abbr.initialism{font-size:90%;text-transform:uppercase}blockquote{padding:10px 20px;margin:0 0 20px;border-left:5px solid #eee}blockquote p{font-size:17.5px;font-weight:300;line-height:1.25}blockquote p:last-child{margin-bottom:0}blockquote small{display:block;line-height:1.428571429;color:#999}blockquote small:before{content:'\2014 \00A0'}blockquote.pull-right{padding-right:15px;padding-left:0;border-right:5px solid #eee;border-left:0}blockquote.pull-right p,blockquote.pull-right small,blockquote.pull-right .small{text-align:right}blockquote.pull-right small:before,blockquote.pull-right .small:before{content:''}blockquote.pull-right small:after,blockquote.pull-right .small:after{content:'\00A0 \2014'}blockquote:before,blockquote:after{content:""}address{margin-bottom:20px;font-style:normal;line-height:1.428571429}code,kbd,pre,samp{font-family:Monaco,Menlo,Consolas,"Courier New",monospace}code{padding:2px 4px;font-size:90%;color:#c7254e;white-space:nowrap;background-color:#f9f2f4;border-radius:4px}pre{display:block;padding:9.5px;margin:0 0 10px;font-size:13px;line-height:1.428571429;color:#333;word-break:break-all;word-wrap:break-word;background-color:#f5f5f5;border:1px solid #ccc;border-radius:4px}pre code{padding:0;font-size:inherit;color:inherit;white-space:pre-wrap;background-color:transparent;border-radius:0}.pre-scrollable{max-height:340px;overflow-y:scroll}.container{padding-right:15px;padding-left:15px;margin-right:auto;margin-left:auto}.container:before,.container:after{display:table;content:" "}.container:after{clear:both}.container:before,.container:after{display:table;content:" "}.container:after{clear:both}.row{margin-right:-15px;margin-left:-15px}.row:before,.row:after{display:table;content:" "}.row:after{clear:both}.row:before,.row:after{display:table;content:" "}.row:after{clear:both}.col-xs-1,.col-sm-1,.col-md-1,.col-lg-1,.col-xs-2,.col-sm-2,.col-md-2,.col-lg-2,.col-xs-3,.col-sm-3,.col-md-3,.col-lg-3,.col-xs-4,.col-sm-4,.col-md-4,.col-lg-4,.col-xs-5,.col-sm-5,.col-md-5,.col-lg-5,.col-xs-6,.col-sm-6,.col-md-6,.col-lg-6,.col-xs-7,.col-sm-7,.col-md-7,.col-lg-7,.col-xs-8,.col-sm-8,.col-md-8,.col-lg-8,.col-xs-9,.col-sm-9,.col-md-9,.col-lg-9,.col-xs-10,.col-sm-10,.col-md-10,.col-lg-10,.col-xs-11,.col-sm-11,.col-md-11,.col-lg-11,.col-xs-12,.col-sm-12,.col-md-12,.col-lg-12{position:relative;min-height:1px;padding-right:15px;padding-left:15px}.col-xs-1,.col-xs-2,.col-xs-3,.col-xs-4,.col-xs-5,.col-xs-6,.col-xs-7,.col-xs-8,.col-xs-9,.col-xs-10,.col-xs-11{float:left}.col-xs-12{width:100%}.col-xs-11{width:91.66666666666666%}.col-xs-10{width:83.33333333333334%}.col-xs-9{width:75%}.col-xs-8{width:66.66666666666666%}.col-xs-7{width:58.333333333333336%}.col-xs-6{width:50%}.col-xs-5{width:41.66666666666667%}.col-xs-4{width:33.33333333333333%}.col-xs-3{width:25%}.col-xs-2{width:16.666666666666664%}.col-xs-1{width:8.333333333333332%}.col-xs-pull-12{right:100%}.col-xs-pull-11{right:91.66666666666666%}.col-xs-pull-10{right:83.33333333333334%}.col-xs-pull-9{right:75%}.col-xs-pull-8{right:66.66666666666666%}.col-xs-pull-7{right:58.333333333333336%}.col-xs-pull-6{right:50%}.col-xs-pull-5{right:41.66666666666667%}.col-xs-pull-4{right:33.33333333333333%}.col-xs-pull-3{right:25%}.col-xs-pull-2{right:16.666666666666664%}.col-xs-pull-1{right:8.333333333333332%}.col-xs-push-12{left:100%}.col-xs-push-11{left:91.66666666666666%}.col-xs-push-10{left:83.33333333333334%}.col-xs-push-9{left:75%}.col-xs-push-8{left:66.66666666666666%}.col-xs-push-7{left:58.333333333333336%}.col-xs-push-6{left:50%}.col-xs-push-5{left:41.66666666666667%}.col-xs-push-4{left:33.33333333333333%}.col-xs-push-3{left:25%}.col-xs-push-2{left:16.666666666666664%}.col-xs-push-1{left:8.333333333333332%}.col-xs-offset-12{margin-left:100%}.col-xs-offset-11{margin-left:91.66666666666666%}.col-xs-offset-10{margin-left:83.33333333333334%}.col-xs-offset-9{margin-left:75%}.col-xs-offset-8{margin-left:66.66666666666666%}.col-xs-offset-7{margin-left:58.333333333333336%}.col-xs-offset-6{margin-left:50%}.col-xs-offset-5{margin-left:41.66666666666667%}.col-xs-offset-4{margin-left:33.33333333333333%}.col-xs-offset-3{margin-left:25%}.col-xs-offset-2{margin-left:16.666666666666664%}.col-xs-offset-1{margin-left:8.333333333333332%}@media(min-width:768px){.container{width:750px}.col-sm-1,.col-sm-2,.col-sm-3,.col-sm-4,.col-sm-5,.col-sm-6,.col-sm-7,.col-sm-8,.col-sm-9,.col-sm-10,.col-sm-11{float:left}.col-sm-12{width:100%}.col-sm-11{width:91.66666666666666%}.col-sm-10{width:83.33333333333334%}.col-sm-9{width:75%}.col-sm-8{width:66.66666666666666%}.col-sm-7{width:58.333333333333336%}.col-sm-6{width:50%}.col-sm-5{width:41.66666666666667%}.col-sm-4{width:33.33333333333333%}.col-sm-3{width:25%}.col-sm-2{width:16.666666666666664%}.col-sm-1{width:8.333333333333332%}.col-sm-pull-12{right:100%}.col-sm-pull-11{right:91.66666666666666%}.col-sm-pull-10{right:83.33333333333334%}.col-sm-pull-9{right:75%}.col-sm-pull-8{right:66.66666666666666%}.col-sm-pull-7{right:58.333333333333336%}.col-sm-pull-6{right:50%}.col-sm-pull-5{right:41.66666666666667%}.col-sm-pull-4{right:33.33333333333333%}.col-sm-pull-3{right:25%}.col-sm-pull-2{right:16.666666666666664%}.col-sm-pull-1{right:8.333333333333332%}.col-sm-push-12{left:100%}.col-sm-push-11{left:91.66666666666666%}.col-sm-push-10{left:83.33333333333334%}.col-sm-push-9{left:75%}.col-sm-push-8{left:66.66666666666666%}.col-sm-push-7{left:58.333333333333336%}.col-sm-push-6{left:50%}.col-sm-push-5{left:41.66666666666667%}.col-sm-push-4{left:33.33333333333333%}.col-sm-push-3{left:25%}.col-sm-push-2{left:16.666666666666664%}.col-sm-push-1{left:8.333333333333332%}.col-sm-offset-12{margin-left:100%}.col-sm-offset-11{margin-left:91.66666666666666%}.col-sm-offset-10{margin-left:83.33333333333334%}.col-sm-offset-9{margin-left:75%}.col-sm-offset-8{margin-left:66.66666666666666%}.col-sm-offset-7{margin-left:58.333333333333336%}.col-sm-offset-6{margin-left:50%}.col-sm-offset-5{margin-left:41.66666666666667%}.col-sm-offset-4{margin-left:33.33333333333333%}.col-sm-offset-3{margin-left:25%}.col-sm-offset-2{margin-left:16.666666666666664%}.col-sm-offset-1{margin-left:8.333333333333332%}}@media(min-width:992px){.container{width:970px}.col-md-1,.col-md-2,.col-md-3,.col-md-4,.col-md-5,.col-md-6,.col-md-7,.col-md-8,.col-md-9,.col-md-10,.col-md-11{float:left}.col-md-12{width:100%}.col-md-11{width:91.66666666666666%}.col-md-10{width:83.33333333333334%}.col-md-9{width:75%}.col-md-8{width:66.66666666666666%}.col-md-7{width:58.333333333333336%}.col-md-6{width:50%}.col-md-5{width:41.66666666666667%}.col-md-4{width:33.33333333333333%}.col-md-3{width:25%}.col-md-2{width:16.666666666666664%}.col-md-1{width:8.333333333333332%}.col-md-pull-12{right:100%}.col-md-pull-11{right:91.66666666666666%}.col-md-pull-10{right:83.33333333333334%}.col-md-pull-9{right:75%}.col-md-pull-8{right:66.66666666666666%}.col-md-pull-7{right:58.333333333333336%}.col-md-pull-6{right:50%}.col-md-pull-5{right:41.66666666666667%}.col-md-pull-4{right:33.33333333333333%}.col-md-pull-3{right:25%}.col-md-pull-2{right:16.666666666666664%}.col-md-pull-1{right:8.333333333333332%}.col-md-push-12{left:100%}.col-md-push-11{left:91.66666666666666%}.col-md-push-10{left:83.33333333333334%}.col-md-push-9{left:75%}.col-md-push-8{left:66.66666666666666%}.col-md-push-7{left:58.333333333333336%}.col-md-push-6{left:50%}.col-md-push-5{left:41.66666666666667%}.col-md-push-4{left:33.33333333333333%}.col-md-push-3{left:25%}.col-md-push-2{left:16.666666666666664%}.col-md-push-1{left:8.333333333333332%}.col-md-offset-12{margin-left:100%}.col-md-offset-11{margin-left:91.66666666666666%}.col-md-offset-10{margin-left:83.33333333333334%}.col-md-offset-9{margin-left:75%}.col-md-offset-8{margin-left:66.66666666666666%}.col-md-offset-7{margin-left:58.333333333333336%}.col-md-offset-6{margin-left:50%}.col-md-offset-5{margin-left:41.66666666666667%}.col-md-offset-4{margin-left:33.33333333333333%}.col-md-offset-3{margin-left:25%}.col-md-offset-2{margin-left:16.666666666666664%}.col-md-offset-1{margin-left:8.333333333333332%}}@media(min-width:1200px){.container{width:1170px}.col-lg-1,.col-lg-2,.col-lg-3,.col-lg-4,.col-lg-5,.col-lg-6,.col-lg-7,.col-lg-8,.col-lg-9,.col-lg-10,.col-lg-11{float:left}.col-lg-12{width:100%}.col-lg-11{width:91.66666666666666%}.col-lg-10{width:83.33333333333334%}.col-lg-9{width:75%}.col-lg-8{width:66.66666666666666%}.col-lg-7{width:58.333333333333336%}.col-lg-6{width:50%}.col-lg-5{width:41.66666666666667%}.col-lg-4{width:33.33333333333333%}.col-lg-3{width:25%}.col-lg-2{width:16.666666666666664%}.col-lg-1{width:8.333333333333332%}.col-lg-pull-12{right:100%}.col-lg-pull-11{right:91.66666666666666%}.col-lg-pull-10{right:83.33333333333334%}.col-lg-pull-9{right:75%}.col-lg-pull-8{right:66.66666666666666%}.col-lg-pull-7{right:58.333333333333336%}.col-lg-pull-6{right:50%}.col-lg-pull-5{right:41.66666666666667%}.col-lg-pull-4{right:33.33333333333333%}.col-lg-pull-3{right:25%}.col-lg-pull-2{right:16.666666666666664%}.col-lg-pull-1{right:8.333333333333332%}.col-lg-push-12{left:100%}.col-lg-push-11{left:91.66666666666666%}.col-lg-push-10{left:83.33333333333334%}.col-lg-push-9{left:75%}.col-lg-push-8{left:66.66666666666666%}.col-lg-push-7{left:58.333333333333336%}.col-lg-push-6{left:50%}.col-lg-push-5{left:41.66666666666667%}.col-lg-push-4{left:33.33333333333333%}.col-lg-push-3{left:25%}.col-lg-push-2{left:16.666666666666664%}.col-lg-push-1{left:8.333333333333332%}.col-lg-offset-12{margin-left:100%}.col-lg-offset-11{margin-left:91.66666666666666%}.col-lg-offset-10{margin-left:83.33333333333334%}.col-lg-offset-9{margin-left:75%}.col-lg-offset-8{margin-left:66.66666666666666%}.col-lg-offset-7{margin-left:58.333333333333336%}.col-lg-offset-6{margin-left:50%}.col-lg-offset-5{margin-left:41.66666666666667%}.col-lg-offset-4{margin-left:33.33333333333333%}.col-lg-offset-3{margin-left:25%}.col-lg-offset-2{margin-left:16.666666666666664%}.col-lg-offset-1{margin-left:8.333333333333332%}}table{max-width:100%;background-color:transparent}th{text-align:left}.table{width:100%;margin-bottom:20px}.table>thead>tr>th,.table>tbody>tr>th,.table>tfoot>tr>th,.table>thead>tr>td,.table>tbody>tr>td,.table>tfoot>tr>td{padding:8px;line-height:1.428571429;vertical-align:top;border-top:1px solid #ddd}.table>thead>tr>th{vertical-align:bottom;border-bottom:2px solid #ddd}.table>caption+thead>tr:first-child>th,.table>colgroup+thead>tr:first-child>th,.table>thead:first-child>tr:first-child>th,.table>caption+thead>tr:first-child>td,.table>colgroup+thead>tr:first-child>td,.table>thead:first-child>tr:first-child>td{border-top:0}.table>tbody+tbody{border-top:2px solid #ddd}.table .table{background-color:#fff}.table-condensed>thead>tr>th,.table-condensed>tbody>tr>th,.table-condensed>tfoot>tr>th,.table-condensed>thead>tr>td,.table-condensed>tbody>tr>td,.table-condensed>tfoot>tr>td{padding:5px}.table-bordered{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>tbody>tr>th,.table-bordered>tfoot>tr>th,.table-bordered>thead>tr>td,.table-bordered>tbody>tr>td,.table-bordered>tfoot>tr>td{border:1px solid #ddd}.table-bordered>thead>tr>th,.table-bordered>thead>tr>td{border-bottom-width:2px}.table-striped>tbody>tr:nth-child(odd)>td,.table-striped>tbody>tr:nth-child(odd)>th{background-color:#f9f9f9}.table-hover>tbody>tr:hover>td,.table-hover>tbody>tr:hover>th{background-color:#f5f5f5}table col[class*="col-"]{display:table-column;float:none}table td[class*="col-"],table th[class*="col-"]{display:table-cell;float:none}.table>thead>tr>td.active,.table>tbody>tr>td.active,.table>tfoot>tr>td.active,.table>thead>tr>th.active,.table>tbody>tr>th.active,.table>tfoot>tr>th.active,.table>thead>tr.active>td,.table>tbody>tr.active>td,.table>tfoot>tr.active>td,.table>thead>tr.active>th,.table>tbody>tr.active>th,.table>tfoot>tr.active>th{background-color:#f5f5f5}.table>thead>tr>td.success,.table>tbody>tr>td.success,.table>tfoot>tr>td.success,.table>thead>tr>th.success,.table>tbody>tr>th.success,.table>tfoot>tr>th.success,.table>thead>tr.success>td,.table>tbody>tr.success>td,.table>tfoot>tr.success>td,.table>thead>tr.success>th,.table>tbody>tr.success>th,.table>tfoot>tr.success>th{background-color:#dff0d8}.table-hover>tbody>tr>td.success:hover,.table-hover>tbody>tr>th.success:hover,.table-hover>tbody>tr.success:hover>td,.table-hover>tbody>tr.success:hover>th{background-color:#d0e9c6}.table>thead>tr>td.danger,.table>tbody>tr>td.danger,.table>tfoot>tr>td.danger,.table>thead>tr>th.danger,.table>tbody>tr>th.danger,.table>tfoot>tr>th.danger,.table>thead>tr.danger>td,.table>tbody>tr.danger>td,.table>tfoot>tr.danger>td,.table>thead>tr.danger>th,.table>tbody>tr.danger>th,.table>tfoot>tr.danger>th{background-color:#f2dede}.table-hover>tbody>tr>td.danger:hover,.table-hover>tbody>tr>th.danger:hover,.table-hover>tbody>tr.danger:hover>td,.table-hover>tbody>tr.danger:hover>th{background-color:#ebcccc}.table>thead>tr>td.warning,.table>tbody>tr>td.warning,.table>tfoot>tr>td.warning,.table>thead>tr>th.warning,.table>tbody>tr>th.warning,.table>tfoot>tr>th.warning,.table>thead>tr.warning>td,.table>tbody>tr.warning>td,.table>tfoot>tr.warning>td,.table>thead>tr.warning>th,.table>tbody>tr.warning>th,.table>tfoot>tr.warning>th{background-color:#fcf8e3}.table-hover>tbody>tr>td.warning:hover,.table-hover>tbody>tr>th.warning:hover,.table-hover>tbody>tr.warning:hover>td,.table-hover>tbody>tr.warning:hover>th{background-color:#faf2cc}@media(max-width:767px){.table-responsive{width:100%;margin-bottom:15px;overflow-x:scroll;overflow-y:hidden;border:1px solid #ddd;-ms-overflow-style:-ms-autohiding-scrollbar;-webkit-overflow-scrolling:touch}.table-responsive>.table{margin-bottom:0}.table-responsive>.table>thead>tr>th,.table-responsive>.table>tbody>tr>th,.table-responsive>.table>tfoot>tr>th,.table-responsive>.table>thead>tr>td,.table-responsive>.table>tbody>tr>td,.table-responsive>.table>tfoot>tr>td{white-space:nowrap}.table-responsive>.table-bordered{border:0}.table-responsive>.table-bordered>thead>tr>th:first-child,.table-responsive>.table-bordered>tbody>tr>th:first-child,.table-responsive>.table-bordered>tfoot>tr>th:first-child,.table-responsive>.table-bordered>thead>tr>td:first-child,.table-responsive>.table-bordered>tbody>tr>td:first-child,.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.table-responsive>.table-bordered>thead>tr>th:last-child,.table-responsive>.table-bordered>tbody>tr>th:last-child,.table-responsive>.table-bordered>tfoot>tr>th:last-child,.table-responsive>.table-bordered>thead>tr>td:last-child,.table-responsive>.table-bordered>tbody>tr>td:last-child,.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.table-responsive>.table-bordered>tbody>tr:last-child>th,.table-responsive>.table-bordered>tfoot>tr:last-child>th,.table-responsive>.table-bordered>tbody>tr:last-child>td,.table-responsive>.table-bordered>tfoot>tr:last-child>td{border-bottom:0}}fieldset{padding:0;margin:0;border:0}legend{display:block;width:100%;padding:0;margin-bottom:20px;font-size:21px;line-height:inherit;color:#333;border:0;border-bottom:1px solid #e5e5e5}label{display:inline-block;margin-bottom:5px;font-weight:bold}input[type="search"]{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box}input[type="radio"],input[type="checkbox"]{margin:4px 0 0;margin-top:1px \9;line-height:normal}input[type="file"]{display:block}select[multiple],select[size]{height:auto}select optgroup{font-family:inherit;font-size:inherit;font-style:inherit}input[type="file"]:focus,input[type="radio"]:focus,input[type="checkbox"]:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}input[type="number"]::-webkit-outer-spin-button,input[type="number"]::-webkit-inner-spin-button{height:auto}output{display:block;padding-top:7px;font-size:14px;line-height:1.428571429;color:#555;vertical-align:middle}.form-control:-moz-placeholder{color:#999}.form-control::-moz-placeholder{color:#999}.form-control:-ms-input-placeholder{color:#999}.form-control::-webkit-input-placeholder{color:#999}.form-control{display:block;width:100%;height:34px;padding:6px 12px;font-size:14px;line-height:1.428571429;color:#555;vertical-align:middle;background-color:#fff;background-image:none;border:1px solid #ccc;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);-webkit-transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s;transition:border-color ease-in-out .15s,box-shadow ease-in-out .15s}.form-control:focus{border-color:#66afe9;outline:0;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 8px rgba(102,175,233,0.6)}.form-control[disabled],.form-control[readonly],fieldset[disabled] .form-control{cursor:not-allowed;background-color:#eee}textarea.form-control{height:auto}.form-group{margin-bottom:15px}.radio,.checkbox{display:block;min-height:20px;padding-left:20px;margin-top:10px;margin-bottom:10px;vertical-align:middle}.radio label,.checkbox label{display:inline;margin-bottom:0;font-weight:normal;cursor:pointer}.radio input[type="radio"],.radio-inline input[type="radio"],.checkbox input[type="checkbox"],.checkbox-inline input[type="checkbox"]{float:left;margin-left:-20px}.radio+.radio,.checkbox+.checkbox{margin-top:-5px}.radio-inline,.checkbox-inline{display:inline-block;padding-left:20px;margin-bottom:0;font-weight:normal;vertical-align:middle;cursor:pointer}.radio-inline+.radio-inline,.checkbox-inline+.checkbox-inline{margin-top:0;margin-left:10px}input[type="radio"][disabled],input[type="checkbox"][disabled],.radio[disabled],.radio-inline[disabled],.checkbox[disabled],.checkbox-inline[disabled],fieldset[disabled] input[type="radio"],fieldset[disabled] input[type="checkbox"],fieldset[disabled] .radio,fieldset[disabled] .radio-inline,fieldset[disabled] .checkbox,fieldset[disabled] .checkbox-inline{cursor:not-allowed}.input-sm{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-sm{height:30px;line-height:30px}textarea.input-sm{height:auto}.input-lg{height:45px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-lg{height:45px;line-height:45px}textarea.input-lg{height:auto}.has-warning .help-block,.has-warning .control-label,.has-warning .radio,.has-warning .checkbox,.has-warning .radio-inline,.has-warning .checkbox-inline{color:#c09853}.has-warning .form-control{border-color:#c09853;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.has-warning .form-control:focus{border-color:#a47e3c;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #dbc59e}.has-warning .input-group-addon{color:#c09853;background-color:#fcf8e3;border-color:#c09853}.has-error .help-block,.has-error .control-label,.has-error .radio,.has-error .checkbox,.has-error .radio-inline,.has-error .checkbox-inline{color:#b94a48}.has-error .form-control{border-color:#b94a48;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.has-error .form-control:focus{border-color:#953b39;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #d59392}.has-error .input-group-addon{color:#b94a48;background-color:#f2dede;border-color:#b94a48}.has-success .help-block,.has-success .control-label,.has-success .radio,.has-success .checkbox,.has-success .radio-inline,.has-success .checkbox-inline{color:#468847}.has-success .form-control{border-color:#468847;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075);box-shadow:inset 0 1px 1px rgba(0,0,0,0.075)}.has-success .form-control:focus{border-color:#356635;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b;box-shadow:inset 0 1px 1px rgba(0,0,0,0.075),0 0 6px #7aba7b}.has-success .input-group-addon{color:#468847;background-color:#dff0d8;border-color:#468847}.form-control-static{margin-bottom:0}.help-block{display:block;margin-top:5px;margin-bottom:10px;color:#737373}@media(min-width:768px){.form-inline .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.form-inline .form-control{display:inline-block}.form-inline .radio,.form-inline .checkbox{display:inline-block;padding-left:0;margin-top:0;margin-bottom:0}.form-inline .radio input[type="radio"],.form-inline .checkbox input[type="checkbox"]{float:none;margin-left:0}}.form-horizontal .control-label,.form-horizontal .radio,.form-horizontal .checkbox,.form-horizontal .radio-inline,.form-horizontal .checkbox-inline{padding-top:7px;margin-top:0;margin-bottom:0}.form-horizontal .form-group{margin-right:-15px;margin-left:-15px}.form-horizontal .form-group:before,.form-horizontal .form-group:after{display:table;content:" "}.form-horizontal .form-group:after{clear:both}.form-horizontal .form-group:before,.form-horizontal .form-group:after{display:table;content:" "}.form-horizontal .form-group:after{clear:both}.form-horizontal .form-control-static{padding-top:7px}@media(min-width:768px){.form-horizontal .control-label{text-align:right}}.btn{display:inline-block;padding:6px 12px;margin-bottom:0;font-size:14px;font-weight:normal;line-height:1.428571429;text-align:center;white-space:nowrap;vertical-align:middle;cursor:pointer;background-image:none;border:1px solid transparent;border-radius:4px;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none}.btn:focus{outline:thin dotted #333;outline:5px auto -webkit-focus-ring-color;outline-offset:-2px}.btn:hover,.btn:focus{color:#333;text-decoration:none}.btn:active,.btn.active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.btn.disabled,.btn[disabled],fieldset[disabled] .btn{pointer-events:none;cursor:not-allowed;opacity:.65;filter:alpha(opacity=65);-webkit-box-shadow:none;box-shadow:none}.btn-default{color:#333;background-color:#fff;border-color:#ccc}.btn-default:hover,.btn-default:focus,.btn-default:active,.btn-default.active,.open .dropdown-toggle.btn-default{color:#333;background-color:#ebebeb;border-color:#adadad}.btn-default:active,.btn-default.active,.open .dropdown-toggle.btn-default{background-image:none}.btn-default.disabled,.btn-default[disabled],fieldset[disabled] .btn-default,.btn-default.disabled:hover,.btn-default[disabled]:hover,fieldset[disabled] .btn-default:hover,.btn-default.disabled:focus,.btn-default[disabled]:focus,fieldset[disabled] .btn-default:focus,.btn-default.disabled:active,.btn-default[disabled]:active,fieldset[disabled] .btn-default:active,.btn-default.disabled.active,.btn-default[disabled].active,fieldset[disabled] .btn-default.active{background-color:#fff;border-color:#ccc}.btn-primary{color:#fff;background-color:#428bca;border-color:#357ebd}.btn-primary:hover,.btn-primary:focus,.btn-primary:active,.btn-primary.active,.open .dropdown-toggle.btn-primary{color:#fff;background-color:#3276b1;border-color:#285e8e}.btn-primary:active,.btn-primary.active,.open .dropdown-toggle.btn-primary{background-image:none}.btn-primary.disabled,.btn-primary[disabled],fieldset[disabled] .btn-primary,.btn-primary.disabled:hover,.btn-primary[disabled]:hover,fieldset[disabled] .btn-primary:hover,.btn-primary.disabled:focus,.btn-primary[disabled]:focus,fieldset[disabled] .btn-primary:focus,.btn-primary.disabled:active,.btn-primary[disabled]:active,fieldset[disabled] .btn-primary:active,.btn-primary.disabled.active,.btn-primary[disabled].active,fieldset[disabled] .btn-primary.active{background-color:#428bca;border-color:#357ebd}.btn-warning{color:#fff;background-color:#f0ad4e;border-color:#eea236}.btn-warning:hover,.btn-warning:focus,.btn-warning:active,.btn-warning.active,.open .dropdown-toggle.btn-warning{color:#fff;background-color:#ed9c28;border-color:#d58512}.btn-warning:active,.btn-warning.active,.open .dropdown-toggle.btn-warning{background-image:none}.btn-warning.disabled,.btn-warning[disabled],fieldset[disabled] .btn-warning,.btn-warning.disabled:hover,.btn-warning[disabled]:hover,fieldset[disabled] .btn-warning:hover,.btn-warning.disabled:focus,.btn-warning[disabled]:focus,fieldset[disabled] .btn-warning:focus,.btn-warning.disabled:active,.btn-warning[disabled]:active,fieldset[disabled] .btn-warning:active,.btn-warning.disabled.active,.btn-warning[disabled].active,fieldset[disabled] .btn-warning.active{background-color:#f0ad4e;border-color:#eea236}.btn-danger{color:#fff;background-color:#d9534f;border-color:#d43f3a}.btn-danger:hover,.btn-danger:focus,.btn-danger:active,.btn-danger.active,.open .dropdown-toggle.btn-danger{color:#fff;background-color:#d2322d;border-color:#ac2925}.btn-danger:active,.btn-danger.active,.open .dropdown-toggle.btn-danger{background-image:none}.btn-danger.disabled,.btn-danger[disabled],fieldset[disabled] .btn-danger,.btn-danger.disabled:hover,.btn-danger[disabled]:hover,fieldset[disabled] .btn-danger:hover,.btn-danger.disabled:focus,.btn-danger[disabled]:focus,fieldset[disabled] .btn-danger:focus,.btn-danger.disabled:active,.btn-danger[disabled]:active,fieldset[disabled] .btn-danger:active,.btn-danger.disabled.active,.btn-danger[disabled].active,fieldset[disabled] .btn-danger.active{background-color:#d9534f;border-color:#d43f3a}.btn-success{color:#fff;background-color:#5cb85c;border-color:#4cae4c}.btn-success:hover,.btn-success:focus,.btn-success:active,.btn-success.active,.open .dropdown-toggle.btn-success{color:#fff;background-color:#47a447;border-color:#398439}.btn-success:active,.btn-success.active,.open .dropdown-toggle.btn-success{background-image:none}.btn-success.disabled,.btn-success[disabled],fieldset[disabled] .btn-success,.btn-success.disabled:hover,.btn-success[disabled]:hover,fieldset[disabled] .btn-success:hover,.btn-success.disabled:focus,.btn-success[disabled]:focus,fieldset[disabled] .btn-success:focus,.btn-success.disabled:active,.btn-success[disabled]:active,fieldset[disabled] .btn-success:active,.btn-success.disabled.active,.btn-success[disabled].active,fieldset[disabled] .btn-success.active{background-color:#5cb85c;border-color:#4cae4c}.btn-info{color:#fff;background-color:#5bc0de;border-color:#46b8da}.btn-info:hover,.btn-info:focus,.btn-info:active,.btn-info.active,.open .dropdown-toggle.btn-info{color:#fff;background-color:#39b3d7;border-color:#269abc}.btn-info:active,.btn-info.active,.open .dropdown-toggle.btn-info{background-image:none}.btn-info.disabled,.btn-info[disabled],fieldset[disabled] .btn-info,.btn-info.disabled:hover,.btn-info[disabled]:hover,fieldset[disabled] .btn-info:hover,.btn-info.disabled:focus,.btn-info[disabled]:focus,fieldset[disabled] .btn-info:focus,.btn-info.disabled:active,.btn-info[disabled]:active,fieldset[disabled] .btn-info:active,.btn-info.disabled.active,.btn-info[disabled].active,fieldset[disabled] .btn-info.active{background-color:#5bc0de;border-color:#46b8da}.btn-link{font-weight:normal;color:#428bca;cursor:pointer;border-radius:0}.btn-link,.btn-link:active,.btn-link[disabled],fieldset[disabled] .btn-link{background-color:transparent;-webkit-box-shadow:none;box-shadow:none}.btn-link,.btn-link:hover,.btn-link:focus,.btn-link:active{border-color:transparent}.btn-link:hover,.btn-link:focus{color:#2a6496;text-decoration:underline;background-color:transparent}.btn-link[disabled]:hover,fieldset[disabled] .btn-link:hover,.btn-link[disabled]:focus,fieldset[disabled] .btn-link:focus{color:#999;text-decoration:none}.btn-lg{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.btn-sm,.btn-xs{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-xs{padding:1px 5px}.btn-block{display:block;width:100%;padding-right:0;padding-left:0}.btn-block+.btn-block{margin-top:5px}input[type="submit"].btn-block,input[type="reset"].btn-block,input[type="button"].btn-block{width:100%}.fade{opacity:0;-webkit-transition:opacity .15s linear;transition:opacity .15s linear}.fade.in{opacity:1}.collapse{display:none}.collapse.in{display:block}.collapsing{position:relative;height:0;overflow:hidden;-webkit-transition:height .35s ease;transition:height .35s ease}@font-face{font-family:'Glyphicons Halflings';src:url('../fonts/glyphicons-halflings-regular.eot');src:url('../fonts/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'),url('../fonts/glyphicons-halflings-regular.woff') format('woff'),url('../fonts/glyphicons-halflings-regular.ttf') format('truetype'),url('../fonts/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg')}.glyphicon{position:relative;top:1px;display:inline-block;font-family:'Glyphicons Halflings';-webkit-font-smoothing:antialiased;font-style:normal;font-weight:normal;line-height:1;-moz-osx-font-smoothing:grayscale}.glyphicon:empty{width:1em}.glyphicon-asterisk:before{content:"\2a"}.glyphicon-plus:before{content:"\2b"}.glyphicon-euro:before{content:"\20ac"}.glyphicon-minus:before{content:"\2212"}.glyphicon-cloud:before{content:"\2601"}.glyphicon-envelope:before{content:"\2709"}.glyphicon-pencil:before{content:"\270f"}.glyphicon-glass:before{content:"\e001"}.glyphicon-music:before{content:"\e002"}.glyphicon-search:before{content:"\e003"}.glyphicon-heart:before{content:"\e005"}.glyphicon-star:before{content:"\e006"}.glyphicon-star-empty:before{content:"\e007"}.glyphicon-user:before{content:"\e008"}.glyphicon-film:before{content:"\e009"}.glyphicon-th-large:before{content:"\e010"}.glyphicon-th:before{content:"\e011"}.glyphicon-th-list:before{content:"\e012"}.glyphicon-ok:before{content:"\e013"}.glyphicon-remove:before{content:"\e014"}.glyphicon-zoom-in:before{content:"\e015"}.glyphicon-zoom-out:before{content:"\e016"}.glyphicon-off:before{content:"\e017"}.glyphicon-signal:before{content:"\e018"}.glyphicon-cog:before{content:"\e019"}.glyphicon-trash:before{content:"\e020"}.glyphicon-home:before{content:"\e021"}.glyphicon-file:before{content:"\e022"}.glyphicon-time:before{content:"\e023"}.glyphicon-road:before{content:"\e024"}.glyphicon-download-alt:before{content:"\e025"}.glyphicon-download:before{content:"\e026"}.glyphicon-upload:before{content:"\e027"}.glyphicon-inbox:before{content:"\e028"}.glyphicon-play-circle:before{content:"\e029"}.glyphicon-repeat:before{content:"\e030"}.glyphicon-refresh:before{content:"\e031"}.glyphicon-list-alt:before{content:"\e032"}.glyphicon-lock:before{content:"\e033"}.glyphicon-flag:before{content:"\e034"}.glyphicon-headphones:before{content:"\e035"}.glyphicon-volume-off:before{content:"\e036"}.glyphicon-volume-down:before{content:"\e037"}.glyphicon-volume-up:before{content:"\e038"}.glyphicon-qrcode:before{content:"\e039"}.glyphicon-barcode:before{content:"\e040"}.glyphicon-tag:before{content:"\e041"}.glyphicon-tags:before{content:"\e042"}.glyphicon-book:before{content:"\e043"}.glyphicon-bookmark:before{content:"\e044"}.glyphicon-print:before{content:"\e045"}.glyphicon-camera:before{content:"\e046"}.glyphicon-font:before{content:"\e047"}.glyphicon-bold:before{content:"\e048"}.glyphicon-italic:before{content:"\e049"}.glyphicon-text-height:before{content:"\e050"}.glyphicon-text-width:before{content:"\e051"}.glyphicon-align-left:before{content:"\e052"}.glyphicon-align-center:before{content:"\e053"}.glyphicon-align-right:before{content:"\e054"}.glyphicon-align-justify:before{content:"\e055"}.glyphicon-list:before{content:"\e056"}.glyphicon-indent-left:before{content:"\e057"}.glyphicon-indent-right:before{content:"\e058"}.glyphicon-facetime-video:before{content:"\e059"}.glyphicon-picture:before{content:"\e060"}.glyphicon-map-marker:before{content:"\e062"}.glyphicon-adjust:before{content:"\e063"}.glyphicon-tint:before{content:"\e064"}.glyphicon-edit:before{content:"\e065"}.glyphicon-share:before{content:"\e066"}.glyphicon-check:before{content:"\e067"}.glyphicon-move:before{content:"\e068"}.glyphicon-step-backward:before{content:"\e069"}.glyphicon-fast-backward:before{content:"\e070"}.glyphicon-backward:before{content:"\e071"}.glyphicon-play:before{content:"\e072"}.glyphicon-pause:before{content:"\e073"}.glyphicon-stop:before{content:"\e074"}.glyphicon-forward:before{content:"\e075"}.glyphicon-fast-forward:before{content:"\e076"}.glyphicon-step-forward:before{content:"\e077"}.glyphicon-eject:before{content:"\e078"}.glyphicon-chevron-left:before{content:"\e079"}.glyphicon-chevron-right:before{content:"\e080"}.glyphicon-plus-sign:before{content:"\e081"}.glyphicon-minus-sign:before{content:"\e082"}.glyphicon-remove-sign:before{content:"\e083"}.glyphicon-ok-sign:before{content:"\e084"}.glyphicon-question-sign:before{content:"\e085"}.glyphicon-info-sign:before{content:"\e086"}.glyphicon-screenshot:before{content:"\e087"}.glyphicon-remove-circle:before{content:"\e088"}.glyphicon-ok-circle:before{content:"\e089"}.glyphicon-ban-circle:before{content:"\e090"}.glyphicon-arrow-left:before{content:"\e091"}.glyphicon-arrow-right:before{content:"\e092"}.glyphicon-arrow-up:before{content:"\e093"}.glyphicon-arrow-down:before{content:"\e094"}.glyphicon-share-alt:before{content:"\e095"}.glyphicon-resize-full:before{content:"\e096"}.glyphicon-resize-small:before{content:"\e097"}.glyphicon-exclamation-sign:before{content:"\e101"}.glyphicon-gift:before{content:"\e102"}.glyphicon-leaf:before{content:"\e103"}.glyphicon-fire:before{content:"\e104"}.glyphicon-eye-open:before{content:"\e105"}.glyphicon-eye-close:before{content:"\e106"}.glyphicon-warning-sign:before{content:"\e107"}.glyphicon-plane:before{content:"\e108"}.glyphicon-calendar:before{content:"\e109"}.glyphicon-random:before{content:"\e110"}.glyphicon-comment:before{content:"\e111"}.glyphicon-magnet:before{content:"\e112"}.glyphicon-chevron-up:before{content:"\e113"}.glyphicon-chevron-down:before{content:"\e114"}.glyphicon-retweet:before{content:"\e115"}.glyphicon-shopping-cart:before{content:"\e116"}.glyphicon-folder-close:before{content:"\e117"}.glyphicon-folder-open:before{content:"\e118"}.glyphicon-resize-vertical:before{content:"\e119"}.glyphicon-resize-horizontal:before{content:"\e120"}.glyphicon-hdd:before{content:"\e121"}.glyphicon-bullhorn:before{content:"\e122"}.glyphicon-bell:before{content:"\e123"}.glyphicon-certificate:before{content:"\e124"}.glyphicon-thumbs-up:before{content:"\e125"}.glyphicon-thumbs-down:before{content:"\e126"}.glyphicon-hand-right:before{content:"\e127"}.glyphicon-hand-left:before{content:"\e128"}.glyphicon-hand-up:before{content:"\e129"}.glyphicon-hand-down:before{content:"\e130"}.glyphicon-circle-arrow-right:before{content:"\e131"}.glyphicon-circle-arrow-left:before{content:"\e132"}.glyphicon-circle-arrow-up:before{content:"\e133"}.glyphicon-circle-arrow-down:before{content:"\e134"}.glyphicon-globe:before{content:"\e135"}.glyphicon-wrench:before{content:"\e136"}.glyphicon-tasks:before{content:"\e137"}.glyphicon-filter:before{content:"\e138"}.glyphicon-briefcase:before{content:"\e139"}.glyphicon-fullscreen:before{content:"\e140"}.glyphicon-dashboard:before{content:"\e141"}.glyphicon-paperclip:before{content:"\e142"}.glyphicon-heart-empty:before{content:"\e143"}.glyphicon-link:before{content:"\e144"}.glyphicon-phone:before{content:"\e145"}.glyphicon-pushpin:before{content:"\e146"}.glyphicon-usd:before{content:"\e148"}.glyphicon-gbp:before{content:"\e149"}.glyphicon-sort:before{content:"\e150"}.glyphicon-sort-by-alphabet:before{content:"\e151"}.glyphicon-sort-by-alphabet-alt:before{content:"\e152"}.glyphicon-sort-by-order:before{content:"\e153"}.glyphicon-sort-by-order-alt:before{content:"\e154"}.glyphicon-sort-by-attributes:before{content:"\e155"}.glyphicon-sort-by-attributes-alt:before{content:"\e156"}.glyphicon-unchecked:before{content:"\e157"}.glyphicon-expand:before{content:"\e158"}.glyphicon-collapse-down:before{content:"\e159"}.glyphicon-collapse-up:before{content:"\e160"}.glyphicon-log-in:before{content:"\e161"}.glyphicon-flash:before{content:"\e162"}.glyphicon-log-out:before{content:"\e163"}.glyphicon-new-window:before{content:"\e164"}.glyphicon-record:before{content:"\e165"}.glyphicon-save:before{content:"\e166"}.glyphicon-open:before{content:"\e167"}.glyphicon-saved:before{content:"\e168"}.glyphicon-import:before{content:"\e169"}.glyphicon-export:before{content:"\e170"}.glyphicon-send:before{content:"\e171"}.glyphicon-floppy-disk:before{content:"\e172"}.glyphicon-floppy-saved:before{content:"\e173"}.glyphicon-floppy-remove:before{content:"\e174"}.glyphicon-floppy-save:before{content:"\e175"}.glyphicon-floppy-open:before{content:"\e176"}.glyphicon-credit-card:before{content:"\e177"}.glyphicon-transfer:before{content:"\e178"}.glyphicon-cutlery:before{content:"\e179"}.glyphicon-header:before{content:"\e180"}.glyphicon-compressed:before{content:"\e181"}.glyphicon-earphone:before{content:"\e182"}.glyphicon-phone-alt:before{content:"\e183"}.glyphicon-tower:before{content:"\e184"}.glyphicon-stats:before{content:"\e185"}.glyphicon-sd-video:before{content:"\e186"}.glyphicon-hd-video:before{content:"\e187"}.glyphicon-subtitles:before{content:"\e188"}.glyphicon-sound-stereo:before{content:"\e189"}.glyphicon-sound-dolby:before{content:"\e190"}.glyphicon-sound-5-1:before{content:"\e191"}.glyphicon-sound-6-1:before{content:"\e192"}.glyphicon-sound-7-1:before{content:"\e193"}.glyphicon-copyright-mark:before{content:"\e194"}.glyphicon-registration-mark:before{content:"\e195"}.glyphicon-cloud-download:before{content:"\e197"}.glyphicon-cloud-upload:before{content:"\e198"}.glyphicon-tree-conifer:before{content:"\e199"}.glyphicon-tree-deciduous:before{content:"\e200"}.caret{display:inline-block;width:0;height:0;margin-left:2px;vertical-align:middle;border-top:4px solid #000;border-right:4px solid transparent;border-bottom:0 dotted;border-left:4px solid transparent}.dropdown{position:relative}.dropdown-toggle:focus{outline:0}.dropdown-menu{position:absolute;top:100%;left:0;z-index:1000;display:none;float:left;min-width:160px;padding:5px 0;margin:2px 0 0;font-size:14px;list-style:none;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.15);border-radius:4px;-webkit-box-shadow:0 6px 12px rgba(0,0,0,0.175);box-shadow:0 6px 12px rgba(0,0,0,0.175);background-clip:padding-box}.dropdown-menu.pull-right{right:0;left:auto}.dropdown-menu .divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.dropdown-menu>li>a{display:block;padding:3px 20px;clear:both;font-weight:normal;line-height:1.428571429;color:#333;white-space:nowrap}.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus{color:#262626;text-decoration:none;background-color:#f5f5f5}.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus{color:#fff;text-decoration:none;background-color:#428bca;outline:0}.dropdown-menu>.disabled>a,.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{color:#999}.dropdown-menu>.disabled>a:hover,.dropdown-menu>.disabled>a:focus{text-decoration:none;cursor:not-allowed;background-color:transparent;background-image:none;filter:progid:DXImageTransform.Microsoft.gradient(enabled=false)}.open>.dropdown-menu{display:block}.open>a{outline:0}.dropdown-header{display:block;padding:3px 20px;font-size:12px;line-height:1.428571429;color:#999}.dropdown-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:990}.pull-right>.dropdown-menu{right:0;left:auto}.dropup .caret,.navbar-fixed-bottom .dropdown .caret{border-top:0 dotted;border-bottom:4px solid #000;content:""}.dropup .dropdown-menu,.navbar-fixed-bottom .dropdown .dropdown-menu{top:auto;bottom:100%;margin-bottom:1px}@media(min-width:768px){.navbar-right .dropdown-menu{right:0;left:auto}}.btn-default .caret{border-top-color:#333}.btn-primary .caret,.btn-success .caret,.btn-warning .caret,.btn-danger .caret,.btn-info .caret{border-top-color:#fff}.dropup .btn-default .caret{border-bottom-color:#333}.dropup .btn-primary .caret,.dropup .btn-success .caret,.dropup .btn-warning .caret,.dropup .btn-danger .caret,.dropup .btn-info .caret{border-bottom-color:#fff}.btn-group,.btn-group-vertical{position:relative;display:inline-block;vertical-align:middle}.btn-group>.btn,.btn-group-vertical>.btn{position:relative;float:left}.btn-group>.btn:hover,.btn-group-vertical>.btn:hover,.btn-group>.btn:focus,.btn-group-vertical>.btn:focus,.btn-group>.btn:active,.btn-group-vertical>.btn:active,.btn-group>.btn.active,.btn-group-vertical>.btn.active{z-index:2}.btn-group>.btn:focus,.btn-group-vertical>.btn:focus{outline:0}.btn-group .btn+.btn,.btn-group .btn+.btn-group,.btn-group .btn-group+.btn,.btn-group .btn-group+.btn-group{margin-left:-1px}.btn-toolbar:before,.btn-toolbar:after{display:table;content:" "}.btn-toolbar:after{clear:both}.btn-toolbar:before,.btn-toolbar:after{display:table;content:" "}.btn-toolbar:after{clear:both}.btn-toolbar .btn-group{float:left}.btn-toolbar>.btn+.btn,.btn-toolbar>.btn-group+.btn,.btn-toolbar>.btn+.btn-group,.btn-toolbar>.btn-group+.btn-group{margin-left:5px}.btn-group>.btn:not(:first-child):not(:last-child):not(.dropdown-toggle){border-radius:0}.btn-group>.btn:first-child{margin-left:0}.btn-group>.btn:first-child:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn:last-child:not(:first-child),.btn-group>.dropdown-toggle:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.btn-group>.btn-group{float:left}.btn-group>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group>.btn-group:first-child>.btn:last-child,.btn-group>.btn-group:first-child>.dropdown-toggle{border-top-right-radius:0;border-bottom-right-radius:0}.btn-group>.btn-group:last-child>.btn:first-child{border-bottom-left-radius:0;border-top-left-radius:0}.btn-group .dropdown-toggle:active,.btn-group.open .dropdown-toggle{outline:0}.btn-group-xs>.btn{padding:5px 10px;padding:1px 5px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-sm>.btn{padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}.btn-group-lg>.btn{padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}.btn-group>.btn+.dropdown-toggle{padding-right:8px;padding-left:8px}.btn-group>.btn-lg+.dropdown-toggle{padding-right:12px;padding-left:12px}.btn-group.open .dropdown-toggle{-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125)}.btn-group.open .dropdown-toggle.btn-link{-webkit-box-shadow:none;box-shadow:none}.btn .caret{margin-left:0}.btn-lg .caret{border-width:5px 5px 0;border-bottom-width:0}.dropup .btn-lg .caret{border-width:0 5px 5px}.btn-group-vertical>.btn,.btn-group-vertical>.btn-group{display:block;float:none;width:100%;max-width:100%}.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after{display:table;content:" "}.btn-group-vertical>.btn-group:after{clear:both}.btn-group-vertical>.btn-group:before,.btn-group-vertical>.btn-group:after{display:table;content:" "}.btn-group-vertical>.btn-group:after{clear:both}.btn-group-vertical>.btn-group>.btn{float:none}.btn-group-vertical>.btn+.btn,.btn-group-vertical>.btn+.btn-group,.btn-group-vertical>.btn-group+.btn,.btn-group-vertical>.btn-group+.btn-group{margin-top:-1px;margin-left:0}.btn-group-vertical>.btn:not(:first-child):not(:last-child){border-radius:0}.btn-group-vertical>.btn:first-child:not(:last-child){border-top-right-radius:4px;border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn:last-child:not(:first-child){border-top-right-radius:0;border-bottom-left-radius:4px;border-top-left-radius:0}.btn-group-vertical>.btn-group:not(:first-child):not(:last-child)>.btn{border-radius:0}.btn-group-vertical>.btn-group:first-child>.btn:last-child,.btn-group-vertical>.btn-group:first-child>.dropdown-toggle{border-bottom-right-radius:0;border-bottom-left-radius:0}.btn-group-vertical>.btn-group:last-child>.btn:first-child{border-top-right-radius:0;border-top-left-radius:0}.btn-group-justified{display:table;width:100%;border-collapse:separate;table-layout:fixed}.btn-group-justified .btn{display:table-cell;float:none;width:1%}[data-toggle="buttons"]>.btn>input[type="radio"],[data-toggle="buttons"]>.btn>input[type="checkbox"]{display:none}.input-group{position:relative;display:table;border-collapse:separate}.input-group.col{float:none;padding-right:0;padding-left:0}.input-group .form-control{width:100%;margin-bottom:0}.input-group-lg>.form-control,.input-group-lg>.input-group-addon,.input-group-lg>.input-group-btn>.btn{height:45px;padding:10px 16px;font-size:18px;line-height:1.33;border-radius:6px}select.input-group-lg>.form-control,select.input-group-lg>.input-group-addon,select.input-group-lg>.input-group-btn>.btn{height:45px;line-height:45px}textarea.input-group-lg>.form-control,textarea.input-group-lg>.input-group-addon,textarea.input-group-lg>.input-group-btn>.btn{height:auto}.input-group-sm>.form-control,.input-group-sm>.input-group-addon,.input-group-sm>.input-group-btn>.btn{height:30px;padding:5px 10px;font-size:12px;line-height:1.5;border-radius:3px}select.input-group-sm>.form-control,select.input-group-sm>.input-group-addon,select.input-group-sm>.input-group-btn>.btn{height:30px;line-height:30px}textarea.input-group-sm>.form-control,textarea.input-group-sm>.input-group-addon,textarea.input-group-sm>.input-group-btn>.btn{height:auto}.input-group-addon,.input-group-btn,.input-group .form-control{display:table-cell}.input-group-addon:not(:first-child):not(:last-child),.input-group-btn:not(:first-child):not(:last-child),.input-group .form-control:not(:first-child):not(:last-child){border-radius:0}.input-group-addon,.input-group-btn{width:1%;white-space:nowrap;vertical-align:middle}.input-group-addon{padding:6px 12px;font-size:14px;font-weight:normal;line-height:1;color:#555;text-align:center;background-color:#eee;border:1px solid #ccc;border-radius:4px}.input-group-addon.input-sm{padding:5px 10px;font-size:12px;border-radius:3px}.input-group-addon.input-lg{padding:10px 16px;font-size:18px;border-radius:6px}.input-group-addon input[type="radio"],.input-group-addon input[type="checkbox"]{margin-top:0}.input-group .form-control:first-child,.input-group-addon:first-child,.input-group-btn:first-child>.btn,.input-group-btn:first-child>.dropdown-toggle,.input-group-btn:last-child>.btn:not(:last-child):not(.dropdown-toggle){border-top-right-radius:0;border-bottom-right-radius:0}.input-group-addon:first-child{border-right:0}.input-group .form-control:last-child,.input-group-addon:last-child,.input-group-btn:last-child>.btn,.input-group-btn:last-child>.dropdown-toggle,.input-group-btn:first-child>.btn:not(:first-child){border-bottom-left-radius:0;border-top-left-radius:0}.input-group-addon:last-child{border-left:0}.input-group-btn{position:relative;white-space:nowrap}.input-group-btn:first-child>.btn{margin-right:-1px}.input-group-btn:last-child>.btn{margin-left:-1px}.input-group-btn>.btn{position:relative}.input-group-btn>.btn+.btn{margin-left:-4px}.input-group-btn>.btn:hover,.input-group-btn>.btn:active{z-index:2}.nav{padding-left:0;margin-bottom:0;list-style:none}.nav:before,.nav:after{display:table;content:" "}.nav:after{clear:both}.nav:before,.nav:after{display:table;content:" "}.nav:after{clear:both}.nav>li{position:relative;display:block}.nav>li>a{position:relative;display:block;padding:10px 15px}.nav>li>a:hover,.nav>li>a:focus{text-decoration:none;background-color:#eee}.nav>li.disabled>a{color:#999}.nav>li.disabled>a:hover,.nav>li.disabled>a:focus{color:#999;text-decoration:none;cursor:not-allowed;background-color:transparent}.nav .open>a,.nav .open>a:hover,.nav .open>a:focus{background-color:#eee;border-color:#428bca}.nav .open>a .caret,.nav .open>a:hover .caret,.nav .open>a:focus .caret{border-top-color:#2a6496;border-bottom-color:#2a6496}.nav .nav-divider{height:1px;margin:9px 0;overflow:hidden;background-color:#e5e5e5}.nav>li>a>img{max-width:none}.nav-tabs{border-bottom:1px solid #ddd}.nav-tabs>li{float:left;margin-bottom:-1px}.nav-tabs>li>a{margin-right:2px;line-height:1.428571429;border:1px solid transparent;border-radius:4px 4px 0 0}.nav-tabs>li>a:hover{border-color:#eee #eee #ddd}.nav-tabs>li.active>a,.nav-tabs>li.active>a:hover,.nav-tabs>li.active>a:focus{color:#555;cursor:default;background-color:#fff;border:1px solid #ddd;border-bottom-color:transparent}.nav-tabs.nav-justified{width:100%;border-bottom:0}.nav-tabs.nav-justified>li{float:none}.nav-tabs.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-tabs.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media(min-width:768px){.nav-tabs.nav-justified>li{display:table-cell;width:1%}.nav-tabs.nav-justified>li>a{margin-bottom:0}}.nav-tabs.nav-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border:1px solid #ddd}@media(min-width:768px){.nav-tabs.nav-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs.nav-justified>.active>a,.nav-tabs.nav-justified>.active>a:hover,.nav-tabs.nav-justified>.active>a:focus{border-bottom-color:#fff}}.nav-pills>li{float:left}.nav-pills>li>a{border-radius:4px}.nav-pills>li+li{margin-left:2px}.nav-pills>li.active>a,.nav-pills>li.active>a:hover,.nav-pills>li.active>a:focus{color:#fff;background-color:#428bca}.nav-pills>li.active>a .caret,.nav-pills>li.active>a:hover .caret,.nav-pills>li.active>a:focus .caret{border-top-color:#fff;border-bottom-color:#fff}.nav-stacked>li{float:none}.nav-stacked>li+li{margin-top:2px;margin-left:0}.nav-justified{width:100%}.nav-justified>li{float:none}.nav-justified>li>a{margin-bottom:5px;text-align:center}.nav-justified>.dropdown .dropdown-menu{top:auto;left:auto}@media(min-width:768px){.nav-justified>li{display:table-cell;width:1%}.nav-justified>li>a{margin-bottom:0}}.nav-tabs-justified{border-bottom:0}.nav-tabs-justified>li>a{margin-right:0;border-radius:4px}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border:1px solid #ddd}@media(min-width:768px){.nav-tabs-justified>li>a{border-bottom:1px solid #ddd;border-radius:4px 4px 0 0}.nav-tabs-justified>.active>a,.nav-tabs-justified>.active>a:hover,.nav-tabs-justified>.active>a:focus{border-bottom-color:#fff}}.tab-content>.tab-pane{display:none}.tab-content>.active{display:block}.nav .caret{border-top-color:#428bca;border-bottom-color:#428bca}.nav a:hover .caret{border-top-color:#2a6496;border-bottom-color:#2a6496}.nav-tabs .dropdown-menu{margin-top:-1px;border-top-right-radius:0;border-top-left-radius:0}.navbar{position:relative;min-height:50px;margin-bottom:20px;border:1px solid transparent}.navbar:before,.navbar:after{display:table;content:" "}.navbar:after{clear:both}.navbar:before,.navbar:after{display:table;content:" "}.navbar:after{clear:both}@media(min-width:768px){.navbar{border-radius:4px}}.navbar-header:before,.navbar-header:after{display:table;content:" "}.navbar-header:after{clear:both}.navbar-header:before,.navbar-header:after{display:table;content:" "}.navbar-header:after{clear:both}@media(min-width:768px){.navbar-header{float:left}}.navbar-collapse{max-height:340px;padding-right:15px;padding-left:15px;overflow-x:visible;border-top:1px solid transparent;box-shadow:inset 0 1px 0 rgba(255,255,255,0.1);-webkit-overflow-scrolling:touch}.navbar-collapse:before,.navbar-collapse:after{display:table;content:" "}.navbar-collapse:after{clear:both}.navbar-collapse:before,.navbar-collapse:after{display:table;content:" "}.navbar-collapse:after{clear:both}.navbar-collapse.in{overflow-y:auto}@media(min-width:768px){.navbar-collapse{width:auto;border-top:0;box-shadow:none}.navbar-collapse.collapse{display:block!important;height:auto!important;padding-bottom:0;overflow:visible!important}.navbar-collapse.in{overflow-y:auto}.navbar-collapse .navbar-nav.navbar-left:first-child{margin-left:-15px}.navbar-collapse .navbar-nav.navbar-right:last-child{margin-right:-15px}.navbar-collapse .navbar-text:last-child{margin-right:0}}.container>.navbar-header,.container>.navbar-collapse{margin-right:-15px;margin-left:-15px}@media(min-width:768px){.container>.navbar-header,.container>.navbar-collapse{margin-right:0;margin-left:0}}.navbar-static-top{z-index:1000;border-width:0 0 1px}@media(min-width:768px){.navbar-static-top{border-radius:0}}.navbar-fixed-top,.navbar-fixed-bottom{position:fixed;right:0;left:0;z-index:1030}@media(min-width:768px){.navbar-fixed-top,.navbar-fixed-bottom{border-radius:0}}.navbar-fixed-top{top:0;border-width:0 0 1px}.navbar-fixed-bottom{bottom:0;margin-bottom:0;border-width:1px 0 0}.navbar-brand{float:left;padding:15px 15px;font-size:18px;line-height:20px}.navbar-brand:hover,.navbar-brand:focus{text-decoration:none}@media(min-width:768px){.navbar>.container .navbar-brand{margin-left:-15px}}.navbar-toggle{position:relative;float:right;padding:9px 10px;margin-top:8px;margin-right:15px;margin-bottom:8px;background-color:transparent;border:1px solid transparent;border-radius:4px}.navbar-toggle .icon-bar{display:block;width:22px;height:2px;border-radius:1px}.navbar-toggle .icon-bar+.icon-bar{margin-top:4px}@media(min-width:768px){.navbar-toggle{display:none}}.navbar-nav{margin:7.5px -15px}.navbar-nav>li>a{padding-top:10px;padding-bottom:10px;line-height:20px}@media(max-width:767px){.navbar-nav .open .dropdown-menu{position:static;float:none;width:auto;margin-top:0;background-color:transparent;border:0;box-shadow:none}.navbar-nav .open .dropdown-menu>li>a,.navbar-nav .open .dropdown-menu .dropdown-header{padding:5px 15px 5px 25px}.navbar-nav .open .dropdown-menu>li>a{line-height:20px}.navbar-nav .open .dropdown-menu>li>a:hover,.navbar-nav .open .dropdown-menu>li>a:focus{background-image:none}}@media(min-width:768px){.navbar-nav{float:left;margin:0}.navbar-nav>li{float:left}.navbar-nav>li>a{padding-top:15px;padding-bottom:15px}}@media(min-width:768px){.navbar-left{float:left!important}.navbar-right{float:right!important}}.navbar-form{padding:10px 15px;margin-top:8px;margin-right:-15px;margin-bottom:8px;margin-left:-15px;border-top:1px solid transparent;border-bottom:1px solid transparent;-webkit-box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1);box-shadow:inset 0 1px 0 rgba(255,255,255,0.1),0 1px 0 rgba(255,255,255,0.1)}@media(min-width:768px){.navbar-form .form-group{display:inline-block;margin-bottom:0;vertical-align:middle}.navbar-form .form-control{display:inline-block}.navbar-form .radio,.navbar-form .checkbox{display:inline-block;padding-left:0;margin-top:0;margin-bottom:0}.navbar-form .radio input[type="radio"],.navbar-form .checkbox input[type="checkbox"]{float:none;margin-left:0}}@media(max-width:767px){.navbar-form .form-group{margin-bottom:5px}}@media(min-width:768px){.navbar-form{width:auto;padding-top:0;padding-bottom:0;margin-right:0;margin-left:0;border:0;-webkit-box-shadow:none;box-shadow:none}}.navbar-nav>li>.dropdown-menu{margin-top:0;border-top-right-radius:0;border-top-left-radius:0}.navbar-fixed-bottom .navbar-nav>li>.dropdown-menu{border-bottom-right-radius:0;border-bottom-left-radius:0}.navbar-nav.pull-right>li>.dropdown-menu,.navbar-nav>li>.dropdown-menu.pull-right{right:0;left:auto}.navbar-btn{margin-top:8px;margin-bottom:8px}.navbar-text{float:left;margin-top:15px;margin-bottom:15px}@media(min-width:768px){.navbar-text{margin-right:15px;margin-left:15px}}.navbar-default{background-color:#f8f8f8;border-color:#e7e7e7}.navbar-default .navbar-brand{color:#777}.navbar-default .navbar-brand:hover,.navbar-default .navbar-brand:focus{color:#5e5e5e;background-color:transparent}.navbar-default .navbar-text{color:#777}.navbar-default .navbar-nav>li>a{color:#777}.navbar-default .navbar-nav>li>a:hover,.navbar-default .navbar-nav>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav>.active>a,.navbar-default .navbar-nav>.active>a:hover,.navbar-default .navbar-nav>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.disabled>a,.navbar-default .navbar-nav>.disabled>a:hover,.navbar-default .navbar-nav>.disabled>a:focus{color:#ccc;background-color:transparent}.navbar-default .navbar-toggle{border-color:#ddd}.navbar-default .navbar-toggle:hover,.navbar-default .navbar-toggle:focus{background-color:#ddd}.navbar-default .navbar-toggle .icon-bar{background-color:#ccc}.navbar-default .navbar-collapse,.navbar-default .navbar-form{border-color:#e7e7e7}.navbar-default .navbar-nav>.dropdown>a:hover .caret,.navbar-default .navbar-nav>.dropdown>a:focus .caret{border-top-color:#333;border-bottom-color:#333}.navbar-default .navbar-nav>.open>a,.navbar-default .navbar-nav>.open>a:hover,.navbar-default .navbar-nav>.open>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav>.open>a .caret,.navbar-default .navbar-nav>.open>a:hover .caret,.navbar-default .navbar-nav>.open>a:focus .caret{border-top-color:#555;border-bottom-color:#555}.navbar-default .navbar-nav>.dropdown>a .caret{border-top-color:#777;border-bottom-color:#777}@media(max-width:767px){.navbar-default .navbar-nav .open .dropdown-menu>li>a{color:#777}.navbar-default .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>li>a:focus{color:#333;background-color:transparent}.navbar-default .navbar-nav .open .dropdown-menu>.active>a,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.active>a:focus{color:#555;background-color:#e7e7e7}.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-default .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#ccc;background-color:transparent}}.navbar-default .navbar-link{color:#777}.navbar-default .navbar-link:hover{color:#333}.navbar-inverse{background-color:#222;border-color:#080808}.navbar-inverse .navbar-brand{color:#999}.navbar-inverse .navbar-brand:hover,.navbar-inverse .navbar-brand:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-text{color:#999}.navbar-inverse .navbar-nav>li>a{color:#999}.navbar-inverse .navbar-nav>li>a:hover,.navbar-inverse .navbar-nav>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav>.active>a,.navbar-inverse .navbar-nav>.active>a:hover,.navbar-inverse .navbar-nav>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.disabled>a,.navbar-inverse .navbar-nav>.disabled>a:hover,.navbar-inverse .navbar-nav>.disabled>a:focus{color:#444;background-color:transparent}.navbar-inverse .navbar-toggle{border-color:#333}.navbar-inverse .navbar-toggle:hover,.navbar-inverse .navbar-toggle:focus{background-color:#333}.navbar-inverse .navbar-toggle .icon-bar{background-color:#fff}.navbar-inverse .navbar-collapse,.navbar-inverse .navbar-form{border-color:#101010}.navbar-inverse .navbar-nav>.open>a,.navbar-inverse .navbar-nav>.open>a:hover,.navbar-inverse .navbar-nav>.open>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav>.dropdown>a:hover .caret{border-top-color:#fff;border-bottom-color:#fff}.navbar-inverse .navbar-nav>.dropdown>a .caret{border-top-color:#999;border-bottom-color:#999}.navbar-inverse .navbar-nav>.open>a .caret,.navbar-inverse .navbar-nav>.open>a:hover .caret,.navbar-inverse .navbar-nav>.open>a:focus .caret{border-top-color:#fff;border-bottom-color:#fff}@media(max-width:767px){.navbar-inverse .navbar-nav .open .dropdown-menu>.dropdown-header{border-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a{color:#999}.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>li>a:focus{color:#fff;background-color:transparent}.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.active>a:focus{color:#fff;background-color:#080808}.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:hover,.navbar-inverse .navbar-nav .open .dropdown-menu>.disabled>a:focus{color:#444;background-color:transparent}}.navbar-inverse .navbar-link{color:#999}.navbar-inverse .navbar-link:hover{color:#fff}.breadcrumb{padding:8px 15px;margin-bottom:20px;list-style:none;background-color:#f5f5f5;border-radius:4px}.breadcrumb>li{display:inline-block}.breadcrumb>li+li:before{padding:0 5px;color:#ccc;content:"/\00a0"}.breadcrumb>.active{color:#999}.pagination{display:inline-block;padding-left:0;margin:20px 0;border-radius:4px}.pagination>li{display:inline}.pagination>li>a,.pagination>li>span{position:relative;float:left;padding:6px 12px;margin-left:-1px;line-height:1.428571429;text-decoration:none;background-color:#fff;border:1px solid #ddd}.pagination>li:first-child>a,.pagination>li:first-child>span{margin-left:0;border-bottom-left-radius:4px;border-top-left-radius:4px}.pagination>li:last-child>a,.pagination>li:last-child>span{border-top-right-radius:4px;border-bottom-right-radius:4px}.pagination>li>a:hover,.pagination>li>span:hover,.pagination>li>a:focus,.pagination>li>span:focus{background-color:#eee}.pagination>.active>a,.pagination>.active>span,.pagination>.active>a:hover,.pagination>.active>span:hover,.pagination>.active>a:focus,.pagination>.active>span:focus{z-index:2;color:#fff;cursor:default;background-color:#428bca;border-color:#428bca}.pagination>.disabled>span,.pagination>.disabled>span:hover,.pagination>.disabled>span:focus,.pagination>.disabled>a,.pagination>.disabled>a:hover,.pagination>.disabled>a:focus{color:#999;cursor:not-allowed;background-color:#fff;border-color:#ddd}.pagination-lg>li>a,.pagination-lg>li>span{padding:10px 16px;font-size:18px}.pagination-lg>li:first-child>a,.pagination-lg>li:first-child>span{border-bottom-left-radius:6px;border-top-left-radius:6px}.pagination-lg>li:last-child>a,.pagination-lg>li:last-child>span{border-top-right-radius:6px;border-bottom-right-radius:6px}.pagination-sm>li>a,.pagination-sm>li>span{padding:5px 10px;font-size:12px}.pagination-sm>li:first-child>a,.pagination-sm>li:first-child>span{border-bottom-left-radius:3px;border-top-left-radius:3px}.pagination-sm>li:last-child>a,.pagination-sm>li:last-child>span{border-top-right-radius:3px;border-bottom-right-radius:3px}.pager{padding-left:0;margin:20px 0;text-align:center;list-style:none}.pager:before,.pager:after{display:table;content:" "}.pager:after{clear:both}.pager:before,.pager:after{display:table;content:" "}.pager:after{clear:both}.pager li{display:inline}.pager li>a,.pager li>span{display:inline-block;padding:5px 14px;background-color:#fff;border:1px solid #ddd;border-radius:15px}.pager li>a:hover,.pager li>a:focus{text-decoration:none;background-color:#eee}.pager .next>a,.pager .next>span{float:right}.pager .previous>a,.pager .previous>span{float:left}.pager .disabled>a,.pager .disabled>a:hover,.pager .disabled>a:focus,.pager .disabled>span{color:#999;cursor:not-allowed;background-color:#fff}.label{display:inline;padding:.2em .6em .3em;font-size:75%;font-weight:bold;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;border-radius:.25em}.label[href]:hover,.label[href]:focus{color:#fff;text-decoration:none;cursor:pointer}.label:empty{display:none}.label-default{background-color:#999}.label-default[href]:hover,.label-default[href]:focus{background-color:#808080}.label-primary{background-color:#428bca}.label-primary[href]:hover,.label-primary[href]:focus{background-color:#3071a9}.label-success{background-color:#5cb85c}.label-success[href]:hover,.label-success[href]:focus{background-color:#449d44}.label-info{background-color:#5bc0de}.label-info[href]:hover,.label-info[href]:focus{background-color:#31b0d5}.label-warning{background-color:#f0ad4e}.label-warning[href]:hover,.label-warning[href]:focus{background-color:#ec971f}.label-danger{background-color:#d9534f}.label-danger[href]:hover,.label-danger[href]:focus{background-color:#c9302c}.badge{display:inline-block;min-width:10px;padding:3px 7px;font-size:12px;font-weight:bold;line-height:1;color:#fff;text-align:center;white-space:nowrap;vertical-align:baseline;background-color:#999;border-radius:10px}.badge:empty{display:none}a.badge:hover,a.badge:focus{color:#fff;text-decoration:none;cursor:pointer}.btn .badge{position:relative;top:-1px}a.list-group-item.active>.badge,.nav-pills>.active>a>.badge{color:#428bca;background-color:#fff}.nav-pills>li>a>.badge{margin-left:3px}.jumbotron{padding:30px;margin-bottom:30px;font-size:21px;font-weight:200;line-height:2.1428571435;color:inherit;background-color:#eee}.jumbotron h1{line-height:1;color:inherit}.jumbotron p{line-height:1.4}.container .jumbotron{border-radius:6px}@media screen and (min-width:768px){.jumbotron{padding-top:48px;padding-bottom:48px}.container .jumbotron{padding-right:60px;padding-left:60px}.jumbotron h1{font-size:63px}}.thumbnail{display:inline-block;display:block;height:auto;max-width:100%;padding:4px;margin-bottom:20px;line-height:1.428571429;background-color:#fff;border:1px solid #ddd;border-radius:4px;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out}.thumbnail>img{display:block;height:auto;max-width:100%;margin-right:auto;margin-left:auto}a.thumbnail:hover,a.thumbnail:focus,a.thumbnail.active{border-color:#428bca}.thumbnail .caption{padding:9px;color:#333}.alert{padding:15px;margin-bottom:20px;border:1px solid transparent;border-radius:4px}.alert h4{margin-top:0;color:inherit}.alert .alert-link{font-weight:bold}.alert>p,.alert>ul{margin-bottom:0}.alert>p+p{margin-top:5px}.alert-dismissable{padding-right:35px}.alert-dismissable .close{position:relative;top:-2px;right:-21px;color:inherit}.alert-success{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.alert-success hr{border-top-color:#c9e2b3}.alert-success .alert-link{color:#356635}.alert-info{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.alert-info hr{border-top-color:#a6e1ec}.alert-info .alert-link{color:#2d6987}.alert-warning{color:#c09853;background-color:#fcf8e3;border-color:#faebcc}.alert-warning hr{border-top-color:#f7e1b5}.alert-warning .alert-link{color:#a47e3c}.alert-danger{color:#b94a48;background-color:#f2dede;border-color:#ebccd1}.alert-danger hr{border-top-color:#e4b9c0}.alert-danger .alert-link{color:#953b39}@-webkit-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-moz-keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}@-o-keyframes progress-bar-stripes{from{background-position:0 0}to{background-position:40px 0}}@keyframes progress-bar-stripes{from{background-position:40px 0}to{background-position:0 0}}.progress{height:20px;margin-bottom:20px;overflow:hidden;background-color:#f5f5f5;border-radius:4px;-webkit-box-shadow:inset 0 1px 2px rgba(0,0,0,0.1);box-shadow:inset 0 1px 2px rgba(0,0,0,0.1)}.progress-bar{float:left;width:0;height:100%;font-size:12px;line-height:20px;color:#fff;text-align:center;background-color:#428bca;-webkit-box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);box-shadow:inset 0 -1px 0 rgba(0,0,0,0.15);-webkit-transition:width .6s ease;transition:width .6s ease}.progress-striped .progress-bar{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-size:40px 40px}.progress.active .progress-bar{-webkit-animation:progress-bar-stripes 2s linear infinite;animation:progress-bar-stripes 2s linear infinite}.progress-bar-success{background-color:#5cb85c}.progress-striped .progress-bar-success{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-bar-info{background-color:#5bc0de}.progress-striped .progress-bar-info{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-bar-warning{background-color:#f0ad4e}.progress-striped .progress-bar-warning{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.progress-bar-danger{background-color:#d9534f}.progress-striped .progress-bar-danger{background-image:-webkit-gradient(linear,0 100%,100% 0,color-stop(0.25,rgba(255,255,255,0.15)),color-stop(0.25,transparent),color-stop(0.5,transparent),color-stop(0.5,rgba(255,255,255,0.15)),color-stop(0.75,rgba(255,255,255,0.15)),color-stop(0.75,transparent),to(transparent));background-image:-webkit-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:-moz-linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent);background-image:linear-gradient(45deg,rgba(255,255,255,0.15) 25%,transparent 25%,transparent 50%,rgba(255,255,255,0.15) 50%,rgba(255,255,255,0.15) 75%,transparent 75%,transparent)}.media,.media-body{overflow:hidden;zoom:1}.media,.media .media{margin-top:15px}.media:first-child{margin-top:0}.media-object{display:block}.media-heading{margin:0 0 5px}.media>.pull-left{margin-right:10px}.media>.pull-right{margin-left:10px}.media-list{padding-left:0;list-style:none}.list-group{padding-left:0;margin-bottom:20px}.list-group-item{position:relative;display:block;padding:10px 15px;margin-bottom:-1px;background-color:#fff;border:1px solid #ddd}.list-group-item:first-child{border-top-right-radius:4px;border-top-left-radius:4px}.list-group-item:last-child{margin-bottom:0;border-bottom-right-radius:4px;border-bottom-left-radius:4px}.list-group-item>.badge{float:right}.list-group-item>.badge+.badge{margin-right:5px}a.list-group-item{color:#555}a.list-group-item .list-group-item-heading{color:#333}a.list-group-item:hover,a.list-group-item:focus{text-decoration:none;background-color:#f5f5f5}a.list-group-item.active,a.list-group-item.active:hover,a.list-group-item.active:focus{z-index:2;color:#fff;background-color:#428bca;border-color:#428bca}a.list-group-item.active .list-group-item-heading,a.list-group-item.active:hover .list-group-item-heading,a.list-group-item.active:focus .list-group-item-heading{color:inherit}a.list-group-item.active .list-group-item-text,a.list-group-item.active:hover .list-group-item-text,a.list-group-item.active:focus .list-group-item-text{color:#e1edf7}.list-group-item-heading{margin-top:0;margin-bottom:5px}.list-group-item-text{margin-bottom:0;line-height:1.3}.panel{margin-bottom:20px;background-color:#fff;border:1px solid transparent;border-radius:4px;-webkit-box-shadow:0 1px 1px rgba(0,0,0,0.05);box-shadow:0 1px 1px rgba(0,0,0,0.05)}.panel-body{padding:15px}.panel-body:before,.panel-body:after{display:table;content:" "}.panel-body:after{clear:both}.panel-body:before,.panel-body:after{display:table;content:" "}.panel-body:after{clear:both}.panel>.list-group{margin-bottom:0}.panel>.list-group .list-group-item{border-width:1px 0}.panel>.list-group .list-group-item:first-child{border-top-right-radius:0;border-top-left-radius:0}.panel>.list-group .list-group-item:last-child{border-bottom:0}.panel-heading+.list-group .list-group-item:first-child{border-top-width:0}.panel>.table,.panel>.table-responsive{margin-bottom:0}.panel>.panel-body+.table,.panel>.panel-body+.table-responsive{border-top:1px solid #ddd}.panel>.table-bordered,.panel>.table-responsive>.table-bordered{border:0}.panel>.table-bordered>thead>tr>th:first-child,.panel>.table-responsive>.table-bordered>thead>tr>th:first-child,.panel>.table-bordered>tbody>tr>th:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:first-child,.panel>.table-bordered>tfoot>tr>th:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:first-child,.panel>.table-bordered>thead>tr>td:first-child,.panel>.table-responsive>.table-bordered>thead>tr>td:first-child,.panel>.table-bordered>tbody>tr>td:first-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:first-child,.panel>.table-bordered>tfoot>tr>td:first-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:first-child{border-left:0}.panel>.table-bordered>thead>tr>th:last-child,.panel>.table-responsive>.table-bordered>thead>tr>th:last-child,.panel>.table-bordered>tbody>tr>th:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>th:last-child,.panel>.table-bordered>tfoot>tr>th:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>th:last-child,.panel>.table-bordered>thead>tr>td:last-child,.panel>.table-responsive>.table-bordered>thead>tr>td:last-child,.panel>.table-bordered>tbody>tr>td:last-child,.panel>.table-responsive>.table-bordered>tbody>tr>td:last-child,.panel>.table-bordered>tfoot>tr>td:last-child,.panel>.table-responsive>.table-bordered>tfoot>tr>td:last-child{border-right:0}.panel>.table-bordered>thead>tr:last-child>th,.panel>.table-responsive>.table-bordered>thead>tr:last-child>th,.panel>.table-bordered>tbody>tr:last-child>th,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>th,.panel>.table-bordered>tfoot>tr:last-child>th,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>th,.panel>.table-bordered>thead>tr:last-child>td,.panel>.table-responsive>.table-bordered>thead>tr:last-child>td,.panel>.table-bordered>tbody>tr:last-child>td,.panel>.table-responsive>.table-bordered>tbody>tr:last-child>td,.panel>.table-bordered>tfoot>tr:last-child>td,.panel>.table-responsive>.table-bordered>tfoot>tr:last-child>td{border-bottom:0}.panel-heading{padding:10px 15px;border-bottom:1px solid transparent;border-top-right-radius:3px;border-top-left-radius:3px}.panel-heading>.dropdown .dropdown-toggle{color:inherit}.panel-title{margin-top:0;margin-bottom:0;font-size:16px}.panel-title>a{color:inherit}.panel-footer{padding:10px 15px;background-color:#f5f5f5;border-top:1px solid #ddd;border-bottom-right-radius:3px;border-bottom-left-radius:3px}.panel-group .panel{margin-bottom:0;overflow:hidden;border-radius:4px}.panel-group .panel+.panel{margin-top:5px}.panel-group .panel-heading{border-bottom:0}.panel-group .panel-heading+.panel-collapse .panel-body{border-top:1px solid #ddd}.panel-group .panel-footer{border-top:0}.panel-group .panel-footer+.panel-collapse .panel-body{border-bottom:1px solid #ddd}.panel-default{border-color:#ddd}.panel-default>.panel-heading{color:#333;background-color:#f5f5f5;border-color:#ddd}.panel-default>.panel-heading+.panel-collapse .panel-body{border-top-color:#ddd}.panel-default>.panel-heading>.dropdown .caret{border-color:#333 transparent}.panel-default>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#ddd}.panel-primary{border-color:#428bca}.panel-primary>.panel-heading{color:#fff;background-color:#428bca;border-color:#428bca}.panel-primary>.panel-heading+.panel-collapse .panel-body{border-top-color:#428bca}.panel-primary>.panel-heading>.dropdown .caret{border-color:#fff transparent}.panel-primary>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#428bca}.panel-success{border-color:#d6e9c6}.panel-success>.panel-heading{color:#468847;background-color:#dff0d8;border-color:#d6e9c6}.panel-success>.panel-heading+.panel-collapse .panel-body{border-top-color:#d6e9c6}.panel-success>.panel-heading>.dropdown .caret{border-color:#468847 transparent}.panel-success>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#d6e9c6}.panel-warning{border-color:#faebcc}.panel-warning>.panel-heading{color:#c09853;background-color:#fcf8e3;border-color:#faebcc}.panel-warning>.panel-heading+.panel-collapse .panel-body{border-top-color:#faebcc}.panel-warning>.panel-heading>.dropdown .caret{border-color:#c09853 transparent}.panel-warning>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#faebcc}.panel-danger{border-color:#ebccd1}.panel-danger>.panel-heading{color:#b94a48;background-color:#f2dede;border-color:#ebccd1}.panel-danger>.panel-heading+.panel-collapse .panel-body{border-top-color:#ebccd1}.panel-danger>.panel-heading>.dropdown .caret{border-color:#b94a48 transparent}.panel-danger>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#ebccd1}.panel-info{border-color:#bce8f1}.panel-info>.panel-heading{color:#3a87ad;background-color:#d9edf7;border-color:#bce8f1}.panel-info>.panel-heading+.panel-collapse .panel-body{border-top-color:#bce8f1}.panel-info>.panel-heading>.dropdown .caret{border-color:#3a87ad transparent}.panel-info>.panel-footer+.panel-collapse .panel-body{border-bottom-color:#bce8f1}.well{min-height:20px;padding:19px;margin-bottom:20px;background-color:#f5f5f5;border:1px solid #e3e3e3;border-radius:4px;-webkit-box-shadow:inset 0 1px 1px rgba(0,0,0,0.05);box-shadow:inset 0 1px 1px rgba(0,0,0,0.05)}.well blockquote{border-color:#ddd;border-color:rgba(0,0,0,0.15)}.well-lg{padding:24px;border-radius:6px}.well-sm{padding:9px;border-radius:3px}.close{float:right;font-size:21px;font-weight:bold;line-height:1;color:#000;text-shadow:0 1px 0 #fff;opacity:.2;filter:alpha(opacity=20)}.close:hover,.close:focus{color:#000;text-decoration:none;cursor:pointer;opacity:.5;filter:alpha(opacity=50)}button.close{padding:0;cursor:pointer;background:transparent;border:0;-webkit-appearance:none}.modal-open{overflow:hidden}.modal{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1040;display:none;overflow:auto;overflow-y:scroll}.modal.fade .modal-dialog{-webkit-transform:translate(0,-25%);-ms-transform:translate(0,-25%);transform:translate(0,-25%);-webkit-transition:-webkit-transform .3s ease-out;-moz-transition:-moz-transform .3s ease-out;-o-transition:-o-transform .3s ease-out;transition:transform .3s ease-out}.modal.in .modal-dialog{-webkit-transform:translate(0,0);-ms-transform:translate(0,0);transform:translate(0,0)}.modal-dialog{position:relative;z-index:1050;width:auto;padding:10px;margin-right:auto;margin-left:auto}.modal-content{position:relative;background-color:#fff;border:1px solid #999;border:1px solid rgba(0,0,0,0.2);border-radius:6px;outline:0;-webkit-box-shadow:0 3px 9px rgba(0,0,0,0.5);box-shadow:0 3px 9px rgba(0,0,0,0.5);background-clip:padding-box}.modal-backdrop{position:fixed;top:0;right:0;bottom:0;left:0;z-index:1030;background-color:#000}.modal-backdrop.fade{opacity:0;filter:alpha(opacity=0)}.modal-backdrop.in{opacity:.5;filter:alpha(opacity=50)}.modal-header{min-height:16.428571429px;padding:15px;border-bottom:1px solid #e5e5e5}.modal-header .close{margin-top:-2px}.modal-title{margin:0;line-height:1.428571429}.modal-body{position:relative;padding:20px}.modal-footer{padding:19px 20px 20px;margin-top:15px;text-align:right;border-top:1px solid #e5e5e5}.modal-footer:before,.modal-footer:after{display:table;content:" "}.modal-footer:after{clear:both}.modal-footer:before,.modal-footer:after{display:table;content:" "}.modal-footer:after{clear:both}.modal-footer .btn+.btn{margin-bottom:0;margin-left:5px}.modal-footer .btn-group .btn+.btn{margin-left:-1px}.modal-footer .btn-block+.btn-block{margin-left:0}@media screen and (min-width:768px){.modal-dialog{width:600px;padding-top:30px;padding-bottom:30px}.modal-content{-webkit-box-shadow:0 5px 15px rgba(0,0,0,0.5);box-shadow:0 5px 15px rgba(0,0,0,0.5)}}.tooltip{position:absolute;z-index:1030;display:block;font-size:12px;line-height:1.4;opacity:0;filter:alpha(opacity=0);visibility:visible}.tooltip.in{opacity:.9;filter:alpha(opacity=90)}.tooltip.top{padding:5px 0;margin-top:-3px}.tooltip.right{padding:0 5px;margin-left:3px}.tooltip.bottom{padding:5px 0;margin-top:3px}.tooltip.left{padding:0 5px;margin-left:-3px}.tooltip-inner{max-width:200px;padding:3px 8px;color:#fff;text-align:center;text-decoration:none;background-color:#000;border-radius:4px}.tooltip-arrow{position:absolute;width:0;height:0;border-color:transparent;border-style:solid}.tooltip.top .tooltip-arrow{bottom:0;left:50%;margin-left:-5px;border-top-color:#000;border-width:5px 5px 0}.tooltip.top-left .tooltip-arrow{bottom:0;left:5px;border-top-color:#000;border-width:5px 5px 0}.tooltip.top-right .tooltip-arrow{right:5px;bottom:0;border-top-color:#000;border-width:5px 5px 0}.tooltip.right .tooltip-arrow{top:50%;left:0;margin-top:-5px;border-right-color:#000;border-width:5px 5px 5px 0}.tooltip.left .tooltip-arrow{top:50%;right:0;margin-top:-5px;border-left-color:#000;border-width:5px 0 5px 5px}.tooltip.bottom .tooltip-arrow{top:0;left:50%;margin-left:-5px;border-bottom-color:#000;border-width:0 5px 5px}.tooltip.bottom-left .tooltip-arrow{top:0;left:5px;border-bottom-color:#000;border-width:0 5px 5px}.tooltip.bottom-right .tooltip-arrow{top:0;right:5px;border-bottom-color:#000;border-width:0 5px 5px}.popover{position:absolute;top:0;left:0;z-index:1010;display:none;max-width:276px;padding:1px;text-align:left;white-space:normal;background-color:#fff;border:1px solid #ccc;border:1px solid rgba(0,0,0,0.2);border-radius:6px;-webkit-box-shadow:0 5px 10px rgba(0,0,0,0.2);box-shadow:0 5px 10px rgba(0,0,0,0.2);background-clip:padding-box}.popover.top{margin-top:-10px}.popover.right{margin-left:10px}.popover.bottom{margin-top:10px}.popover.left{margin-left:-10px}.popover-title{padding:8px 14px;margin:0;font-size:14px;font-weight:normal;line-height:18px;background-color:#f7f7f7;border-bottom:1px solid #ebebeb;border-radius:5px 5px 0 0}.popover-content{padding:9px 14px}.popover .arrow,.popover .arrow:after{position:absolute;display:block;width:0;height:0;border-color:transparent;border-style:solid}.popover .arrow{border-width:11px}.popover .arrow:after{border-width:10px;content:""}.popover.top .arrow{bottom:-11px;left:50%;margin-left:-11px;border-top-color:#999;border-top-color:rgba(0,0,0,0.25);border-bottom-width:0}.popover.top .arrow:after{bottom:1px;margin-left:-10px;border-top-color:#fff;border-bottom-width:0;content:" "}.popover.right .arrow{top:50%;left:-11px;margin-top:-11px;border-right-color:#999;border-right-color:rgba(0,0,0,0.25);border-left-width:0}.popover.right .arrow:after{bottom:-10px;left:1px;border-right-color:#fff;border-left-width:0;content:" "}.popover.bottom .arrow{top:-11px;left:50%;margin-left:-11px;border-bottom-color:#999;border-bottom-color:rgba(0,0,0,0.25);border-top-width:0}.popover.bottom .arrow:after{top:1px;margin-left:-10px;border-bottom-color:#fff;border-top-width:0;content:" "}.popover.left .arrow{top:50%;right:-11px;margin-top:-11px;border-left-color:#999;border-left-color:rgba(0,0,0,0.25);border-right-width:0}.popover.left .arrow:after{right:1px;bottom:-10px;border-left-color:#fff;border-right-width:0;content:" "}.carousel{position:relative}.carousel-inner{position:relative;width:100%;overflow:hidden}.carousel-inner>.item{position:relative;display:none;-webkit-transition:.6s ease-in-out left;transition:.6s ease-in-out left}.carousel-inner>.item>img,.carousel-inner>.item>a>img{display:block;height:auto;max-width:100%;line-height:1}.carousel-inner>.active,.carousel-inner>.next,.carousel-inner>.prev{display:block}.carousel-inner>.active{left:0}.carousel-inner>.next,.carousel-inner>.prev{position:absolute;top:0;width:100%}.carousel-inner>.next{left:100%}.carousel-inner>.prev{left:-100%}.carousel-inner>.next.left,.carousel-inner>.prev.right{left:0}.carousel-inner>.active.left{left:-100%}.carousel-inner>.active.right{left:100%}.carousel-control{position:absolute;top:0;bottom:0;left:0;width:15%;font-size:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,0.6);opacity:.5;filter:alpha(opacity=50)}.carousel-control.left{background-image:-webkit-gradient(linear,0 top,100% top,from(rgba(0,0,0,0.5)),to(rgba(0,0,0,0.0001)));background-image:-webkit-linear-gradient(left,color-stop(rgba(0,0,0,0.5) 0),color-stop(rgba(0,0,0,0.0001) 100%));background-image:-moz-linear-gradient(left,rgba(0,0,0,0.5) 0,rgba(0,0,0,0.0001) 100%);background-image:linear-gradient(to right,rgba(0,0,0,0.5) 0,rgba(0,0,0,0.0001) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#80000000',endColorstr='#00000000',GradientType=1)}.carousel-control.right{right:0;left:auto;background-image:-webkit-gradient(linear,0 top,100% top,from(rgba(0,0,0,0.0001)),to(rgba(0,0,0,0.5)));background-image:-webkit-linear-gradient(left,color-stop(rgba(0,0,0,0.0001) 0),color-stop(rgba(0,0,0,0.5) 100%));background-image:-moz-linear-gradient(left,rgba(0,0,0,0.0001) 0,rgba(0,0,0,0.5) 100%);background-image:linear-gradient(to right,rgba(0,0,0,0.0001) 0,rgba(0,0,0,0.5) 100%);background-repeat:repeat-x;filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#00000000',endColorstr='#80000000',GradientType=1)}.carousel-control:hover,.carousel-control:focus{color:#fff;text-decoration:none;opacity:.9;filter:alpha(opacity=90)}.carousel-control .icon-prev,.carousel-control .icon-next,.carousel-control .glyphicon-chevron-left,.carousel-control .glyphicon-chevron-right{position:absolute;top:50%;z-index:5;display:inline-block}.carousel-control .icon-prev,.carousel-control .glyphicon-chevron-left{left:50%}.carousel-control .icon-next,.carousel-control .glyphicon-chevron-right{right:50%}.carousel-control .icon-prev,.carousel-control .icon-next{width:20px;height:20px;margin-top:-10px;margin-left:-10px;font-family:serif}.carousel-control .icon-prev:before{content:'\2039'}.carousel-control .icon-next:before{content:'\203a'}.carousel-indicators{position:absolute;bottom:10px;left:50%;z-index:15;width:60%;padding-left:0;margin-left:-30%;text-align:center;list-style:none}.carousel-indicators li{display:inline-block;width:10px;height:10px;margin:1px;text-indent:-999px;cursor:pointer;background-color:#000 \9;background-color:rgba(0,0,0,0);border:1px solid #fff;border-radius:10px}.carousel-indicators .active{width:12px;height:12px;margin:0;background-color:#fff}.carousel-caption{position:absolute;right:15%;bottom:20px;left:15%;z-index:10;padding-top:20px;padding-bottom:20px;color:#fff;text-align:center;text-shadow:0 1px 2px rgba(0,0,0,0.6)}.carousel-caption .btn{text-shadow:none}@media screen and (min-width:768px){.carousel-control .glyphicons-chevron-left,.carousel-control .glyphicons-chevron-right,.carousel-control .icon-prev,.carousel-control .icon-next{width:30px;height:30px;margin-top:-15px;margin-left:-15px;font-size:30px}.carousel-caption{right:20%;left:20%;padding-bottom:30px}.carousel-indicators{bottom:20px}}.clearfix:before,.clearfix:after{display:table;content:" "}.clearfix:after{clear:both}.center-block{display:block;margin-right:auto;margin-left:auto}.pull-right{float:right!important}.pull-left{float:left!important}.hide{display:none!important}.show{display:block!important}.invisible{visibility:hidden}.text-hide{font:0/0 a;color:transparent;text-shadow:none;background-color:transparent;border:0}.hidden{display:none!important;visibility:hidden!important}.affix{position:fixed}@-ms-viewport{width:device-width}.visible-xs,tr.visible-xs,th.visible-xs,td.visible-xs{display:none!important}@media(max-width:767px){.visible-xs{display:block!important}tr.visible-xs{display:table-row!important}th.visible-xs,td.visible-xs{display:table-cell!important}}@media(min-width:768px) and (max-width:991px){.visible-xs.visible-sm{display:block!important}tr.visible-xs.visible-sm{display:table-row!important}th.visible-xs.visible-sm,td.visible-xs.visible-sm{display:table-cell!important}}@media(min-width:992px) and (max-width:1199px){.visible-xs.visible-md{display:block!important}tr.visible-xs.visible-md{display:table-row!important}th.visible-xs.visible-md,td.visible-xs.visible-md{display:table-cell!important}}@media(min-width:1200px){.visible-xs.visible-lg{display:block!important}tr.visible-xs.visible-lg{display:table-row!important}th.visible-xs.visible-lg,td.visible-xs.visible-lg{display:table-cell!important}}.visible-sm,tr.visible-sm,th.visible-sm,td.visible-sm{display:none!important}@media(max-width:767px){.visible-sm.visible-xs{display:block!important}tr.visible-sm.visible-xs{display:table-row!important}th.visible-sm.visible-xs,td.visible-sm.visible-xs{display:table-cell!important}}@media(min-width:768px) and (max-width:991px){.visible-sm{display:block!important}tr.visible-sm{display:table-row!important}th.visible-sm,td.visible-sm{display:table-cell!important}}@media(min-width:992px) and (max-width:1199px){.visible-sm.visible-md{display:block!important}tr.visible-sm.visible-md{display:table-row!important}th.visible-sm.visible-md,td.visible-sm.visible-md{display:table-cell!important}}@media(min-width:1200px){.visible-sm.visible-lg{display:block!important}tr.visible-sm.visible-lg{display:table-row!important}th.visible-sm.visible-lg,td.visible-sm.visible-lg{display:table-cell!important}}.visible-md,tr.visible-md,th.visible-md,td.visible-md{display:none!important}@media(max-width:767px){.visible-md.visible-xs{display:block!important}tr.visible-md.visible-xs{display:table-row!important}th.visible-md.visible-xs,td.visible-md.visible-xs{display:table-cell!important}}@media(min-width:768px) and (max-width:991px){.visible-md.visible-sm{display:block!important}tr.visible-md.visible-sm{display:table-row!important}th.visible-md.visible-sm,td.visible-md.visible-sm{display:table-cell!important}}@media(min-width:992px) and (max-width:1199px){.visible-md{display:block!important}tr.visible-md{display:table-row!important}th.visible-md,td.visible-md{display:table-cell!important}}@media(min-width:1200px){.visible-md.visible-lg{display:block!important}tr.visible-md.visible-lg{display:table-row!important}th.visible-md.visible-lg,td.visible-md.visible-lg{display:table-cell!important}}.visible-lg,tr.visible-lg,th.visible-lg,td.visible-lg{display:none!important}@media(max-width:767px){.visible-lg.visible-xs{display:block!important}tr.visible-lg.visible-xs{display:table-row!important}th.visible-lg.visible-xs,td.visible-lg.visible-xs{display:table-cell!important}}@media(min-width:768px) and (max-width:991px){.visible-lg.visible-sm{display:block!important}tr.visible-lg.visible-sm{display:table-row!important}th.visible-lg.visible-sm,td.visible-lg.visible-sm{display:table-cell!important}}@media(min-width:992px) and (max-width:1199px){.visible-lg.visible-md{display:block!important}tr.visible-lg.visible-md{display:table-row!important}th.visible-lg.visible-md,td.visible-lg.visible-md{display:table-cell!important}}@media(min-width:1200px){.visible-lg{display:block!important}tr.visible-lg{display:table-row!important}th.visible-lg,td.visible-lg{display:table-cell!important}}.hidden-xs{display:block!important}tr.hidden-xs{display:table-row!important}th.hidden-xs,td.hidden-xs{display:table-cell!important}@media(max-width:767px){.hidden-xs,tr.hidden-xs,th.hidden-xs,td.hidden-xs{display:none!important}}@media(min-width:768px) and (max-width:991px){.hidden-xs.hidden-sm,tr.hidden-xs.hidden-sm,th.hidden-xs.hidden-sm,td.hidden-xs.hidden-sm{display:none!important}}@media(min-width:992px) and (max-width:1199px){.hidden-xs.hidden-md,tr.hidden-xs.hidden-md,th.hidden-xs.hidden-md,td.hidden-xs.hidden-md{display:none!important}}@media(min-width:1200px){.hidden-xs.hidden-lg,tr.hidden-xs.hidden-lg,th.hidden-xs.hidden-lg,td.hidden-xs.hidden-lg{display:none!important}}.hidden-sm{display:block!important}tr.hidden-sm{display:table-row!important}th.hidden-sm,td.hidden-sm{display:table-cell!important}@media(max-width:767px){.hidden-sm.hidden-xs,tr.hidden-sm.hidden-xs,th.hidden-sm.hidden-xs,td.hidden-sm.hidden-xs{display:none!important}}@media(min-width:768px) and (max-width:991px){.hidden-sm,tr.hidden-sm,th.hidden-sm,td.hidden-sm{display:none!important}}@media(min-width:992px) and (max-width:1199px){.hidden-sm.hidden-md,tr.hidden-sm.hidden-md,th.hidden-sm.hidden-md,td.hidden-sm.hidden-md{display:none!important}}@media(min-width:1200px){.hidden-sm.hidden-lg,tr.hidden-sm.hidden-lg,th.hidden-sm.hidden-lg,td.hidden-sm.hidden-lg{display:none!important}}.hidden-md{display:block!important}tr.hidden-md{display:table-row!important}th.hidden-md,td.hidden-md{display:table-cell!important}@media(max-width:767px){.hidden-md.hidden-xs,tr.hidden-md.hidden-xs,th.hidden-md.hidden-xs,td.hidden-md.hidden-xs{display:none!important}}@media(min-width:768px) and (max-width:991px){.hidden-md.hidden-sm,tr.hidden-md.hidden-sm,th.hidden-md.hidden-sm,td.hidden-md.hidden-sm{display:none!important}}@media(min-width:992px) and (max-width:1199px){.hidden-md,tr.hidden-md,th.hidden-md,td.hidden-md{display:none!important}}@media(min-width:1200px){.hidden-md.hidden-lg,tr.hidden-md.hidden-lg,th.hidden-md.hidden-lg,td.hidden-md.hidden-lg{display:none!important}}.hidden-lg{display:block!important}tr.hidden-lg{display:table-row!important}th.hidden-lg,td.hidden-lg{display:table-cell!important}@media(max-width:767px){.hidden-lg.hidden-xs,tr.hidden-lg.hidden-xs,th.hidden-lg.hidden-xs,td.hidden-lg.hidden-xs{display:none!important}}@media(min-width:768px) and (max-width:991px){.hidden-lg.hidden-sm,tr.hidden-lg.hidden-sm,th.hidden-lg.hidden-sm,td.hidden-lg.hidden-sm{display:none!important}}@media(min-width:992px) and (max-width:1199px){.hidden-lg.hidden-md,tr.hidden-lg.hidden-md,th.hidden-lg.hidden-md,td.hidden-lg.hidden-md{display:none!important}}@media(min-width:1200px){.hidden-lg,tr.hidden-lg,th.hidden-lg,td.hidden-lg{display:none!important}}.visible-print,tr.visible-print,th.visible-print,td.visible-print{display:none!important}@media print{.visible-print{display:block!important}tr.visible-print{display:table-row!important}th.visible-print,td.visible-print{display:table-cell!important}.hidden-print,tr.hidden-print,th.hidden-print,td.hidden-print{display:none!important}}
\ No newline at end of file
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/css/style.css b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/css/style.css
new file mode 100644
index 0000000..4a2f65a
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/css/style.css
@@ -0,0 +1,391 @@
+/* #Reset & Basics 
+================================================== */
+html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
+	margin: 0;
+	padding: 0;
+	border: 0;
+	font-size: 100%;
+	font: inherit;
+	vertical-align: baseline;
+}
+input, select, textarea, button {
+	outline: none;
+}
+article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {
+	display: block;
+}
+body {
+	line-height: 1;
+}
+ol, ul {
+	list-style: none;
+}
+blockquote, q {
+	quotes: none;
+}
+blockquote:before, blockquote:after, q:before, q:after {
+	content: '';
+	content: none;
+}
+table {
+	/*border-collapse: collapse;*/
+	border-spacing: 0;
+}
+a {
+	text-decoration: none;
+}
+img {
+	border: 0;
+}
+/* #Clearing
+================================================== */
+
+/* Self Clearing Goodness */
+.container:after { content: "\0020"; display: block; height: 0; clear: both; visibility: hidden; }
+
+/* Use clearfix class on parent to clear nested columns,
+or wrap each row of columns in a <div class="row"> */
+.clearfix:before,
+.clearfix:after,
+.row:before,
+.row:after {
+    content: '\0020';
+    display: block;
+    overflow: hidden;
+    visibility: hidden;
+    width: 0;
+    height: 0; }
+.row:after,
+.clearfix:after {
+    clear: both; }
+.row,
+.clearfix {
+    zoom: 1; }
+
+/* You can also use a <br class="clear" /> to clear columns */
+.clear {
+    clear: both;
+    display: block;
+    overflow: hidden;
+    visibility: hidden;
+    width: 0;
+    height: 0;
+}
+/* #TYPO 
+================================================== */
+@font-face {
+	font-family: 'helvetica';
+	src: url('../fonts/Helvetica.eot');
+	src: url('../fonts/Helvetica.woff') format('woff'), 
+		 url('../fonts/Helvetica.ttf') format('truetype'), 
+		 url('../fonts/Helvetica.svg') format('svg');
+	font-weight: normal;
+	font-style: normal;
+}
+/* #common styles
+================================================== */
+body {
+	font-family: 'helvetica';
+}
+html, body {
+  height: 100%;
+}
+.page-wrap {
+  min-height: 100%;
+  /* equal to footer height */
+  margin-bottom: -70px; 
+}
+.page-wrap:after {
+  content: "";
+  display: block;
+}
+.site-footer, .page-wrap:after {
+  height: 70px; 
+}
+.site-footer {
+  background: #000;
+  text-align: center;
+  color: #FFF;
+  line-height: 70px;
+  font-size: 24px;
+}
+.container {
+	width: 940px;
+	margin: 0 auto;
+	position: relative;
+}
+.top_bar {
+	background-color: #eee;
+	padding: 15px 0;
+	margin-bottom: 20px;
+}
+.top_bar figure img {
+	float: left;
+	margin-right: 15px;
+}
+.top_bar figure figcaption {
+	font-size: 24px;
+    margin-top: 13px;
+    float: left;
+}
+.user {
+	background: url('../images/icons.png') no-repeat -11px 0;
+    position: absolute;
+    right: 0;
+    top: 19px;
+    padding-left: 25px;
+	font-size: 18px;
+}
+.user span {
+	color: #666;
+}
+.user a {
+	color: #005C3E;
+}
+a.logout {
+	background: url('../images/icons.png') no-repeat -7px -26px;
+    padding-left: 20px;
+    border-left: 1px solid #666;
+    margin-left: 4px;	
+	color: #666;
+}
+a.logout:hover {
+	    color: #005C3E;
+    text-decoration: underline;
+}
+
+
+.selectedCam {
+	background-color: #005C3E !important;
+    border-color: #005C3E !important;
+    color: white !important;
+
+	}
+.selectedCam:hover {	
+    background-color: #005C3E !important;
+    border-color: #005C3E !important;
+    color: white !important;
+}
+
+h3 {
+	font-size: 24px; 
+	color: #005C3E; 
+	border-bottom: 1px solid #cecece;
+	padding-bottom: 15px;
+	margin-bottom: 20px;	
+}
+/* #pages styles
+================================================== */
+.login-strip {
+	background: #eee;
+	padding: 20px 0;
+	position: absolute;
+	top: 25%;
+	width: 100%;
+}
+.loginBox {
+	width: 250px;
+	margin: 0 auto;
+}
+.loginBox img {
+	float: left;
+    margin-right: 10px;
+}
+.loginBox figcaption {
+	margin-bottom: 20px;
+}
+.loginBox figcaption {
+	font-size: 18px;
+	line-height: 23px;
+}
+.loginBox label, .loginBox label input {
+	float: left;
+    width: 100%;
+    margin-bottom: 8px;
+}
+.loginBox label input {
+	margin-bottom: 0;
+	margin-top: 8px;
+	padding: 5px;
+	font-family: 'helvetica';
+	-webkit-box-sizing: border-box; 
+	-moz-box-sizing: border-box;    
+	box-sizing: border-box;
+	border: 1px solid #d0d0d0;
+	border-radius: 4px;  
+}
+.loginBox input[type=submit] {
+	float: right;
+    background-color: #005C3E;
+    padding: 7px 20px;
+    border: 0;
+    color: #FFF;
+    border-radius: 3px;
+    font: 18px 'helvetica';
+	margin-top: 12px;
+}
+.left_side, .right_side {
+	float: left;
+	width: 50%;
+	-webkit-box-sizing: border-box; 
+	-moz-box-sizing: border-box;    
+	box-sizing: border-box;
+	padding-right: 20px;
+}
+.right_side {
+	padding-right: 0;
+	padding-left: 20px;
+	border-left:  1px solid #cecece;
+}
+.left_side img {
+	width: 100%;
+	height: 100%;
+}
+.status {
+	float: right;
+}
+.left_side video {
+	width: 100%;
+	background: #000;
+}
+.right_side li {
+	border-bottom: 1px dashed #DDD;
+	color: #005C3E;
+	padding: 10px 0;
+	font-size: 18px;
+	overflow: hidden;
+}
+.right_side li div {float: left;}
+.right_side li i {float: left; margin-right: 10px;}
+.lamp {
+	background: url('../images/icons.png') no-repeat -13px -68px;
+	width: 13px;
+	height: 24px;
+}
+.socket {
+	background: url('../images/icons.png') no-repeat -11px -126px;
+	width: 15px;
+	height: 15px;
+}
+.siren {
+	background: url('../images/icons.png') no-repeat -12px -174px;
+	width: 16px;
+	height: 16px;
+}
+.smokeDetector {
+	background: url('../images/icons.png') no-repeat -11px -217px;
+	width: 17px;
+	height: 18px;	
+}
+.valve {
+	background: url('../images/icons.png') no-repeat -13px -264px;
+	width: 12px;
+	height: 17px;	
+}
+.flood {
+	background: url('../images/icons.png') no-repeat -11px -308px;
+	width: 17px;
+	height: 19px;
+}
+.zigbee {
+	background: url('../images/zigbee.jpg');
+	width: 17px;
+	height: 19px;
+}
+.circle {
+	width: 20px;
+	height: 20px;
+	float: right;
+	border-radius: 25px;
+	background: #df3b3a;
+}
+.circle.green , .circle.true {
+	background: #64BD63;
+}
+.circle.red , .circle.false{
+	background: #df3b3a;
+}
+.opened, .closed {
+	background: url('../images/icons.png') no-repeat -9px -359px;
+	width: 21px;
+	height: 20px;
+	float: right;
+}
+.closed {
+	background-position: -10px -415px;
+}
+@media only screen and (max-width: 767px)   {
+
+/* Smartphones (portrait and landscape) ----------- */
+.container {
+	    width: 90%;
+}
+.left_side, .right_side {width: 100%; min-height: auto; padding: 0; border: 0}
+.right_side  {margin-top: 20px; min-height: auto !important; padding-bottom: 20px;}
+.right_side li div  {
+	width: 70%;
+}
+.user {
+	position: static;
+    float: left;
+    width: 90%;
+	margin-top: 20px;
+	font-size: 16px;
+}
+.top_bar figure figcaption {
+	float: none;
+}
+}
+
+@media only screen 
+
+and (min-device-width : 768px) 
+
+and (max-device-width : 1023px) 
+
+and (orientation : portrait) {
+
+/* iPads (portrait) ----------- */
+.container {
+    width: 717px;
+}
+}
+
+.adjustSwitch {
+	position: relative;
+	
+}
+
+.tdSmall {
+	width: 40px;
+}
+
+
+.spinner {
+  
+  z-index: 1;
+  margin: 0 0 0 0;
+  border: 4px solid #f3f3f3;
+  border-radius: 50%;
+  border-top: 4px solid #005C3E;
+/*   border-left: 4px solid #005C3E;
+  border-bottom: 4px solid #005C3E; */
+  width: 25px;
+  height: 25px;
+  -webkit-animation: spin 2s linear infinite;
+  animation: spin 2s linear infinite;
+}
+
+@-webkit-keyframes spin {
+  0% { -webkit-transform: rotate(0deg); }
+  100% { -webkit-transform: rotate(360deg); }
+}
+
+@keyframes spin {
+  0% { transform: rotate(0deg); }
+  100% { transform: rotate(360deg); }
+}
+
+.backgroundRed {
+	background:#F00;
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/fonts/Helvetica.eot b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/fonts/Helvetica.eot
new file mode 100644
index 0000000..709edc5
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/fonts/Helvetica.eot
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/fonts/Helvetica.svg b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/fonts/Helvetica.svg
new file mode 100644
index 0000000..1b27e9f
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/fonts/Helvetica.svg
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/fonts/Helvetica.ttf b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/fonts/Helvetica.ttf
new file mode 100644
index 0000000..64100fb
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/fonts/Helvetica.ttf
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/fonts/Helvetica.woff b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/fonts/Helvetica.woff
new file mode 100644
index 0000000..50a4926
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/fonts/Helvetica.woff
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/co2.png b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/co2.png
new file mode 100644
index 0000000..dffc400
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/co2.png
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/favicon.ico b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/favicon.ico
new file mode 100644
index 0000000..d3c2054
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/favicon.ico
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/humidity.png b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/humidity.png
new file mode 100644
index 0000000..506e54c
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/humidity.png
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/icons.png b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/icons.png
new file mode 100644
index 0000000..8b1a79b
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/icons.png
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/logo.png b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/logo.png
new file mode 100644
index 0000000..a165501
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/logo.png
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/motion_sensor.png b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/motion_sensor.png
new file mode 100644
index 0000000..56e70e7
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/motion_sensor.png
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/noise.jpg b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/noise.jpg
new file mode 100644
index 0000000..efd0aea
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/noise.jpg
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/open_door_35.png b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/open_door_35.png
new file mode 100644
index 0000000..b76a287
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/open_door_35.png
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/power_consumption.png b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/power_consumption.png
new file mode 100644
index 0000000..2d04cee
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/power_consumption.png
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/pressure.jpg b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/pressure.jpg
new file mode 100644
index 0000000..2627065
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/pressure.jpg
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/temp.jpg b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/temp.jpg
new file mode 100644
index 0000000..e8d1207
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/temp.jpg
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/zigbee.jpg b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/zigbee.jpg
new file mode 100644
index 0000000..83c4e72
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/images/zigbee.jpg
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/1_hls.min.js b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/1_hls.min.js
new file mode 100644
index 0000000..a182815
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/1_hls.min.js
@@ -0,0 +1,6 @@
+//v0.5.44
+!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.Hls=e()}}(function(){return function s(e,t,r){function a(i,d){if(!t[i]){if(!e[i]){var l="function"==typeof require&&require;if(!d&&l)return l(i,!0);if(n)return n(i,!0);var u=new Error("Cannot find module '"+i+"'");throw u.code="MODULE_NOT_FOUND",u}var o=t[i]={exports:{}};e[i][0].call(o.exports,function(t){var r=e[i][1][t];return a(r?r:t)},o,o.exports,s,e,t,r)}return t[i].exports}for(var n="function"==typeof require&&require,i=0;i<r.length;i++)a(r[i]);return a}({1:[function(s,i,o){function e(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function t(e){return"function"==typeof e}function n(e){return"number"==typeof e}function r(e){return"object"==typeof e&&null!==e}function a(e){return void 0===e}i.exports=e,e.EventEmitter=e,e.prototype._events=void 0,e.prototype._maxListeners=void 0,e.defaultMaxListeners=10,e.prototype.setMaxListeners=function(e){if(!n(e)||0>e||isNaN(e))throw TypeError("n must be a positive number");return this._maxListeners=e,this},e.prototype.emit=function(l){var s,e,u,i,n,o;if(this._events||(this._events={}),"error"===l&&(!this._events.error||r(this._events.error)&&!this._events.error.length)){if(s=arguments[1],s instanceof Error)throw s;throw TypeError('Uncaught, unspecified "error" event.')}if(e=this._events[l],a(e))return!1;if(t(e))switch(arguments.length){case 1:e.call(this);break;case 2:e.call(this,arguments[1]);break;case 3:e.call(this,arguments[1],arguments[2]);break;default:i=Array.prototype.slice.call(arguments,1),e.apply(this,i)}else if(r(e))for(i=Array.prototype.slice.call(arguments,1),o=e.slice(),u=o.length,n=0;u>n;n++)o[n].apply(this,i);return!0},e.prototype.addListener=function(i,n){var s;if(!t(n))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",i,t(n.listener)?n.listener:n),this._events[i]?r(this._events[i])?this._events[i].push(n):this._events[i]=[this._events[i],n]:this._events[i]=n,r(this._events[i])&&!this._events[i].warned&&(s=a(this._maxListeners)?e.defaultMaxListeners:this._maxListeners,s&&s>0&&this._events[i].length>s&&(this._events[i].warned=!0,"function"==typeof console.trace)),this},e.prototype.on=e.prototype.addListener,e.prototype.once=function(a,e){function r(){this.removeListener(a,r),i||(i=!0,e.apply(this,arguments))}if(!t(e))throw TypeError("listener must be a function");var i=!1;return r.listener=e,this.on(a,r),this},e.prototype.removeListener=function(i,a){var e,s,o,n;if(!t(a))throw TypeError("listener must be a function");if(!this._events||!this._events[i])return this;if(e=this._events[i],o=e.length,s=-1,e===a||t(e.listener)&&e.listener===a)delete this._events[i],this._events.removeListener&&this.emit("removeListener",i,a);else if(r(e)){for(n=o;n-- >0;)if(e[n]===a||e[n].listener&&e[n].listener===a){s=n;break}if(0>s)return this;1===e.length?(e.length=0,delete this._events[i]):e.splice(s,1),this._events.removeListener&&this.emit("removeListener",i,a)}return this},e.prototype.removeAllListeners=function(r){var a,e;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[r]&&delete this._events[r],this;if(0===arguments.length){for(a in this._events)"removeListener"!==a&&this.removeAllListeners(a);return this.removeAllListeners("removeListener"),this._events={},this}if(e=this._events[r],t(e))this.removeListener(r,e);else if(e)for(;e.length;)this.removeListener(r,e[e.length-1]);return delete this._events[r],this},e.prototype.listeners=function(e){var r;return r=this._events&&this._events[e]?t(this._events[e])?[this._events[e]]:this._events[e].slice():[]},e.prototype.listenerCount=function(r){if(this._events){var e=this._events[r];if(t(e))return 1;if(e)return e.length}return 0},e.listenerCount=function(e,t){return e.listenerCount(t)}},{}],2:[function(n,a,s){var i=arguments[3],e=arguments[4],r=arguments[5],t=JSON.stringify;a.exports=function(l){for(var a,s=Object.keys(r),n=0,d=s.length;d>n;n++){var o=s[n],u=r[o].exports;if(u===l||u.default===l){a=o;break}}if(!a){a=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var f={},n=0,d=s.length;d>n;n++){var o=s[n];f[o]=o}e[a]=[Function(["require","module","exports"],"("+l+")(self)"),f]}var h=Math.floor(Math.pow(16,8)*Math.random()).toString(16),c={};c[a]=a,e[h]=[Function(["require"],"var f = require("+t(a)+");(f.default ? f.default : f)(self);"),c];var v="("+i+")({"+Object.keys(e).map(function(r){return t(r)+":["+e[r][0]+","+t(e[r][1])+"]"}).join(",")+"},{},["+t(h)+"])",g=window.URL||window.webkitURL||window.mozURL||window.msURL;return new Worker(g.createObjectURL(new Blob([v],{type:"text/javascript"})))}},{}],3:[function(e,m,n){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function g(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function v(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var l=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),c=e("../events"),t=r(c),d=e("../event-handler"),i=r(d),h=e("../helper/buffer-helper"),o=r(h),s=e("../errors"),a=e("../utils/logger"),p=e("./ewma-bandwidth-estimator"),u=r(p),y=function(r){function e(a){f(this,e);var r=g(this,Object.getPrototypeOf(e).call(this,a,t.default.FRAG_LOADING,t.default.FRAG_LOADED,t.default.ERROR));return r.lastLoadedFragLevel=0,r._autoLevelCapping=-1,r._nextAutoLevel=-1,r.hls=a,r.onCheck=r.abandonRulesCheck.bind(r),r}return v(e,r),l(e,[{key:"destroy",value:function(){this.clearTimer(),i.default.prototype.destroy.call(this)}},{key:"onFragLoading",value:function(i){if(this.timer||(this.timer=setInterval(this.onCheck,100)),!this.bwEstimator){var t=this.hls,s=i.frag.level,o=t.levels[s].details.live,e=t.config,r=void 0,a=void 0;o?(r=e.abrEwmaFastLive,a=e.abrEwmaSlowLive):(r=e.abrEwmaFastVoD,a=e.abrEwmaSlowVoD),this.bwEstimator=new u.default(t,a,r,e.abrEwmaDefaultEstimate)}var n=i.frag;n.trequest=performance.now(),this.fragCurrent=n}},{key:"abandonRulesCheck",value:function(){var i=this.hls,n=i.media,e=this.fragCurrent;if(!e.loader||e.loader.stats&&e.loader.stats.aborted)return a.logger.warn("frag loader destroy or aborted, disarm abandonRulesCheck"),void this.clearTimer();if(n&&(!n.paused||!n.readyState)&&e.autoLevel&&e.level){var u=performance.now()-e.trequest;if(u>500*e.duration){var f=i.levels,h=Math.max(1,1e3*e.loaded/u),v=Math.max(e.loaded,Math.round(e.duration*f[e.level].bitrate/8)),c=n.currentTime,d=(v-e.loaded)/h,s=o.default.bufferInfo(n,c,i.config.maxBufferHole).end-c;if(s<2*e.duration&&d>s){var l=void 0,r=void 0;for(r=e.level-1;r>=0&&(l=e.duration*f[r].bitrate/(6.4*h),a.logger.log("fragLoadedDelay/bufferStarvationDelay/fragLevelNextLoadedDelay["+r+"] :"+d.toFixed(1)+"/"+s.toFixed(1)+"/"+l.toFixed(1)),!(s>l));r--);d>l&&(r=Math.max(0,r),i.nextLoadLevel=r,this.bwEstimator.sample(u,e.loaded),a.logger.warn("loading too slow, abort fragment loading and switch to level "+r),e.loader.abort(),this.clearTimer(),i.trigger(t.default.FRAG_LOAD_EMERGENCY_ABORTED,{frag:e}))}}}}},{key:"onFragLoaded",value:function(e){var t=e.stats;void 0===t.aborted&&1===e.frag.loadCounter&&this.bwEstimator.sample(performance.now()-t.trequest,t.loaded),this.clearTimer(),this.lastLoadedFragLevel=e.frag.level,this._nextAutoLevel=-1}},{key:"onError",value:function(e){switch(e.details){case s.ErrorDetails.FRAG_LOAD_ERROR:case s.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}}},{key:"clearTimer",value:function(){this.timer&&(clearInterval(this.timer),this.timer=null)}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(e){this._autoLevelCapping=e}},{key:"nextAutoLevel",get:function(){var e,r,i=this.hls,t=i.levels,a=i.config;if(r=-1===this._autoLevelCapping&&t&&t.length?t.length-1:this._autoLevelCapping,-1!==this._nextAutoLevel)return Math.min(this._nextAutoLevel,r);var n=this.bwEstimator?this.bwEstimator.getEstimate():a.abrEwmaDefaultEstimate,s=void 0;for(e=0;r>=e;e++)if(s=e<=this.lastLoadedFragLevel?a.abrBandWidthFactor*n:a.abrBandWidthUpFactor*n,s<t[e].bitrate)return Math.max(0,e-1);return e-1},set:function(e){this._nextAutoLevel=e}}]),e}(i.default);n.default=y},{"../errors":21,"../event-handler":22,"../events":23,"../helper/buffer-helper":24,"../utils/logger":38,"./ewma-bandwidth-estimator":6}],4:[function(a,v,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function h(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(i,"__esModule",{value:!0});var c=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),l=a("../events"),e=n(l),d=a("../event-handler"),s=n(d),t=a("../utils/logger"),r=a("../errors"),o=function(i){function a(r){u(this,a);var t=f(this,Object.getPrototypeOf(a).call(this,r,e.default.MEDIA_ATTACHING,e.default.MEDIA_DETACHING,e.default.BUFFER_RESET,e.default.BUFFER_APPENDING,e.default.BUFFER_CODECS,e.default.BUFFER_EOS,e.default.BUFFER_FLUSHING,e.default.LEVEL_UPDATED));return t._msDuration=null,t._levelDuration=null,t.onsbue=t.onSBUpdateEnd.bind(t),t.onsbe=t.onSBUpdateError.bind(t),t}return h(a,i),c(a,[{key:"destroy",value:function(){s.default.prototype.destroy.call(this)}},{key:"onMediaAttaching",value:function(r){var t=this.media=r.media;if(t){var e=this.mediaSource=new MediaSource;this.onmso=this.onMediaSourceOpen.bind(this),this.onmse=this.onMediaSourceEnded.bind(this),this.onmsc=this.onMediaSourceClose.bind(this),e.addEventListener("sourceopen",this.onmso),e.addEventListener("sourceended",this.onmse),e.addEventListener("sourceclose",this.onmsc),t.src=URL.createObjectURL(e)}}},{key:"onMediaDetaching",value:function(){var r=this.mediaSource;if(r){if("open"===r.readyState)try{r.endOfStream()}catch(e){t.logger.warn("onMediaDetaching:"+e.message+" while calling endOfStream")}r.removeEventListener("sourceopen",this.onmso),r.removeEventListener("sourceended",this.onmse),r.removeEventListener("sourceclose",this.onmsc);try{this.media.src="",this.media.removeAttribute("src")}catch(e){t.logger.warn("onMediaDetaching:"+e.message+" while unlinking video.src")}this.mediaSource=null,this.media=null,this.pendingTracks=null,this.sourceBuffer=null}this.onmso=this.onmse=this.onmsc=null,this.hls.trigger(e.default.MEDIA_DETACHED)}},{key:"onMediaSourceOpen",value:function(){t.logger.log("media source opened"),this.hls.trigger(e.default.MEDIA_ATTACHED,{media:this.media}),this.mediaSource.removeEventListener("sourceopen",this.onmso);var r=this.pendingTracks;r&&(this.onBufferCodecs(r),this.pendingTracks=null,this.doAppending())}},{key:"onMediaSourceClose",value:function(){t.logger.log("media source closed")}},{key:"onMediaSourceEnded",value:function(){t.logger.log("media source ended")}},{key:"onSBUpdateEnd",value:function(){this._needsFlush&&this.doFlush(),this._needsEos&&this.onBufferEos(),this.hls.trigger(e.default.BUFFER_APPENDED),this.doAppending()}},{key:"onSBUpdateError",value:function(a){t.logger.error("sourceBuffer error:"+a),this.hls.trigger(e.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1})}},{key:"onBufferReset",value:function(){var e=this.sourceBuffer;if(e){for(var r in e){var t=e[r];try{this.mediaSource.removeSourceBuffer(t),t.removeEventListener("updateend",this.onsbue),t.removeEventListener("error",this.onsbe)}catch(e){}}this.sourceBuffer=null}this.flushRange=[],this.appended=0}},{key:"onBufferCodecs",value:function(e){var r=this.mediaSource;if(!r||"open"!==r.readyState)return void(this.pendingTracks=e);if(!this.sourceBuffer){var i={};for(var n in e){var a=e[n],l=a.levelCodec||a.codec,s=a.container+";codecs="+l;t.logger.log("creating sourceBuffer with mimeType:"+s);var o=i[n]=r.addSourceBuffer(s);o.addEventListener("updateend",this.onsbue),o.addEventListener("error",this.onsbe)}this.sourceBuffer=i}}},{key:"onBufferAppending",value:function(e){this.segments?this.segments.push(e):this.segments=[e],this.doAppending()}},{key:"onBufferAppendFail",value:function(a){t.logger.error("sourceBuffer error:"+a.event),this.hls.trigger(e.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1,frag:this.fragCurrent})}},{key:"onBufferEos",value:function(){var e=this.sourceBuffer,r=this.mediaSource;r&&"open"===r.readyState&&(e.audio&&e.audio.updating||e.video&&e.video.updating?this._needsEos=!0:(t.logger.log("all media data available, signal endOfStream() to MediaSource and stop loading fragment"),r.endOfStream(),this._needsEos=!1))}},{key:"onBufferFlushing",value:function(e){this.flushRange.push({start:e.startOffset,end:e.endOffset}),this.flushBufferCounter=0,this.doFlush()}},{key:"onLevelUpdated",value:function(t){var e=t.details;0!==e.fragments.length&&(this._levelDuration=e.totalduration+e.fragments[0].start,this.updateMediaElementDuration())}},{key:"updateMediaElementDuration",value:function(){if(null!==this._levelDuration){var a=this.media,e=this.mediaSource,r=this.sourceBuffer;if(a&&e&&r&&0!==a.readyState&&"open"===e.readyState){for(var i in r)if(r[i].updating)return;null===this._msDuration&&(this._msDuration=e.duration),this._levelDuration>this._msDuration&&(t.logger.log("Updating mediasource duration to "+this._levelDuration),e.duration=this._levelDuration,this._msDuration=this._levelDuration)}}}},{key:"doFlush",value:function(){for(;this.flushRange.length;){var r=this.flushRange[0];if(!this.flushBuffer(r.start,r.end))return void(this._needsFlush=!0);this.flushRange.shift(),this.flushBufferCounter=0}if(0===this.flushRange.length){this._needsFlush=!1;var a=0,t=this.sourceBuffer;if(t)for(var i in t)a+=t[i].buffered.length;this.appended=a,this.hls.trigger(e.default.BUFFER_FLUSHED)}}},{key:"doAppending",value:function(){var i=this.hls,s=this.sourceBuffer,n=this.segments;if(s){if(this.media.error)return n=[],void t.logger.error("trying to append although a media error occured, flush segment and abort");for(var l in s)if(s[l].updating)return;if(n.length){var o=n.shift();try{s[o.type].appendBuffer(o.data),this.appendError=0,this.appended++}catch(s){t.logger.error("error while trying to append buffer:"+s.message),n.unshift(o);var a={type:r.ErrorTypes.MEDIA_ERROR};if(22===s.code)return this.segments=[],a.details=r.ErrorDetails.BUFFER_FULL_ERROR,void i.trigger(e.default.ERROR,a);if(this.appendError?this.appendError++:this.appendError=1,a.details=r.ErrorDetails.BUFFER_APPEND_ERROR,a.frag=this.fragCurrent,this.appendError>i.config.appendErrorMaxRetry)return t.logger.log("fail "+i.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),n=[],a.fatal=!0,void i.trigger(e.default.ERROR,a);a.fatal=!1,i.trigger(e.default.ERROR,a)}}}}},{key:"flushBuffer",value:function(l,s){var e,r,o,n,a,i;if(this.flushBufferCounter<this.appended&&this.sourceBuffer)for(var u in this.sourceBuffer){if(e=this.sourceBuffer[u],e.updating)return t.logger.warn("cannot flush, sb updating in progress"),!1;for(r=0;r<e.buffered.length;r++)if(o=e.buffered.start(r),n=e.buffered.end(r),-1!==navigator.userAgent.toLowerCase().indexOf("firefox")&&s===Number.POSITIVE_INFINITY?(a=l,i=s):(a=Math.max(o,l),i=Math.min(n,s)),Math.min(i,n)-a>.5)return this.flushBufferCounter++,t.logger.log("flush "+u+" ["+a+","+i+"], of ["+o+","+n+"], pos:"+this.media.currentTime),e.remove(a,i),!1}else t.logger.warn("abort flushing too many retries");return t.logger.log("buffer flushed"),!0}}]),a}(s.default);i.default=o},{"../errors":21,"../event-handler":22,"../events":23,"../utils/logger":38}],5:[function(e,h,t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function f(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(t,"__esModule",{value:!0});var o=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),l=e("../events"),a=r(l),d=e("../event-handler"),s=r(d),u=function(t){function e(t){return i(this,e),n(this,Object.getPrototypeOf(e).call(this,t,a.default.MEDIA_ATTACHING,a.default.MANIFEST_PARSED))}return f(e,t),o(e,[{key:"destroy",value:function(){this.hls.config.capLevelToPlayerSize&&(this.media=null,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(this.timer=clearInterval(this.timer)))}},{key:"onMediaAttaching",value:function(e){this.media=e.media instanceof HTMLVideoElement?e.media:null}},{key:"onManifestParsed",value:function(e){this.hls.config.capLevelToPlayerSize&&(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.levels=e.levels,this.hls.firstLevel=this.getMaxLevel(e.firstLevel),clearInterval(this.timer),this.timer=setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}},{key:"detectPlayerSize",value:function(){if(this.media){var e=this.levels?this.levels.length:0;e&&(this.hls.autoLevelCapping=this.getMaxLevel(e-1),this.hls.autoLevelCapping>this.autoLevelCapping&&this.hls.streamController.nextLevelSwitch(),this.autoLevelCapping=this.hls.autoLevelCapping)}}},{key:"getMaxLevel",value:function(n){var r=void 0,e=void 0,t=void 0,s=this.mediaWidth,o=this.mediaHeight,a=0,i=0;for(e=0;n>=e&&(t=this.levels[e],r=e,a=t.width,i=t.height,!(a>=s||i>=o));e++);return r}},{key:"contentScaleFactor",get:function(){var e=1;try{e=window.devicePixelRatio}catch(e){}return e}},{key:"mediaWidth",get:function(){var e=void 0;return this.media&&(e=this.media.width||this.media.clientWidth||this.media.offsetWidth,e*=this.contentScaleFactor),e}},{key:"mediaHeight",get:function(){var e=void 0;return this.media&&(e=this.media.height||this.media.clientHeight||this.media.offsetHeight,e*=this.contentScaleFactor),e}}]),e}(s.default);t.default=u},{"../event-handler":22,"../events":23}],6:[function(r,l,e){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),s=r("../utils/ewma"),t=a(s),o=function(){function e(r,a,n,s){i(this,e),this.hls=r,this.defaultEstimate_=s,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new t.default(a),this.fast_=new t.default(n)}return n(e,[{key:"sample",value:function(e,a){e=Math.max(e,this.minDelayMs_);var t=8e3*a/e,r=e/1e3;this.fast_.sample(r,t),this.slow_.sample(r,t)}},{key:"getEstimate",value:function(){return!this.fast_||!this.slow_||this.fast_.getTotalWeight()<this.minWeight_?this.defaultEstimate_:Math.min(this.fast_.getEstimate(),this.slow_.getEstimate())}},{key:"destroy",value:function(){}}]),e}();e.default=o},{"../utils/ewma":37}],7:[function(a,v,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(i,"__esModule",{value:!0});var c=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),l=a("../events"),t=n(l),d=a("../event-handler"),f=n(d),r=a("../utils/logger"),e=a("../errors"),o=function(i){function a(r){u(this,a);var e=h(this,Object.getPrototypeOf(a).call(this,r,t.default.MANIFEST_LOADED,t.default.LEVEL_LOADED,t.default.ERROR));return e.ontick=e.tick.bind(e),e._manualLevel=e._autoLevelCapping=-1,e}return s(a,i),c(a,[{key:"destroy",value:function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this._manualLevel=-1}},{key:"startLoad",value:function(){this.canload=!0,this.timer&&this.tick()}},{key:"stopLoad",value:function(){this.canload=!1}},{key:"onManifestLoaded",value:function(l){var s,i,n=[],a=[],u={},d=!1,f=!1,o=this.hls;if(l.levels.forEach(function(e){e.videoCodec&&(d=!0),e.audioCodec&&(f=!0);var t=u[e.bitrate];void 0===t?(u[e.bitrate]=n.length,e.url=[e.url],e.urlId=0,n.push(e)):n[t].url.push(e.url)}),d&&f?n.forEach(function(e){e.videoCodec&&a.push(e)}):a=n,a=a.filter(function(e){var a=function(e){return MediaSource.isTypeSupported("audio/mp4;codecs="+e)},i=function(e){return MediaSource.isTypeSupported("video/mp4;codecs="+e)},t=e.audioCodec,r=e.videoCodec;return(!t||a(t))&&(!r||i(r))}),a.length){for(s=a[0].bitrate,a.sort(function(e,t){return e.bitrate-t.bitrate}),this._levels=a,i=0;i<a.length;i++)if(a[i].bitrate===s){this._firstLevel=i,r.logger.log("manifest loaded,"+a.length+" level(s) found, first bitrate:"+s);break}o.trigger(t.default.MANIFEST_PARSED,{levels:this._levels,firstLevel:this._firstLevel,stats:l.stats})}else o.trigger(t.default.ERROR,{type:e.ErrorTypes.MEDIA_ERROR,details:e.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:o.url,reason:"no level with compatible codecs found in manifest"})}},{key:"setLevelInternal",value:function(a){var n=this._levels;if(a>=0&&a<n.length){this.timer&&(clearTimeout(this.timer),this.timer=null),this._level=a,r.logger.log("switching to level "+a),this.hls.trigger(t.default.LEVEL_SWITCH,{level:a});var i=n[a];if(void 0===i.details||i.details.live===!0){r.logger.log("(re)loading playlist for level "+a);var s=i.urlId;this.hls.trigger(t.default.LEVEL_LOADING,{url:i.url[s],level:a,id:s})}}else this.hls.trigger(t.default.ERROR,{type:e.ErrorTypes.OTHER_ERROR,details:e.ErrorDetails.LEVEL_SWITCH_ERROR,level:a,fatal:!1,reason:"invalid level idx"})}},{key:"onError",value:function(n){if(!n.fatal){var i=n.details,o=this.hls,s=void 0,a=void 0,l=!1;switch(i){case e.ErrorDetails.FRAG_LOAD_ERROR:case e.ErrorDetails.FRAG_LOAD_TIMEOUT:case e.ErrorDetails.FRAG_LOOP_LOADING_ERROR:case e.ErrorDetails.KEY_LOAD_ERROR:case e.ErrorDetails.KEY_LOAD_TIMEOUT:s=n.frag.level;break;case e.ErrorDetails.LEVEL_LOAD_ERROR:case e.ErrorDetails.LEVEL_LOAD_TIMEOUT:s=n.level,l=!0}if(void 0!==s)if(a=this._levels[s],a.urlId<a.url.length-1)a.urlId++,a.details=void 0,r.logger.warn("level controller,"+i+" for level "+s+": switching to redundant stream id "+a.urlId);else{var u=-1===this._manualLevel&&s;u?(r.logger.warn("level controller,"+i+": emergency switch-down for next fragment"),o.abrController.nextAutoLevel=0):a&&a.details&&a.details.live?(r.logger.warn("level controller,"+i+" on live stream, discard"),l&&(this._level=void 0)):i!==e.ErrorDetails.FRAG_LOAD_ERROR&&i!==e.ErrorDetails.FRAG_LOAD_TIMEOUT&&(r.logger.error("cannot recover "+i+" error"),this._level=void 0,this.timer&&(clearTimeout(this.timer),this.timer=null),n.fatal=!0,o.trigger(t.default.ERROR,n))}}}},{key:"onLevelLoaded",value:function(t){if(t.level===this._level){var a=t.details;if(a.live){var e=1e3*a.targetduration,n=this._levels[t.level],i=n.details;i&&a.endSN===i.endSN&&(e/=2,r.logger.log("same live playlist, reload twice faster")),e-=performance.now()-t.stats.trequest,e=Math.max(1e3,Math.round(e)),r.logger.log("live playlist, reload in "+e+" ms"),this.timer=setTimeout(this.ontick,e)}else this.timer=null}}},{key:"tick",value:function(){var e=this._level;if(void 0!==e&&this.canload){var r=this._levels[e],a=r.urlId;this.hls.trigger(t.default.LEVEL_LOADING,{url:r.url[a],level:e,id:a})}}},{key:"levels",get:function(){return this._levels}},{key:"level",get:function(){return this._level},set:function(e){var t=this._levels;t&&t.length>e&&(this._level===e&&void 0!==t[e].details||this.setLevelInternal(e))}},{key:"manualLevel",get:function(){return this._manualLevel},set:function(e){this._manualLevel=e,void 0===this._startLevel&&(this._startLevel=e),-1!==e&&(this.level=e)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(e){this._firstLevel=e}},{key:"startLevel",get:function(){return void 0===this._startLevel?this._firstLevel:this._startLevel},set:function(e){this._startLevel=e}},{key:"nextLoadLevel",get:function(){return-1!==this._manualLevel?this._manualLevel:this.hls.abrController.nextAutoLevel},set:function(e){this.level=e,-1===this._manualLevel&&(this.hls.abrController.nextAutoLevel=e)}}]),a}(f.default);i.default=o},{"../errors":21,"../event-handler":22,"../events":23,"../utils/logger":38}],8:[function(i,A,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function h(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function v(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(o,"__esModule",{value:!0});var m=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),b=i("../demux/demuxer"),_=n(b),d=i("../events"),r=n(d),R=i("../event-handler"),l=n(R),t=i("../utils/logger"),g=i("../utils/binary-search"),p=n(g),y=i("../helper/buffer-helper"),s=n(y),E=i("../helper/level-helper"),u=n(E),a=i("../errors"),e={STOPPED:"STOPPED",STARTING:"STARTING",IDLE:"IDLE",PAUSED:"PAUSED",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_LEVEL:"WAITING_LEVEL",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR"},f=function(n){function i(t){h(this,i);var e=c(this,Object.getPrototypeOf(i).call(this,t,r.default.MEDIA_ATTACHED,r.default.MEDIA_DETACHING,r.default.MANIFEST_LOADING,r.default.MANIFEST_PARSED,r.default.LEVEL_LOADED,r.default.KEY_LOADED,r.default.FRAG_LOADED,r.default.FRAG_LOAD_EMERGENCY_ABORTED,r.default.FRAG_PARSING_INIT_SEGMENT,r.default.FRAG_PARSING_DATA,r.default.FRAG_PARSED,r.default.ERROR,r.default.BUFFER_APPENDED,r.default.BUFFER_FLUSHED));return e.config=t.config,e.audioCodecSwap=!1,e.ticks=0,e.ontick=e.tick.bind(e),e}return v(i,n),m(i,[{key:"destroy",value:function(){this.stopLoad(),this.timer&&(clearInterval(this.timer),this.timer=null),l.default.prototype.destroy.call(this),this.state=e.STOPPED}},{key:"startLoad",value:function(i){if(this.levels){var r=this.media,a=this.lastCurrentTime;this.stopLoad(),this.demuxer=new _.default(this.hls),this.timer||(this.timer=setInterval(this.ontick,100)),this.level=-1,this.fragLoadError=0,r&&a>0?(t.logger.log("configure startPosition @"+a),this.lastPaused||(t.logger.log("resuming video"),r.play()),this.state=e.IDLE):(this.lastCurrentTime=this.startPosition?this.startPosition:i,this.state=e.STARTING),this.nextLoadPosition=this.startPosition=this.lastCurrentTime,this.tick()}else t.logger.warn("cannot start loading as manifest not parsed yet"),this.state=e.STOPPED}},{key:"stopLoad",value:function(){var t=this.fragCurrent;t&&(t.loader&&t.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=e.STOPPED}},{key:"tick",value:function(){this.ticks++,1===this.ticks&&(this.doTick(),this.ticks>1&&setTimeout(this.tick,1),this.ticks=0)}},{key:"doTick",value:function(){var R,l,n,h=this.hls,o=h.config,f=this.media,b=f&&f.seeking;switch(this.state){case e.ERROR:case e.PAUSED:break;case e.STARTING:var _=h.startLevel;-1===_&&(_=0,this.fragBitrateTest=!0),this.level=h.nextLoadLevel=_,this.state=e.WAITING_LEVEL,this.loadedmetadata=!1;break;case e.IDLE:if(!f&&(this.startFragRequested||!o.startFragPrefetch))break;R=this.loadedmetadata?f.currentTime:this.nextLoadPosition,l=h.nextLoadLevel;var v,L=s.default.bufferInfo(f,R,o.maxBufferHole),P=L.len,d=L.end,c=this.fragPrevious;if(this.levels[l].hasOwnProperty("bitrate")?(v=Math.max(8*o.maxBufferSize/this.levels[l].bitrate,o.maxBufferLength),v=Math.min(v,o.maxMaxBufferLength)):v=o.maxBufferLength,v>P){if(h.nextLoadLevel=l,this.level=l,n=this.levels[l].details,"undefined"==typeof n||n.live&&this.levelLastLoaded!==l){this.state=e.WAITING_LEVEL;break}var u=n.fragments,g=u.length,m=u[0].start,E=u[g-1].start+u[g-1].duration,i=void 0;if(n.live){var D=void 0!==o.liveMaxLatencyDuration?o.liveMaxLatencyDuration:o.liveMaxLatencyDurationCount*n.targetduration;if(d<Math.max(m,E-D)){var O=void 0!==o.liveSyncDuration?o.liveSyncDuration:o.liveSyncDurationCount*n.targetduration,y=m+Math.max(0,n.totalduration-O);t.logger.log("buffer end: "+d+" is located too far from the end of live sliding playlist, reset currentTime to : "+y.toFixed(3)),d=y,f&&f.readyState&&f.duration>y&&(f.currentTime=y)}if(n.PTSKnown&&d>E)break;if(this.startFragRequested&&!n.PTSKnown){if(c){var A=c.sn+1;A>=n.startSN&&A<=n.endSN&&(i=u[A-n.startSN],t.logger.log("live playlist, switching playlist, load frag with next SN: "+i.sn))}i||(i=u[Math.min(g-1,Math.round(g/2))],t.logger.log("live playlist, switching playlist, unknown, load middle frag : "+i.sn))}}else m>d&&(i=u[0]);if(i||!function(){var e=o.maxFragLookUpTolerance;E>d?((d>E-e||b)&&(e=0),i=p.default.search(u,function(t){return t.start+t.duration-e<=d?1:t.start-e>d?-1:0})):i=u[g-1]}(),i){if(m=i.start,c&&i.level===c.level&&i.sn===c.sn){if(!(i.sn<n.endSN)){n.live||(this.hls.trigger(r.default.BUFFER_EOS),b||(this.state=e.ENDED));break}var T=c.deltaPTS,k=i.sn-n.startSN;if(T&&T>o.maxBufferHole&&c.dropped?(i=u[k-1],
+        t.logger.warn("SN just loaded, with large PTS gap between audio and video, maybe frag is not starting with a keyframe ? load previous one to try to overcome this"),c.loadCounter--):(i=u[k+1],t.logger.log("SN just loaded, load next one: "+i.sn)),!i)break}if(null!=i.decryptdata.uri&&null==i.decryptdata.key)t.logger.log("Loading key for "+i.sn+" of ["+n.startSN+" ,"+n.endSN+"],level "+l),this.state=e.KEY_LOADING,h.trigger(r.default.KEY_LOADING,{frag:i});else{if(t.logger.log("Loading "+i.sn+" of ["+n.startSN+" ,"+n.endSN+"],level "+l+", currentTime:"+R+",bufferEnd:"+d.toFixed(3)),void 0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,i.loadCounter){i.loadCounter++;var S=o.fragLoadingLoopThreshold;if(i.loadCounter>S&&Math.abs(this.fragLoadIdx-i.loadIdx)<S)return void h.trigger(r.default.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.FRAG_LOOP_LOADING_ERROR,fatal:!1,frag:i})}else i.loadCounter=1;i.loadIdx=this.fragLoadIdx,this.fragCurrent=i,this.startFragRequested=!0,i.autoLevel=h.autoLevelEnabled,h.trigger(r.default.FRAG_LOADING,{frag:i}),this.state=e.FRAG_LOADING}}}break;case e.WAITING_LEVEL:l=this.levels[this.level],l&&l.details&&(this.state=e.IDLE);break;case e.FRAG_LOADING_WAITING_RETRY:var I=performance.now(),w=this.retryDate;(!w||I>=w||b)&&(t.logger.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=e.IDLE);break;case e.STOPPED:case e.FRAG_LOADING:case e.PARSING:case e.PARSED:case e.ENDED:}this._checkBuffer(),this._checkFragmentChanged()}},{key:"getBufferRange",value:function(a){var e,t,r=this.bufferRange;if(r)for(e=r.length-1;e>=0;e--)if(t=r[e],a>=t.start&&a<=t.end)return t;return null}},{key:"followingBufferRange",value:function(e){return e?this.getBufferRange(e.end+.5):null}},{key:"isBuffered",value:function(r){var a=this.media;if(a)for(var t=a.buffered,e=0;e<t.length;e++)if(r>=t.start(e)&&r<=t.end(e))return!0;return!1}},{key:"_checkFragmentChanged",value:function(){var t,e,a=this.media;if(a&&a.seeking===!1&&(e=a.currentTime,e>a.playbackRate*this.lastCurrentTime&&(this.lastCurrentTime=e),this.isBuffered(e)?t=this.getBufferRange(e):this.isBuffered(e+.1)&&(t=this.getBufferRange(e+.1)),t)){var i=t.frag;i!==this.fragPlaying&&(this.fragPlaying=i,this.hls.trigger(r.default.FRAG_CHANGED,{frag:i}))}}},{key:"immediateLevelSwitch",value:function(){if(t.logger.log("immediateLevelSwitch"),!this.immediateSwitch){this.immediateSwitch=!0;var a=this.media,i=void 0;a?(i=a.paused,a.pause()):i=!0,this.previouslyPaused=i}var n=this.fragCurrent;n&&n.loader&&n.loader.abort(),this.fragCurrent=null,this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.state=e.PAUSED,this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY})}},{key:"immediateLevelSwitchEnd",value:function(){this.immediateSwitch=!1;var e=this.media;e&&e.readyState&&(e.currentTime-=1e-4,this.previouslyPaused||e.play())}},{key:"nextLevelSwitch",value:function(){var t=this.media;if(t&&t.readyState){var n=void 0,i=void 0,a=void 0;if(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,i=this.getBufferRange(t.currentTime),i&&i.start>1&&(this.state=e.PAUSED,this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:0,endOffset:i.start-1})),t.paused)n=0;else{var l=this.hls.nextLoadLevel,u=this.levels[l],o=this.fragLastKbps;n=o&&this.fragCurrent?this.fragCurrent.duration*u.bitrate/(1e3*o)+1:0}if(a=this.getBufferRange(t.currentTime+n),a&&(a=this.followingBufferRange(a))){var s=this.fragCurrent;s&&s.loader&&s.loader.abort(),this.fragCurrent=null,this.state=e.PAUSED,this.hls.trigger(r.default.BUFFER_FLUSHING,{startOffset:a.start,endOffset:Number.POSITIVE_INFINITY})}}}},{key:"onMediaAttached",value:function(r){var e=this.media=r.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),this.onvended=this.onMediaEnded.bind(this),e.addEventListener("seeking",this.onvseeking),e.addEventListener("seeked",this.onvseeked),e.addEventListener("ended",this.onvended);var t=this.config;this.levels&&t.autoStartLoad&&this.hls.startLoad(t.startPosition)}},{key:"onMediaDetaching",value:function(){var e=this.media;e&&e.ended&&(t.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var r=this.levels;r&&r.forEach(function(e){e.details&&e.details.fragments.forEach(function(e){e.loadCounter=void 0})}),e&&(e.removeEventListener("seeking",this.onvseeking),e.removeEventListener("seeked",this.onvseeked),e.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=null,this.loadedmetadata=!1,this.stopLoad()}},{key:"onMediaSeeking",value:function(){if(this.state===e.FRAG_LOADING){if(0===s.default.bufferInfo(this.media,this.media.currentTime,this.config.maxBufferHole).len){t.logger.log("seeking outside of buffer while fragment load in progress, cancel fragment load");var r=this.fragCurrent;r&&(r.loader&&r.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.state=e.IDLE}}else this.state===e.ENDED&&(this.state=e.IDLE);this.media&&(this.lastCurrentTime=this.media.currentTime),void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold),this.tick()}},{key:"onMediaSeeked",value:function(){this.tick()}},{key:"onMediaEnded",value:function(){t.logger.log("media ended"),this.startPosition=this.lastCurrentTime=0}},{key:"onManifestLoading",value:function(){t.logger.log("trigger BUFFER_RESET"),this.hls.trigger(r.default.BUFFER_RESET),this.bufferRange=[],this.stalled=!1}},{key:"onManifestParsed",value:function(r){var e,a=!1,i=!1;r.levels.forEach(function(t){e=t.audioCodec,e&&(-1!==e.indexOf("mp4a.40.2")&&(a=!0),-1!==e.indexOf("mp4a.40.5")&&(i=!0))}),this.audioCodecSwitch=a&&i,this.audioCodecSwitch&&t.logger.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=r.levels,this.startLevelLoaded=!1,this.startFragRequested=!1;var n=this.config;n.autoStartLoad&&this.hls.startLoad(n.startPosition)}},{key:"onLevelLoaded",value:function(o){var a=o.details,i=o.level,l=this.levels[i],d=a.totalduration,n=0;if(t.logger.log("level "+i+" loaded ["+a.startSN+","+a.endSN+"],duration:"+d),this.levelLastLoaded=i,a.live){var f=l.details;f?(u.default.mergeDetails(f,a),n=a.fragments[0].start,a.PTSKnown?t.logger.log("live playlist sliding:"+n.toFixed(3)):t.logger.log("live playlist - outdated PTS, unknown sliding")):(a.PTSKnown=!1,t.logger.log("live playlist - first load, unknown sliding"))}else a.PTSKnown=!1;if(l.details=a,this.hls.trigger(r.default.LEVEL_UPDATED,{details:a,level:i}),this.startFragRequested===!1){if(-1===this.startPosition){var s=a.startTimeOffset;if(isNaN(s))if(a.live){var h=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*a.targetduration;this.startPosition=Math.max(0,n+d-h)}else this.startPosition=0;else t.logger.log("start time offset found in playlist, adjust startPosition to "+s),this.startPosition=s}this.nextLoadPosition=this.startPosition}this.state===e.WAITING_LEVEL&&(this.state=e.IDLE),this.tick()}},{key:"onKeyLoaded",value:function(){this.state===e.KEY_LOADING&&(this.state=e.IDLE,this.tick())}},{key:"onFragLoaded",value:function(i){var a=this.fragCurrent;if(this.state===e.FRAG_LOADING&&a&&i.frag.level===a.level&&i.frag.sn===a.sn)if(t.logger.log("Loaded  "+a.sn+" of level "+a.level),this.fragBitrateTest===!0)this.state=e.IDLE,this.fragBitrateTest=!1,this.startFragRequested=!1,i.stats.tparsed=i.stats.tbuffered=performance.now(),this.hls.trigger(r.default.FRAG_BUFFERED,{stats:i.stats,frag:a});else{this.state=e.PARSING,this.stats=i.stats;var s=this.levels[this.level],o=s.details,f=o.totalduration,h=void 0===a.startDTS||isNaN(a.startDTS)?a.start:a.startDTS,l=a.level,u=a.sn,n=s.audioCodec||this.config.defaultAudioCodec;this.audioCodecSwap&&(t.logger.log("swapping playlist audio codec"),void 0===n&&(n=this.lastAudioCodec),n&&(n=-1!==n.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5")),this.pendingAppending=0,t.logger.log("Demuxing "+u+" of ["+o.startSN+" ,"+o.endSN+"],level "+l+", cc "+a.cc);var d=this.demuxer;d&&d.push(i.payload,n,s.videoCodec,h,a.cc,l,u,f,a.decryptdata)}this.fragLoadError=0}},{key:"onFragParsingInitSegment",value:function(l){if(this.state===e.PARSING){var o,a,i=l.tracks;if(a=i.audio){var n=this.levels[this.level].audioCodec,u=navigator.userAgent.toLowerCase();n&&this.audioCodecSwap&&(t.logger.log("swapping playlist audio codec"),n=-1!==n.indexOf("mp4a.40.5")?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==a.metadata.channelCount&&-1===u.indexOf("firefox")&&(n="mp4a.40.5"),-1!==u.indexOf("android")&&(n="mp4a.40.2",t.logger.log("Android: force audio codec to"+n)),a.levelCodec=n}if(a=i.video,a&&(a.levelCodec=this.levels[this.level].videoCodec),l.unique){var s={codec:"",levelCodec:""};for(o in l.tracks)a=i[o],s.container=a.container,s.codec&&(s.codec+=",",s.levelCodec+=","),a.codec&&(s.codec+=a.codec),a.levelCodec&&(s.levelCodec+=a.levelCodec);i={audiovideo:s}}this.hls.trigger(r.default.BUFFER_CODECS,i);for(o in i){a=i[o],t.logger.log("track:"+o+",container:"+a.container+",codecs[level/parsed]=["+a.levelCodec+"/"+a.codec+"]");var d=a.initSegment;d&&(this.pendingAppending++,this.hls.trigger(r.default.BUFFER_APPENDING,{type:o,data:d}))}this.tick()}}},{key:"onFragParsingData",value:function(a){var o=this;if(this.state===e.PARSING){this.tparse2=Date.now();var n=this.levels[this.level],i=this.fragCurrent;t.logger.log("parsed "+a.type+",PTS:["+a.startPTS.toFixed(3)+","+a.endPTS.toFixed(3)+"],DTS:["+a.startDTS.toFixed(3)+"/"+a.endDTS.toFixed(3)+"],nb:"+a.nb+",dropped:"+(a.dropped||0));var l=u.default.updateFragPTSDTS(n.details,i.sn,a.startPTS,a.endPTS,a.startDTS,a.endDTS),s=this.hls;s.trigger(r.default.LEVEL_PTS_UPDATED,{details:n.details,level:this.level,drift:l}),"video"===a.type&&(i.dropped=a.dropped),[a.data1,a.data2].forEach(function(e){e&&(o.pendingAppending++,s.trigger(r.default.BUFFER_APPENDING,{type:a.type,data:e}))}),this.nextLoadPosition=a.endPTS,this.bufferRange.push({type:a.type,start:a.startPTS,end:a.endPTS,frag:i}),this.tick()}else t.logger.warn("not in PARSING state but "+this.state+", ignoring FRAG_PARSING_DATA event")}},{key:"onFragParsed",value:function(){this.state===e.PARSING&&(this.stats.tparsed=performance.now(),this.state=e.PARSED,this._checkAppendedParsed())}},{key:"onBufferAppended",value:function(){switch(this.state){case e.PARSING:case e.PARSED:this.pendingAppending--,this._checkAppendedParsed()}}},{key:"_checkAppendedParsed",value:function(){if(this.state===e.PARSED&&0===this.pendingAppending){var i=this.fragCurrent,a=this.stats;i&&(this.fragPrevious=i,a.tbuffered=performance.now(),this.fragLastKbps=Math.round(8*a.length/(a.tbuffered-a.tfirst)),this.hls.trigger(r.default.FRAG_BUFFERED,{stats:a,frag:i}),t.logger.log("media buffered : "+this.timeRangesToString(this.media.buffered)),this.state=e.IDLE),this.tick()}}},{key:"onError",value:function(i){switch(i.details){case a.ErrorDetails.FRAG_LOAD_ERROR:case a.ErrorDetails.FRAG_LOAD_TIMEOUT:if(!i.fatal){var n=this.fragLoadError;if(n?n++:n=1,n<=this.config.fragLoadingMaxRetry||this.media&&this.isBuffered(this.media.currentTime)){this.fragLoadError=n,i.frag.loadCounter=0;var s=Math.min(Math.pow(2,n-1)*this.config.fragLoadingRetryDelay,64e3);t.logger.warn("mediaController: frag loading failed, retry in "+s+" ms"),this.retryDate=performance.now()+s,this.state=e.FRAG_LOADING_WAITING_RETRY}else t.logger.error("mediaController: "+i.details+" reaches max retry, redispatch as fatal ..."),i.fatal=!0,this.hls.trigger(r.default.ERROR,i),this.state=e.ERROR}break;case a.ErrorDetails.FRAG_LOOP_LOADING_ERROR:case a.ErrorDetails.LEVEL_LOAD_ERROR:case a.ErrorDetails.LEVEL_LOAD_TIMEOUT:case a.ErrorDetails.KEY_LOAD_ERROR:case a.ErrorDetails.KEY_LOAD_TIMEOUT:this.state!==e.ERROR&&(this.state=i.fatal?e.ERROR:e.IDLE,t.logger.warn("mediaController: "+i.details+" while loading frag,switch to "+this.state+" state ..."));break;case a.ErrorDetails.BUFFER_FULL_ERROR:this.state!==e.PARSING&&this.state!==e.PARSED||(this.config.maxMaxBufferLength/=2,t.logger.warn("reduce max buffer length to "+this.config.maxMaxBufferLength+"s and switch to IDLE state"),this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.state=e.IDLE)}}},{key:"_checkBuffer",value:function(){var e=this.media;if(e&&e.readyState){var n=e.currentTime,u=e.buffered;if(!this.loadedmetadata&&u.length){this.loadedmetadata=!0;var i=this.startPosition;if(!n&&n!==i&&i){t.logger.log("target start position:"+i);var l=u.start(0),g=u.end(0);(l>i||i>g)&&(i=l,t.logger.log("target start position not buffered, seek to buffered.start(0) "+l)),t.logger.log("adjust currentTime from "+n+" to "+i),e.currentTime=i}}else{var d=s.default.bufferInfo(e,n,0),v=!(e.paused||e.ended||0===e.buffered.length),f=.4,h=n>e.playbackRate*this.lastCurrentTime;if(this.stalled&&h&&(this.stalled=!1,t.logger.log("playback not stuck anymore @"+n)),v&&d.len<=f&&(h?(f=0,this.seekHoleNudgeDuration=0):this.stalled?this.seekHoleNudgeDuration+=this.config.seekHoleNudgeDuration:(this.seekHoleNudgeDuration=0,t.logger.log("playback seems stuck @"+n),this.hls.trigger(r.default.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1}),this.stalled=!0),d.len<=f)){var o=d.nextStart,c=o-n;if(o&&c<this.config.maxSeekHole&&c>0){t.logger.log("adjust currentTime from "+e.currentTime+" to next buffered @ "+o+" + nudge "+this.seekHoleNudgeDuration);var p=o+this.seekHoleNudgeDuration-e.currentTime;e.currentTime=o+this.seekHoleNudgeDuration,this.hls.trigger(r.default.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,hole:p})}}}}}},{key:"onFragLoadEmergencyAborted",value:function(){this.state=e.IDLE,this.tick()}},{key:"onBufferFlushed",value:function(){var t,r,a=[];for(r=0;r<this.bufferRange.length;r++)t=this.bufferRange[r],this.isBuffered((t.start+t.end)/2)&&a.push(t);this.bufferRange=a,this.immediateSwitch&&this.immediateLevelSwitchEnd(),this.state=e.IDLE,this.fragPrevious=null}},{key:"swapAudioCodec",value:function(){this.audioCodecSwap=!this.audioCodecSwap}},{key:"timeRangesToString",value:function(t){for(var r="",a=t.length,e=0;a>e;e++)r+="["+t.start(e)+","+t.end(e)+"]";return r}},{key:"currentLevel",get:function(){if(this.media){var e=this.getBufferRange(this.media.currentTime);if(e)return e.frag.level}return-1}},{key:"nextBufferRange",get:function(){return this.media?this.followingBufferRange(this.getBufferRange(this.media.currentTime)):null}},{key:"nextLevel",get:function(){var e=this.nextBufferRange;return e?e.frag.level:-1}}]),i}(l.default);o.default=f},{"../demux/demuxer":17,"../errors":21,"../event-handler":22,"../events":23,"../helper/buffer-helper":24,"../helper/level-helper":25,"../utils/binary-search":35,"../utils/logger":38}],9:[function(t,v,a){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(a,"__esModule",{value:!0});var c=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),l=t("../events"),e=r(l),d=t("../event-handler"),i=r(d),h=t("../utils/cea-708-interpreter"),o=r(h),u=function(r){function t(a){f(this,t);var r=n(this,Object.getPrototypeOf(t).call(this,a,e.default.MEDIA_ATTACHING,e.default.MEDIA_DETACHING,e.default.FRAG_PARSING_USERDATA,e.default.MANIFEST_LOADING,e.default.FRAG_LOADED));return r.hls=a,r.config=a.config,r.config.enableCEA708Captions&&(r.cea708Interpreter=new o.default),r}return s(t,r),c(t,[{key:"destroy",value:function(){i.default.prototype.destroy.call(this)}},{key:"onMediaAttaching",value:function(e){var t=this.media=e.media;this.cea708Interpreter.attach(t)}},{key:"onMediaDetaching",value:function(){this.cea708Interpreter.detach()}},{key:"onManifestLoading",value:function(){this.lastPts=Number.POSITIVE_INFINITY}},{key:"onFragLoaded",value:function(t){var e=t.frag.start;e<=this.lastPts&&this.cea708Interpreter.clear(),this.lastPts=e}},{key:"onFragParsingUserdata",value:function(t){for(var e=0;e<t.samples.length;e++)this.cea708Interpreter.push(t.samples[e].pts,t.samples[e].bytes)}}]),t}(i.default);a.default=u},{"../event-handler":22,"../events":23,"../utils/cea-708-interpreter":36}],10:[function(i,n,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),a=function(){function e(f){t(this,e),this._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],this._precompute();var a,s,r,o,l,n=this._tables[0][4],u=this._tables[1],i=f.length,d=1;if(4!==i&&6!==i&&8!==i)throw new Error("Invalid aes key size="+i);for(o=f.slice(0),l=[],this._key=[o,l],a=i;4*i+28>a;a++)r=o[a-1],(a%i===0||8===i&&a%i===4)&&(r=n[r>>>24]<<24^n[r>>16&255]<<16^n[r>>8&255]<<8^n[255&r],a%i===0&&(r=r<<8^r>>>24^d<<24,d=d<<1^283*(d>>7))),o[a]=o[a-i]^r;for(s=0;a;s++,a--)r=o[3&s?a:a-4],4>=a||4>s?l[s]=r:l[s]=u[0][n[r>>>24]]^u[1][n[r>>16&255]]^u[2][n[r>>8&255]]^u[3][n[255&r]]}return r(e,[{key:"_precompute",value:function(){var e,a,r,u,f,d,t,s,l,n=this._tables[0],o=this._tables[1],h=n[4],v=o[4],i=[],c=[];for(e=0;256>e;e++)c[(i[e]=e<<1^283*(e>>7))^e]=e;for(a=r=0;!h[a];a^=u||1,r=c[r]||1)for(t=r^r<<1^r<<2^r<<3^r<<4,t=t>>8^255&t^99,h[a]=t,v[t]=a,d=i[f=i[u=i[a]]],l=16843009*d^65537*f^257*u^16843008*a,s=257*i[t]^16843008*t,e=0;4>e;e++)n[e][a]=s=s<<24^s>>>8,o[e][t]=l=l<<24^l>>>8;for(e=0;5>e;e++)n[e]=n[e].slice(0),o[e]=o[e].slice(0)}},{key:"decrypt",value:function(R,p,_,b,E,m){var h,g,v,n,e=this._key[1],t=R^e[0],a=b^e[1],i=_^e[2],r=p^e[3],y=e.length/4-2,s=4,o=this._tables[1],f=o[0],d=o[1],u=o[2],l=o[3],c=o[4];for(n=0;y>n;n++)h=f[t>>>24]^d[a>>16&255]^u[i>>8&255]^l[255&r]^e[s],g=f[a>>>24]^d[i>>16&255]^u[r>>8&255]^l[255&t]^e[s+1],v=f[i>>>24]^d[r>>16&255]^u[t>>8&255]^l[255&a]^e[s+2],r=f[r>>>24]^d[t>>16&255]^u[a>>8&255]^l[255&i]^e[s+3],s+=4,t=h,a=g,i=v;for(n=0;4>n;n++)E[(3&-n)+m]=c[t>>>24]<<24^c[a>>16&255]<<16^c[i>>8&255]<<8^c[255&r]^e[s++],h=t,t=a,a=i,i=r,r=h}}]),e}();e.default=a},{}],11:[function(t,l,e){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),n=t("./aes"),s=r(n),o=function(){function e(t,r){a(this,e),this.key=t,this.iv=r}return i(e,[{key:"ntoh",value:function(e){return e<<24|(65280&e)<<8|(16711680&e)>>8|e>>>24}},{key:"doDecrypt",value:function(a,g,i){var u,h,o,f,l,c,d,n,e,r=new Int32Array(a.buffer,a.byteOffset,a.byteLength>>2),p=new s.default(Array.prototype.slice.call(g)),v=new Uint8Array(a.byteLength),t=new Int32Array(v.buffer);for(u=~~i[0],h=~~i[1],o=~~i[2],f=~~i[3],e=0;e<r.length;e+=4)l=~~this.ntoh(r[e]),c=~~this.ntoh(r[e+1]),d=~~this.ntoh(r[e+2]),n=~~this.ntoh(r[e+3]),p.decrypt(l,c,d,n,t,e),t[e]=this.ntoh(t[e]^u),t[e+1]=this.ntoh(t[e+1]^h),t[e+2]=this.ntoh(t[e+2]^o),t[e+3]=this.ntoh(t[e+3]^f),u=l,h=c,o=d,f=n;return v}},{key:"localDecrypt",value:function(e,t,r,a){var i=this.doDecrypt(e,t,r);a.set(i,e.byteOffset)}},{key:"decrypt",value:function(n){var r=32e3,t=new Int32Array(n),a=new Uint8Array(n.byteLength),e=0,s=this.key,i=this.iv;for(this.localDecrypt(t.subarray(e,e+r),s,i,a),e=r;e<t.length;e+=r)i=new Uint32Array([this.ntoh(t[e-4]),this.ntoh(t[e-3]),this.ntoh(t[e-2]),this.ntoh(t[e-1])]),this.localDecrypt(t.subarray(e,e+r),s,i,a);return a}}]),e}();e.default=o},{"./aes":10}],12:[function(t,d,r){"use strict";function l(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(r,"__esModule",{value:!0});var u=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),s=t("./aes128-decrypter"),o=l(s),a=t("../errors"),e=t("../utils/logger"),n=function(){function t(r){i(this,t),this.hls=r;try{var e=window?window.crypto:crypto;this.subtle=e.subtle||e.webkitSubtle,this.disableWebCrypto=!this.subtle}catch(e){this.disableWebCrypto=!0}}return u(t,[{key:"destroy",value:function(){}},{key:"decrypt",value:function(e,t,r,a){this.disableWebCrypto&&this.hls.config.enableSoftwareAES?this.decryptBySoftware(e,t,r,a):this.decryptByWebCrypto(e,t,r,a)}},{key:"decryptByWebCrypto",value:function(t,r,a,i){var n=this;e.logger.log("decrypting by WebCrypto API"),this.subtle.importKey("raw",r,{name:"AES-CBC",length:128},!1,["decrypt"]).then(function(e){n.subtle.decrypt({name:"AES-CBC",iv:a.buffer},e,t).then(i).catch(function(e){n.onWebCryptoError(e,t,r,a,i)})}).catch(function(e){n.onWebCryptoError(e,t,r,a,i)})}},{key:"decryptBySoftware",value:function(r,a,i,n){e.logger.log("decrypting by JavaScript Implementation");var t=new DataView(a.buffer),s=new Uint32Array([t.getUint32(0),t.getUint32(4),t.getUint32(8),t.getUint32(12)]);t=new DataView(i.buffer);var l=new Uint32Array([t.getUint32(0),t.getUint32(4),t.getUint32(8),t.getUint32(12)]),u=new o.default(s,l);n(u.decrypt(r).buffer)}},{key:"onWebCryptoError",value:function(t,r,i,n,s){this.hls.config.enableSoftwareAES?(e.logger.log("disabling to use WebCrypto API"),this.disableWebCrypto=!0,this.decryptBySoftware(r,i,n,s)):(e.logger.error("decrypting error : "+t.message),this.hls.trigger(Event.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.FRAG_DECRYPT_ERROR,fatal:!0,reason:t.message}))}}]),t}();r.default=n},{"../errors":21,"../utils/logger":38,"./aes128-decrypter":11}],13:[function(e,f,t){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),d=e("./adts"),o=r(d),l=e("../utils/logger"),u=e("../demux/id3"),a=r(u),s=function(){function e(t,r){i(this,e),this.observer=t,this.remuxerClass=r,this.remuxer=new this.remuxerClass(t),this._aacTrack={container:"audio/adts",type:"audio",id:-1,sequenceNumber:0,samples:[],len:0}}return n(e,[{key:"push",value:function(t,p,R,m,_,b,E,y){var i,n,g,c,e,s,f,u,v,r=this._aacTrack,d=new a.default(t),h=90*d.timeStamp;for(e=d.length,u=t.length;u-1>e&&(255!==t[e]||240!==(240&t[e+1]));e++);for(r.audiosamplerate||(i=o.default.getAudioConfig(this.observer,t,e,p),r.config=i.config,r.audiosamplerate=i.samplerate,r.channelCount=i.channelCount,r.codec=i.codec,r.duration=y,l.logger.log("parsed codec:"+r.codec+",rate:"+i.samplerate+",nb channel:"+i.channelCount)),c=0,g=9216e4/r.audiosamplerate;u>e+5&&(s=1&t[e+1]?7:9,n=(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5,n-=s,n>0&&u>=e+s+n);)for(f=h+c*g,v={unit:t.subarray(e+s,e+s+n),pts:f,dts:f},r.samples.push(v),r.len+=n,e+=n+s,c++;u-1>e&&(255!==t[e]||240!==(240&t[e+1]));e++);this.remuxer.remux(this._aacTrack,{samples:[]},{samples:[{pts:h,dts:h,unit:d.payload}]},{samples:[]},m)}},{key:"destroy",value:function(){}}],[{key:"probe",value:function(t){var e,r,i=new a.default(t);if(i.hasTimeStamp)for(e=i.length,r=t.length;r-1>e;e++)if(255===t[e]&&240===(240&t[e+1]))return!0;return!1}}]),e}();t.default=s},{"../demux/id3":19,"../utils/logger":38,"./adts":14}],14:[function(e,o,t){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),n=e("../utils/logger"),r=e("../errors"),s=function(){function e(){a(this,e)}return i(e,null,[{key:"getAudioConfig",value:function(h,u,l,i){var a,e,s,o,t,f=navigator.userAgent.toLowerCase(),d=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];return a=((192&u[l+2])>>>6)+1,e=(60&u[l+2])>>>2,e>d.length-1?void h.trigger(Event.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+e}):(o=(1&u[l+2])<<2,o|=(192&u[l+3])>>>6,n.logger.log("manifest codec:"+i+",ADTS data:type:"+a+",sampleingIndex:"+e+"["+d[e]+"Hz],channelConfig:"+o),-1!==f.indexOf("firefox")?e>=6?(a=5,t=new Array(4),s=e-3):(a=2,t=new Array(2),s=e):-1!==f.indexOf("android")?(a=2,t=new Array(2),s=e):(a=5,t=new Array(4),i&&(-1!==i.indexOf("mp4a.40.29")||-1!==i.indexOf("mp4a.40.5"))||!i&&e>=6?s=e-3:((i&&-1!==i.indexOf("mp4a.40.2")&&e>=6&&1===o||!i&&1===o)&&(a=2,t=new Array(2)),s=e)),t[0]=a<<3,t[0]|=(14&e)>>1,t[1]|=(1&e)<<7,t[1]|=o<<3,5===a&&(t[1]|=(14&s)>>1,t[2]=(1&s)<<7,t[2]|=8,t[3]=0),{config:t,samplerate:d[e],channelCount:o,codec:"mp4a.40."+a})}}]),e}();t.default=s},{"../errors":21,"../utils/logger":38}],15:[function(e,y,a){"use strict";function t(e){return e&&e.__esModule?e:{default:e}}function d(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(a,"__esModule",{value:!0});var h=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),v=e("../events"),o=t(v),i=e("../errors"),p=e("../demux/aacdemuxer"),n=t(p),f=e("../demux/tsdemuxer"),r=t(f),c=e("../remux/mp4-remuxer"),s=t(c),g=e("../remux/passthrough-remuxer"),u=t(g),l=function(){function e(t,r){d(this,e),this.hls=t,this.typeSupported=r}return h(e,[{key:"destroy",value:function(){var e=this.demuxer;e&&e.destroy()}},{key:"push",value:function(a,l,d,f,h,c,v,g){var e=this.demuxer;if(!e){var t=this.hls;if(r.default.probe(a))e=this.typeSupported.mp2t===!0?new r.default(t,u.default):new r.default(t,s.default);else{if(!n.default.probe(a))return void t.trigger(o.default.ERROR,{type:i.ErrorTypes.MEDIA_ERROR,details:i.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"});e=new n.default(t,s.default)}this.demuxer=e}e.push(a,l,d,f,h,c,v,g)}}]),e}();a.default=l},{"../demux/aacdemuxer":13,"../demux/tsdemuxer":20,"../errors":21,"../events":23,"../remux/mp4-remuxer":32,"../remux/passthrough-remuxer":33}],16:[function(t,d,a){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(a,"__esModule",{value:!0});var i=t("../demux/demuxer-inline"),u=r(i),s=t("../events"),e=r(s),l=t("events"),n=r(l),o=function(r){var t=new n.default;t.trigger=function(a){for(var r=arguments.length,i=Array(r>1?r-1:0),e=1;r>e;e++)i[e-1]=arguments[e];t.emit.apply(t,[a,a].concat(i))},t.off=function(i){for(var r=arguments.length,a=Array(r>1?r-1:0),e=1;r>e;e++)a[e-1]=arguments[e];t.removeListener.apply(t,[i].concat(a))},r.addEventListener("message",function(a){var e=a.data;switch(e.cmd){case"init":r.demuxer=new u.default(t,e.typeSupported);break;case"demux":r.demuxer.push(new Uint8Array(e.data),e.audioCodec,e.videoCodec,e.timeOffset,e.cc,e.level,e.sn,e.duration)}}),t.on(e.default.FRAG_PARSING_INIT_SEGMENT,function(t,e){r.postMessage({event:t,tracks:e.tracks,unique:e.unique})}),t.on(e.default.FRAG_PARSING_DATA,function(a,e){var t={event:a,type:e.type,startPTS:e.startPTS,endPTS:e.endPTS,startDTS:e.startDTS,endDTS:e.endDTS,data1:e.data1.buffer,data2:e.data2.buffer,nb:e.nb,dropped:e.dropped};r.postMessage(t,[t.data1,t.data2])}),t.on(e.default.FRAG_PARSED,function(e){r.postMessage({event:e})}),t.on(e.default.ERROR,function(e,t){r.postMessage({event:e,data:t})}),t.on(e.default.FRAG_PARSING_METADATA,function(e,t){var a={event:e,samples:t.samples};r.postMessage(a)}),t.on(e.default.FRAG_PARSING_USERDATA,function(e,t){var a={event:e,samples:t.samples};r.postMessage(a)})};a.default=o},{"../demux/demuxer-inline":15,"../events":23,events:1}],17:[function(t,p,a){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function l(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(a,"__esModule",{value:!0});var u=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),h=t("../events"),e=r(h),g=t("../demux/demuxer-inline"),n=r(g),d=t("../demux/demuxer-worker"),f=r(d),s=t("../utils/logger"),c=t("../crypt/decrypter"),v=r(c),i=t("../errors"),o=function(){function r(a){l(this,r),this.hls=a;var o={mp4:MediaSource.isTypeSupported("video/mp4"),mp2t:a.config.enableMP2TPassThrough&&MediaSource.isTypeSupported("video/mp2t")};if(a.config.enableWorker&&"undefined"!=typeof Worker){s.logger.log("demuxing in webworker");try{var d=t("webworkify"),u=this.w=d(f.default);this.onwmsg=this.onWorkerMessage.bind(this),u.addEventListener("message",this.onwmsg),u.onerror=function(t){a.trigger(e.default.ERROR,{type:i.ErrorTypes.OTHER_ERROR,details:i.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",err:{message:t.message+" ("+t.filename+":"+t.lineno+")"}})},u.postMessage({cmd:"init",typeSupported:o})}catch(e){s.logger.error("error while initializing DemuxerWorker, fallback on DemuxerInline"),this.demuxer=new n.default(a,o)}}else this.demuxer=new n.default(a,o);this.demuxInitialized=!0}return u(r,[{key:"destroy",value:function(){var e=this.w;if(e)e.removeEventListener("message",this.onwmsg),e.terminate(),this.w=null;else{var t=this.demuxer;t&&(t.destroy(),this.demuxer=null)}var r=this.decrypter;r&&(r.destroy(),this.decrypter=null)}},{key:"pushDecrypted",value:function(e,t,r,a,i,n,s,o){var l=this.w;if(l)l.postMessage({cmd:"demux",data:e,audioCodec:t,videoCodec:r,timeOffset:a,cc:i,level:n,sn:s,duration:o},[e]);else{var u=this.demuxer;u&&u.push(new Uint8Array(e),t,r,a,i,n,s,o)}}},{key:"push",value:function(t,r,a,i,n,s,o,l,e){if(t.byteLength>0&&null!=e&&null!=e.key&&"AES-128"===e.method){null==this.decrypter&&(this.decrypter=new v.default(this.hls));var u=this;this.decrypter.decrypt(t,e.key,e.iv,function(e){u.pushDecrypted(e,r,a,i,n,s,o,l)})}else this.pushDecrypted(t,r,a,i,n,s,o,l)}},{key:"onWorkerMessage",value:function(a){var t=a.data;switch(t.event){case e.default.FRAG_PARSING_INIT_SEGMENT:var r={};r.tracks=t.tracks,r.unique=t.unique,this.hls.trigger(e.default.FRAG_PARSING_INIT_SEGMENT,r);break;case e.default.FRAG_PARSING_DATA:this.hls.trigger(e.default.FRAG_PARSING_DATA,{data1:new Uint8Array(t.data1),data2:new Uint8Array(t.data2),startPTS:t.startPTS,endPTS:t.endPTS,startDTS:t.startDTS,endDTS:t.endDTS,type:t.type,nb:t.nb,dropped:t.dropped});break;case e.default.FRAG_PARSING_METADATA:this.hls.trigger(e.default.FRAG_PARSING_METADATA,{
+    samples:t.samples});break;case e.default.FRAG_PARSING_USERDATA:this.hls.trigger(e.default.FRAG_PARSING_USERDATA,{samples:t.samples});break;default:this.hls.trigger(t.event,t.data)}}}]),r}();a.default=o},{"../crypt/decrypter":12,"../demux/demuxer-inline":15,"../demux/demuxer-worker":16,"../errors":21,"../events":23,"../utils/logger":38,webworkify:2}],18:[function(t,s,e){"use strict";function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var a=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),i=t("../utils/logger"),n=function(){function e(t){r(this,e),this.data=t,this.bytesAvailable=this.data.byteLength,this.word=0,this.bitsAvailable=0}return a(e,[{key:"loadWord",value:function(){var t=this.data.byteLength-this.bytesAvailable,r=new Uint8Array(4),e=Math.min(4,this.bytesAvailable);if(0===e)throw new Error("no bytes available");r.set(this.data.subarray(t,t+e)),this.word=new DataView(r.buffer).getUint32(0),this.bitsAvailable=8*e,this.bytesAvailable-=e}},{key:"skipBits",value:function(e){var t;this.bitsAvailable>e?(this.word<<=e,this.bitsAvailable-=e):(e-=this.bitsAvailable,t=e>>3,e-=t>>3,this.bytesAvailable-=t,this.loadWord(),this.word<<=e,this.bitsAvailable-=e)}},{key:"readBits",value:function(t){var e=Math.min(this.bitsAvailable,t),r=this.word>>>32-e;return t>32&&i.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0?this.word<<=e:this.bytesAvailable>0&&this.loadWord(),e=t-e,e>0?r<<e|this.readBits(e):r}},{key:"skipLZ",value:function(){var e;for(e=0;e<this.bitsAvailable;++e)if(0!==(this.word&2147483648>>>e))return this.word<<=e,this.bitsAvailable-=e,e;return this.loadWord(),e+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"skipEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var e=this.skipLZ();return this.readBits(e+1)-1}},{key:"readEG",value:function(){var e=this.readUEG();return 1&e?1+e>>>1:-1*(e>>>1)}},{key:"readBoolean",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"readUShort",value:function(){return this.readBits(16)}},{key:"readUInt",value:function(){return this.readBits(32)}},{key:"skipScalingList",value:function(i){var t,a,r=8,e=8;for(t=0;i>t;t++)0!==e&&(a=this.readEG(),e=(r+a+256)%256),r=0===e?r:e}},{key:"readSPS",value:function(){var t,g,p,l,i,n,a,o,r,s=0,d=0,f=0,h=0,c=1;if(this.readUByte(),t=this.readUByte(),g=this.readBits(5),this.skipBits(3),p=this.readUByte(),this.skipUEG(),100===t||110===t||122===t||244===t||44===t||83===t||86===t||118===t||128===t){var v=this.readUEG();if(3===v&&this.skipBits(1),this.skipUEG(),this.skipUEG(),this.skipBits(1),this.readBoolean())for(o=3!==v?8:12,r=0;o>r;r++)this.readBoolean()&&(6>r?this.skipScalingList(16):this.skipScalingList(64))}this.skipUEG();var u=this.readUEG();if(0===u)this.readUEG();else if(1===u)for(this.skipBits(1),this.skipEG(),this.skipEG(),l=this.readUEG(),r=0;l>r;r++)this.skipEG();if(this.skipUEG(),this.skipBits(1),i=this.readUEG(),n=this.readUEG(),a=this.readBits(1),0===a&&this.skipBits(1),this.skipBits(1),this.readBoolean()&&(s=this.readUEG(),d=this.readUEG(),f=this.readUEG(),h=this.readUEG()),this.readBoolean()&&this.readBoolean()){var e=void 0,y=this.readUByte();switch(y){case 1:e=[1,1];break;case 2:e=[12,11];break;case 3:e=[10,11];break;case 4:e=[16,11];break;case 5:e=[40,33];break;case 6:e=[24,11];break;case 7:e=[20,11];break;case 8:e=[32,11];break;case 9:e=[80,33];break;case 10:e=[18,11];break;case 11:e=[15,11];break;case 12:e=[64,33];break;case 13:e=[160,99];break;case 14:e=[4,3];break;case 15:e=[3,2];break;case 16:e=[2,1];break;case 255:e=[this.readUByte()<<8|this.readUByte(),this.readUByte()<<8|this.readUByte()]}e&&(c=e[0]/e[1])}return{width:Math.ceil((16*(i+1)-2*s-2*d)*c),height:(2-a)*(n+1)*16-(a?2:4)*(f+h)}}},{key:"readSliceType",value:function(){return this.readUByte(),this.readUEG(),this.readUEG()}}]),e}();e.default=n},{"../utils/logger":38}],19:[function(r,s,t){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),e=r("../utils/logger"),n=function(){function t(i){a(this,t),this._hasTimeStamp=!1;for(var l,u,d,f,h,s,o,n,r=0;;)if(o=this.readUTF(i,r,3),r+=3,"ID3"===o)r+=3,l=127&i[r++],u=127&i[r++],d=127&i[r++],f=127&i[r++],h=(l<<21)+(u<<14)+(d<<7)+f,s=r+h,this._parseID3Frames(i,r,s),r=s;else{if("3DI"!==o)return r-=3,n=r,void(n&&(this.hasTimeStamp||e.logger.warn("ID3 tag found, but no timestamp"),this._length=n,this._payload=i.subarray(0,n)));r+=7,e.logger.log("3DI footer found, end: "+r)}}return i(t,[{key:"readUTF",value:function(a,e,i){var t="",r=e,n=e+i;do t+=String.fromCharCode(a[r++]);while(n>r);return t}},{key:"_parseID3Frames",value:function(r,t,n){for(var i,s,o,l,a;n>=t+8;)switch(i=this.readUTF(r,t,4),t+=4,s=r[t++]<<24+r[t++]<<16+r[t++]<<8+r[t++],l=r[t++]<<8+r[t++],o=t,i){case"PRIV":if("com.apple.streaming.transportStreamTimestamp"===this.readUTF(r,t,44)){t+=44,t+=4;var u=1&r[t++];this._hasTimeStamp=!0,a=((r[t++]<<23)+(r[t++]<<15)+(r[t++]<<7)+r[t++])/45,u&&(a+=47721858.84),a=Math.round(a),e.logger.trace("ID3 timestamp found: "+a),this._timeStamp=a}}}},{key:"hasTimeStamp",get:function(){return this._hasTimeStamp}},{key:"timeStamp",get:function(){return this._timeStamp}},{key:"length",get:function(){return this._length}},{key:"payload",get:function(){return this._payload}}]),t}();t.default=n},{"../utils/logger":38}],20:[function(t,v,i){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var f=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),h=t("./adts"),c=a(h),l=t("../events"),n=a(l),d=t("./exp-golomb"),s=a(d),e=t("../utils/logger"),r=t("../errors"),o=function(){function t(e,r){u(this,t),this.observer=e,this.remuxerClass=r,this.lastCC=0,this.remuxer=new this.remuxerClass(e)}return f(t,[{key:"switchLevel",value:function(){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack={container:"video/mp2t",type:"video",id:-1,sequenceNumber:0,samples:[],len:0,nbNalu:0,dropped:0},this._aacTrack={container:"video/mp2t",type:"audio",id:-1,sequenceNumber:0,samples:[],len:0},this._id3Track={type:"id3",id:-1,sequenceNumber:0,samples:[],len:0},this._txtTrack={type:"text",id:-1,sequenceNumber:0,samples:[],len:0},this.aacOverFlow=null,this.aacLastPTS=null,this.avcNaluState=0,this.remuxer.switchLevel()}},{key:"insertDiscontinuity",value:function(){this.switchLevel(),this.remuxer.insertDiscontinuity()}},{key:"push",value:function(a,A,T,R,p,m,E,L){var s,o,l,t,d,u,y,i,c=a.length,b=this.remuxer.passthrough,v=!1;this.audioCodec=A,this.videoCodec=T,this.timeOffset=R,this._duration=L,this.contiguous=!1,p!==this.lastCC&&(e.logger.log("discontinuity detected"),this.insertDiscontinuity(),this.lastCC=p),m!==this.lastLevel?(e.logger.log("level switch detected"),this.switchLevel(),this.lastLevel=m):E===this.lastSN+1&&(this.contiguous=!0),this.lastSN=E;var g=this.pmtParsed,h=this._avcTrack.id,f=this._aacTrack.id,_=this._id3Track.id;for(c-=c%188,t=0;c>t;t+=188)if(71===a[t]){if(d=!!(64&a[t+1]),u=((31&a[t+1])<<8)+a[t+2],y=(48&a[t+3])>>4,y>1){if(i=t+5+a[t+4],i===t+188)continue}else i=t+4;if(g)if(u===h){if(d){if(s&&(this._parseAVCPES(this._parsePES(s)),b&&this._avcTrack.codec&&(-1===f||this._aacTrack.codec)))return void this.remux(a);s={data:[],size:0}}s&&(s.data.push(a.subarray(i,t+188)),s.size+=t+188-i)}else if(u===f){if(d){if(o&&(this._parseAACPES(this._parsePES(o)),b&&this._aacTrack.codec&&(-1===h||this._avcTrack.codec)))return void this.remux(a);o={data:[],size:0}}o&&(o.data.push(a.subarray(i,t+188)),o.size+=t+188-i)}else u===_&&(d&&(l&&this._parseID3PES(this._parsePES(l)),l={data:[],size:0}),l&&(l.data.push(a.subarray(i,t+188)),l.size+=t+188-i));else d&&(i+=a[i]+1),0===u?this._parsePAT(a,i):u===this._pmtId?(this._parsePMT(a,i),g=this.pmtParsed=!0,h=this._avcTrack.id,f=this._aacTrack.id,_=this._id3Track.id,v&&(e.logger.log("reparse from beginning"),v=!1,t=-188)):(e.logger.log("unknown PID found before PAT/PMT"),v=!0)}else this.observer.trigger(n.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});s&&this._parseAVCPES(this._parsePES(s)),o&&this._parseAACPES(this._parsePES(o)),l&&this._parseID3PES(this._parsePES(l)),this.remux(null)}},{key:"remux",value:function(e){this.remuxer.remux(this._aacTrack,this._avcTrack,this._id3Track,this._txtTrack,this.timeOffset,this.contiguous,e)}},{key:"destroy",value:function(){this.switchLevel(),this._initPTS=this._initDTS=void 0,this._duration=0}},{key:"_parsePAT",value:function(e,t){this._pmtId=(31&e[t+10])<<8|e[t+11]}},{key:"_parsePMT",value:function(r,t){var i,n,s,a;for(i=(15&r[t+1])<<8|r[t+2],n=t+3+i-4,s=(15&r[t+10])<<8|r[t+11],t+=12+s;n>t;){switch(a=(31&r[t+1])<<8|r[t+2],r[t]){case 15:this._aacTrack.id=a;break;case 21:this._id3Track.id=a;break;case 27:this._avcTrack.id=a;break;default:e.logger.log("unkown stream type:"+r[t])}t+=((15&r[t+3])<<8|r[t+4])+5}}},{key:"_parsePES",value:function(o){var e,n,h,d,u,l,a,r,t,f=0,s=o.data;if(e=s[0],h=(e[0]<<16)+(e[1]<<8)+e[2],1===h){for(d=(e[4]<<8)+e[5],n=e[7],192&n&&(a=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,a>4294967295&&(a-=8589934592),64&n?(r=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,r>4294967295&&(r-=8589934592)):r=a),u=e[8],t=u+9,o.size-=t,l=new Uint8Array(o.size);s.length;){e=s.shift();var i=e.byteLength;if(t){if(t>i){t-=i;continue}e=e.subarray(t),i-=t,t=0}l.set(e,f),f+=i}return{data:l,pts:a,dts:r,len:d}}return null}},{key:"_parseAVCPES",value:function(a){var t,m,n,o,y=this,r=this._avcTrack,u=r.samples,p=this._parseAVCNALu(a.data),d=[],l=!1,c=!1,f=0;if(0===p.length&&u.length>0){var v=u[u.length-1],h=v.units.units[v.units.units.length-1],g=new Uint8Array(h.data.byteLength+a.data.byteLength);g.set(h.data,0),g.set(a.data,h.data.byteLength),h.data=g,v.units.length+=a.data.byteLength,r.len+=a.data.byteLength}a.data=null;var i="",E=function(){d.length&&(c===!0||r.sps&&(u.length||this.contiguous)?(m={units:{units:d,length:f},pts:a.pts,dts:a.dts,key:c},u.push(m),r.len+=f,r.nbNalu+=d.length):r.dropped++,d=[],f=0)}.bind(this);p.forEach(function(e){switch(e.type){case 1:n=!0,l&&(i+="NDR ");break;case 5:n=!0,l&&(i+="IDR "),c=!0;break;case 6:n=!0,l&&(i+="SEI "),t=new s.default(e.data),t.readUByte();var b=t.readUByte();if(4===b){var g=0;do g=t.readUByte();while(255===g);var A=t.readUByte();if(181===A){var R=t.readUShort();if(49===R){var L=t.readUInt();if(1195456820===L){var k=t.readUByte();if(3===k){var v=t.readUByte(),_=t.readUByte(),S=31&v,h=[v,_];for(o=0;S>o;o++)h.push(t.readUByte()),h.push(t.readUByte()),h.push(t.readUByte());y._txtTrack.samples.push({type:3,pts:a.pts,bytes:h})}}}}}break;case 7:if(n=!0,l&&(i+="SPS "),!r.sps){t=new s.default(e.data);var p=t.readSPS();r.width=p.width,r.height=p.height,r.sps=[e.data],r.duration=y._duration;var T=e.data.subarray(1,4),m="avc1.";for(o=0;3>o;o++){var u=T[o].toString(16);u.length<2&&(u="0"+u),m+=u}r.codec=m}break;case 8:n=!0,l&&(i+="PPS "),r.pps||(r.pps=[e.data]);break;case 9:n=!1,l&&(i+="AUD "),E();break;default:n=!1,i+="unknown NAL "+e.type+" "}n&&(d.push(e),f+=e.data.byteLength)}),(l||i.length)&&e.logger.log(i),E()}},{key:"_parseAVCNALu",value:function(r){for(var s,a,l,_,n,d,t=0,g=r.byteLength,e=this.avcNaluState,v=[];g>t;)switch(s=r[t++],e){case 0:0===s&&(e=1);break;case 1:e=0===s?2:0;break;case 2:case 3:if(0===s)e=3;else if(1===s&&g>t){if(_=31&r[t],n)l={data:r.subarray(n,t-e-1),type:d},v.push(l);else{var i=this.avcNaluState;if(i&&4-i>=t){var m=this._avcTrack,c=m.samples;if(c.length){var p=c[c.length-1],R=p.units.units,u=R[R.length-1];u.state&&(u.data=u.data.subarray(0,u.data.byteLength-i),p.units.length-=i,m.len-=i)}}if(a=t-e-1,a>0){var y=this._avcTrack,h=y.samples;if(h.length){var E=h[h.length-1],b=E.units.units,o=b[b.length-1],f=new Uint8Array(o.data.byteLength+a);f.set(o.data,0),f.set(r.subarray(0,a),o.data.byteLength),o.data=f,E.units.length+=a,y.len+=a}}}n=t,d=_,e=0}else e=0}return n&&(l={data:r.subarray(n,g),type:d,state:e},v.push(l),this.avcNaluState=e),v}},{key:"_parseAACPES",value:function(R){var l,o,p,E,t,d,f,s,_,i=this._aacTrack,a=R.data,v=R.pts,T=0,L=this._duration,A=this.audioCodec,u=this.aacOverFlow,b=this.aacLastPTS;if(u){var m=new Uint8Array(u.byteLength+a.byteLength);m.set(u,0),m.set(a,u.byteLength),a=m}for(t=T,s=a.length;s-1>t&&(255!==a[t]||240!==(240&a[t+1]));t++);if(t){var y,h;if(s-1>t?(y="AAC PES did not start with ADTS header,offset:"+t,h=!1):(y="no ADTS header found in AAC PES",h=!0),this.observer.trigger(n.default.ERROR,{type:r.ErrorTypes.MEDIA_ERROR,details:r.ErrorDetails.FRAG_PARSING_ERROR,fatal:h,reason:y}),h)return}if(i.audiosamplerate||(l=c.default.getAudioConfig(this.observer,a,t,A),i.config=l.config,i.audiosamplerate=l.samplerate,i.channelCount=l.channelCount,i.codec=l.codec,i.duration=L,e.logger.log("parsed codec:"+i.codec+",rate:"+l.samplerate+",nb channel:"+l.channelCount)),E=0,p=9216e4/i.audiosamplerate,u&&b){var g=b+p;Math.abs(g-v)>1&&(e.logger.log("AAC: align PTS for overlapping frames by "+Math.round((g-v)/90)),v=g)}for(;s>t+5&&(d=1&a[t+1]?7:9,o=(3&a[t+3])<<11|a[t+4]<<3|(224&a[t+5])>>>5,o-=d,o>0&&s>=t+d+o);)for(f=v+E*p,_={unit:a.subarray(t+d,t+d+o),pts:f,dts:f},i.samples.push(_),i.len+=o,t+=o+d,E++;s-1>t&&(255!==a[t]||240!==(240&a[t+1]));t++);u=s>t?a.subarray(t,s):null,this.aacOverFlow=u,this.aacLastPTS=f}},{key:"_parseID3PES",value:function(e){this._id3Track.samples.push(e)}}],[{key:"probe",value:function(e){return e.length>=564&&71===e[0]&&71===e[188]&&71===e[376]}}]),t}();i.default=o},{"../errors":21,"../events":23,"../utils/logger":38,"./adts":14,"./exp-golomb":18}],21:[function(t,r,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});e.ErrorTypes={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",OTHER_ERROR:"otherError"},e.ErrorDetails={MANIFEST_LOAD_ERROR:"manifestLoadError",MANIFEST_LOAD_TIMEOUT:"manifestLoadTimeOut",MANIFEST_PARSING_ERROR:"manifestParsingError",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"manifestIncompatibleCodecsError",LEVEL_LOAD_ERROR:"levelLoadError",LEVEL_LOAD_TIMEOUT:"levelLoadTimeOut",LEVEL_SWITCH_ERROR:"levelSwitchError",FRAG_LOAD_ERROR:"fragLoadError",FRAG_LOOP_LOADING_ERROR:"fragLoopLoadingError",FRAG_LOAD_TIMEOUT:"fragLoadTimeOut",FRAG_DECRYPT_ERROR:"fragDecryptError",FRAG_PARSING_ERROR:"fragParsingError",KEY_LOAD_ERROR:"keyLoadError",KEY_LOAD_TIMEOUT:"keyLoadTimeOut",BUFFER_APPEND_ERROR:"bufferAppendError",BUFFER_APPENDING_ERROR:"bufferAppendingError",BUFFER_STALLED_ERROR:"bufferStalledError",BUFFER_FULL_ERROR:"bufferFullError",BUFFER_SEEK_OVER_HOLE:"bufferSeekOverHole",INTERNAL_EXCEPTION:"internalException"}},{}],22:[function(e,f,t){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e},d=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),o=e("./utils/logger"),r=e("./errors"),u=e("./events"),s=a(u),l=function(){function e(n){i(this,e),this.hls=n,this.onEvent=this.onEvent.bind(this);for(var r=arguments.length,a=Array(r>1?r-1:0),t=1;r>t;t++)a[t-1]=arguments[t];this.handledEvents=a,this.useGenericHandler=!0,this.registerListeners()}return d(e,[{key:"destroy",value:function(){this.unregisterListeners()}},{key:"isEventHandler",value:function(){return"object"===n(this.handledEvents)&&this.handledEvents.length&&"function"==typeof this.onEvent}},{key:"registerListeners",value:function(){this.isEventHandler()&&this.handledEvents.forEach(function(e){if("hlsEventGeneric"===e)throw new Error("Forbidden event name: "+e);this.hls.on(e,this.onEvent)}.bind(this))}},{key:"unregisterListeners",value:function(){this.isEventHandler()&&this.handledEvents.forEach(function(e){this.hls.off(e,this.onEvent)}.bind(this))}},{key:"onEvent",value:function(e,t){this.onEventGeneric(e,t)}},{key:"onEventGeneric",value:function(e,t){var a=function(t,r){var e="on"+t.replace("hls","");if("function"!=typeof this[e])throw new Error("Event "+t+" has no generic handler in this "+this.constructor.name+" class (tried "+e+")");return this[e].bind(this,r)};try{a.call(this,e,t).call()}catch(t){o.logger.error("internal error happened while processing "+e+":"+t.message),this.hls.trigger(s.default.ERROR,{type:r.ErrorTypes.OTHER_ERROR,details:r.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:e,err:t})}}}]),e}();t.default=l},{"./errors":21,"./events":23,"./utils/logger":38}],23:[function(t,e,r){"use strict";e.exports={MEDIA_ATTACHING:"hlsMediaAttaching",MEDIA_ATTACHED:"hlsMediaAttached",MEDIA_DETACHING:"hlsMediaDetaching",MEDIA_DETACHED:"hlsMediaDetached",BUFFER_RESET:"hlsBufferReset",BUFFER_CODECS:"hlsBufferCodecs",BUFFER_APPENDING:"hlsBufferAppending",BUFFER_APPENDED:"hlsBufferAppended",BUFFER_EOS:"hlsBufferEos",BUFFER_FLUSHING:"hlsBufferFlushing",BUFFER_FLUSHED:"hlsBufferFlushed",MANIFEST_LOADING:"hlsManifestLoading",MANIFEST_LOADED:"hlsManifestLoaded",MANIFEST_PARSED:"hlsManifestParsed",LEVEL_LOADING:"hlsLevelLoading",LEVEL_LOADED:"hlsLevelLoaded",LEVEL_UPDATED:"hlsLevelUpdated",LEVEL_PTS_UPDATED:"hlsLevelPtsUpdated",LEVEL_SWITCH:"hlsLevelSwitch",FRAG_LOADING:"hlsFragLoading",FRAG_LOAD_PROGRESS:"hlsFragLoadProgress",FRAG_LOAD_EMERGENCY_ABORTED:"hlsFragLoadEmergencyAborted",FRAG_LOADED:"hlsFragLoaded",FRAG_PARSING_INIT_SEGMENT:"hlsFragParsingInitSegment",FRAG_PARSING_USERDATA:"hlsFragParsingUserdata",FRAG_PARSING_METADATA:"hlsFragParsingMetadata",FRAG_PARSING_DATA:"hlsFragParsingData",FRAG_PARSED:"hlsFragParsed",FRAG_BUFFERED:"hlsFragBuffered",FRAG_CHANGED:"hlsFragChanged",FPS_DROP:"hlsFpsDrop",ERROR:"hlsError",DESTROYING:"hlsDestroying",KEY_LOADING:"hlsKeyLoading",KEY_LOADED:"hlsKeyLoaded"}},{}],24:[function(i,n,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),a=function(){function e(){t(this,e)}return r(e,null,[{key:"bufferInfo",value:function(r,i,n){if(r){var e,t=r.buffered,a=[];for(e=0;e<t.length;e++)a.push({start:t.start(e),end:t.end(e)});return this.bufferedInfo(a,i,n)}return{len:0,start:0,end:0,nextStart:void 0}}},{key:"bufferedInfo",value:function(r,a,s){var o,l,i,h,e,t=[];for(r.sort(function(e,t){var r=e.start-t.start;return r?r:t.end-e.end}),e=0;e<r.length;e++){var u=t.length;if(u){var d=t[u-1].end;r[e].start-d<s?r[e].end>d&&(t[u-1].end=r[e].end):t.push(r[e])}else t.push(r[e])}for(e=0,o=0,l=i=a;e<t.length;e++){var n=t[e].start,f=t[e].end;if(a+s>=n&&f>a)l=n,i=f,o=i-a;else if(n>a+s){h=n;break}}return{len:o,start:l,end:i,nextStart:h}}}]),e}();e.default=a},{}],25:[function(r,s,t){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),e=r("../utils/logger"),n=function(){function t(){a(this,t)}return i(t,null,[{key:"mergeDetails",value:function(o,a){var i,c=Math.max(o.startSN,a.startSN)-a.startSN,h=Math.min(o.endSN,a.endSN)-a.startSN,u=a.startSN-o.startSN,f=o.fragments,l=a.fragments,d=0;if(c>h)return void(a.PTSKnown=!1);for(var r=c;h>=r;r++){var s=f[u+r],n=l[r];n&&s&&(d=s.cc-n.cc,isNaN(s.startPTS)||(n.start=n.startPTS=s.startPTS,n.endPTS=s.endPTS,n.duration=s.duration,i=n))}if(d)for(e.logger.log("discontinuity sliding from playlist, take drift into account"),r=0;r<l.length;r++)l[r].cc+=d;if(i)t.updateFragPTSDTS(a,i.sn,i.startPTS,i.endPTS,i.startDTS,i.endDTS);else if(u>=0&&u<f.length){var v=f[u].start;for(r=0;r<l.length;r++)l[r].start+=v}a.PTSKnown=o.PTSKnown}},{key:"updateFragPTSDTS",value:function(i,l,a,s,d,u){var o,n,e,r;if(l<i.startSN||l>i.endSN)return 0;if(o=l-i.startSN,n=i.fragments,e=n[o],!isNaN(e.startPTS)){var f=Math.abs(e.startPTS-a);isNaN(e.deltaPTS)?e.deltaPTS=f:e.deltaPTS=Math.max(f,e.deltaPTS),a=Math.min(a,e.startPTS),s=Math.max(s,e.endPTS),d=Math.min(d,e.startDTS),u=Math.max(u,e.endDTS)}var h=a-e.start;for(e.start=e.startPTS=a,e.endPTS=s,e.startDTS=d,e.endDTS=u,e.duration=s-a,r=o;r>0;r--)t.updatePTS(n,r,r-1);for(r=o;r<n.length-1;r++)t.updatePTS(n,r,r+1);return i.PTSKnown=!0,h}},{key:"updatePTS",value:function(s,a,i){var t=s[a],r=s[i],n=r.startPTS;isNaN(n)?i>a?r.start=t.start+t.duration:r.start=t.start-r.duration:i>a?(t.duration=n-t.start,t.duration<0&&e.logger.error("negative duration computed for frag "+t.sn+",level "+t.level+", there should be some duration drift between playlist and fragment!")):(r.duration=t.start-n,r.duration<0&&e.logger.error("negative duration computed for frag "+r.sn+",level "+r.level+", there should be some duration drift between playlist and fragment!"))}}]),t}();t.default=n},{"../utils/logger":38}],26:[function(t,I,i){"use strict";function r(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var n=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),T=t("./events"),a=r(T),s=t("./errors"),u=t("./loader/playlist-loader"),d=r(u),f=t("./loader/fragment-loader"),h=r(f),c=t("./controller/abr-controller"),v=r(c),g=t("./controller/buffer-controller"),P=r(g),y=t("./controller/cap-level-controller"),m=r(y),E=t("./controller/stream-controller"),b=r(E),_=t("./controller/level-controller"),R=r(_),A=t("./controller/timeline-controller"),L=r(A),e=t("./utils/logger"),k=t("./utils/xhr-loader"),S=r(k),w=t("events"),D=r(w),O=t("./loader/key-loader"),p=r(O),l=function(){function t(){var r=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];o(this,t);var n=t.DefaultConfig;if((r.liveSyncDurationCount||r.liveMaxLatencyDurationCount)&&(r.liveSyncDuration||r.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");for(var i in n)i in r||(r[i]=n[i]);if(void 0!==r.liveMaxLatencyDurationCount&&r.liveMaxLatencyDurationCount<=r.liveSyncDurationCount)throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be gt "liveSyncDurationCount"');if(void 0!==r.liveMaxLatencyDuration&&(r.liveMaxLatencyDuration<=r.liveSyncDuration||void 0===r.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be gt "liveSyncDuration"');(0,e.enableLogs)(r.debug),this.config=r;var a=this.observer=new D.default;a.trigger=function(r){for(var t=arguments.length,i=Array(t>1?t-1:0),e=1;t>e;e++)i[e-1]=arguments[e];a.emit.apply(a,[r,r].concat(i))},a.off=function(i){for(var t=arguments.length,r=Array(t>1?t-1:0),e=1;t>e;e++)r[e-1]=arguments[e];a.removeListener.apply(a,[i].concat(r))},this.on=a.on.bind(a),this.off=a.off.bind(a),this.trigger=a.trigger.bind(a),this.playlistLoader=new d.default(this),this.fragmentLoader=new h.default(this),this.levelController=new R.default(this),this.abrController=new r.abrController(this),this.bufferController=new r.bufferController(this),this.capLevelController=new r.capLevelController(this),this.streamController=new r.streamController(this),this.timelineController=new r.timelineController(this),this.keyLoader=new p.default(this)}return n(t,null,[{key:"isSupported",value:function(){return window.MediaSource&&"function"==typeof window.MediaSource.isTypeSupported&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}},{key:"Events",get:function(){return a.default}},{key:"ErrorTypes",get:function(){return s.ErrorTypes}},{key:"ErrorDetails",get:function(){return s.ErrorDetails}},{key:"DefaultConfig",get:function(){return t.defaultConfig||(t.defaultConfig={autoStartLoad:!0,startPosition:-1,debug:!1,capLevelToPlayerSize:!1,maxBufferLength:30,maxBufferSize:6e7,maxBufferHole:.5,maxSeekHole:2,seekHoleNudgeDuration:.01,stalledInBufferedNudgeThreshold:10,maxFragLookUpTolerance:.2,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingLoopThreshold:3,startFragPrefetch:!1,appendErrorMaxRetry:3,loader:S.default,fLoader:void 0,pLoader:void 0,abrController:v.default,bufferController:P.default,capLevelController:m.default,streamController:b.default,timelineController:L.default,enableCEA708Captions:!0,enableMP2TPassThrough:!1,abrEwmaFastLive:5,abrEwmaSlowLive:9,abrEwmaFastVoD:4,abrEwmaSlowVoD:15,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.8,abrBandWidthUpFactor:.7}),t.defaultConfig},set:function(e){t.defaultConfig=e}}]),n(t,[{key:"destroy",value:function(){e.logger.log("destroy"),this.trigger(a.default.DESTROYING),this.detachMedia(),this.playlistLoader.destroy(),this.fragmentLoader.destroy(),this.levelController.destroy(),this.abrController.destroy(),this.bufferController.destroy(),this.capLevelController.destroy(),this.streamController.destroy(),this.timelineController.destroy(),this.keyLoader.destroy(),this.url=null,this.observer.removeAllListeners()}},{key:"attachMedia",value:function(t){e.logger.log("attachMedia"),this.media=t,this.trigger(a.default.MEDIA_ATTACHING,{media:t})}},{key:"detachMedia",value:function(){e.logger.log("detachMedia"),this.trigger(a.default.MEDIA_DETACHING),this.media=null}},{key:"loadSource",value:function(t){e.logger.log("loadSource:"+t),this.url=t,this.trigger(a.default.MANIFEST_LOADING,{url:t})}},{key:"startLoad",value:function(){var t=arguments.length<=0||void 0===arguments[0]?-1:arguments[0];e.logger.log("startLoad"),this.levelController.startLoad(),this.streamController.startLoad(t)}},{key:"stopLoad",value:function(){e.logger.log("stopLoad"),this.levelController.stopLoad(),this.streamController.stopLoad()}},{key:"swapAudioCodec",value:function(){e.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}},{key:"recoverMediaError",value:function(){e.logger.log("recoverMediaError");var t=this.media;this.detachMedia(),this.attachMedia(t)}},{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){e.logger.log("set currentLevel:"+t),this.loadLevel=t,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){e.logger.log("set nextLevel:"+t),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){e.logger.log("set loadLevel:"+t),this.levelController.manualLevel=t}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(e){this.levelController.nextLoadLevel=e}},{key:"firstLevel",get:function(){return this.levelController.firstLevel},set:function(t){e.logger.log("set firstLevel:"+t),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(t){e.logger.log("set startLevel:"+t),this.levelController.startLevel=t}},{key:"autoLevelCapping",get:function(){return this.abrController.autoLevelCapping},set:function(t){e.logger.log("set autoLevelCapping:"+t),this.abrController.autoLevelCapping=t}},{key:"autoLevelEnabled",get:function(){return-1===this.levelController.manualLevel}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}}]),t}();i.default=l},{"./controller/abr-controller":3,"./controller/buffer-controller":4,"./controller/cap-level-controller":5,"./controller/level-controller":7,"./controller/stream-controller":8,"./controller/timeline-controller":9,"./errors":21,"./events":23,"./loader/fragment-loader":28,"./loader/key-loader":29,"./loader/playlist-loader":30,"./utils/logger":38,"./utils/xhr-loader":40,events:1}],27:[function(e,t,r){"use strict";t.exports=e("./hls.js").default},{"./hls.js":26}],28:[function(r,c,a){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(a,"__esModule",{value:!0});var h=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),l=r("../events"),e=i(l),d=r("../event-handler"),n=i(d),t=r("../errors"),o=function(a){function r(t){return u(this,r),f(this,Object.getPrototypeOf(r).call(this,t,e.default.FRAG_LOADING))}return s(r,a),h(r,[{key:"destroy",value:function(){this.loader&&(this.loader.destroy(),this.loader=null),n.default.prototype.destroy.call(this)}},{key:"onFragLoading",value:function(r){var t=r.frag;this.frag=t,this.frag.loaded=0;var e=this.hls.config;t.loader=this.loader="undefined"!=typeof e.fLoader?new e.fLoader(e):new e.loader(e),this.loader.load(t.url,"arraybuffer",this.loadsuccess.bind(this),this.loaderror.bind(this),this.loadtimeout.bind(this),e.fragLoadingTimeOut,0,0,this.loadprogress.bind(this),t)}},{key:"loadsuccess",value:function(a,t){var r=a.currentTarget.response;t.length=r.byteLength,this.frag.loader=void 0,this.hls.trigger(e.default.FRAG_LOADED,{payload:r,frag:this.frag,stats:t})}},{key:"loaderror",value:function(r){this.loader&&this.loader.abort(),this.hls.trigger(e.default.ERROR,{type:t.ErrorTypes.NETWORK_ERROR,details:t.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:this.frag,response:r})}},{key:"loadtimeout",value:function(){this.loader&&this.loader.abort(),
+    this.hls.trigger(e.default.ERROR,{type:t.ErrorTypes.NETWORK_ERROR,details:t.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:this.frag})}},{key:"loadprogress",value:function(r,t){this.frag.loaded=t.loaded,this.hls.trigger(e.default.FRAG_LOAD_PROGRESS,{frag:this.frag,stats:t})}}]),r}(n.default);a.default=o},{"../errors":21,"../event-handler":22,"../events":23}],29:[function(r,c,a){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(a,"__esModule",{value:!0});var h=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),l=r("../events"),e=i(l),d=r("../event-handler"),n=i(d),t=r("../errors"),o=function(a){function r(a){u(this,r);var t=f(this,Object.getPrototypeOf(r).call(this,a,e.default.KEY_LOADING));return t.decryptkey=null,t.decrypturl=null,t}return s(r,a),h(r,[{key:"destroy",value:function(){this.loader&&(this.loader.destroy(),this.loader=null),n.default.prototype.destroy.call(this)}},{key:"onKeyLoading",value:function(n){var t=this.frag=n.frag,i=t.decryptdata,a=i.uri;if(a!==this.decrypturl||null===this.decryptkey){var r=this.hls.config;t.loader=this.loader=new r.loader(r),this.decrypturl=a,this.decryptkey=null,t.loader.load(a,"arraybuffer",this.loadsuccess.bind(this),this.loaderror.bind(this),this.loadtimeout.bind(this),r.fragLoadingTimeOut,r.fragLoadingMaxRetry,r.fragLoadingRetryDelay,this.loadprogress.bind(this),t)}else this.decryptkey&&(i.key=this.decryptkey,this.hls.trigger(e.default.KEY_LOADED,{frag:t}))}},{key:"loadsuccess",value:function(r){var t=this.frag;this.decryptkey=t.decryptdata.key=new Uint8Array(r.currentTarget.response),t.loader=void 0,this.hls.trigger(e.default.KEY_LOADED,{frag:t})}},{key:"loaderror",value:function(r){this.loader&&this.loader.abort(),this.hls.trigger(e.default.ERROR,{type:t.ErrorTypes.NETWORK_ERROR,details:t.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:this.frag,response:r})}},{key:"loadtimeout",value:function(){this.loader&&this.loader.abort(),this.hls.trigger(e.default.ERROR,{type:t.ErrorTypes.NETWORK_ERROR,details:t.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:this.frag})}},{key:"loadprogress",value:function(){}}]),r}(n.default);a.default=o},{"../errors":21,"../event-handler":22,"../events":23}],30:[function(r,m,s){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function p(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function h(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(s,"__esModule",{value:!0});var l=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),c=r("../events"),t=a(c),d=r("../event-handler"),n=a(d),e=r("../errors"),o=r("../utils/url"),v=a(o),g=r("../utils/attr-list"),i=a(g),u=r("../utils/logger"),y=function(a){function r(e){return f(this,r),p(this,Object.getPrototypeOf(r).call(this,e,t.default.MANIFEST_LOADING,t.default.LEVEL_LOADING))}return h(r,a),l(r,[{key:"destroy",value:function(){this.loader&&(this.loader.destroy(),this.loader=null),this.url=this.id=null,n.default.prototype.destroy.call(this)}},{key:"onManifestLoading",value:function(e){this.load(e.url,null)}},{key:"onLevelLoading",value:function(e){this.load(e.url,e.level,e.id)}},{key:"load",value:function(t,n,s){var r,a,i,e=this.hls.config;if(this.loading&&this.loader){if(this.url===t&&this.id===n&&this.id2===s)return;this.loader.abort()}this.url=t,this.id=n,this.id2=s,null===this.id?(r=e.manifestLoadingMaxRetry,a=e.manifestLoadingTimeOut,i=e.manifestLoadingRetryDelay):(r=e.levelLoadingMaxRetry,a=e.levelLoadingTimeOut,i=e.levelLoadingRetryDelay),this.loader="undefined"!=typeof e.pLoader?new e.pLoader(e):new e.loader(e),this.loading=!0,this.loader.load(t,"",this.loadsuccess.bind(this),this.loaderror.bind(this),this.loadtimeout.bind(this),a,r,i)}},{key:"resolve",value:function(e,t){return v.default.buildAbsoluteURL(t,e)}},{key:"parseMasterPlaylist",value:function(f,u){for(var l=[],a=void 0,d=/#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)/g;null!=(a=d.exec(f));){var e={},r=e.attrs=new i.default(a[1]);e.url=this.resolve(a[2],u);var s=r.decimalResolution("RESOLUTION");s&&(e.width=s.width,e.height=s.height),e.bitrate=r.decimalInteger("AVERAGE-BANDWIDTH")||r.decimalInteger("BANDWIDTH"),e.name=r.NAME;var t=r.CODECS;if(t){t=t.split(",");for(var o=0;o<t.length;o++){var n=t[o];-1!==n.indexOf("avc1")?e.videoCodec=this.avc1toavcoti(n):e.audioCodec=n}}l.push(e)}return l}},{key:"createInitializationVector",value:function(r){for(var t=new Uint8Array(16),e=12;16>e;e++)t[e]=r>>8*(15-e)&255;return t}},{key:"fragmentDecryptdataFromLevelkey",value:function(e,r){var t=e;return e&&e.method&&e.uri&&!e.iv&&(t=this.cloneObj(e),t.iv=this.createInitializationVector(r)),t}},{key:"avc1toavcoti",value:function(r){var e,t=r.split(".");return t.length>2?(e=t.shift()+".",e+=parseInt(t.shift()).toString(16),e+=("000"+parseInt(t.shift()).toString(16)).substr(-4)):e=r,e}},{key:"cloneObj",value:function(e){return JSON.parse(JSON.stringify(e))}},{key:"parseLevelPlaylist",value:function(D,f,T){var E,e,R,l=0,o=0,t={version:null,type:null,url:f,fragments:[],live:!0,startSN:0},a={method:null,key:null,iv:null,uri:null},y=0,c=null,r=null,n=null,d=null,h=null,s=null;for(R=/(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE):(\d+))|(?:#EXT-X-(TARGETDURATION):(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT(INF):(\d+(?:\.\d+)?)(?:,(.*))?)|(?:(?!#)()(\S.+))|(?:#EXT-X-(BYTERANGE):(\d+(?:@\d+(?:\.\d+)?))|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(PROGRAM-DATE-TIME):(.+))|(?:#EXT-X-(VERSION):(\d+))|(?:(#)(.*):(.*))|(?:(#)(.*)))(?:.*)\r?\n?/g;null!==(e=R.exec(D));)switch(e.shift(),e=e.filter(function(e){return void 0!==e}),e[0]){case"VERSION":t.version=parseInt(e[1]);break;case"PLAYLIST-TYPE":t.type=e[1].toUpperCase();break;case"MEDIA-SEQUENCE":l=t.startSN=parseInt(e[1]);break;case"TARGETDURATION":t.targetduration=parseFloat(e[1]);break;case"EXTM3U":break;case"ENDLIST":t.live=!1;break;case"DIS":y++;break;case"BYTERANGE":var v=e[1].split("@");s=1===v.length?h:parseInt(v[1]),h=parseInt(v[0])+s;break;case"INF":n=parseFloat(e[1]),d=e[2]?e[2]:null;break;case"":if(!isNaN(n)){var b=l++;E=this.fragmentDecryptdataFromLevelkey(a,b);var L=e[1]?this.resolve(e[1],f):null;r={url:L,duration:n,title:d,start:o,sn:b,level:T,cc:y,decryptdata:E,programDateTime:c},null!==s&&(r.byteRangeStartOffset=s,r.byteRangeEndOffset=h),t.fragments.push(r),o+=n,n=null,d=null,s=null,c=null}break;case"KEY":var A=e[1],p=new i.default(A),g=p.enumeratedString("METHOD"),m=p.URI,k=p.hexadecimalInteger("IV");g&&(a={method:null,key:null,iv:null,uri:null},m&&"AES-128"===g&&(a.method=g,a.uri=this.resolve(m,f),a.key=null,a.iv=k));break;case"START":var S=e[1],w=new i.default(S),_=w.decimalFloatingPoint("TIME-OFFSET");_&&(t.startTimeOffset=_);break;case"PROGRAM-DATE-TIME":c=new Date(Date.parse(e[1]));break;case"#":e.shift();break;default:u.logger.warn("line parsed but not handled: "+e)}return r&&!r.url&&(t.fragments.pop(),o-=r.duration),t.totalduration=o,t.endSN=l-1,t}},{key:"loadsuccess",value:function(d,a){var s,o=d.currentTarget,n=o.responseText,r=o.responseURL,l=this.id,f=this.id2,i=this.hls;if(this.loading=!1,void 0===r&&(r=this.url),a.tload=performance.now(),a.mtime=new Date(o.getResponseHeader("Last-Modified")),0===n.indexOf("#EXTM3U"))if(n.indexOf("#EXTINF:")>0){var u=this.parseLevelPlaylist(n,r,l||0);null===l?i.trigger(t.default.MANIFEST_LOADED,{levels:[{url:r,details:u}],url:r,stats:a}):(a.tparsed=performance.now(),i.trigger(t.default.LEVEL_LOADED,{details:u,level:l,id:f,stats:a}))}else s=this.parseMasterPlaylist(n,r),s.length?i.trigger(t.default.MANIFEST_LOADED,{levels:s,url:r,stats:a}):i.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:e.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:r,reason:"no level found in manifest"});else i.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:e.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:r,reason:"no EXTM3U delimiter"})}},{key:"loaderror",value:function(i){var r,a;null===this.id?(r=e.ErrorDetails.MANIFEST_LOAD_ERROR,a=!0):(r=e.ErrorDetails.LEVEL_LOAD_ERROR,a=!1),this.loader&&this.loader.abort(),this.loading=!1,this.hls.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:r,fatal:a,url:this.url,loader:this.loader,response:i.currentTarget,level:this.id,id:this.id2})}},{key:"loadtimeout",value:function(){var r,a;null===this.id?(r=e.ErrorDetails.MANIFEST_LOAD_TIMEOUT,a=!0):(r=e.ErrorDetails.LEVEL_LOAD_TIMEOUT,a=!1),this.loader&&this.loader.abort(),this.loading=!1,this.hls.trigger(t.default.ERROR,{type:e.ErrorTypes.NETWORK_ERROR,details:r,fatal:a,url:this.url,loader:this.loader,level:this.id,id:this.id2})}}]),r}(n.default);s.default=y},{"../errors":21,"../event-handler":22,"../events":23,"../utils/attr-list":34,"../utils/logger":38,"../utils/url":39}],31:[function(i,n,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),a=function(){function e(){t(this,e)}return r(e,null,[{key:"init",value:function(){e.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var t;for(t in e.types)e.types.hasOwnProperty(t)&&(e.types[t]=[t.charCodeAt(0),t.charCodeAt(1),t.charCodeAt(2),t.charCodeAt(3)]);var a=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),i=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);e.HDLR_TYPES={video:a,audio:i};var n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),s=new Uint8Array([0,0,0,0,0,0,0,0]);e.STTS=e.STSC=e.STCO=s,e.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),e.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),e.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),e.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var r=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);e.FTYP=e.box(e.types.ftyp,r,l,r,o),e.DINF=e.box(e.types.dinf,e.box(e.types.dref,n))}},{key:"box",value:function(i){for(var t,a=Array.prototype.slice.call(arguments,1),e=8,r=a.length,n=r;r--;)e+=a[r].byteLength;for(t=new Uint8Array(e),t[0]=e>>24&255,t[1]=e>>16&255,t[2]=e>>8&255,t[3]=255&e,t.set(i,4),r=0,e=8;n>r;r++)t.set(a[r],e),e+=a[r].byteLength;return t}},{key:"hdlr",value:function(t){return e.box(e.types.hdlr,e.HDLR_TYPES[t])}},{key:"mdat",value:function(t){return e.box(e.types.mdat,t)}},{key:"mdhd",value:function(t,r){return r*=t,e.box(e.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24,r>>16&255,r>>8&255,255&r,85,196,0,0]))}},{key:"mdia",value:function(t){return e.box(e.types.mdia,e.mdhd(t.timescale,t.duration),e.hdlr(t.type),e.minf(t))}},{key:"mfhd",value:function(t){return e.box(e.types.mfhd,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t]))}},{key:"minf",value:function(t){return"audio"===t.type?e.box(e.types.minf,e.box(e.types.smhd,e.SMHD),e.DINF,e.stbl(t)):e.box(e.types.minf,e.box(e.types.vmhd,e.VMHD),e.DINF,e.stbl(t))}},{key:"moof",value:function(t,r,a){return e.box(e.types.moof,e.mfhd(t),e.traf(a,r))}},{key:"moov",value:function(t){for(var r=t.length,a=[];r--;)a[r]=e.trak(t[r]);return e.box.apply(null,[e.types.moov,e.mvhd(t[0].timescale,t[0].duration)].concat(a).concat(e.mvex(t)))}},{key:"mvex",value:function(r){for(var t=r.length,a=[];t--;)a[t]=e.trex(r[t]);return e.box.apply(null,[e.types.mvex].concat(a))}},{key:"mvhd",value:function(t,r){r*=t;var a=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,t>>24&255,t>>16&255,t>>8&255,255&t,r>>24&255,r>>16&255,r>>8&255,255&r,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return e.box(e.types.mvhd,a)}},{key:"sdtp",value:function(n){var r,t,a=n.samples||[],i=new Uint8Array(4+a.length);for(t=0;t<a.length;t++)r=a[t].flags,i[t+4]=r.dependsOn<<4|r.isDependedOn<<2|r.hasRedundancy;return e.box(e.types.sdtp,i)}},{key:"stbl",value:function(t){return e.box(e.types.stbl,e.stsd(t),e.box(e.types.stts,e.STTS),e.box(e.types.stsc,e.STSC),e.box(e.types.stsz,e.STSZ),e.box(e.types.stco,e.STCO))}},{key:"avc1",value:function(t){var r,i,n,a=[],s=[];for(r=0;r<t.sps.length;r++)i=t.sps[r],n=i.byteLength,a.push(n>>>8&255),a.push(255&n),a=a.concat(Array.prototype.slice.call(i));for(r=0;r<t.pps.length;r++)i=t.pps[r],n=i.byteLength,s.push(n>>>8&255),s.push(255&n),s=s.concat(Array.prototype.slice.call(i));var u=e.box(e.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|t.sps.length].concat(a).concat([t.pps.length]).concat(s))),o=t.width,l=t.height;return e.box(e.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,o>>8&255,255&o,l>>8&255,255&l,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),u,e.box(e.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"esds",value:function(t){var e=t.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t.config).concat([6,1,2]))}},{key:"mp4a",value:function(t){var r=t.audiosamplerate;return e.box(e.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,t.channelCount,0,16,0,0,0,0,r>>8&255,255&r,0,0]),e.box(e.types.esds,e.esds(t)))}},{key:"stsd",value:function(t){return"audio"===t.type?e.box(e.types.stsd,e.STSD,e.mp4a(t)):e.box(e.types.stsd,e.STSD,e.avc1(t))}},{key:"tkhd",value:function(t){var r=t.id,a=t.duration*t.timescale,i=t.width,n=t.height;return e.box(e.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,r>>24&255,r>>16&255,r>>8&255,255&r,0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,255&i,0,0,n>>8&255,255&n,0,0]))}},{key:"traf",value:function(a,t){var i=e.sdtp(a),r=a.id;return e.box(e.types.traf,e.box(e.types.tfhd,new Uint8Array([0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r])),e.box(e.types.tfdt,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t])),e.trun(a,i.length+16+16+8+16+8+8),i)}},{key:"trak",value:function(t){return t.duration=t.duration||4294967295,e.box(e.types.trak,e.tkhd(t),e.mdia(t))}},{key:"trex",value:function(r){var t=r.id;return e.box(e.types.trex,new Uint8Array([0,0,0,0,t>>24,t>>16&255,t>>8&255,255&t,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(h,o){var a,i,n,s,t,l,d=h.samples||[],r=d.length,f=12+16*r,u=new Uint8Array(f);for(o+=8+f,u.set([0,0,15,1,r>>>24&255,r>>>16&255,r>>>8&255,255&r,o>>>24&255,o>>>16&255,o>>>8&255,255&o],0),a=0;r>a;a++)i=d[a],n=i.duration,s=i.size,t=i.flags,l=i.cts,u.set([n>>>24&255,n>>>16&255,n>>>8&255,255&n,s>>>24&255,s>>>16&255,s>>>8&255,255&s,t.isLeading<<2|t.dependsOn,t.isDependedOn<<6|t.hasRedundancy<<4|t.paddingValue<<1|t.isNonSync,61440&t.degradPrio,15&t.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*a);return e.box(e.types.trun,u)}},{key:"initSegment",value:function(a){e.types||e.init();var t,r=e.moov(a);return t=new Uint8Array(e.FTYP.byteLength+r.byteLength),t.set(e.FTYP),t.set(r,e.FTYP.byteLength),t}}]),e}();e.default=a},{}],32:[function(a,h,i){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(i,"__esModule",{value:!0});var l=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),f=a("../events"),t=n(f),e=a("../utils/logger"),u=a("../remux/mp4-generator"),r=n(u),s=a("../errors"),d=function(){function a(e){o(this,a),this.observer=e,this.ISGenerated=!1,this.PES2MP4SCALEFACTOR=4,this.PES_TIMESCALE=9e4,this.MP4_TIMESCALE=this.PES_TIMESCALE/this.PES2MP4SCALEFACTOR}return l(a,[{key:"destroy",value:function(){}},{key:"insertDiscontinuity",value:function(){this._initPTS=this._initDTS=void 0}},{key:"switchLevel",value:function(){this.ISGenerated=!1}},{key:"remux",value:function(r,a,i,n,e,s){this.ISGenerated||this.generateIS(r,a,e),this.ISGenerated&&(a.samples.length&&this.remuxVideo(a,e,s),r.samples.length&&this.remuxAudio(r,e,s)),i.samples.length&&this.remuxID3(i,e),n.samples.length&&this.remuxText(n,e),this.observer.trigger(t.default.FRAG_PARSED)}},{key:"generateIS",value:function(a,i,h){var n,o,c=this.observer,v=a.samples,d=i.samples,f=this.PES_TIMESCALE,l={},g={tracks:l,unique:!1},u=void 0===this._initPTS;u&&(n=o=1/0),a.config&&v.length&&(a.timescale=a.audiosamplerate,a.timescale*a.duration>Math.pow(2,32)&&!function(){var e=function r(t,e){return e?r(e,t%e):t};a.timescale=a.audiosamplerate/e(a.audiosamplerate,1024)}(),e.logger.log("audio mp4 timescale :"+a.timescale),l.audio={container:"audio/mp4",codec:a.codec,initSegment:r.default.initSegment([a]),metadata:{channelCount:a.channelCount}},u&&(n=o=v[0].pts-f*h)),i.sps&&i.pps&&d.length&&(i.timescale=this.MP4_TIMESCALE,l.video={container:"video/mp4",codec:i.codec,initSegment:r.default.initSegment([i]),metadata:{width:i.width,height:i.height}},u&&(n=Math.min(n,d[0].pts-f*h),o=Math.min(o,d[0].dts-f*h))),Object.keys(l).length?(c.trigger(t.default.FRAG_PARSING_INIT_SEGMENT,g),this.ISGenerated=!0,u&&(this._initPTS=n,this._initDTS=o)):c.trigger(t.default.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})}},{key:"remuxVideo",value:function(a,D,w){var L,s,v,T,y,d,k,S,R,g,m,f,u,i,l,b=8,c=this.PES_TIMESCALE,h=this.PES2MP4SCALEFACTOR,o=[],A=a.samples.reduce(function(t,e){return Math.max(Math.min(t,e.pts-e.dts),-18e3)},0);for(0>A&&e.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Math.round(A/90)+" ms to overcome this issue"),d=new Uint8Array(a.len+4*a.nbNalu+8),L=new DataView(d.buffer),L.setUint32(0,d.byteLength),d.set(r.default.types.mdat,4);a.samples.length;){for(s=a.samples.shift(),T=0;s.units.units.length;)y=s.units.units.shift(),L.setUint32(b,y.data.byteLength),b+=4,d.set(y.data,b),b+=y.data.byteLength,T+=4+y.data.byteLength;if(m=s.pts-this._initDTS,f=s.dts-this._initDTS+A,f=Math.min(m,f),void 0!==g){u=this._PTSNormalize(m,g),i=this._PTSNormalize(f,g);var _=(i-g)/h;0>=_&&(e.logger.log("invalid sample duration at PTS/DTS: "+s.pts+"/"+s.dts+":"+_),_=1),v.duration=_}else{var p=void 0,n=void 0;p=w?this.nextAvcDts:D*c,u=this._PTSNormalize(m,p),i=this._PTSNormalize(f,p),n=Math.round((i-p)/90),w&&n&&(n>1?e.logger.log("AVC:"+n+" ms hole between fragments detected,filling it"):-1>n&&e.logger.log("AVC:"+-n+" ms overlapping between fragments detected"),i=p,u=Math.max(u-n,i),e.logger.log("Video/PTS/DTS adjusted: "+u+"/"+i+",delta:"+n)),S=Math.max(0,u),R=Math.max(0,i)}v={size:T,duration:0,cts:(u-i)/h,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0}},l=v.flags,s.key===!0?(l.dependsOn=2,l.isNonSync=0):(l.dependsOn=1,l.isNonSync=1),o.push(v),g=i}var E=0;o.length>=2&&(E=o[o.length-2].duration,v.duration=E),this.nextAvcDts=i+E*h;var O=a.dropped;a.len=0,a.nbNalu=0,a.dropped=0,o.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1&&(l=o[0].flags,l.dependsOn=2,l.isNonSync=0),a.samples=o,k=r.default.moof(a.sequenceNumber++,R/h,a),a.samples=[],this.observer.trigger(t.default.FRAG_PARSING_DATA,{data1:k,data2:d,startPTS:S/c,endPTS:(u+h*E)/c,startDTS:R/c,endDTS:this.nextAvcDts/c,type:"video",nb:o.length,dropped:O})}},{key:"remuxAudio",value:function(a,D,S){var k,p,n,h,d,T,L,b,u,g,R,o,i,A=8,s=this.PES_TIMESCALE,w=a.timescale,f=s/w,E=1024*a.timescale/a.audiosamplerate,m=[],_=[];for(a.samples.sort(function(e,t){return e.pts-t.pts}),_=a.samples;_.length;){if(p=_.shift(),h=p.unit,g=p.pts-this._initDTS,R=p.dts-this._initDTS,void 0!==u)o=this._PTSNormalize(g,u),i=this._PTSNormalize(R,u),n.duration=(i-u)/f,Math.abs(n.duration-E)>E/10&&e.logger.log("invalid AAC sample duration at PTS "+Math.round(g/90)+",should be 1024,found :"+Math.round(n.duration*a.audiosamplerate/a.timescale)),n.duration=E,o=i=E*f+u;else{var c=void 0,l=void 0;if(c=S?this.nextAacPts:D*s,o=this._PTSNormalize(g,c),i=this._PTSNormalize(R,c),l=Math.round(1e3*(o-c)/s),S&&l){if(l>0)e.logger.log(l+" ms hole between AAC samples detected,filling it");else if(-12>l){e.logger.log(-l+" ms overlapping between AAC samples detected, drop frame"),a.len-=h.byteLength;continue}o=i=c}if(L=Math.max(0,o),b=Math.max(0,i),!(a.len>0))return;d=new Uint8Array(a.len+8),k=new DataView(d.buffer),k.setUint32(0,d.byteLength),d.set(r.default.types.mdat,4)}d.set(h,A),A+=h.byteLength,n={size:h.byteLength,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},m.push(n),u=i}var y=0,v=m.length;v>=2&&(y=m[v-2].duration,n.duration=y),v&&(this.nextAacPts=o+f*y,a.len=0,a.samples=m,T=r.default.moof(a.sequenceNumber++,b/f,a),a.samples=[],this.observer.trigger(t.default.FRAG_PARSING_DATA,{data1:T,data2:d,startPTS:L/s,endPTS:this.nextAacPts/s,startDTS:b/s,endDTS:(i+f*y)/s,type:"audio",nb:v}))}},{key:"remuxID3",value:function(r,i){var e,n=r.samples.length;if(n){for(var a=0;n>a;a++)e=r.samples[a],e.pts=(e.pts-this._initPTS)/this.PES_TIMESCALE,e.dts=(e.dts-this._initDTS)/this.PES_TIMESCALE;this.observer.trigger(t.default.FRAG_PARSING_METADATA,{samples:r.samples})}r.samples=[],i=i}},{key:"remuxText",value:function(e,i){e.samples.sort(function(e,t){return e.pts-t.pts});var r,n=e.samples.length;if(n){for(var a=0;n>a;a++)r=e.samples[a],r.pts=(r.pts-this._initPTS)/this.PES_TIMESCALE;this.observer.trigger(t.default.FRAG_PARSING_USERDATA,{samples:e.samples})}e.samples=[],i=i}},{key:"_PTSNormalize",value:function(e,t){var r;if(void 0===t)return e;for(r=e>t?-8589934592:8589934592;Math.abs(e-t)>4294967296;)e+=r;return e}},{key:"passthrough",get:function(){return!1}}]),a}();i.default=d},{"../errors":21,"../events":23,"../remux/mp4-generator":31,"../utils/logger":38}],33:[function(r,l,e){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var n=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),s=r("../events"),t=a(s),o=function(){function e(t){i(this,e),this.observer=t,this.ISGenerated=!1}return n(e,[{key:"destroy",value:function(){}},{key:"insertDiscontinuity",value:function(){}},{key:"switchLevel",value:function(){this.ISGenerated=!1}},{key:"remux",value:function(o,s,f,d,i,u){var n=this.observer;if(!this.ISGenerated){var l={},a={tracks:l,unique:!0},e=s,r=e.codec;r&&(a.tracks.video={container:e.container,codec:r,metadata:{width:e.width,height:e.height}}),e=o,r=e.codec,r&&(a.tracks.audio={container:e.container,codec:r,metadata:{channelCount:e.channelCount}}),this.ISGenerated=!0,n.trigger(t.default.FRAG_PARSING_INIT_SEGMENT,a)}n.trigger(t.default.FRAG_PARSING_DATA,{data1:u,startPTS:i,startDTS:i,type:"audiovideo",nb:1,dropped:0})}},{key:"passthrough",get:function(){return!0}}]),e}();e.default=o},{"../events":23}],34:[function(i,n,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),a=function(){function e(r){t(this,e),"string"==typeof r&&(r=e.parseAttrList(r));for(var a in r)r.hasOwnProperty(a)&&(this[a]=r[a])}return r(e,[{key:"decimalInteger",value:function(t){var e=parseInt(this[t],10);return e>Number.MAX_SAFE_INTEGER?1/0:e}},{key:"hexadecimalInteger",value:function(r){if(this[r]){var e=(this[r]||"0x").slice(2);e=(1&e.length?"0":"")+e;for(var a=new Uint8Array(e.length/2),t=0;t<e.length/2;t++)a[t]=parseInt(e.slice(2*t,2*t+2),16);return a}return null}},{key:"hexadecimalIntegerAsNumber",value:function(t){var e=parseInt(this[t],16);return e>Number.MAX_SAFE_INTEGER?1/0:e}},{key:"decimalFloatingPoint",value:function(e){return parseFloat(this[e])}},{key:"enumeratedString",value:function(e){return this[e]}},{key:"decimalResolution",value:function(t){var e=/^(\d+)x(\d+)$/.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}}}],[{key:"parseAttrList",value:function(i){for(var t,n=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,r={};null!==(t=n.exec(i));){var e=t[2],a='"';0===e.indexOf(a)&&e.lastIndexOf(a)===e.length-1&&(e=e.slice(1,-1)),r[t[1]]=e}return r}}]),e}();e.default=a},{}],35:[function(r,e,a){"use strict";var t={search:function(i,s){for(var t=0,r=i.length-1,e=null,a=null;r>=t;){e=(t+r)/2|0,a=i[e];var n=s(a);if(n>0)t=e+1;else{if(!(0>n))return a;r=e-1}}return null}};e.exports=t},{}],36:[function(i,n,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),a=function(){function e(){t(this,e)}return r(e,[{key:"attach",value:function(e){this.media=e,this.display=[],this.memory=[]}},{key:"detach",value:function(){this.clear()}},{key:"destroy",value:function(){}},{key:"_createCue",value:function(){var t=window.VTTCue||window.TextTrackCue,e=this.cue=new t(-1,-1,"");e.text="",e.pauseOnExit=!1,e.startTime=Number.MAX_VALUE,e.endTime=Number.MAX_VALUE,this.memory.push(e)}},{key:"clear",value:function(){var e=this._textTrack;if(e&&e.cues)for(;e.cues.length>0;)e.removeCue(e.cues[0])}},{key:"push",value:function(r,a){this.cue||this._createCue();for(var i,t,e,s,o,u=31&a[0],n=2,l=0;u>l;l++)if(i=a[n++],t=127&a[n++],e=127&a[n++],s=0!==(4&i),o=3&i,(0!==t||0!==e)&&s&&0===o){if(32&t||64&t)this.cue.text+=this._fromCharCode(t)+this._fromCharCode(e);else if((17===t||25===t)&&e>=48&&63>=e)switch(e){case 48:this.cue.text+="®";break;case 49:this.cue.text+="°";break;case 50:this.cue.text+="½";break;case 51:this.cue.text+="¿";break;case 52:this.cue.text+="™";break;case 53:this.cue.text+="¢";break;case 54:this.cue.text+="";break;case 55:this.cue.text+="£";break;case 56:this.cue.text+="♪";break;case 57:this.cue.text+=" ";break;case 58:this.cue.text+="è";break;case 59:this.cue.text+="â";break;case 60:this.cue.text+="ê";break;case 61:this.cue.text+="î";break;case 62:this.cue.text+="ô";break;case 63:this.cue.text+="û"}if((17===t||25===t)&&e>=32&&47>=e)switch(e){case 32:break;case 33:break;case 34:break;case 35:break;case 36:break;case 37:break;case 38:break;case 39:break;case 40:break;case 41:break;case 42:break;case 43:break;case 44:break;case 45:break;case 46:break;case 47:}if((20===t||28===t)&&e>=32&&47>=e)switch(e){case 32:this._clearActiveCues(r);break;case 33:this.cue.text=this.cue.text.substr(0,this.cue.text.length-1);break;case 34:break;case 35:break;case 36:break;case 37:break;case 38:break;case 39:break;case 40:break;case 41:this._clearActiveCues(r);break;case 42:break;case 43:break;case 44:this._clearActiveCues(r);break;case 45:break;case 46:this._text="";break;case 47:this._flipMemory(r)}if((23===t||31===t)&&e>=33&&35>=e)switch(e){case 33:break;case 34:break;case 35:}}}},{key:"_fromCharCode",value:function(e){switch(e){case 42:return"á";case 2:return"á";case 2:return"é";case 4:return"í";case 5:return"ó";case 6:return"ú";case 3:return"ç";case 4:return"÷";case 5:return"Ñ";case 6:return"ñ";case 7:return"█";default:return String.fromCharCode(e)}}},{key:"_flipMemory",value:function(e){this._clearActiveCues(e),this._flushCaptions(e)}},{key:"_flushCaptions",value:function(s){this._has708||(this._textTrack=this.media.addTextTrack("captions","English","en"),this._has708=!0);var e=!0,a=!1,i=void 0;try{for(var n,t=this.memory[Symbol.iterator]();!(e=(n=t.next()).done);e=!0){var r=n.value;r.startTime=s,this._textTrack.addCue(r),this.display.push(r)}}catch(e){a=!0,i=e}finally{try{!e&&t.return&&t.return()}finally{if(a)throw i}}this.memory=[],this.cue=null}},{key:"_clearActiveCues",value:function(n){var e=!0,r=!1,a=void 0;try{for(var i,t=this.display[Symbol.iterator]();!(e=(i=t.next()).done);e=!0){var s=i.value;s.endTime=n}}catch(e){r=!0,a=e}finally{try{!e&&t.return&&t.return()}finally{if(r)throw a}}this.display=[]}},{key:"_clearBufferedCues",value:function(){}}]),e}();e.default=a},{}],37:[function(i,n,e){"use strict";function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),a=function(){function e(r){t(this,e),this.alpha_=r?Math.exp(Math.log(.5)/r):0,this.estimate_=0,this.totalWeight_=0}return r(e,[{key:"sample",value:function(e,r){var t=Math.pow(this.alpha_,e);this.estimate_=r*(1-t)+t*this.estimate_,this.totalWeight_+=e}},{key:"getTotalWeight",value:function(){return this.totalWeight_}},{key:"getEstimate",value:function(){if(this.alpha_){var e=1-Math.pow(this.alpha_,this.totalWeight_);return this.estimate_/e}return this.estimate_}}]),e}();e.default=a},{}],38:[function(l,u,r){"use strict";function e(){}function i(t,e){return e="["+t+"] > "+e}function n(t){var r=window.console[t];return r?function(){for(var n=arguments.length,e=Array(n),a=0;n>a;a++)e[a]=arguments[a];e[0]&&(e[0]=i(t,e[0])),r.apply(window.console,e)}:e}function s(r){for(var a=arguments.length,i=Array(a>1?a-1:0),e=1;a>e;e++)i[e-1]=arguments[e];i.forEach(function(e){t[e]=r[e]?r[e].bind(r):n(e)})}Object.defineProperty(r,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol?"symbol":typeof e;
+},a={trace:e,debug:e,log:e,warn:e,info:e,error:e},t=a;r.enableLogs=function(e){if(e===!0||"object"===("undefined"==typeof e?"undefined":o(e))){s(e,"debug","log","info","warn","error");try{t.log()}catch(e){t=a}}else t=a},r.logger=t},{}],39:[function(r,t,a){"use strict";var e={buildAbsoluteURL:function(r,t){if(t=t.trim(),/^[a-z]+:/i.test(t))return t;var l=null,o=null,n=/^([^#]*)(.*)$/.exec(t);n&&(o=n[2],t=n[1]);var s=/^([^\?]*)(.*)$/.exec(t);s&&(l=s[2],t=s[1]);var f=/^([^#]*)(.*)$/.exec(r);f&&(r=f[1]);var u=/^([^\?]*)(.*)$/.exec(r);u&&(r=u[1]);var a=/^(([a-z]+:)?\/\/[a-z0-9\.\-_~]+(:[0-9]+)?)?(\/.*)$/i.exec(r);if(!a)throw new Error("Error trying to parse base URL.");var h=a[2]||"",d=a[1]||"",c=a[4],i=null;return i=/^\/\//.test(t)?h+"//"+e.buildAbsolutePath("",t.substring(2)):/^\//.test(t)?d+"/"+e.buildAbsolutePath("",t.substring(1)):e.buildAbsolutePath(d+c,t),l&&(i+=l),o&&(i+=o),i},buildAbsolutePath:function(n,s){for(var a,e,o=s,i="",t=n.replace(/[^\/]*$/,o.replace(/(\/|^)(?:\.?\/+)+/g,"$1")),r=0;e=t.indexOf("/../",r),e>-1;r=e+a)a=/^\/(?:\.\.\/)*/.exec(t.slice(e))[0].length,i=(i+t.substring(r,e)).replace(new RegExp("(?:\\/+[^\\/]*){0,"+(a-1)/3+"}$"),"/");return i+t.substr(r)}};t.exports=e},{}],40:[function(r,s,t){"use strict";function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(a,r){for(var t=0;t<r.length;t++){var e=r[t];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(a,e.key,e)}}return function(t,r,a){return r&&e(t.prototype,r),a&&e(t,a),t}}(),e=r("../utils/logger"),n=function(){function t(e){a(this,t),e&&e.xhrSetup&&(this.xhrSetup=e.xhrSetup)}return i(t,[{key:"destroy",value:function(){this.abort(),this.loader=null}},{key:"abort",value:function(){var e=this.loader,t=this.timeoutHandle;e&&4!==e.readyState&&(this.stats.aborted=!0,e.abort()),t&&window.clearTimeout(t)}},{key:"load",value:function(t,r,a,i,n,s,o,l){var u=arguments.length<=8||void 0===arguments[8]?null:arguments[8],e=arguments.length<=9||void 0===arguments[9]?null:arguments[9];this.url=t,!e||isNaN(e.byteRangeStartOffset)||isNaN(e.byteRangeEndOffset)||(this.byteRange=e.byteRangeStartOffset+"-"+(e.byteRangeEndOffset-1)),this.responseType=r,this.onSuccess=a,this.onProgress=u,this.onTimeout=n,this.onError=i,this.stats={trequest:performance.now(),retry:0},this.timeout=s,this.maxRetry=o,this.retryDelay=l,this.loadInternal()}},{key:"loadInternal",value:function(){var e;e="undefined"!=typeof XDomainRequest?this.loader=new XDomainRequest:this.loader=new XMLHttpRequest,e.onloadend=this.loadend.bind(this),e.onprogress=this.loadprogress.bind(this),e.open("GET",this.url,!0),this.byteRange&&e.setRequestHeader("Range","bytes="+this.byteRange),e.responseType=this.responseType;var t=this.stats;t.tfirst=0,t.loaded=0,this.xhrSetup&&this.xhrSetup(e,this.url),this.timeoutHandle=window.setTimeout(this.loadtimeout.bind(this),this.timeout),e.send()}},{key:"loadend",value:function(a){var i=a.currentTarget,t=i.status,r=this.stats;r.aborted||(t>=200&&300>t?(window.clearTimeout(this.timeoutHandle),r.tload=Math.max(r.tfirst,performance.now()),this.onSuccess(a,r)):r.retry>=this.maxRetry||t>=400&&499>t?(window.clearTimeout(this.timeoutHandle),e.logger.error(t+" while loading "+this.url),this.onError(a)):(e.logger.warn(t+" while loading "+this.url+", retrying in "+this.retryDelay+"..."),this.destroy(),window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,64e3),r.retry++))}},{key:"loadtimeout",value:function(t){e.logger.warn("timeout while loading "+this.url),this.onTimeout(t,this.stats)}},{key:"loadprogress",value:function(t){var e=this.stats;0===e.tfirst&&(e.tfirst=Math.max(performance.now(),e.trequest)),e.loaded=t.loaded,this.onProgress&&this.onProgress(t,e)}}]),t}();t.default=n},{"../utils/logger":38}]},{},[27])(27)});
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/angular-ui-switch.js b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/angular-ui-switch.js
new file mode 100644
index 0000000..9a6b591
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/angular-ui-switch.js
@@ -0,0 +1,28 @@
+angular.module('uiSwitch', [])
+
+.directive('switch', function(){
+  return {
+    restrict: 'AE'
+  , replace: true
+  , transclude: true
+  , template: function(element, attrs) {
+      var html = '';
+      html += '<span';
+      html +=   ' class="switch' + (attrs.class ? ' ' + attrs.class : '') + '"';
+      html +=   attrs.ngModel ? ' ng-click="' + attrs.disabled + ' ? ' + attrs.ngModel + ' : ' + attrs.ngModel + '=!' + attrs.ngModel + (attrs.ngChange ? '; ' + attrs.ngChange + '()"' : '"') : '';
+      html +=   ' ng-class="{ checked:' + attrs.ngModel + ', disabled:' + attrs.disabled + ' }"';
+      html +=   '>';
+      html +=   '<small></small>';
+      html +=   '<input type="checkbox"';
+      html +=     attrs.id ? ' id="' + attrs.id + '"' : '';
+      html +=     attrs.name ? ' name="' + attrs.name + '"' : '';
+      html +=     attrs.ngModel ? ' ng-model="' + attrs.ngModel + '"' : '';
+      html +=     ' style="display:none" />';
+      html +=     '<span class="switch-text">'; /*adding new container for switch text*/
+      html +=     attrs.on ? '<span class="on">'+attrs.on+'</span>' : ''; /*switch text on value set by user in directive html markup*/
+      html +=     attrs.off ? '<span class="off">'+attrs.off + '</span>' : ' ';  /*switch text off value set by user in directive html markup*/
+      html += '</span>';
+      return html;
+    }
+  }
+});
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/angular.min.js b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/angular.min.js
new file mode 100644
index 0000000..dae7873
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/angular.min.js
@@ -0,0 +1,242 @@
+/*
+ AngularJS v1.3.0-rc.3
+ (c) 2010-2014 Google, Inc. http://angularjs.org
+ License: MIT
+*/
+(function(O,Y,s){'use strict';function Q(b){return function(){var a=arguments[0],c;c="["+(b?b+":":"")+a+"] http://errors.angularjs.org/1.3.0-rc.3/"+(b?b+"/":"")+a;for(a=1;a<arguments.length;a++){c=c+(1==a?"?":"&")+"p"+(a-1)+"=";var d=encodeURIComponent,e;e=arguments[a];e="function"==typeof e?e.toString().replace(/ \{[\s\S]*$/,""):"undefined"==typeof e?"undefined":"string"!=typeof e?JSON.stringify(e):e;c+=d(e)}return Error(c)}}function Na(b){if(null==b||Oa(b))return!1;var a=b.length;return 1===b.nodeType&&
+a?!0:C(b)||M(b)||0===a||"number"===typeof a&&0<a&&a-1 in b}function r(b,a,c){var d,e;if(b)if(F(b))for(d in b)"prototype"==d||"length"==d||"name"==d||b.hasOwnProperty&&!b.hasOwnProperty(d)||a.call(c,b[d],d,b);else if(M(b)||Na(b)){var f="object"!==typeof b;d=0;for(e=b.length;d<e;d++)(f||d in b)&&a.call(c,b[d],d,b)}else if(b.forEach&&b.forEach!==r)b.forEach(a,c,b);else for(d in b)b.hasOwnProperty(d)&&a.call(c,b[d],d,b);return b}function ac(b){var a=[],c;for(c in b)b.hasOwnProperty(c)&&a.push(c);return a.sort()}
+function rd(b,a,c){for(var d=ac(b),e=0;e<d.length;e++)a.call(c,b[d[e]],d[e]);return d}function bc(b){return function(a,c){b(c,a)}}function sd(){return++cb}function cc(b,a){a?b.$$hashKey=a:delete b.$$hashKey}function v(b){for(var a=b.$$hashKey,c=1,d=arguments.length;c<d;c++){var e=arguments[c];if(e)for(var f=Object.keys(e),g=0,h=f.length;g<h;g++){var k=f[g];b[k]=e[k]}}cc(b,a);return b}function Z(b){return parseInt(b,10)}function dc(b,a){return v(new (v(function(){},{prototype:b})),a)}function z(){}
+function Pa(b){return b}function ga(b){return function(){return b}}function w(b){return"undefined"===typeof b}function x(b){return"undefined"!==typeof b}function S(b){return null!==b&&"object"===typeof b}function C(b){return"string"===typeof b}function ea(b){return"number"===typeof b}function ha(b){return"[object Date]"===Fa.call(b)}function F(b){return"function"===typeof b}function db(b){return"[object RegExp]"===Fa.call(b)}function Oa(b){return b&&b.window===b}function Qa(b){return b&&b.$evalAsync&&
+b.$watch}function eb(b){return"boolean"===typeof b}function td(b){return!(!b||!(b.nodeName||b.prop&&b.attr&&b.find))}function ud(b){var a={};b=b.split(",");var c;for(c=0;c<b.length;c++)a[b[c]]=!0;return a}function pa(b){return R(b.nodeName||b[0].nodeName)}function Ra(b,a){var c=b.indexOf(a);0<=c&&b.splice(c,1);return a}function Ga(b,a,c,d){if(Oa(b)||Qa(b))throw Sa("cpws");if(a){if(b===a)throw Sa("cpi");c=c||[];d=d||[];if(S(b)){var e=c.indexOf(b);if(-1!==e)return d[e];c.push(b);d.push(a)}if(M(b))for(var f=
+a.length=0;f<b.length;f++)e=Ga(b[f],null,c,d),S(b[f])&&(c.push(b[f]),d.push(e)),a.push(e);else{var g=a.$$hashKey;M(a)?a.length=0:r(a,function(b,c){delete a[c]});for(f in b)b.hasOwnProperty(f)&&(e=Ga(b[f],null,c,d),S(b[f])&&(c.push(b[f]),d.push(e)),a[f]=e);cc(a,g)}}else if(a=b)M(b)?a=Ga(b,[],c,d):ha(b)?a=new Date(b.getTime()):db(b)?(a=new RegExp(b.source,b.toString().match(/[^\/]*$/)[0]),a.lastIndex=b.lastIndex):S(b)&&(e=Object.create(Object.getPrototypeOf(b)),a=Ga(b,e,c,d));return a}function qa(b,
+a){if(M(b)){a=a||[];for(var c=0,d=b.length;c<d;c++)a[c]=b[c]}else if(S(b))for(c in a=a||{},b)if("$"!==c.charAt(0)||"$"!==c.charAt(1))a[c]=b[c];return a||b}function ra(b,a){if(b===a)return!0;if(null===b||null===a)return!1;if(b!==b&&a!==a)return!0;var c=typeof b,d;if(c==typeof a&&"object"==c)if(M(b)){if(!M(a))return!1;if((c=b.length)==a.length){for(d=0;d<c;d++)if(!ra(b[d],a[d]))return!1;return!0}}else{if(ha(b))return ha(a)?ra(b.getTime(),a.getTime()):!1;if(db(b)&&db(a))return b.toString()==a.toString();
+if(Qa(b)||Qa(a)||Oa(b)||Oa(a)||M(a))return!1;c={};for(d in b)if("$"!==d.charAt(0)&&!F(b[d])){if(!ra(b[d],a[d]))return!1;c[d]=!0}for(d in a)if(!c.hasOwnProperty(d)&&"$"!==d.charAt(0)&&a[d]!==s&&!F(a[d]))return!1;return!0}return!1}function fb(b,a,c){return b.concat(Ta.call(a,c))}function ec(b,a){var c=2<arguments.length?Ta.call(arguments,2):[];return!F(a)||a instanceof RegExp?a:c.length?function(){return arguments.length?a.apply(b,c.concat(Ta.call(arguments,0))):a.apply(b,c)}:function(){return arguments.length?
+a.apply(b,arguments):a.call(b)}}function vd(b,a){var c=a;"string"===typeof b&&"$"===b.charAt(0)&&"$"===b.charAt(1)?c=s:Oa(a)?c="$WINDOW":a&&Y===a?c="$DOCUMENT":Qa(a)&&(c="$SCOPE");return c}function sa(b,a){return"undefined"===typeof b?s:JSON.stringify(b,vd,a?"  ":null)}function fc(b){return C(b)?JSON.parse(b):b}function ta(b){b=D(b).clone();try{b.empty()}catch(a){}var c=D("<div>").append(b).html();try{return 3===b[0].nodeType?R(c):c.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(a,b){return"<"+
+R(b)})}catch(d){return R(c)}}function gc(b){try{return decodeURIComponent(b)}catch(a){}}function hc(b){var a={},c,d;r((b||"").split("&"),function(b){b&&(c=b.replace(/\+/g,"%20").split("="),d=gc(c[0]),x(d)&&(b=x(c[1])?gc(c[1]):!0,Ab.call(a,d)?M(a[d])?a[d].push(b):a[d]=[a[d],b]:a[d]=b))});return a}function Bb(b){var a=[];r(b,function(b,d){M(b)?r(b,function(b){a.push(Ca(d,!0)+(!0===b?"":"="+Ca(b,!0)))}):a.push(Ca(d,!0)+(!0===b?"":"="+Ca(b,!0)))});return a.length?a.join("&"):""}function gb(b){return Ca(b,
+!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function Ca(b,a){return encodeURIComponent(b).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,a?"%20":"+")}function wd(b,a){var c,d,e=hb.length;b=D(b);for(d=0;d<e;++d)if(c=hb[d]+a,C(c=b.attr(c)))return c;return null}function xd(b,a){var c,d,e={};r(hb,function(a){a+="app";!c&&b.hasAttribute&&b.hasAttribute(a)&&(c=b,d=b.getAttribute(a))});r(hb,function(a){a+="app";
+var e;!c&&(e=b.querySelector("["+a.replace(":","\\:")+"]"))&&(c=e,d=e.getAttribute(a))});c&&(e.strictDi=null!==wd(c,"strict-di"),a(c,d?[d]:[],e))}function ic(b,a,c){S(c)||(c={});c=v({strictDi:!1},c);var d=function(){b=D(b);if(b.injector()){var d=b[0]===Y?"document":ta(b);throw Sa("btstrpd",d.replace(/</,"&lt;").replace(/>/,"&gt;"));}a=a||[];a.unshift(["$provide",function(a){a.value("$rootElement",b)}]);c.debugInfoEnabled&&a.push(["$compileProvider",function(a){a.debugInfoEnabled(!0)}]);a.unshift("ng");
+d=Cb(a,c.strictDi);d.invoke(["$rootScope","$rootElement","$compile","$injector",function(a,b,c,d){a.$apply(function(){b.data("$injector",d);c(b)(a)})}]);return d},e=/^NG_ENABLE_DEBUG_INFO!/,f=/^NG_DEFER_BOOTSTRAP!/;O&&e.test(O.name)&&(c.debugInfoEnabled=!0,O.name=O.name.replace(e,""));if(O&&!f.test(O.name))return d();O.name=O.name.replace(f,"");Da.resumeBootstrap=function(b){r(b,function(b){a.push(b)});d()}}function yd(){O.name="NG_ENABLE_DEBUG_INFO!"+O.name;O.location.reload()}function zd(b){return Da.element(b).injector().get("$$testability")}
+function Db(b,a){a=a||"_";return b.replace(Ad,function(b,d){return(d?a:"")+b.toLowerCase()})}function Bd(){var b;jc||((ma=O.jQuery)&&ma.fn.on?(D=ma,v(ma.fn,{scope:Ha.scope,isolateScope:Ha.isolateScope,controller:Ha.controller,injector:Ha.injector,inheritedData:Ha.inheritedData}),b=ma.cleanData,ma.cleanData=function(a){var c;if(Eb)Eb=!1;else for(var d=0,e;null!=(e=a[d]);d++)(c=ma._data(e,"events"))&&c.$destroy&&ma(e).triggerHandler("$destroy");b(a)}):D=T,Da.element=D,jc=!0)}function Fb(b,a,c){if(!b)throw Sa("areq",
+a||"?",c||"required");return b}function ib(b,a,c){c&&M(b)&&(b=b[b.length-1]);Fb(F(b),a,"not a function, got "+(b&&"object"===typeof b?b.constructor.name||"Object":typeof b));return b}function Ia(b,a){if("hasOwnProperty"===b)throw Sa("badname",a);}function kc(b,a,c){if(!a)return b;a=a.split(".");for(var d,e=b,f=a.length,g=0;g<f;g++)d=a[g],b&&(b=(e=b)[d]);return!c&&F(b)?ec(e,b):b}function jb(b){var a=b[0];b=b[b.length-1];var c=[a];do{a=a.nextSibling;if(!a)break;c.push(a)}while(a!==b);return D(c)}function Cd(b){function a(a,
+b,c){return a[b]||(a[b]=c())}var c=Q("$injector"),d=Q("ng");b=a(b,"angular",Object);b.$$minErr=b.$$minErr||Q;return a(b,"module",function(){var b={};return function(f,g,h){if("hasOwnProperty"===f)throw d("badname","module");g&&b.hasOwnProperty(f)&&(b[f]=null);return a(b,f,function(){function a(c,d,e,f){f||(f=b);return function(){f[e||"push"]([c,d,arguments]);return m}}if(!g)throw c("nomod",f);var b=[],d=[],e=[],q=a("$injector","invoke","push",d),m={_invokeQueue:b,_configBlocks:d,_runBlocks:e,requires:g,
+name:f,provider:a("$provide","provider"),factory:a("$provide","factory"),service:a("$provide","service"),value:a("$provide","value"),constant:a("$provide","constant","unshift"),animation:a("$animateProvider","register"),filter:a("$filterProvider","register"),controller:a("$controllerProvider","register"),directive:a("$compileProvider","directive"),config:q,run:function(a){e.push(a);return this}};h&&q(h);return m})}})}function Dd(b){v(b,{bootstrap:ic,copy:Ga,extend:v,equals:ra,element:D,forEach:r,
+injector:Cb,noop:z,bind:ec,toJson:sa,fromJson:fc,identity:Pa,isUndefined:w,isDefined:x,isString:C,isFunction:F,isObject:S,isNumber:ea,isElement:td,isArray:M,version:Ed,isDate:ha,lowercase:R,uppercase:kb,callbacks:{counter:0},getTestability:zd,$$minErr:Q,$$csp:Ua,reloadWithDebugInfo:yd,$$hasClass:lb});Va=Cd(O);try{Va("ngLocale")}catch(a){Va("ngLocale",[]).provider("$locale",Fd)}Va("ng",["ngLocale"],["$provide",function(a){a.provider({$$sanitizeUri:Gd});a.provider("$compile",lc).directive({a:Hd,input:mc,
+textarea:mc,form:Id,script:Jd,select:Kd,style:Ld,option:Md,ngBind:Nd,ngBindHtml:Od,ngBindTemplate:Pd,ngClass:Qd,ngClassEven:Rd,ngClassOdd:Sd,ngCloak:Td,ngController:Ud,ngForm:Vd,ngHide:Wd,ngIf:Xd,ngInclude:Yd,ngInit:Zd,ngNonBindable:$d,ngPluralize:ae,ngRepeat:be,ngShow:ce,ngStyle:de,ngSwitch:ee,ngSwitchWhen:fe,ngSwitchDefault:ge,ngOptions:he,ngTransclude:ie,ngModel:je,ngList:ke,ngChange:le,pattern:nc,ngPattern:nc,required:oc,ngRequired:oc,minlength:pc,ngMinlength:pc,maxlength:qc,ngMaxlength:qc,ngValue:me,
+ngModelOptions:ne}).directive({ngInclude:oe}).directive(mb).directive(rc);a.provider({$anchorScroll:pe,$animate:qe,$browser:re,$cacheFactory:se,$controller:te,$document:ue,$exceptionHandler:ve,$filter:sc,$interpolate:we,$interval:xe,$http:ye,$httpBackend:ze,$location:Ae,$log:Be,$parse:Ce,$rootScope:De,$q:Ee,$$q:Fe,$sce:Ge,$sceDelegate:He,$sniffer:Ie,$templateCache:Je,$templateRequest:Ke,$$testability:Le,$timeout:Me,$window:Ne,$$rAF:Oe,$$asyncCallback:Pe})}])}function Wa(b){return b.replace(Qe,function(a,
+b,d,e){return e?d.toUpperCase():d}).replace(Re,"Moz$1")}function tc(b){b=b.nodeType;return 1===b||!b||9===b}function uc(b,a){var c,d,e=a.createDocumentFragment(),f=[];if(Gb.test(b)){c=c||e.appendChild(a.createElement("div"));d=(Se.exec(b)||["",""])[1].toLowerCase();d=ia[d]||ia._default;c.innerHTML=d[1]+b.replace(Te,"<$1></$2>")+d[2];for(d=d[0];d--;)c=c.lastChild;f=fb(f,c.childNodes);c=e.firstChild;c.textContent=""}else f.push(a.createTextNode(b));e.textContent="";e.innerHTML="";r(f,function(a){e.appendChild(a)});
+return e}function T(b){if(b instanceof T)return b;var a;C(b)&&(b=ca(b),a=!0);if(!(this instanceof T)){if(a&&"<"!=b.charAt(0))throw Hb("nosel");return new T(b)}if(a){a=Y;var c;b=(c=Ue.exec(b))?[a.createElement(c[1])]:(c=uc(b,a))?c.childNodes:[]}vc(this,b)}function Ib(b){return b.cloneNode(!0)}function nb(b,a){a||ob(b);if(b.querySelectorAll)for(var c=b.querySelectorAll("*"),d=0,e=c.length;d<e;d++)ob(c[d])}function wc(b,a,c,d){if(x(d))throw Hb("offargs");var e=(d=pb(b))&&d.events;if(d&&d.handle)if(a)r(a.split(" "),
+function(a){w(c)?(b.removeEventListener(a,e[a],!1),delete e[a]):Ra(e[a]||[],c)});else for(a in e)"$destroy"!==a&&b.removeEventListener(a,e[a],!1),delete e[a]}function ob(b,a){var c=b.ng339,d=c&&qb[c];d&&(a?delete d.data[a]:(d.handle&&(d.events.$destroy&&d.handle({},"$destroy"),wc(b)),delete qb[c],b.ng339=s))}function pb(b,a){var c=b.ng339,c=c&&qb[c];a&&!c&&(b.ng339=c=++Ve,c=qb[c]={events:{},data:{},handle:s});return c}function Jb(b,a,c){if(tc(b)){var d=x(c),e=!d&&a&&!S(a),f=!a;b=(b=pb(b,!e))&&b.data;
+if(d)b[a]=c;else{if(f)return b;if(e)return b&&b[a];v(b,a)}}}function lb(b,a){return b.getAttribute?-1<(" "+(b.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").indexOf(" "+a+" "):!1}function Kb(b,a){a&&b.setAttribute&&r(a.split(" "),function(a){b.setAttribute("class",ca((" "+(b.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").replace(" "+ca(a)+" "," ")))})}function Lb(b,a){if(a&&b.setAttribute){var c=(" "+(b.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ");r(a.split(" "),function(a){a=
+ca(a);-1===c.indexOf(" "+a+" ")&&(c+=a+" ")});b.setAttribute("class",ca(c))}}function vc(b,a){if(a)if(a.nodeType)b[b.length++]=a;else{var c=a.length;if("number"===typeof c&&a.window!==a){if(c)for(var d=0;d<c;d++)b[b.length++]=a[d]}else b[b.length++]=a}}function xc(b,a){return rb(b,"$"+(a||"ngController")+"Controller")}function rb(b,a,c){9==b.nodeType&&(b=b.documentElement);for(a=M(a)?a:[a];b;){for(var d=0,e=a.length;d<e;d++)if((c=D.data(b,a[d]))!==s)return c;b=b.parentNode||11===b.nodeType&&b.host}}
+function yc(b){for(nb(b,!0);b.firstChild;)b.removeChild(b.firstChild)}function zc(b,a){a||nb(b);var c=b.parentNode;c&&c.removeChild(b)}function Ac(b,a){var c=sb[a.toLowerCase()];return c&&Bc[pa(b)]&&c}function We(b,a){var c=b.nodeName;return("INPUT"===c||"TEXTAREA"===c)&&Cc[a]}function Xe(b,a){var c=function(c,e){c.isDefaultPrevented=function(){return c.defaultPrevented};var f=a[e||c.type],g=f?f.length:0;if(g){if(w(c.immediatePropagationStopped)){var h=c.stopImmediatePropagation;c.stopImmediatePropagation=
+function(){c.immediatePropagationStopped=!0;c.stopPropagation&&c.stopPropagation();h&&h.call(c)}}c.isImmediatePropagationStopped=function(){return!0===c.immediatePropagationStopped};1<g&&(f=qa(f));for(var k=0;k<g;k++)c.isImmediatePropagationStopped()||f[k].call(b,c)}};c.elem=b;return c}function Ja(b,a){var c=b&&b.$$hashKey;if(c)return"function"===typeof c&&(c=b.$$hashKey()),c;c=typeof b;return c="function"==c||"object"==c&&null!==b?b.$$hashKey=c+":"+(a||sd)():c+":"+b}function Xa(b,a){if(a){var c=
+0;this.nextUid=function(){return++c}}r(b,this.put,this)}function Ye(b){return(b=b.toString().replace(Dc,"").match(Ec))?"function("+(b[1]||"").replace(/[\s\r\n]+/," ")+")":"fn"}function Mb(b,a,c){var d;if("function"===typeof b){if(!(d=b.$inject)){d=[];if(b.length){if(a)throw C(c)&&c||(c=b.name||Ye(b)),Ka("strictdi",c);a=b.toString().replace(Dc,"");a=a.match(Ec);r(a[1].split(Ze),function(a){a.replace($e,function(a,b,c){d.push(c)})})}b.$inject=d}}else M(b)?(a=b.length-1,ib(b[a],"fn"),d=b.slice(0,a)):
+ib(b,"fn",!0);return d}function Cb(b,a){function c(a){return function(b,c){if(S(b))r(b,bc(a));else return a(b,c)}}function d(a,b){Ia(a,"service");if(F(b)||M(b))b=p.instantiate(b);if(!b.$get)throw Ka("pget",a);return n[a+"Provider"]=b}function e(a,b){return d(a,{$get:b})}function f(a){var b=[],c;r(a,function(a){function d(a){var b,c;b=0;for(c=a.length;b<c;b++){var e=a[b],f=p.get(e[0]);f[e[1]].apply(f,e[2])}}if(!l.get(a)){l.put(a,!0);try{C(a)?(c=Va(a),b=b.concat(f(c.requires)).concat(c._runBlocks),
+d(c._invokeQueue),d(c._configBlocks)):F(a)?b.push(p.invoke(a)):M(a)?b.push(p.invoke(a)):ib(a,"module")}catch(e){throw M(a)&&(a=a[a.length-1]),e.message&&e.stack&&-1==e.stack.indexOf(e.message)&&(e=e.message+"\n"+e.stack),Ka("modulerr",a,e.stack||e.message||e);}}});return b}function g(b,c){function d(a){if(b.hasOwnProperty(a)){if(b[a]===h)throw Ka("cdep",a+" <- "+k.join(" <- "));return b[a]}try{return k.unshift(a),b[a]=h,b[a]=c(a)}catch(e){throw b[a]===h&&delete b[a],e;}finally{k.shift()}}function e(b,
+c,f,g){"string"===typeof f&&(g=f,f=null);var h=[];g=Mb(b,a,g);var k,l,m;l=0;for(k=g.length;l<k;l++){m=g[l];if("string"!==typeof m)throw Ka("itkn",m);h.push(f&&f.hasOwnProperty(m)?f[m]:d(m))}M(b)&&(b=b[k]);return b.apply(c,h)}return{invoke:e,instantiate:function(a,b,c){var d=function(){};d.prototype=(M(a)?a[a.length-1]:a).prototype;d=new d;a=e(a,d,b,c);return S(a)||F(a)?a:d},get:d,annotate:Mb,has:function(a){return n.hasOwnProperty(a+"Provider")||b.hasOwnProperty(a)}}}a=!0===a;var h={},k=[],l=new Xa([],
+!0),n={$provide:{provider:c(d),factory:c(e),service:c(function(a,b){return e(a,["$injector",function(a){return a.instantiate(b)}])}),value:c(function(a,b){return e(a,ga(b))}),constant:c(function(a,b){Ia(a,"constant");n[a]=b;q[a]=b}),decorator:function(a,b){var c=p.get(a+"Provider"),d=c.$get;c.$get=function(){var a=m.invoke(d,c);return m.invoke(b,null,{$delegate:a})}}}},p=n.$injector=g(n,function(){throw Ka("unpr",k.join(" <- "));}),q={},m=q.$injector=g(q,function(a){var b=p.get(a+"Provider");return m.invoke(b.$get,
+b,s,a)});r(f(b),function(a){m.invoke(a||z)});return m}function pe(){var b=!0;this.disableAutoScrolling=function(){b=!1};this.$get=["$window","$location","$rootScope",function(a,c,d){function e(a){var b=null;r(a,function(a){b||"a"!==pa(a)||(b=a)});return b}function f(){var b=c.hash(),d;b?(d=g.getElementById(b))?d.scrollIntoView():(d=e(g.getElementsByName(b)))?d.scrollIntoView():"top"===b&&a.scrollTo(0,0):a.scrollTo(0,0)}var g=a.document;b&&d.$watch(function(){return c.hash()},function(){d.$evalAsync(f)});
+return f}]}function Pe(){this.$get=["$$rAF","$timeout",function(b,a){return b.supported?function(a){return b(a)}:function(b){return a(b,0,!1)}}]}function af(b,a,c,d){function e(a){try{a.apply(null,Ta.call(arguments,1))}finally{if(t--,0===t)for(;u.length;)try{u.pop()()}catch(b){c.error(b)}}}function f(a,b){(function tb(){r(H,function(a){a()});A=b(tb,a)})()}function g(){G=null;y!=h.url()&&(y=h.url(),r(B,function(a){a(h.url())}))}var h=this,k=a[0],l=b.location,n=b.history,p=b.setTimeout,q=b.clearTimeout,
+m={};h.isMock=!1;var t=0,u=[];h.$$completeOutstandingRequest=e;h.$$incOutstandingRequestCount=function(){t++};h.notifyWhenNoOutstandingRequests=function(a){r(H,function(a){a()});0===t?a():u.push(a)};var H=[],A;h.addPollFn=function(a){w(A)&&f(100,p);H.push(a);return a};var y=l.href,E=a.find("base"),G=null;h.url=function(a,c){l!==b.location&&(l=b.location);n!==b.history&&(n=b.history);if(a){if(y!=a)return y=a,d.history?c?n.replaceState(null,"",a):(n.pushState(null,"",a),E.attr("href",E.attr("href"))):
+(G=a,c?l.replace(a):l.href=a),h}else return G||l.href.replace(/%27/g,"'")};var B=[],X=!1;h.onUrlChange=function(a){if(!X){if(d.history)D(b).on("popstate",g);if(d.hashchange)D(b).on("hashchange",g);else h.addPollFn(g);X=!0}B.push(a);return a};h.$$checkUrlChange=g;h.baseHref=function(){var a=E.attr("href");return a?a.replace(/^(https?\:)?\/\/[^\/]*/,""):""};var K={},L="",P=h.baseHref();h.cookies=function(a,b){var d,e,f,g;if(a)b===s?k.cookie=encodeURIComponent(a)+"=;path="+P+";expires=Thu, 01 Jan 1970 00:00:00 GMT":
+C(b)&&(d=(k.cookie=encodeURIComponent(a)+"="+encodeURIComponent(b)+";path="+P).length+1,4096<d&&c.warn("Cookie '"+a+"' possibly not set or overflowed because it was too large ("+d+" > 4096 bytes)!"));else{if(k.cookie!==L)for(L=k.cookie,d=L.split("; "),K={},f=0;f<d.length;f++)e=d[f],g=e.indexOf("="),0<g&&(a=decodeURIComponent(e.substring(0,g)),K[a]===s&&(K[a]=decodeURIComponent(e.substring(g+1))));return K}};h.defer=function(a,b){var c;t++;c=p(function(){delete m[c];e(a)},b||0);m[c]=!0;return c};h.defer.cancel=
+function(a){return m[a]?(delete m[a],q(a),e(z),!0):!1}}function re(){this.$get=["$window","$log","$sniffer","$document",function(b,a,c,d){return new af(b,d,a,c)}]}function se(){this.$get=function(){function b(b,d){function e(a){a!=p&&(q?q==a&&(q=a.n):q=a,f(a.n,a.p),f(a,p),p=a,p.n=null)}function f(a,b){a!=b&&(a&&(a.p=b),b&&(b.n=a))}if(b in a)throw Q("$cacheFactory")("iid",b);var g=0,h=v({},d,{id:b}),k={},l=d&&d.capacity||Number.MAX_VALUE,n={},p=null,q=null;return a[b]={put:function(a,b){if(l<Number.MAX_VALUE){var c=
+n[a]||(n[a]={key:a});e(c)}if(!w(b))return a in k||g++,k[a]=b,g>l&&this.remove(q.key),b},get:function(a){if(l<Number.MAX_VALUE){var b=n[a];if(!b)return;e(b)}return k[a]},remove:function(a){if(l<Number.MAX_VALUE){var b=n[a];if(!b)return;b==p&&(p=b.p);b==q&&(q=b.n);f(b.n,b.p);delete n[a]}delete k[a];g--},removeAll:function(){k={};g=0;n={};p=q=null},destroy:function(){n=h=k=null;delete a[b]},info:function(){return v({},h,{size:g})}}}var a={};b.info=function(){var b={};r(a,function(a,e){b[e]=a.info()});
+return b};b.get=function(b){return a[b]};return b}}function Je(){this.$get=["$cacheFactory",function(b){return b("templates")}]}function lc(b,a){function c(a,b){var c=/^\s*([@=&])(\??)\s*(\w*)\s*$/,d={};r(a,function(a,e){var f=a.match(c);if(!f)throw ja("iscp",b,e,a);d[e]={attrName:f[3]||e,mode:f[1],optional:"?"===f[2]}});return d}var d={},e=/^\s*directive\:\s*([\d\w_\-]+)\s+(.*)$/,f=/(([\d\w_\-]+)(?:\:([^;]+))?;?)/,g=ud("ngSrc,ngSrcset,src,srcset"),h=/^(on[a-z]+|formaction)$/;this.directive=function n(a,
+e){Ia(a,"directive");C(a)?(Fb(e,"directiveFactory"),d.hasOwnProperty(a)||(d[a]=[],b.factory(a+"Directive",["$injector","$exceptionHandler",function(b,e){var f=[];r(d[a],function(d,g){try{var h=b.invoke(d);F(h)?h={compile:ga(h)}:!h.compile&&h.link&&(h.compile=ga(h.link));h.priority=h.priority||0;h.index=g;h.name=h.name||a;h.require=h.require||h.controller&&h.name;h.restrict=h.restrict||"EA";S(h.scope)&&(h.$$isolateBindings=c(h.scope,h.name));f.push(h)}catch(k){e(k)}});return f}])),d[a].push(e)):r(a,
+bc(n));return this};this.aHrefSanitizationWhitelist=function(b){return x(b)?(a.aHrefSanitizationWhitelist(b),this):a.aHrefSanitizationWhitelist()};this.imgSrcSanitizationWhitelist=function(b){return x(b)?(a.imgSrcSanitizationWhitelist(b),this):a.imgSrcSanitizationWhitelist()};var k=!0;this.debugInfoEnabled=function(a){return x(a)?(k=a,this):k};this.$get=["$injector","$interpolate","$exceptionHandler","$templateRequest","$parse","$controller","$rootScope","$document","$sce","$animate","$$sanitizeUri",
+function(a,b,c,m,t,u,H,A,y,E,G){function B(a,b){try{a.addClass(b)}catch(c){}}function X(a,b,c,d,e){a instanceof D||(a=D(a));r(a,function(b,c){3==b.nodeType&&b.nodeValue.match(/\S+/)&&(a[c]=D(b).wrap("<span></span>").parent()[0])});var f=K(a,b,a,c,d,e);X.$$addScopeClass(a);var h=null,g=a,k;return function(b,c,d,e,m){Fb(b,"scope");h||(h=(m=m&&m[0])?"foreignobject"!==pa(m)&&m.toString().match(/SVG/)?"svg":"html":"html");"html"!==h&&a[0]!==k&&(g=D(Nb(h,D("<div>").append(a).html())));k=a[0];m=c?Ha.clone.call(g):
+g;if(d)for(var q in d)m.data("$"+q+"Controller",d[q].instance);X.$$addScopeInfo(m,b);c&&c(m,b);f&&f(b,m,m,e);return m}}function K(a,b,c,d,e,f){function h(a,c,d,e){var f,k,m,q,n,p,y;if(u)for(y=Array(c.length),q=0;q<g.length;q+=3)f=g[q],y[f]=c[f];else y=c;q=0;for(n=g.length;q<n;)k=y[g[q++]],c=g[q++],f=g[q++],c?(c.scope?(m=a.$new(),X.$$addScopeInfo(D(k),m)):m=a,p=c.transcludeOnThisElement?L(a,c.transclude,e,c.elementTranscludeOnThisElement):!c.templateOnThisElement&&e?e:!e&&b?L(a,b):null,c(f,m,k,d,p)):
+f&&f(a,k.childNodes,s,e)}for(var g=[],k,m,q,n,u,p=0;p<a.length;p++){k=new Ob;m=P(a[p],[],k,0===p?d:s,e);(f=m.length?U(m,a[p],k,b,c,null,[],[],f):null)&&f.scope&&X.$$addScopeClass(k.$$element);k=f&&f.terminal||!(q=a[p].childNodes)||!q.length?null:K(q,f?(f.transcludeOnThisElement||!f.templateOnThisElement)&&f.transclude:b);if(f||k)g.push(p,f,k),n=!0,u=u||f;f=null}return n?h:null}function L(a,b,c,d){return function(e,f,g,h){var k=!1;e||(e=a.$new(),k=e.$$transcluded=!0);f=b(e,f,g,c,h);if(k&&!d)f.on("$destroy",
+function(){e.$destroy()});return f}}function P(b,c,g,h,k){var m=g.$attr,q;switch(b.nodeType){case 1:$(c,va(pa(b)),"E",h,k);for(var u,p,y,t=b.attributes,E=0,H=t&&t.length;E<H;E++){var K=!1,G=!1;u=t[E];if(!aa||8<=aa||u.specified){q=u.name;u=ca(u.value);p=va(q);if(y=ka.test(p))q=Db(p.substr(6),"-");var A=p.replace(/(Start|End)$/,""),r;a:{var U=A;if(d.hasOwnProperty(U)){r=void 0;for(var U=a.get(U+"Directive"),N=0,B=U.length;N<B;N++)if(r=U[N],r.multiElement){r=!0;break a}}r=!1}r&&p===A+"Start"&&(K=q,G=
+q.substr(0,q.length-5)+"end",q=q.substr(0,q.length-6));p=va(q.toLowerCase());m[p]=q;if(y||!g.hasOwnProperty(p))g[p]=u,Ac(b,p)&&(g[p]=!0);V(b,c,u,p,y);$(c,p,"A",h,k,K,G)}}b=b.className;if(C(b)&&""!==b)for(;q=f.exec(b);)p=va(q[2]),$(c,p,"C",h,k)&&(g[p]=ca(q[3])),b=b.substr(q.index+q[0].length);break;case 3:O(c,b.nodeValue);break;case 8:try{if(q=e.exec(b.nodeValue))p=va(q[1]),$(c,p,"M",h,k)&&(g[p]=ca(q[2]))}catch(P){}}c.sort(w);return c}function J(a,b,c){var d=[],e=0;if(b&&a.hasAttribute&&a.hasAttribute(b)){do{if(!a)throw ja("uterdir",
+b,c);1==a.nodeType&&(a.hasAttribute(b)&&e++,a.hasAttribute(c)&&e--);d.push(a);a=a.nextSibling}while(0<e)}else d.push(a);return D(d)}function N(a,b,c){return function(d,e,f,g,h){e=J(e[0],b,c);return a(d,e,f,g,h)}}function U(a,d,e,f,g,h,k,m,n){function y(a,b,c,d){if(a){c&&(a=N(a,c,d));a.require=I.require;a.directiveName=ka;if(B===I||I.$$isolateScope)a=Fc(a,{isolateScope:!0});k.push(a)}if(b){c&&(b=N(b,c,d));b.require=I.require;b.directiveName=ka;if(B===I||I.$$isolateScope)b=Fc(b,{isolateScope:!0});m.push(b)}}
+function E(a,b,c,d){var e,f="data",g=!1;if(C(b)){for(;"^"==(e=b.charAt(0))||"?"==e;)b=b.substr(1),"^"==e&&(f="inheritedData"),g=g||"?"==e;e=null;d&&"data"===f&&(e=d[b])&&(e=e.instance);e=e||c[f]("$"+b+"Controller");if(!e&&!g)throw ja("ctreq",b,a);}else M(b)&&(e=[],r(b,function(b){e.push(E(a,b,c,d))}));return e}function H(a,c,f,g,h){function q(a,b,c){var d;Qa(a)||(c=b,b=a,a=s);w&&(d=G);c||(c=w?P.parent():P);return h(a,b,d,c)}var n,y,K,ua,G,N,P,J;d===f?(J=e,P=e.$$element):(P=D(f),J=new Ob(P,e));B&&
+(ua=c.$new(!0));N=h&&q;A&&(U={},G={},r(A,function(a){var b={$scope:a===B||a.$$isolateScope?ua:c,$element:P,$attrs:J,$transclude:N};K=a.controller;"@"==K&&(K=J[a.name]);b=u(K,b,!0,a.controllerAs);G[a.name]=b;w||P.data("$"+a.name+"Controller",b.instance);U[a.name]=b}));if(B){X.$$addScopeInfo(P,ua,!0,!(L&&(L===B||L===B.$$originalDirective)));X.$$addScopeClass(P,!0);g=U&&U[B.name];var $=ua;g&&g.identifier&&!0===B.bindToController&&($=g.instance);r(ua.$$isolateBindings=B.$$isolateBindings,function(a,d){var e=
+a.attrName,f=a.optional,g,h,k,m;switch(a.mode){case "@":J.$observe(e,function(a){$[d]=a});J.$$observers[e].$$scope=c;J[e]&&($[d]=b(J[e])(c));break;case "=":if(f&&!J[e])break;h=t(J[e]);m=h.literal?ra:function(a,b){return a===b||a!==a&&b!==b};k=h.assign||function(){g=$[d]=h(c);throw ja("nonassign",J[e],B.name);};g=$[d]=h(c);f=function(a){m(a,$[d])||(m(a,g)?k(c,a=$[d]):$[d]=a);return g=a};f.$stateful=!0;f=c.$watch(t(J[e],f),null,h.literal);ua.$on("$destroy",f);break;case "&":h=t(J[e]),$[d]=function(a){return h(c,
+a)}}})}U&&(r(U,function(a){a()}),U=null);g=0;for(n=k.length;g<n;g++)y=k[g],Gc(y,y.isolateScope?ua:c,P,J,y.require&&E(y.directiveName,y.require,P,G),N);g=c;B&&(B.template||null===B.templateUrl)&&(g=ua);a&&a(g,f.childNodes,s,h);for(g=m.length-1;0<=g;g--)y=m[g],Gc(y,y.isolateScope?ua:c,P,J,y.require&&E(y.directiveName,y.require,P,G),N)}n=n||{};for(var K=-Number.MAX_VALUE,G,A=n.controllerDirectives,U,B=n.newIsolateScopeDirective,L=n.templateDirective,$=n.nonTlbTranscludeDirective,z=!1,V=!1,w=n.hasElementTranscludeDirective,
+v=e.$$element=D(d),I,ka,W,ya=f,O,R=0,xa=a.length;R<xa;R++){I=a[R];var T=I.$$start,Pb=I.$$end;T&&(v=J(d,T,Pb));W=s;if(K>I.priority)break;if(W=I.scope)I.templateUrl||(S(W)?(Q("new/isolated scope",B||G,I,v),B=I):Q("new/isolated scope",B,I,v)),G=G||I;ka=I.name;!I.templateUrl&&I.controller&&(W=I.controller,A=A||{},Q("'"+ka+"' controller",A[ka],I,v),A[ka]=I);if(W=I.transclude)z=!0,I.$$tlb||(Q("transclusion",$,I,v),$=I),"element"==W?(w=!0,K=I.priority,W=v,v=e.$$element=D(Y.createComment(" "+ka+": "+e[ka]+
+" ")),d=v[0],fa(g,Ta.call(W,0),d),ya=X(W,f,K,h&&h.name,{nonTlbTranscludeDirective:$})):(W=D(Ib(d)).contents(),v.empty(),ya=X(W,f));if(I.template)if(V=!0,Q("template",L,I,v),L=I,W=F(I.template)?I.template(v,e):I.template,W=Z(W),I.replace){h=I;W=Gb.test(W)?D(Nb(I.templateNamespace,ca(W))):[];d=W[0];if(1!=W.length||1!==d.nodeType)throw ja("tplrt",ka,"");fa(g,v,d);xa={$attr:{}};W=P(d,[],xa);var aa=a.splice(R+1,a.length-(R+1));B&&tb(W);a=a.concat(W).concat(aa);x(e,xa);xa=a.length}else v.html(W);if(I.templateUrl)V=
+!0,Q("template",L,I,v),L=I,I.replace&&(h=I),H=bf(a.splice(R,a.length-R),v,e,g,z&&ya,k,m,{controllerDirectives:A,newIsolateScopeDirective:B,templateDirective:L,nonTlbTranscludeDirective:$}),xa=a.length;else if(I.compile)try{O=I.compile(v,e,ya),F(O)?y(null,O,T,Pb):O&&y(O.pre,O.post,T,Pb)}catch(ba){c(ba,ta(v))}I.terminal&&(H.terminal=!0,K=Math.max(K,I.priority))}H.scope=G&&!0===G.scope;H.transcludeOnThisElement=z;H.elementTranscludeOnThisElement=w;H.templateOnThisElement=V;H.transclude=ya;n.hasElementTranscludeDirective=
+w;return H}function tb(a){for(var b=0,c=a.length;b<c;b++)a[b]=dc(a[b],{$$isolateScope:!0})}function $(b,e,f,g,h,k,m){if(e===h)return null;h=null;if(d.hasOwnProperty(e)){var u;e=a.get(e+"Directive");for(var p=0,y=e.length;p<y;p++)try{u=e[p],(g===s||g>u.priority)&&-1!=u.restrict.indexOf(f)&&(k&&(u=dc(u,{$$start:k,$$end:m})),b.push(u),h=u)}catch(t){c(t)}}return h}function x(a,b){var c=b.$attr,d=a.$attr,e=a.$$element;r(a,function(d,e){"$"!=e.charAt(0)&&(b[e]&&b[e]!==d&&(d+=("style"===e?";":" ")+b[e]),
+a.$set(e,d,!0,c[e]))});r(b,function(b,f){"class"==f?(B(e,b),a["class"]=(a["class"]?a["class"]+" ":"")+b):"style"==f?(e.attr("style",e.attr("style")+";"+b),a.style=(a.style?a.style+";":"")+b):"$"==f.charAt(0)||a.hasOwnProperty(f)||(a[f]=b,d[f]=c[f])})}function bf(a,b,c,d,e,f,g,h){var k=[],q,n,u=b[0],p=a.shift(),t=v({},p,{templateUrl:null,transclude:null,replace:null,$$originalDirective:p}),E=F(p.templateUrl)?p.templateUrl(b,c):p.templateUrl,H=p.templateNamespace;b.empty();m(y.getTrustedResourceUrl(E)).then(function(m){var y,
+G;m=Z(m);if(p.replace){m=Gb.test(m)?D(Nb(H,ca(m))):[];y=m[0];if(1!=m.length||1!==y.nodeType)throw ja("tplrt",p.name,E);m={$attr:{}};fa(d,b,y);var A=P(y,[],m);S(p.scope)&&tb(A);a=A.concat(a);x(c,m)}else y=u,b.html(m);a.unshift(t);q=U(a,y,c,e,b,p,f,g,h);r(d,function(a,c){a==y&&(d[c]=b[0])});for(n=K(b[0].childNodes,e);k.length;){m=k.shift();G=k.shift();var N=k.shift(),J=k.shift(),A=b[0];if(G!==u){var X=G.className;h.hasElementTranscludeDirective&&p.replace||(A=Ib(y));fa(N,D(G),A);B(D(A),X)}G=q.transcludeOnThisElement?
+L(m,q.transclude,J):J;q(n,m,A,d,G)}k=null});return function(a,b,c,d,e){a=e;k?(k.push(b),k.push(c),k.push(d),k.push(a)):(q.transcludeOnThisElement&&(a=L(b,q.transclude,e)),q(n,b,c,d,a))}}function w(a,b){var c=b.priority-a.priority;return 0!==c?c:a.name!==b.name?a.name<b.name?-1:1:a.index-b.index}function Q(a,b,c,d){if(b)throw ja("multidir",b.name,c.name,a,ta(d));}function O(a,c){var d=b(c,!0);d&&a.push({priority:0,compile:function(a){a=a.parent();var b=!!a.length;b&&X.$$addBindingClass(a);return function(a,
+c){var e=c.parent();b||X.$$addBindingClass(e);X.$$addBindingInfo(e,d.expressions);a.$watch(d,function(a){c[0].nodeValue=a})}}})}function Nb(a,b){a=R(a||"html");switch(a){case "svg":case "math":var c=Y.createElement("div");c.innerHTML="<"+a+">"+b+"</"+a+">";return c.childNodes[0].childNodes;default:return b}}function xa(a,b){if("srcdoc"==b)return y.HTML;var c=pa(a);if("xlinkHref"==b||"form"==c&&"action"==b||"img"!=c&&("src"==b||"ngSrc"==b))return y.RESOURCE_URL}function V(a,c,d,e,f){var k=b(d,!0);
+if(k){if("multiple"===e&&"select"===pa(a))throw ja("selmulti",ta(a));c.push({priority:100,compile:function(){return{pre:function(c,d,m){d=m.$$observers||(m.$$observers={});if(h.test(e))throw ja("nodomevents");if(k=b(m[e],!0,xa(a,e),g[e]||f))m[e]=k(c),(d[e]||(d[e]=[])).$$inter=!0,(m.$$observers&&m.$$observers[e].$$scope||c).$watch(k,function(a,b){"class"===e&&a!=b?m.$updateClass(a,b):m.$set(e,a)})}}}})}}function fa(a,b,c){var d=b[0],e=b.length,f=d.parentNode,g,h;if(a)for(g=0,h=a.length;g<h;g++)if(a[g]==
+d){a[g++]=c;h=g+e-1;for(var k=a.length;g<k;g++,h++)h<k?a[g]=a[h]:delete a[g];a.length-=e-1;a.context===d&&(a.context=c);break}f&&f.replaceChild(c,d);a=Y.createDocumentFragment();a.appendChild(d);D(c).data(D(d).data());ma?(Eb=!0,ma.cleanData([d])):delete D.cache[d[D.expando]];d=1;for(e=b.length;d<e;d++)f=b[d],D(f).remove(),a.appendChild(f),delete b[d];b[0]=c;b.length=1}function Fc(a,b){return v(function(){return a.apply(null,arguments)},a,b)}function Gc(a,b,d,e,f,g){try{a(b,d,e,f,g)}catch(h){c(h,ta(d))}}
+var Ob=function(a,b){if(b){var c=Object.keys(b),d,e,f;d=0;for(e=c.length;d<e;d++)f=c[d],this[f]=b[f]}else this.$attr={};this.$$element=a};Ob.prototype={$normalize:va,$addClass:function(a){a&&0<a.length&&E.addClass(this.$$element,a)},$removeClass:function(a){a&&0<a.length&&E.removeClass(this.$$element,a)},$updateClass:function(a,b){var c=Hc(a,b);c&&c.length&&E.addClass(this.$$element,c);(c=Hc(b,a))&&c.length&&E.removeClass(this.$$element,c)},$set:function(a,b,d,e){var f=this.$$element[0],g=Ac(f,a),
+h=We(f,a),f=a;g?(this.$$element.prop(a,b),e=g):h&&(this[h]=b,f=h);this[a]=b;e?this.$attr[a]=e:(e=this.$attr[a])||(this.$attr[a]=e=Db(a,"-"));g=pa(this.$$element);if("a"===g&&"href"===a||"img"===g&&"src"===a)this[a]=b=G(b,"src"===a);!1!==d&&(null===b||b===s?this.$$element.removeAttr(e):this.$$element.attr(e,b));(a=this.$$observers)&&r(a[f],function(a){try{a(b)}catch(d){c(d)}})},$observe:function(a,b){var c=this,d=c.$$observers||(c.$$observers={}),e=d[a]||(d[a]=[]);e.push(b);H.$evalAsync(function(){e.$$inter||
+b(c[a])});return function(){Ra(e,b)}}};var ya=b.startSymbol(),T=b.endSymbol(),Z="{{"==ya||"}}"==T?Pa:function(a){return a.replace(/\{\{/g,ya).replace(/}}/g,T)},ka=/^ngAttr[A-Z]/;X.$$addBindingInfo=k?function(a,b){var c=a.data("$binding")||[];M(b)?c=c.concat(b):c.push(b);a.data("$binding",c)}:z;X.$$addBindingClass=k?function(a){B(a,"ng-binding")}:z;X.$$addScopeInfo=k?function(a,b,c,d){a.data(c?d?"$isolateScopeNoTemplate":"$isolateScope":"$scope",b)}:z;X.$$addScopeClass=k?function(a,b){B(a,b?"ng-isolate-scope":
+"ng-scope")}:z;return X}]}function va(b){return Wa(b.replace(cf,""))}function Hc(b,a){var c="",d=b.split(/\s+/),e=a.split(/\s+/),f=0;a:for(;f<d.length;f++){for(var g=d[f],h=0;h<e.length;h++)if(g==e[h])continue a;c+=(0<c.length?" ":"")+g}return c}function te(){var b={},a=!1,c=/^(\S+)(\s+as\s+(\w+))?$/;this.register=function(a,c){Ia(a,"controller");S(a)?v(b,a):b[a]=c};this.allowGlobals=function(){a=!0};this.$get=["$injector","$window",function(d,e){function f(a,b,c,d){if(!a||!S(a.$scope))throw Q("$controller")("noscp",
+d,b);a.$scope[b]=c}return function(g,h,k,l){var n,p,q;k=!0===k;l&&C(l)&&(q=l);C(g)&&(l=g.match(c),p=l[1],q=q||l[3],g=b.hasOwnProperty(p)?b[p]:kc(h.$scope,p,!0)||(a?kc(e,p,!0):s),ib(g,p,!0));if(k)return k=function(){},k.prototype=(M(g)?g[g.length-1]:g).prototype,n=new k,q&&f(h,q,n,p||g.name),v(function(){d.invoke(g,n,h,p);return n},{instance:n,identifier:q});n=d.instantiate(g,h,p);q&&f(h,q,n,p||g.name);return n}}]}function ue(){this.$get=["$window",function(b){return D(b.document)}]}function ve(){this.$get=
+["$log",function(b){return function(a,c){b.error.apply(b,arguments)}}]}function Ic(b){var a={},c,d,e;if(!b)return a;r(b.split("\n"),function(b){e=b.indexOf(":");c=R(ca(b.substr(0,e)));d=ca(b.substr(e+1));c&&(a[c]=a[c]?a[c]+", "+d:d)});return a}function Jc(b){var a=S(b)?b:s;return function(c){a||(a=Ic(b));return c?a[R(c)]||null:a}}function Kc(b,a,c){if(F(c))return c(b,a);r(c,function(c){b=c(b,a)});return b}function ye(){var b=/^\s*(\[|\{[^\{])/,a=/[\}\]]\s*$/,c=/^\)\]\}',?\n/,d={"Content-Type":"application/json;charset=utf-8"},
+e=this.defaults={transformResponse:[function(d){C(d)&&(d=d.replace(c,""),b.test(d)&&a.test(d)&&(d=fc(d)));return d}],transformRequest:[function(a){return S(a)&&"[object File]"!==Fa.call(a)&&"[object Blob]"!==Fa.call(a)?sa(a):a}],headers:{common:{Accept:"application/json, text/plain, */*"},post:qa(d),put:qa(d),patch:qa(d)},xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN"},f=!1;this.useApplyAsync=function(a){return x(a)?(f=!!a,this):f};var g=this.interceptors=[];this.$get=["$httpBackend","$browser",
+"$cacheFactory","$rootScope","$q","$injector",function(a,b,c,d,p,q){function m(a){function b(a){var d=v({},a,{data:Kc(a.data,a.headers,c.transformResponse)});a=a.status;return 200<=a&&300>a?d:p.reject(d)}var c={method:"get",transformRequest:e.transformRequest,transformResponse:e.transformResponse},d=function(a){var b=e.headers,c=v({},a.headers),d,f,b=v({},b.common,b[R(a.method)]);a:for(d in b){a=R(d);for(f in c)if(R(f)===a)continue a;c[d]=b[d]}(function(a){var b;r(a,function(c,d){F(c)&&(b=c(),null!=
+b?a[d]=b:delete a[d])})})(c);return c}(a);v(c,a);c.headers=d;c.method=kb(c.method);var f=[function(a){d=a.headers;var c=Kc(a.data,Jc(d),a.transformRequest);w(c)&&r(d,function(a,b){"content-type"===R(b)&&delete d[b]});w(a.withCredentials)&&!w(e.withCredentials)&&(a.withCredentials=e.withCredentials);return t(a,c,d).then(b,b)},s],g=p.when(c);for(r(A,function(a){(a.request||a.requestError)&&f.unshift(a.request,a.requestError);(a.response||a.responseError)&&f.push(a.response,a.responseError)});f.length;){a=
+f.shift();var h=f.shift(),g=g.then(a,h)}g.success=function(a){g.then(function(b){a(b.data,b.status,b.headers,c)});return g};g.error=function(a){g.then(null,function(b){a(b.data,b.status,b.headers,c)});return g};return g}function t(c,g,l){function q(a,b,c,e){function g(){t(b,a,c,e)}J&&(200<=a&&300>a?J.put(U,[a,b,Ic(c),e]):J.remove(U));f?d.$applyAsync(g):(g(),d.$$phase||d.$apply())}function t(a,b,d,e){b=Math.max(b,0);(200<=b&&300>b?r.resolve:r.reject)({data:a,status:b,headers:Jc(d),config:c,statusText:e})}
+function A(){var a=m.pendingRequests.indexOf(c);-1!==a&&m.pendingRequests.splice(a,1)}var r=p.defer(),P=r.promise,J,N,U=u(c.url,c.params);m.pendingRequests.push(c);P.then(A,A);!c.cache&&!e.cache||!1===c.cache||"GET"!==c.method&&"JSONP"!==c.method||(J=S(c.cache)?c.cache:S(e.cache)?e.cache:H);if(J)if(N=J.get(U),x(N)){if(N&&F(N.then))return N.then(A,A),N;M(N)?t(N[1],N[0],qa(N[2]),N[3]):t(N,200,{},"OK")}else J.put(U,P);w(N)&&((N=Lc(c.url)?b.cookies()[c.xsrfCookieName||e.xsrfCookieName]:s)&&(l[c.xsrfHeaderName||
+e.xsrfHeaderName]=N),a(c.method,U,g,q,l,c.timeout,c.withCredentials,c.responseType));return P}function u(a,b){if(!b)return a;var c=[];rd(b,function(a,b){null===a||w(a)||(M(a)||(a=[a]),r(a,function(a){S(a)&&(a=ha(a)?a.toISOString():sa(a));c.push(Ca(b)+"="+Ca(a))}))});0<c.length&&(a+=(-1==a.indexOf("?")?"?":"&")+c.join("&"));return a}var H=c("$http"),A=[];r(g,function(a){A.unshift(C(a)?q.get(a):q.invoke(a))});m.pendingRequests=[];(function(a){r(arguments,function(a){m[a]=function(b,c){return m(v(c||
+{},{method:a,url:b}))}})})("get","delete","head","jsonp");(function(a){r(arguments,function(a){m[a]=function(b,c,d){return m(v(d||{},{method:a,url:b,data:c}))}})})("post","put","patch");m.defaults=e;return m}]}function df(b){if(8>=aa&&(!b.match(/^(get|post|head|put|delete|options)$/i)||!O.XMLHttpRequest))return new O.ActiveXObject("Microsoft.XMLHTTP");if(O.XMLHttpRequest)return new O.XMLHttpRequest;throw Q("$httpBackend")("noxhr");}function ze(){this.$get=["$browser","$window","$document",function(b,
+a,c){return ef(b,df,b.defer,a.angular.callbacks,c[0])}]}function ef(b,a,c,d,e){function f(a,b,c){var f=e.createElement("script"),n=null;f.type="text/javascript";f.src=a;f.async=!0;n=function(a){f.removeEventListener("load",n,!1);f.removeEventListener("error",n,!1);e.body.removeChild(f);f=null;var g=-1,m="unknown";a&&("load"!==a.type||d[b].called||(a={type:"error"}),m=a.type,g="error"===a.type?404:200);c&&c(g,m)};f.addEventListener("load",n,!1);f.addEventListener("error",n,!1);e.body.appendChild(f);
+return n}return function(e,h,k,l,n,p,q,m){function t(){H=-1;y&&y();E&&E.abort()}function u(a,d,e,f,g){B&&c.cancel(B);y=E=null;0===d&&(d=e?200:"file"==za(h).protocol?404:0);a(1223===d?204:d,e,f,g||"");b.$$completeOutstandingRequest(z)}var H;b.$$incOutstandingRequestCount();h=h||b.url();if("jsonp"==R(e)){var A="_"+(d.counter++).toString(36);d[A]=function(a){d[A].data=a;d[A].called=!0};var y=f(h.replace("JSON_CALLBACK","angular.callbacks."+A),A,function(a,b){u(l,a,d[A].data,"",b);d[A]=z})}else{var E=
+a(e);E.open(e,h,!0);r(n,function(a,b){x(a)&&E.setRequestHeader(b,a)});E.onreadystatechange=function(){if(E&&4==E.readyState){var a=null,b=null,c="";-1!==H&&(a=E.getAllResponseHeaders(),b="response"in E?E.response:E.responseText);-1===H&&10>aa||(c=E.statusText);u(l,H||E.status,b,a,c)}};q&&(E.withCredentials=!0);if(m)try{E.responseType=m}catch(G){if("json"!==m)throw G;}E.send(k||null)}if(0<p)var B=c(t,p);else p&&F(p.then)&&p.then(t)}}function we(){var b="{{",a="}}";this.startSymbol=function(a){return a?
+(b=a,this):b};this.endSymbol=function(b){return b?(a=b,this):a};this.$get=["$parse","$exceptionHandler","$sce",function(c,d,e){function f(a){return"\\\\\\"+a}function g(f,g,m,t){function u(c){return c.replace(l,b).replace(n,a)}function H(a){try{var b;var c=m?e.getTrusted(m,a):e.valueOf(a);if(null==c)b="";else{switch(typeof c){case "string":break;case "number":c=""+c;break;default:c=sa(c)}b=c}return b}catch(g){a=Qb("interr",f,g.toString()),d(a)}}t=!!t;for(var A,y,E=0,G=[],r=[],s=f.length,K=[],L=[];E<
+s;)if(-1!=(A=f.indexOf(b,E))&&-1!=(y=f.indexOf(a,A+h)))E!==A&&K.push(u(f.substring(E,A))),E=f.substring(A+h,y),G.push(E),r.push(c(E,H)),E=y+k,L.push(K.length),K.push("");else{E!==s&&K.push(u(f.substring(E)));break}if(m&&1<K.length)throw Qb("noconcat",f);if(!g||G.length){var P=function(a){for(var b=0,c=G.length;b<c;b++){if(t&&w(a[b]))return;K[L[b]]=a[b]}return K.join("")};return v(function(a){var b=0,c=G.length,e=Array(c);try{for(;b<c;b++)e[b]=r[b](a);return P(e)}catch(g){a=Qb("interr",f,g.toString()),
+d(a)}},{exp:f,expressions:G,$$watchDelegate:function(a,b,c){var d;return a.$watchGroup(r,function(c,e){var f=P(c);F(b)&&b.call(this,f,c!==e?d:f,a);d=f},c)}})}}var h=b.length,k=a.length,l=new RegExp(b.replace(/./g,f),"g"),n=new RegExp(a.replace(/./g,f),"g");g.startSymbol=function(){return b};g.endSymbol=function(){return a};return g}]}function xe(){this.$get=["$rootScope","$window","$q","$$q",function(b,a,c,d){function e(e,h,k,l){var n=a.setInterval,p=a.clearInterval,q=0,m=x(l)&&!l,t=(m?d:c).defer(),
+u=t.promise;k=x(k)?k:0;u.then(null,null,e);u.$$intervalId=n(function(){t.notify(q++);0<k&&q>=k&&(t.resolve(q),p(u.$$intervalId),delete f[u.$$intervalId]);m||b.$apply()},h);f[u.$$intervalId]=t;return u}var f={};e.cancel=function(b){return b&&b.$$intervalId in f?(f[b.$$intervalId].reject("canceled"),a.clearInterval(b.$$intervalId),delete f[b.$$intervalId],!0):!1};return e}]}function Fd(){this.$get=function(){return{id:"en-us",NUMBER_FORMATS:{DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{minInt:1,minFrac:0,
+maxFrac:3,posPre:"",posSuf:"",negPre:"-",negSuf:"",gSize:3,lgSize:3},{minInt:1,minFrac:2,maxFrac:2,posPre:"\u00a4",posSuf:"",negPre:"(\u00a4",negSuf:")",gSize:3,lgSize:3}],CURRENCY_SYM:"$"},DATETIME_FORMATS:{MONTH:"January February March April May June July August September October November December".split(" "),SHORTMONTH:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),DAY:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),SHORTDAY:"Sun Mon Tue Wed Thu Fri Sat".split(" "),
+AMPMS:["AM","PM"],medium:"MMM d, y h:mm:ss a",short:"M/d/yy h:mm a",fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",mediumDate:"MMM d, y",shortDate:"M/d/yy",mediumTime:"h:mm:ss a",shortTime:"h:mm a"},pluralCat:function(b){return 1===b?"one":"other"}}}}function Rb(b){b=b.split("/");for(var a=b.length;a--;)b[a]=gb(b[a]);return b.join("/")}function Mc(b,a,c){b=za(b,c);a.$$protocol=b.protocol;a.$$host=b.hostname;a.$$port=Z(b.port)||ff[b.protocol]||null}function Nc(b,a,c){var d="/"!==b.charAt(0);d&&(b=
+"/"+b);b=za(b,c);a.$$path=decodeURIComponent(d&&"/"===b.pathname.charAt(0)?b.pathname.substring(1):b.pathname);a.$$search=hc(b.search);a.$$hash=decodeURIComponent(b.hash);a.$$path&&"/"!=a.$$path.charAt(0)&&(a.$$path="/"+a.$$path)}function wa(b,a){if(0===a.indexOf(b))return a.substr(b.length)}function Ya(b){var a=b.indexOf("#");return-1==a?b:b.substr(0,a)}function Sb(b){return b.substr(0,Ya(b).lastIndexOf("/")+1)}function Oc(b,a){this.$$html5=!0;a=a||"";var c=Sb(b);Mc(b,this,b);this.$$parse=function(a){var e=
+wa(c,a);if(!C(e))throw ub("ipthprfx",a,c);Nc(e,this,b);this.$$path||(this.$$path="/");this.$$compose()};this.$$compose=function(){var a=Bb(this.$$search),b=this.$$hash?"#"+gb(this.$$hash):"";this.$$url=Rb(this.$$path)+(a?"?"+a:"")+b;this.$$absUrl=c+this.$$url.substr(1)};this.$$parseLinkUrl=function(d,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;(f=wa(b,d))!==s?(g=f,g=(f=wa(a,f))!==s?c+(wa("/",f)||f):b+g):(f=wa(c,d))!==s?g=c+f:c==d+"/"&&(g=c);g&&this.$$parse(g);return!!g}}function Tb(b,
+a){var c=Sb(b);Mc(b,this,b);this.$$parse=function(d){var e=wa(b,d)||wa(c,d),e="#"==e.charAt(0)?wa(a,e):this.$$html5?e:"";if(!C(e))throw ub("ihshprfx",d,a);Nc(e,this,b);d=this.$$path;var f=/^\/[A-Z]:(\/.*)/;0===e.indexOf(b)&&(e=e.replace(b,""));f.exec(e)||(d=(e=f.exec(d))?e[1]:d);this.$$path=d;this.$$compose()};this.$$compose=function(){var c=Bb(this.$$search),e=this.$$hash?"#"+gb(this.$$hash):"";this.$$url=Rb(this.$$path)+(c?"?"+c:"")+e;this.$$absUrl=b+(this.$$url?a+this.$$url:"")};this.$$parseLinkUrl=
+function(a,c){return Ya(b)==Ya(a)?(this.$$parse(a),!0):!1}}function Pc(b,a){this.$$html5=!0;Tb.apply(this,arguments);var c=Sb(b);this.$$parseLinkUrl=function(d,e){if(e&&"#"===e[0])return this.hash(e.slice(1)),!0;var f,g;b==Ya(d)?f=d:(g=wa(c,d))?f=b+a+g:c===d+"/"&&(f=c);f&&this.$$parse(f);return!!f};this.$$compose=function(){var c=Bb(this.$$search),e=this.$$hash?"#"+gb(this.$$hash):"";this.$$url=Rb(this.$$path)+(c?"?"+c:"")+e;this.$$absUrl=b+a+this.$$url}}function vb(b){return function(){return this[b]}}
+function Qc(b,a){return function(c){if(w(c))return this[b];this[b]=a(c);this.$$compose();return this}}function Ae(){var b="",a={enabled:!1,requireBase:!0};this.hashPrefix=function(a){return x(a)?(b=a,this):b};this.html5Mode=function(b){return eb(b)?(a.enabled=b,this):S(b)?(a.enabled=eb(b.enabled)?b.enabled:a.enabled,a.requireBase=eb(b.requireBase)?b.requireBase:a.requireBase,this):a};this.$get=["$rootScope","$browser","$sniffer","$rootElement",function(c,d,e,f){function g(a){c.$broadcast("$locationChangeSuccess",
+h.absUrl(),a)}var h,k=d.baseHref(),l=d.url();if(a.enabled){if(!k&&a.requireBase)throw ub("nobase");k=l.substring(0,l.indexOf("/",l.indexOf("//")+2))+(k||"/");e=e.history?Oc:Pc}else k=Ya(l),e=Tb;h=new e(k,"#"+b);h.$$parseLinkUrl(l,l);var n=/^\s*(javascript|mailto):/i;f.on("click",function(a){if(!a.ctrlKey&&!a.metaKey&&2!=a.which){for(var b=D(a.target);"a"!==pa(b[0]);)if(b[0]===f[0]||!(b=b.parent())[0])return;var e=b.prop("href"),g=b.attr("href")||b.attr("xlink:href");S(e)&&"[object SVGAnimatedString]"===
+e.toString()&&(e=za(e.animVal).href);n.test(e)||!e||b.attr("target")||a.isDefaultPrevented()||!h.$$parseLinkUrl(e,g)||(a.preventDefault(),h.absUrl()!=d.url()&&(c.$apply(),O.angular["ff-684208-preventDefault"]=!0))}});h.absUrl()!=l&&d.url(h.absUrl(),!0);d.onUrlChange(function(a){h.absUrl()!=a&&(c.$evalAsync(function(){var b=h.absUrl();h.$$parse(a);c.$broadcast("$locationChangeStart",a,b).defaultPrevented?(h.$$parse(b),d.url(b)):g(b)}),c.$$phase||c.$digest())});var p=0;c.$watch(function(){var a=d.url(),
+b=h.$$replace;p&&a==h.absUrl()||(p++,c.$evalAsync(function(){c.$broadcast("$locationChangeStart",h.absUrl(),a).defaultPrevented?h.$$parse(a):(d.url(h.absUrl(),b),g(a))}));h.$$replace=!1;return p});return h}]}function Be(){var b=!0,a=this;this.debugEnabled=function(a){return x(a)?(b=a,this):b};this.$get=["$window",function(c){function d(a){a instanceof Error&&(a.stack?a=a.message&&-1===a.stack.indexOf(a.message)?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&(a=a.message+"\n"+a.sourceURL+":"+
+a.line));return a}function e(a){var b=c.console||{},e=b[a]||b.log||z;a=!1;try{a=!!e.apply}catch(k){}return a?function(){var a=[];r(arguments,function(b){a.push(d(b))});return e.apply(b,a)}:function(a,b){e(a,null==b?"":b)}}return{log:e("log"),info:e("info"),warn:e("warn"),error:e("error"),debug:function(){var c=e("debug");return function(){b&&c.apply(a,arguments)}}()}}]}function na(b,a){if("__defineGetter__"===b||"__defineSetter__"===b||"__lookupGetter__"===b||"__lookupSetter__"===b||"__proto__"===
+b)throw oa("isecfld",a);return b}function Aa(b,a){if(b){if(b.constructor===b)throw oa("isecfn",a);if(b.window===b)throw oa("isecwindow",a);if(b.children&&(b.nodeName||b.prop&&b.attr&&b.find))throw oa("isecdom",a);if(b===Object)throw oa("isecobj",a);}return b}function Ub(b){return b.constant}function La(b,a,c,d){Aa(b,d);a=a.split(".");for(var e,f=0;1<a.length;f++){e=na(a.shift(),d);var g=Aa(b[e],d);g||(g={},b[e]=g);b=g}e=na(a.shift(),d);Aa(b[e],d);return b[e]=c}function Rc(b,a,c,d,e,f){na(b,f);na(a,
+f);na(c,f);na(d,f);na(e,f);return function(f,h){var k=h&&h.hasOwnProperty(b)?h:f;if(null==k)return k;k=k[b];if(!a)return k;if(null==k)return s;k=k[a];if(!c)return k;if(null==k)return s;k=k[c];if(!d)return k;if(null==k)return s;k=k[d];return e?null==k?s:k=k[e]:k}}function Sc(b,a,c){var d=Tc[b];if(d)return d;var e=b.split("."),f=e.length;if(a.csp)d=6>f?Rc(e[0],e[1],e[2],e[3],e[4],c):function(a,b){var d=0,g;do g=Rc(e[d++],e[d++],e[d++],e[d++],e[d++],c)(a,b),b=s,a=g;while(d<f);return g};else{var g="";
+r(e,function(a,b){na(a,c);g+="if(s == null) return undefined;\ns="+(b?"s":'((l&&l.hasOwnProperty("'+a+'"))?l:s)')+"."+a+";\n"});g+="return s;";a=new Function("s","l",g);a.toString=ga(g);d=a}d.sharedGetter=!0;d.assign=function(a,c){return La(a,b,c,b)};return Tc[b]=d}function Ce(){var b=Object.create(null),a={csp:!1};this.$get=["$filter","$sniffer",function(c,d){function e(a){var b=a;a.sharedGetter&&(b=function(b,c){return a(b,c)},b.literal=a.literal,b.constant=a.constant,b.assign=a.assign);return b}
+function f(a,b){for(var c=0,d=a.length;c<d;c++){var e=a[c];e.constant||(e.inputs?f(e.inputs,b):-1===b.indexOf(e)&&b.push(e))}return b}function g(a,b){return null==a||null==b?a===b:"object"===typeof a&&(a=a.valueOf(),"object"===typeof a)?!1:a===b||a!==a&&b!==b}function h(a,b,c,d){var e=d.$$inputs||(d.$$inputs=f(d.inputs,[])),h;if(1===e.length){var k=g,e=e[0];return a.$watch(function(a){var b=e(a);g(b,k)||(h=d(a),k=b&&b.valueOf());return h},b,c)}for(var l=[],n=0,p=e.length;n<p;n++)l[n]=g;return a.$watch(function(a){for(var b=
+!1,c=0,f=e.length;c<f;c++){var k=e[c](a);if(b||(b=!g(k,l[c])))l[c]=k&&k.valueOf()}b&&(h=d(a));return h},b,c)}function k(a,b,c,d){var e,f;return e=a.$watch(function(a){return d(a)},function(a,c,d){f=a;F(b)&&b.apply(this,arguments);x(a)&&d.$$postDigest(function(){x(f)&&e()})},c)}function l(a,b,c,d){function e(a){var b=!0;r(a,function(a){x(a)||(b=!1)});return b}var f;return f=a.$watch(function(a){return d(a)},function(a,c,d){F(b)&&b.call(this,a,c,d);e(a)&&d.$$postDigest(function(){e(a)&&f()})},c)}function n(a,
+b,c,d){var e;return e=a.$watch(function(a){return d(a)},function(a,c,d){F(b)&&b.apply(this,arguments);e()},c)}function p(a,b){if(!b)return a;var c=function(c,d){var e=a(c,d),f=b(e,c,d);return x(e)?f:e};a.$$watchDelegate&&a.$$watchDelegate!==h?c.$$watchDelegate=a.$$watchDelegate:b.$stateful||(c.$$watchDelegate=h,c.inputs=[a]);return c}a.csp=d.csp;return function(d,f){var g,u,H;switch(typeof d){case "string":return H=d=d.trim(),g=b[H],g||(":"===d.charAt(0)&&":"===d.charAt(1)&&(u=!0,d=d.substring(2)),
+g=new Vb(a),g=(new Za(g,c,a)).parse(d),g.constant?g.$$watchDelegate=n:u?(g=e(g),g.$$watchDelegate=g.literal?l:k):g.inputs&&(g.$$watchDelegate=h),b[H]=g),p(g,f);case "function":return p(d,f);default:return p(z,f)}}}]}function Ee(){this.$get=["$rootScope","$exceptionHandler",function(b,a){return Uc(function(a){b.$evalAsync(a)},a)}]}function Fe(){this.$get=["$browser","$exceptionHandler",function(b,a){return Uc(function(a){b.defer(a)},a)}]}function Uc(b,a){function c(a,b,c){function d(b){return function(c){e||
+(e=!0,b.call(a,c))}}var e=!1;return[d(b),d(c)]}function d(){this.$$state={status:0}}function e(a,b){return function(c){b.call(a,c)}}function f(c){!c.processScheduled&&c.pending&&(c.processScheduled=!0,b(function(){var b,d,e;e=c.pending;c.processScheduled=!1;c.pending=s;for(var f=0,g=e.length;f<g;++f){d=e[f][0];b=e[f][c.status];try{F(b)?d.resolve(b(c.value)):1===c.status?d.resolve(c.value):d.reject(c.value)}catch(h){d.reject(h),a(h)}}}))}function g(){this.promise=new d;this.resolve=e(this,this.resolve);
+this.reject=e(this,this.reject);this.notify=e(this,this.notify)}var h=Q("$q",TypeError);d.prototype={then:function(a,b,c){var d=new g;this.$$state.pending=this.$$state.pending||[];this.$$state.pending.push([d,a,b,c]);0<this.$$state.status&&f(this.$$state);return d.promise},"catch":function(a){return this.then(null,a)},"finally":function(a,b){return this.then(function(b){return l(b,!0,a)},function(b){return l(b,!1,a)},b)}};g.prototype={resolve:function(a){this.promise.$$state.status||(a===this.promise?
+this.$$reject(h("qcycle",a)):this.$$resolve(a))},$$resolve:function(b){var d,e;e=c(this,this.$$resolve,this.$$reject);try{if(S(b)||F(b))d=b&&b.then;F(d)?(this.promise.$$state.status=-1,d.call(b,e[0],e[1],this.notify)):(this.promise.$$state.value=b,this.promise.$$state.status=1,f(this.promise.$$state))}catch(g){e[1](g),a(g)}},reject:function(a){this.promise.$$state.status||this.$$reject(a)},$$reject:function(a){this.promise.$$state.value=a;this.promise.$$state.status=2;f(this.promise.$$state)},notify:function(c){var d=
+this.promise.$$state.pending;0>=this.promise.$$state.status&&d&&d.length&&b(function(){for(var b,e,f=0,g=d.length;f<g;f++){e=d[f][0];b=d[f][3];try{e.notify(F(b)?b(c):c)}catch(h){a(h)}}})}};var k=function(a,b){var c=new g;b?c.resolve(a):c.reject(a);return c.promise},l=function(a,b,c){var d=null;try{F(c)&&(d=c())}catch(e){return k(e,!1)}return d&&F(d.then)?d.then(function(){return k(a,b)},function(a){return k(a,!1)}):k(a,b)},n=function(a,b,c,d){var e=new g;e.resolve(a);return e.promise.then(b,c,d)},
+p=function m(a){if(!F(a))throw h("norslvr",a);if(!(this instanceof m))return new m(a);var b=new g;a(function(a){b.resolve(a)},function(a){b.reject(a)});return b.promise};p.defer=function(){return new g};p.reject=function(a){var b=new g;b.reject(a);return b.promise};p.when=n;p.all=function(a){var b=new g,c=0,d=M(a)?[]:{};r(a,function(a,e){c++;n(a).then(function(a){d.hasOwnProperty(e)||(d[e]=a,--c||b.resolve(d))},function(a){d.hasOwnProperty(e)||b.reject(a)})});0===c&&b.resolve(d);return b.promise};
+return p}function Oe(){this.$get=["$window","$timeout",function(b,a){var c=b.requestAnimationFrame||b.webkitRequestAnimationFrame||b.mozRequestAnimationFrame,d=b.cancelAnimationFrame||b.webkitCancelAnimationFrame||b.mozCancelAnimationFrame||b.webkitCancelRequestAnimationFrame,e=!!c,f=e?function(a){var b=c(a);return function(){d(b)}}:function(b){var c=a(b,16.66,!1);return function(){a.cancel(c)}};f.supported=e;return f}]}function De(){var b=10,a=Q("$rootScope"),c=null,d=null;this.digestTtl=function(a){arguments.length&&
+(b=a);return b};this.$get=["$injector","$exceptionHandler","$parse","$browser",function(e,f,g,h){function k(){this.$id=++cb;this.$$phase=this.$parent=this.$$watchers=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null;this["this"]=this.$root=this;this.$$destroyed=!1;this.$$asyncQueue=[];this.$$postDigestQueue=[];this.$$listeners={};this.$$listenerCount={};this.$$isolateBindings=null;this.$$applyAsyncQueue=[]}function l(b){if(t.$$phase)throw a("inprog",t.$$phase);t.$$phase=
+b}function n(a,b,c){do a.$$listenerCount[c]-=b,0===a.$$listenerCount[c]&&delete a.$$listenerCount[c];while(a=a.$parent)}function p(){}function q(){for(var a=t.$$applyAsyncQueue;a.length;)try{a.shift()()}catch(b){f(b)}d=null}function m(){null===d&&(d=h.defer(function(){t.$apply(q)}))}k.prototype={constructor:k,$new:function(a){a?(a=new k,a.$root=this.$root,a.$$asyncQueue=this.$$asyncQueue,a.$$postDigestQueue=this.$$postDigestQueue):(this.$$ChildScope||(this.$$ChildScope=function(){this.$$watchers=
+this.$$nextSibling=this.$$childHead=this.$$childTail=null;this.$$listeners={};this.$$listenerCount={};this.$id=++cb;this.$$ChildScope=null},this.$$ChildScope.prototype=this),a=new this.$$ChildScope);a["this"]=a;a.$parent=this;a.$$prevSibling=this.$$childTail;this.$$childHead?this.$$childTail=this.$$childTail.$$nextSibling=a:this.$$childHead=this.$$childTail=a;return a},$watch:function(a,b,d){var e=g(a);if(e.$$watchDelegate)return e.$$watchDelegate(this,b,d,e);var f=this.$$watchers,h={fn:b,last:p,
+get:e,exp:a,eq:!!d};c=null;F(b)||(h.fn=z);f||(f=this.$$watchers=[]);f.unshift(h);return function(){Ra(f,h);c=null}},$watchGroup:function(a,b){function c(){h=!1;k?(k=!1,b(e,e,g)):b(e,d,g)}var d=Array(a.length),e=Array(a.length),f=[],g=this,h=!1,k=!0;if(!a.length){var l=!0;g.$evalAsync(function(){l&&b(e,e,g)});return function(){l=!1}}if(1===a.length)return this.$watch(a[0],function(a,c,f){e[0]=a;d[0]=c;b(e,a===c?e:d,f)});r(a,function(a,b){var k=g.$watch(a,function(a,f){e[b]=a;d[b]=f;h||(h=!0,g.$evalAsync(c))});
+f.push(k)});return function(){for(;f.length;)f.shift()()}},$watchCollection:function(a,b){function c(a){e=a;var b,d,g,h;if(S(e))if(Na(e))for(f!==m&&(f=m,r=f.length=0,l++),a=e.length,r!==a&&(l++,f.length=r=a),b=0;b<a;b++)h=f[b],g=e[b],d=h!==h&&g!==g,d||h===g||(l++,f[b]=g);else{f!==p&&(f=p={},r=0,l++);a=0;for(b in e)e.hasOwnProperty(b)&&(a++,g=e[b],h=f[b],b in f?(d=h!==h&&g!==g,d||h===g||(l++,f[b]=g)):(r++,f[b]=g,l++));if(r>a)for(b in l++,f)e.hasOwnProperty(b)||(r--,delete f[b])}else f!==e&&(f=e,l++);
+return l}c.$stateful=!0;var d=this,e,f,h,k=1<b.length,l=0,n=g(a,c),m=[],p={},q=!0,r=0;return this.$watch(n,function(){q?(q=!1,b(e,e,d)):b(e,h,d);if(k)if(S(e))if(Na(e)){h=Array(e.length);for(var a=0;a<e.length;a++)h[a]=e[a]}else for(a in h={},e)Ab.call(e,a)&&(h[a]=e[a]);else h=e})},$digest:function(){var e,g,k,n,m=this.$$asyncQueue,r=this.$$postDigestQueue,B,s,K=b,L,P=[],J,N,U;l("$digest");h.$$checkUrlChange();this===t&&null!==d&&(h.defer.cancel(d),q());c=null;do{s=!1;for(L=this;m.length;){try{U=m.shift(),
+U.scope.$eval(U.expression)}catch(v){f(v)}c=null}a:do{if(n=L.$$watchers)for(B=n.length;B--;)try{if(e=n[B])if((g=e.get(L))!==(k=e.last)&&!(e.eq?ra(g,k):"number"===typeof g&&"number"===typeof k&&isNaN(g)&&isNaN(k)))s=!0,c=e,e.last=e.eq?Ga(g,null):g,e.fn(g,k===p?g:k,L),5>K&&(J=4-K,P[J]||(P[J]=[]),N=F(e.exp)?"fn: "+(e.exp.name||e.exp.toString()):e.exp,N+="; newVal: "+sa(g)+"; oldVal: "+sa(k),P[J].push(N));else if(e===c){s=!1;break a}}catch(x){f(x)}if(!(n=L.$$childHead||L!==this&&L.$$nextSibling))for(;L!==
+this&&!(n=L.$$nextSibling);)L=L.$parent}while(L=n);if((s||m.length)&&!K--)throw t.$$phase=null,a("infdig",b,sa(P));}while(s||m.length);for(t.$$phase=null;r.length;)try{r.shift()()}catch(D){f(D)}},$destroy:function(){if(!this.$$destroyed){var a=this.$parent;this.$broadcast("$destroy");this.$$destroyed=!0;if(this!==t){for(var b in this.$$listenerCount)n(this,this.$$listenerCount[b],b);a.$$childHead==this&&(a.$$childHead=this.$$nextSibling);a.$$childTail==this&&(a.$$childTail=this.$$prevSibling);this.$$prevSibling&&
+(this.$$prevSibling.$$nextSibling=this.$$nextSibling);this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling);this.$parent=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=this.$root=null;this.$$listeners={};this.$$watchers=this.$$asyncQueue=this.$$postDigestQueue=[];this.$destroy=this.$digest=this.$apply=z;this.$on=this.$watch=this.$watchGroup=function(){return z}}}},$eval:function(a,b){return g(a)(this,b)},$evalAsync:function(a){t.$$phase||t.$$asyncQueue.length||
+h.defer(function(){t.$$asyncQueue.length&&t.$digest()});this.$$asyncQueue.push({scope:this,expression:a})},$$postDigest:function(a){this.$$postDigestQueue.push(a)},$apply:function(a){try{return l("$apply"),this.$eval(a)}catch(b){f(b)}finally{t.$$phase=null;try{t.$digest()}catch(c){throw f(c),c;}}},$applyAsync:function(a){function b(){c.$eval(a)}var c=this;a&&t.$$applyAsyncQueue.push(b);m()},$on:function(a,b){var c=this.$$listeners[a];c||(this.$$listeners[a]=c=[]);c.push(b);var d=this;do d.$$listenerCount[a]||
+(d.$$listenerCount[a]=0),d.$$listenerCount[a]++;while(d=d.$parent);var e=this;return function(){c[c.indexOf(b)]=null;n(e,1,a)}},$emit:function(a,b){var c=[],d,e=this,g=!1,h={name:a,targetScope:e,stopPropagation:function(){g=!0},preventDefault:function(){h.defaultPrevented=!0},defaultPrevented:!1},k=fb([h],arguments,1),l,n;do{d=e.$$listeners[a]||c;h.currentScope=e;l=0;for(n=d.length;l<n;l++)if(d[l])try{d[l].apply(null,k)}catch(m){f(m)}else d.splice(l,1),l--,n--;if(g)return h.currentScope=null,h;e=
+e.$parent}while(e);h.currentScope=null;return h},$broadcast:function(a,b){var c=this,d=this,e={name:a,targetScope:this,preventDefault:function(){e.defaultPrevented=!0},defaultPrevented:!1};if(!this.$$listenerCount[a])return e;for(var g=fb([e],arguments,1),h,k;c=d;){e.currentScope=c;d=c.$$listeners[a]||[];h=0;for(k=d.length;h<k;h++)if(d[h])try{d[h].apply(null,g)}catch(l){f(l)}else d.splice(h,1),h--,k--;if(!(d=c.$$listenerCount[a]&&c.$$childHead||c!==this&&c.$$nextSibling))for(;c!==this&&!(d=c.$$nextSibling);)c=
+c.$parent}e.currentScope=null;return e}};var t=new k;return t}]}function Gd(){var b=/^\s*(https?|ftp|mailto|tel|file):/,a=/^\s*((https?|ftp|file|blob):|data:image\/)/;this.aHrefSanitizationWhitelist=function(a){return x(a)?(b=a,this):b};this.imgSrcSanitizationWhitelist=function(b){return x(b)?(a=b,this):a};this.$get=function(){return function(c,d){var e=d?a:b,f;if(!aa||8<=aa)if(f=za(c).href,""!==f&&!f.match(e))return"unsafe:"+f;return c}}}function gf(b){if("self"===b)return b;if(C(b)){if(-1<b.indexOf("***"))throw Ba("iwcard",
+b);b=b.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08").replace("\\*\\*",".*").replace("\\*","[^:/.?&;]*");return new RegExp("^"+b+"$")}if(db(b))return new RegExp("^"+b.source+"$");throw Ba("imatcher");}function Vc(b){var a=[];x(b)&&r(b,function(b){a.push(gf(b))});return a}function He(){this.SCE_CONTEXTS=la;var b=["self"],a=[];this.resourceUrlWhitelist=function(a){arguments.length&&(b=Vc(a));return b};this.resourceUrlBlacklist=function(b){arguments.length&&(a=Vc(b));return a};
+this.$get=["$injector",function(c){function d(a,b){return"self"===a?Lc(b):!!a.exec(b.href)}function e(a){var b=function(a){this.$$unwrapTrustedValue=function(){return a}};a&&(b.prototype=new a);b.prototype.valueOf=function(){return this.$$unwrapTrustedValue()};b.prototype.toString=function(){return this.$$unwrapTrustedValue().toString()};return b}var f=function(a){throw Ba("unsafe");};c.has("$sanitize")&&(f=c.get("$sanitize"));var g=e(),h={};h[la.HTML]=e(g);h[la.CSS]=e(g);h[la.URL]=e(g);h[la.JS]=
+e(g);h[la.RESOURCE_URL]=e(h[la.URL]);return{trustAs:function(a,b){var c=h.hasOwnProperty(a)?h[a]:null;if(!c)throw Ba("icontext",a,b);if(null===b||b===s||""===b)return b;if("string"!==typeof b)throw Ba("itype",a);return new c(b)},getTrusted:function(c,e){if(null===e||e===s||""===e)return e;var g=h.hasOwnProperty(c)?h[c]:null;if(g&&e instanceof g)return e.$$unwrapTrustedValue();if(c===la.RESOURCE_URL){var g=za(e.toString()),p,q,m=!1;p=0;for(q=b.length;p<q;p++)if(d(b[p],g)){m=!0;break}if(m)for(p=0,q=
+a.length;p<q;p++)if(d(a[p],g)){m=!1;break}if(m)return e;throw Ba("insecurl",e.toString());}if(c===la.HTML)return f(e);throw Ba("unsafe");},valueOf:function(a){return a instanceof g?a.$$unwrapTrustedValue():a}}}]}function Ge(){var b=!0;this.enabled=function(a){arguments.length&&(b=!!a);return b};this.$get=["$parse","$sniffer","$sceDelegate",function(a,c,d){if(b&&c.msie&&8>c.msieDocumentMode)throw Ba("iequirks");var e=qa(la);e.isEnabled=function(){return b};e.trustAs=d.trustAs;e.getTrusted=d.getTrusted;
+e.valueOf=d.valueOf;b||(e.trustAs=e.getTrusted=function(a,b){return b},e.valueOf=Pa);e.parseAs=function(b,c){var d=a(c);return d.literal&&d.constant?d:a(c,function(a){return e.getTrusted(b,a)})};var f=e.parseAs,g=e.getTrusted,h=e.trustAs;r(la,function(a,b){var c=R(b);e[Wa("parse_as_"+c)]=function(b){return f(a,b)};e[Wa("get_trusted_"+c)]=function(b){return g(a,b)};e[Wa("trust_as_"+c)]=function(b){return h(a,b)}});return e}]}function Ie(){this.$get=["$window","$document",function(b,a){var c={},d=Z((/android (\d+)/.exec(R((b.navigator||
+{}).userAgent))||[])[1]),e=/Boxee/i.test((b.navigator||{}).userAgent),f=a[0]||{},g=f.documentMode,h,k=/^(Moz|webkit|O|ms)(?=[A-Z])/,l=f.body&&f.body.style,n=!1,p=!1;if(l){for(var q in l)if(n=k.exec(q)){h=n[0];h=h.substr(0,1).toUpperCase()+h.substr(1);break}h||(h="WebkitOpacity"in l&&"webkit");n=!!("transition"in l||h+"Transition"in l);p=!!("animation"in l||h+"Animation"in l);!d||n&&p||(n=C(f.body.style.webkitTransition),p=C(f.body.style.webkitAnimation))}return{history:!(!b.history||!b.history.pushState||
+4>d||e),hashchange:"onhashchange"in b&&(!g||7<g),hasEvent:function(a){if("input"==a&&9==aa)return!1;if(w(c[a])){var b=f.createElement("div");c[a]="on"+a in b}return c[a]},csp:Ua(),vendorPrefix:h,transitions:n,animations:p,android:d,msie:aa,msieDocumentMode:g}}]}function Ke(){this.$get=["$templateCache","$http","$q",function(b,a,c){function d(e,f){function g(){h.totalPendingRequests--;if(!f)throw ja("tpload",e);return c.reject()}var h=d;h.totalPendingRequests++;return a.get(e,{cache:b}).then(function(a){a=
+a.data;if(!a||0===a.length)return g();h.totalPendingRequests--;b.put(e,a);return a},g)}d.totalPendingRequests=0;return d}]}function Le(){this.$get=["$rootScope","$browser","$location",function(b,a,c){return{findBindings:function(a,b,c){a=a.getElementsByClassName("ng-binding");var g=[];r(a,function(a){var d=Da.element(a).data("$binding");d&&r(d,function(d){c?(new RegExp("(^|\\s)"+b+"(\\s|\\||$)")).test(d)&&g.push(a):-1!=d.indexOf(b)&&g.push(a)})});return g},findModels:function(a,b,c){for(var g=["ng-",
+"data-ng-","ng\\:"],h=0;h<g.length;++h){var k=a.querySelectorAll("["+g[h]+"model"+(c?"=":"*=")+'"'+b+'"]');if(k.length)return k}},getLocation:function(){return c.url()},setLocation:function(a){a!==c.url()&&(c.url(a),b.$digest())},whenStable:function(b){a.notifyWhenNoOutstandingRequests(b)}}}]}function Me(){this.$get=["$rootScope","$browser","$q","$$q","$exceptionHandler",function(b,a,c,d,e){function f(f,k,l){var n=x(l)&&!l,p=(n?d:c).defer(),q=p.promise;k=a.defer(function(){try{p.resolve(f())}catch(a){p.reject(a),
+e(a)}finally{delete g[q.$$timeoutId]}n||b.$apply()},k);q.$$timeoutId=k;g[k]=p;return q}var g={};f.cancel=function(b){return b&&b.$$timeoutId in g?(g[b.$$timeoutId].reject("canceled"),delete g[b.$$timeoutId],a.defer.cancel(b.$$timeoutId)):!1};return f}]}function za(b,a){var c=b;aa&&(ba.setAttribute("href",c),c=ba.href);ba.setAttribute("href",c);return{href:ba.href,protocol:ba.protocol?ba.protocol.replace(/:$/,""):"",host:ba.host,search:ba.search?ba.search.replace(/^\?/,""):"",hash:ba.hash?ba.hash.replace(/^#/,
+""):"",hostname:ba.hostname,port:ba.port,pathname:"/"===ba.pathname.charAt(0)?ba.pathname:"/"+ba.pathname}}function Lc(b){b=C(b)?za(b):b;return b.protocol===Wc.protocol&&b.host===Wc.host}function Ne(){this.$get=ga(O)}function sc(b){function a(c,d){if(S(c)){var e={};r(c,function(b,c){e[c]=a(c,b)});return e}return b.factory(c+"Filter",d)}this.register=a;this.$get=["$injector",function(a){return function(b){return a.get(b+"Filter")}}];a("currency",Xc);a("date",Yc);a("filter",hf);a("json",jf);a("limitTo",
+kf);a("lowercase",lf);a("number",Zc);a("orderBy",$c);a("uppercase",mf)}function hf(){return function(b,a,c){if(!M(b))return b;var d=typeof c,e=[];e.check=function(a,b){for(var c=0;c<e.length;c++)if(!e[c](a,b))return!1;return!0};"function"!==d&&(c="boolean"===d&&c?function(a,b){return Da.equals(a,b)}:function(a,b){if(a&&b&&"object"===typeof a&&"object"===typeof b){for(var d in a)if("$"!==d.charAt(0)&&Ab.call(a,d)&&c(a[d],b[d]))return!0;return!1}b=(""+b).toLowerCase();return-1<(""+a).toLowerCase().indexOf(b)});
+var f=function(a,b){if("string"==typeof b&&"!"===b.charAt(0))return!f(a,b.substr(1));switch(typeof a){case "boolean":case "number":case "string":return c(a,b);case "object":switch(typeof b){case "object":return c(a,b);default:for(var d in a)if("$"!==d.charAt(0)&&f(a[d],b))return!0}return!1;case "array":for(d=0;d<a.length;d++)if(f(a[d],b))return!0;return!1;default:return!1}};switch(typeof a){case "boolean":case "number":case "string":a={$:a};case "object":for(var g in a)(function(b){"undefined"!==
+typeof a[b]&&e.push(function(c){return f("$"==b?c:c&&c[b],a[b])})})(g);break;case "function":e.push(a);break;default:return b}d=[];for(g=0;g<b.length;g++){var h=b[g];e.check(h,g)&&d.push(h)}return d}}function Xc(b){var a=b.NUMBER_FORMATS;return function(b,d){w(d)&&(d=a.CURRENCY_SYM);return null==b?b:ad(b,a.PATTERNS[1],a.GROUP_SEP,a.DECIMAL_SEP,2).replace(/\u00A4/g,d)}}function Zc(b){var a=b.NUMBER_FORMATS;return function(b,d){return null==b?b:ad(b,a.PATTERNS[0],a.GROUP_SEP,a.DECIMAL_SEP,d)}}function ad(b,
+a,c,d,e){if(!isFinite(b)||S(b))return"";var f=0>b;b=Math.abs(b);var g=b+"",h="",k=[],l=!1;if(-1!==g.indexOf("e")){var n=g.match(/([\d\.]+)e(-?)(\d+)/);n&&"-"==n[2]&&n[3]>e+1?(g="0",b=0):(h=g,l=!0)}if(l)0<e&&-1<b&&1>b&&(h=b.toFixed(e));else{g=(g.split(bd)[1]||"").length;w(e)&&(e=Math.min(Math.max(a.minFrac,g),a.maxFrac));b=+(Math.round(+(b.toString()+"e"+e)).toString()+"e"+-e);0===b&&(f=!1);b=(""+b).split(bd);g=b[0];b=b[1]||"";var n=0,p=a.lgSize,q=a.gSize;if(g.length>=p+q)for(n=g.length-p,l=0;l<n;l++)0===
+(n-l)%q&&0!==l&&(h+=c),h+=g.charAt(l);for(l=n;l<g.length;l++)0===(g.length-l)%p&&0!==l&&(h+=c),h+=g.charAt(l);for(;b.length<e;)b+="0";e&&"0"!==e&&(h+=d+b.substr(0,e))}k.push(f?a.negPre:a.posPre);k.push(h);k.push(f?a.negSuf:a.posSuf);return k.join("")}function wb(b,a,c){var d="";0>b&&(d="-",b=-b);for(b=""+b;b.length<a;)b="0"+b;c&&(b=b.substr(b.length-a));return d+b}function da(b,a,c,d){c=c||0;return function(e){e=e["get"+b]();if(0<c||e>-c)e+=c;0===e&&-12==c&&(e=12);return wb(e,a,d)}}function xb(b,
+a){return function(c,d){var e=c["get"+b](),f=kb(a?"SHORT"+b:b);return d[f][e]}}function cd(b){var a=(new Date(b,0,1)).getDay();return new Date(b,0,(4>=a?5:12)-a)}function dd(b){return function(a){var c=cd(a.getFullYear());a=+new Date(a.getFullYear(),a.getMonth(),a.getDate()+(4-a.getDay()))-+c;a=1+Math.round(a/6048E5);return wb(a,b)}}function Yc(b){function a(a){var b;if(b=a.match(c)){a=new Date(0);var f=0,g=0,h=b[8]?a.setUTCFullYear:a.setFullYear,k=b[8]?a.setUTCHours:a.setHours;b[9]&&(f=Z(b[9]+b[10]),
+g=Z(b[9]+b[11]));h.call(a,Z(b[1]),Z(b[2])-1,Z(b[3]));f=Z(b[4]||0)-f;g=Z(b[5]||0)-g;h=Z(b[6]||0);b=Math.round(1E3*parseFloat("0."+(b[7]||0)));k.call(a,f,g,h,b)}return a}var c=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(c,e,f){var g="",h=[],k,l;e=e||"mediumDate";e=b.DATETIME_FORMATS[e]||e;C(c)&&(c=nf.test(c)?Z(c):a(c));ea(c)&&(c=new Date(c));if(!ha(c))return c;for(;e;)(l=of.exec(e))?(h=fb(h,l,1),e=h.pop()):(h.push(e),e=null);
+f&&"UTC"===f&&(c=new Date(c.getTime()),c.setMinutes(c.getMinutes()+c.getTimezoneOffset()));r(h,function(a){k=pf[a];g+=k?k(c,b.DATETIME_FORMATS):a.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return g}}function jf(){return function(b){return sa(b,!0)}}function kf(){return function(b,a){ea(b)&&(b=b.toString());if(!M(b)&&!C(b))return b;a=Infinity===Math.abs(Number(a))?Number(a):Z(a);if(C(b))return a?0<=a?b.slice(0,a):b.slice(a,b.length):"";var c=[],d,e;a>b.length?a=b.length:a<-b.length&&(a=-b.length);
+0<a?(d=0,e=a):(d=b.length+a,e=b.length);for(;d<e;d++)c.push(b[d]);return c}}function $c(b){return function(a,c,d){function e(a,b){return b?function(b,c){return a(c,b)}:a}function f(a,b){var c=typeof a,d=typeof b;return c==d?(ha(a)&&ha(b)&&(a=a.valueOf(),b=b.valueOf()),"string"==c&&(a=a.toLowerCase(),b=b.toLowerCase()),a===b?0:a<b?-1:1):c<d?-1:1}if(!Na(a)||!c)return a;c=M(c)?c:[c];c=c.map(function(a){var c=!1,d=a||Pa;if(C(a)){if("+"==a.charAt(0)||"-"==a.charAt(0))c="-"==a.charAt(0),a=a.substring(1);
+d=b(a);if(d.constant){var g=d();return e(function(a,b){return f(a[g],b[g])},c)}}return e(function(a,b){return f(d(a),d(b))},c)});for(var g=[],h=0;h<a.length;h++)g.push(a[h]);return g.sort(e(function(a,b){for(var d=0;d<c.length;d++){var e=c[d](a,b);if(0!==e)return e}return 0},d))}}function Ea(b){F(b)&&(b={link:b});b.restrict=b.restrict||"AC";return ga(b)}function ed(b,a,c,d,e){var f=this,g=[],h=f.$$parentForm=b.parent().controller("form")||$a;f.$error={};f.$$success={};f.$pending=s;f.$name=e(a.name||
+a.ngForm||"")(c);f.$dirty=!1;f.$pristine=!0;f.$valid=!0;f.$invalid=!1;f.$submitted=!1;h.$addControl(f);b.addClass(Ma);f.$rollbackViewValue=function(){r(g,function(a){a.$rollbackViewValue()})};f.$commitViewValue=function(){r(g,function(a){a.$commitViewValue()})};f.$addControl=function(a){Ia(a.$name,"input");g.push(a);a.$name&&(f[a.$name]=a)};f.$$renameControl=function(a,b){var c=a.$name;f[c]===a&&delete f[c];f[b]=a;a.$name=b};f.$removeControl=function(a){a.$name&&f[a.$name]===a&&delete f[a.$name];
+r(f.$pending,function(b,c){f.$setValidity(c,null,a)});r(f.$error,function(b,c){f.$setValidity(c,null,a)});Ra(g,a)};fd({ctrl:this,$element:b,set:function(a,b,c){var d=a[b];d?-1===d.indexOf(c)&&d.push(c):a[b]=[c]},unset:function(a,b,c){var d=a[b];d&&(Ra(d,c),0===d.length&&delete a[b])},parentForm:h,$animate:d});f.$setDirty=function(){d.removeClass(b,Ma);d.addClass(b,yb);f.$dirty=!0;f.$pristine=!1;h.$setDirty()};f.$setPristine=function(){d.setClass(b,Ma,yb+" ng-submitted");f.$dirty=!1;f.$pristine=!0;
+f.$submitted=!1;r(g,function(a){a.$setPristine()})};f.$setUntouched=function(){r(g,function(a){a.$setUntouched()})};f.$setSubmitted=function(){d.addClass(b,"ng-submitted");f.$submitted=!0;h.$setSubmitted()}}function Wb(b){b.$formatters.push(function(a){return b.$isEmpty(a)?a:a.toString()})}function ab(b,a,c,d,e,f){a.prop("validity");var g=a[0].placeholder,h={},k=R(a[0].type);if(!e.android){var l=!1;a.on("compositionstart",function(a){l=!0});a.on("compositionend",function(){l=!1;n()})}var n=function(b){if(!l){var e=
+a.val(),f=b&&b.type;aa&&"input"===(b||h).type&&a[0].placeholder!==g?g=a[0].placeholder:("password"===k||c.ngTrim&&"false"===c.ngTrim||(e=ca(e)),(d.$viewValue!==e||""===e&&d.$$hasNativeValidators)&&d.$setViewValue(e,f))}};if(e.hasEvent("input"))a.on("input",n);else{var p,q=function(a){p||(p=f.defer(function(){n(a);p=null}))};a.on("keydown",function(a){var b=a.keyCode;91===b||15<b&&19>b||37<=b&&40>=b||q(a)});if(e.hasEvent("paste"))a.on("paste cut",q)}a.on("change",n);d.$render=function(){a.val(d.$isEmpty(d.$modelValue)?
+"":d.$viewValue)}}function zb(b,a){return function(c,d){var e,f;if(ha(c))return c;if(C(c)){'"'==c.charAt(0)&&'"'==c.charAt(c.length-1)&&(c=c.substring(1,c.length-1));if(qf.test(c))return new Date(c);b.lastIndex=0;if(e=b.exec(c))return e.shift(),f=d?{yyyy:d.getFullYear(),MM:d.getMonth()+1,dd:d.getDate(),HH:d.getHours(),mm:d.getMinutes(),ss:d.getSeconds(),sss:d.getMilliseconds()/1E3}:{yyyy:1970,MM:1,dd:1,HH:0,mm:0,ss:0,sss:0},r(e,function(b,c){c<a.length&&(f[a[c]]=+b)}),new Date(f.yyyy,f.MM-1,f.dd,
+f.HH,f.mm,f.ss||0,1E3*f.sss||0)}return NaN}}function bb(b,a,c,d){return function(e,f,g,h,k,l,n){function p(a){return x(a)?ha(a)?a:c(a):s}gd(e,f,g,h);ab(e,f,g,h,k,l);var q=h&&h.$options&&h.$options.timezone;h.$$parserName=b;h.$parsers.push(function(b){if(h.$isEmpty(b))return null;if(a.test(b)){var d=h.$modelValue;if(d&&"UTC"===q)var e=6E4*d.getTimezoneOffset(),d=new Date(d.getTime()+e);b=c(b,d);"UTC"===q&&b.setMinutes(b.getMinutes()-b.getTimezoneOffset());return b}return s});h.$formatters.push(function(a){return ha(a)?
+n("date")(a,d,q):""});if(x(g.min)||g.ngMin){var m;h.$validators.min=function(a){return h.$isEmpty(a)||w(m)||c(a)>=m};g.$observe("min",function(a){m=p(a);h.$validate()})}if(x(g.max)||g.ngMax){var r;h.$validators.max=function(a){return h.$isEmpty(a)||w(r)||c(a)<=r};g.$observe("max",function(a){r=p(a);h.$validate()})}}}function gd(b,a,c,d){(d.$$hasNativeValidators=S(a[0].validity))&&d.$parsers.push(function(b){var c=a.prop("validity")||{};return c.badInput&&!c.typeMismatch?s:b})}function hd(b,a,c,d,
+e){if(x(d)){b=b(d);if(!b.constant)throw Q("ngModel")("constexpr",c,d);return b(a)}return e}function fd(b){function a(a,b){b&&!f[a]?(l.addClass(e,a),f[a]=!0):!b&&f[a]&&(l.removeClass(e,a),f[a]=!1)}function c(b,c){b=b?"-"+Db(b,"-"):"";a(rf+b,!0===c);a(sf+b,!1===c)}var d=b.ctrl,e=b.$element,f={},g=b.set,h=b.unset,k=b.parentForm,l=b.$animate;d.$setValidity=function(b,e,f){e===s?(d.$pending||(d.$pending={}),g(d.$pending,b,f)):(d.$pending&&h(d.$pending,b,f),id(d.$pending)&&(d.$pending=s));eb(e)?e?(h(d.$error,
+b,f),g(d.$$success,b,f)):(g(d.$error,b,f),h(d.$$success,b,f)):(h(d.$error,b,f),h(d.$$success,b,f));d.$pending?(a(jd,!0),d.$valid=d.$invalid=s,c("",null)):(a(jd,!1),d.$valid=id(d.$error),d.$invalid=!d.$valid,c("",d.$valid));e=d.$pending&&d.$pending[b]?s:d.$error[b]?!1:d.$$success[b]?!0:null;c(b,e);k.$setValidity(b,e,d)};c("",!0)}function id(b){if(b)for(var a in b)return!1;return!0}function Xb(b,a){b="ngClass"+b;return["$animate",function(c){function d(a,b){var c=[],d=0;a:for(;d<a.length;d++){for(var e=
+a[d],n=0;n<b.length;n++)if(e==b[n])continue a;c.push(e)}return c}function e(a){if(!M(a)){if(C(a))return a.split(" ");if(S(a)){var b=[];r(a,function(a,c){a&&(b=b.concat(c.split(" ")))});return b}}return a}return{restrict:"AC",link:function(f,g,h){function k(a,b){var c=g.data("$classCounts")||{},d=[];r(a,function(a){if(0<b||c[a])c[a]=(c[a]||0)+b,c[a]===+(0<b)&&d.push(a)});g.data("$classCounts",c);return d.join(" ")}function l(b){if(!0===a||f.$index%2===a){var l=e(b||[]);if(!n){var m=k(l,1);h.$addClass(m)}else if(!ra(b,
+n)){var r=e(n),m=d(l,r),l=d(r,l),m=k(m,1),l=k(l,-1);m&&m.length&&c.addClass(g,m);l&&l.length&&c.removeClass(g,l)}}n=qa(b)}var n;f.$watch(h[b],l,!0);h.$observe("class",function(a){l(f.$eval(h[b]))});"ngClass"!==b&&f.$watch("$index",function(c,d){var g=c&1;if(g!==(d&1)){var l=e(f.$eval(h[b]));g===a?(g=k(l,1),h.$addClass(g)):(g=k(l,-1),h.$removeClass(g))}})}}}]}var tf=/^\/(.+)\/([a-z]*)$/,R=function(b){return C(b)?b.toLowerCase():b},Ab=Object.prototype.hasOwnProperty,kb=function(b){return C(b)?b.toUpperCase():
+b},aa,D,ma,Ta=[].slice,uf=[].push,Fa=Object.prototype.toString,Sa=Q("ng"),Da=O.angular||(O.angular={}),Va,cb=0;aa=Z((/msie (\d+)/.exec(R(navigator.userAgent))||[])[1]);isNaN(aa)&&(aa=Z((/trident\/.*; rv:(\d+)/.exec(R(navigator.userAgent))||[])[1]));z.$inject=[];Pa.$inject=[];var M=Array.isArray,ca=function(b){return C(b)?b.trim():b},Ua=function(){if(x(Ua.isActive_))return Ua.isActive_;var b=!(!Y.querySelector("[ng-csp]")&&!Y.querySelector("[data-ng-csp]"));if(!b)try{new Function("")}catch(a){b=!0}return Ua.isActive_=
+b},hb=["ng-","data-ng-","ng:","x-ng-"],Ad=/[A-Z]/g,jc=!1,Eb,Ed={full:"1.3.0-rc.3",major:1,minor:3,dot:0,codeName:"aggressive-pacifism"};T.expando="ng339";var qb=T.cache={},Ve=1;T._data=function(b){return this.cache[b[this.expando]]||{}};var Qe=/([\:\-\_]+(.))/g,Re=/^moz([A-Z])/,vf={mouseleave:"mouseout",mouseenter:"mouseover"},Hb=Q("jqLite"),Ue=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,Gb=/<|&#?\w+;/,Se=/<([\w:]+)/,Te=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,ia={option:[1,'<select multiple="multiple">',
+"</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};ia.optgroup=ia.option;ia.tbody=ia.tfoot=ia.colgroup=ia.caption=ia.thead;ia.th=ia.td;var Ha=T.prototype={ready:function(b){function a(){c||(c=!0,b())}var c=!1;"complete"===Y.readyState?setTimeout(a):(this.on("DOMContentLoaded",a),T(O).on("load",a),this.on("DOMContentLoaded",a))},toString:function(){var b=
+[];r(this,function(a){b.push(""+a)});return"["+b.join(", ")+"]"},eq:function(b){return 0<=b?D(this[b]):D(this[this.length+b])},length:0,push:uf,sort:[].sort,splice:[].splice},sb={};r("multiple selected checked disabled readOnly required open".split(" "),function(b){sb[R(b)]=b});var Bc={};r("input select option textarea button form details".split(" "),function(b){Bc[b]=!0});var Cc={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max",ngPattern:"pattern"};r({data:Jb,removeData:ob},
+function(b,a){T[a]=b});r({data:Jb,inheritedData:rb,scope:function(b){return D.data(b,"$scope")||rb(b.parentNode||b,["$isolateScope","$scope"])},isolateScope:function(b){return D.data(b,"$isolateScope")||D.data(b,"$isolateScopeNoTemplate")},controller:xc,injector:function(b){return rb(b,"$injector")},removeAttr:function(b,a){b.removeAttribute(a)},hasClass:lb,css:function(b,a,c){a=Wa(a);if(x(c))b.style[a]=c;else return b.style[a]},attr:function(b,a,c){var d=R(a);if(sb[d])if(x(c))c?(b[a]=!0,b.setAttribute(a,
+d)):(b[a]=!1,b.removeAttribute(d));else return b[a]||(b.attributes.getNamedItem(a)||z).specified?d:s;else if(x(c))b.setAttribute(a,c);else if(b.getAttribute)return b=b.getAttribute(a,2),null===b?s:b},prop:function(b,a,c){if(x(c))b[a]=c;else return b[a]},text:function(){function b(a,b){if(w(b)){var d=a.nodeType;return 1===d||3===d?a.textContent:""}a.textContent=b}b.$dv="";return b}(),val:function(b,a){if(w(a)){if(b.multiple&&"select"===pa(b)){var c=[];r(b.options,function(a){a.selected&&c.push(a.value||
+a.text)});return 0===c.length?null:c}return b.value}b.value=a},html:function(b,a){if(w(a))return b.innerHTML;nb(b,!0);b.innerHTML=a},empty:yc},function(b,a){T.prototype[a]=function(a,d){var e,f,g=this.length;if(b!==yc&&(2==b.length&&b!==lb&&b!==xc?a:d)===s){if(S(a)){for(e=0;e<g;e++)if(b===Jb)b(this[e],a);else for(f in a)b(this[e],f,a[f]);return this}e=b.$dv;g=e===s?Math.min(g,1):g;for(f=0;f<g;f++){var h=b(this[f],a,d);e=e?e+h:h}return e}for(e=0;e<g;e++)b(this[e],a,d);return this}});r({removeData:ob,
+on:function a(c,d,e,f){if(x(f))throw Hb("onargs");if(tc(c)){var g=pb(c,!0);f=g.events;var h=g.handle;h||(h=g.handle=Xe(c,f));for(var g=0<=d.indexOf(" ")?d.split(" "):[d],k=g.length;k--;){d=g[k];var l=f[d];l||(f[d]=[],"mouseenter"===d||"mouseleave"===d?a(c,vf[d],function(a){var c=a.relatedTarget;c&&(c===this||this.contains(c))||h(a,d)}):"$destroy"!==d&&c.addEventListener(d,h,!1),l=f[d]);l.push(e)}}},off:wc,one:function(a,c,d){a=D(a);a.on(c,function f(){a.off(c,d);a.off(c,f)});a.on(c,d)},replaceWith:function(a,
+c){var d,e=a.parentNode;nb(a);r(new T(c),function(c){d?e.insertBefore(c,d.nextSibling):e.replaceChild(c,a);d=c})},children:function(a){var c=[];r(a.childNodes,function(a){1===a.nodeType&&c.push(a)});return c},contents:function(a){return a.contentDocument||a.childNodes||[]},append:function(a,c){var d=a.nodeType;if(1===d||11===d){c=new T(c);for(var d=0,e=c.length;d<e;d++)a.appendChild(c[d])}},prepend:function(a,c){if(1===a.nodeType){var d=a.firstChild;r(new T(c),function(c){a.insertBefore(c,d)})}},
+wrap:function(a,c){c=D(c).eq(0).clone()[0];var d=a.parentNode;d&&d.replaceChild(c,a);c.appendChild(a)},remove:zc,detach:function(a){zc(a,!0)},after:function(a,c){var d=a,e=a.parentNode;c=new T(c);for(var f=0,g=c.length;f<g;f++){var h=c[f];e.insertBefore(h,d.nextSibling);d=h}},addClass:Lb,removeClass:Kb,toggleClass:function(a,c,d){c&&r(c.split(" "),function(c){var f=d;w(f)&&(f=!lb(a,c));(f?Lb:Kb)(a,c)})},parent:function(a){return(a=a.parentNode)&&11!==a.nodeType?a:null},next:function(a){return a.nextElementSibling},
+find:function(a,c){return a.getElementsByTagName?a.getElementsByTagName(c):[]},clone:Ib,triggerHandler:function(a,c,d){var e,f,g=c.type||c,h=pb(a);if(h=(h=h&&h.events)&&h[g])e={preventDefault:function(){this.defaultPrevented=!0},isDefaultPrevented:function(){return!0===this.defaultPrevented},stopImmediatePropagation:function(){this.immediatePropagationStopped=!0},isImmediatePropagationStopped:function(){return!0===this.immediatePropagationStopped},stopPropagation:z,type:g,target:a},c.type&&(e=v(e,
+c)),c=qa(h),f=d?[e].concat(d):[e],r(c,function(c){e.isImmediatePropagationStopped()||c.apply(a,f)})}},function(a,c){T.prototype[c]=function(c,e,f){for(var g,h=0,k=this.length;h<k;h++)w(g)?(g=a(this[h],c,e,f),x(g)&&(g=D(g))):vc(g,a(this[h],c,e,f));return x(g)?g:this};T.prototype.bind=T.prototype.on;T.prototype.unbind=T.prototype.off});Xa.prototype={put:function(a,c){this[Ja(a,this.nextUid)]=c},get:function(a){return this[Ja(a,this.nextUid)]},remove:function(a){var c=this[a=Ja(a,this.nextUid)];delete this[a];
+return c}};var Ec=/^function\s*[^\(]*\(\s*([^\)]*)\)/m,Ze=/,/,$e=/^\s*(_?)(\S+?)\1\s*$/,Dc=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,Ka=Q("$injector");Cb.$$annotate=Mb;var wf=Q("$animate"),qe=["$provide",function(a){this.$$selectors={};this.register=function(c,d){var e=c+"-animation";if(c&&"."!=c.charAt(0))throw wf("notcsel",c);this.$$selectors[c.substr(1)]=e;a.factory(e,d)};this.classNameFilter=function(a){1===arguments.length&&(this.$$classNameFilter=a instanceof RegExp?a:null);return this.$$classNameFilter};
+this.$get=["$$q","$$asyncCallback",function(a,d){function e(){f||(f=a.defer(),d(function(){f.resolve();f=null}));return f.promise}var f;return{enter:function(a,c,d){d?d.after(a):c.prepend(a);return e()},leave:function(a){a.remove();return e()},move:function(a,c,d){return this.enter(a,c,d)},addClass:function(a,c){c=C(c)?c:M(c)?c.join(" "):"";r(a,function(a){Lb(a,c)});return e()},removeClass:function(a,c){c=C(c)?c:M(c)?c.join(" "):"";r(a,function(a){Kb(a,c)});return e()},setClass:function(a,c,d){this.addClass(a,
+c);this.removeClass(a,d);return e()},enabled:z,cancel:z}}]}],ja=Q("$compile");lc.$inject=["$provide","$$sanitizeUriProvider"];var cf=/^(x[\:\-_]|data[\:\-_])/i,Qb=Q("$interpolate"),xf=/^([^\?#]*)(\?([^#]*))?(#(.*))?$/,ff={http:80,https:443,ftp:21},ub=Q("$location");Pc.prototype=Tb.prototype=Oc.prototype={$$html5:!1,$$replace:!1,absUrl:vb("$$absUrl"),url:function(a){if(w(a))return this.$$url;a=xf.exec(a);a[1]&&this.path(decodeURIComponent(a[1]));(a[2]||a[1])&&this.search(a[3]||"");this.hash(a[5]||
+"");return this},protocol:vb("$$protocol"),host:vb("$$host"),port:vb("$$port"),path:Qc("$$path",function(a){a=a?a.toString():"";return"/"==a.charAt(0)?a:"/"+a}),search:function(a,c){switch(arguments.length){case 0:return this.$$search;case 1:if(C(a)||ea(a))a=a.toString(),this.$$search=hc(a);else if(S(a))r(a,function(c,e){null==c&&delete a[e]}),this.$$search=a;else throw ub("isrcharg");break;default:w(c)||null===c?delete this.$$search[a]:this.$$search[a]=c}this.$$compose();return this},hash:Qc("$$hash",
+function(a){return a?a.toString():""}),replace:function(){this.$$replace=!0;return this}};var oa=Q("$parse"),yf=Function.prototype.call,zf=Function.prototype.apply,Af=Function.prototype.bind,kd=Object.create(null);r({"null":function(){return null},"true":function(){return!0},"false":function(){return!1},undefined:function(){}},function(a,c){a.constant=a.literal=a.sharedGetter=!0;kd[c]=a});var Yb=v(Object.create(null),{"+":function(a,c,d,e){d=d(a,c);e=e(a,c);return x(d)?x(e)?d+e:d:x(e)?e:s},"-":function(a,
+c,d,e){d=d(a,c);e=e(a,c);return(x(d)?d:0)-(x(e)?e:0)},"*":function(a,c,d,e){return d(a,c)*e(a,c)},"/":function(a,c,d,e){return d(a,c)/e(a,c)},"%":function(a,c,d,e){return d(a,c)%e(a,c)},"^":function(a,c,d,e){return d(a,c)^e(a,c)},"===":function(a,c,d,e){return d(a,c)===e(a,c)},"!==":function(a,c,d,e){return d(a,c)!==e(a,c)},"==":function(a,c,d,e){return d(a,c)==e(a,c)},"!=":function(a,c,d,e){return d(a,c)!=e(a,c)},"<":function(a,c,d,e){return d(a,c)<e(a,c)},">":function(a,c,d,e){return d(a,c)>e(a,
+c)},"<=":function(a,c,d,e){return d(a,c)<=e(a,c)},">=":function(a,c,d,e){return d(a,c)>=e(a,c)},"&&":function(a,c,d,e){return d(a,c)&&e(a,c)},"||":function(a,c,d,e){return d(a,c)||e(a,c)},"&":function(a,c,d,e){return d(a,c)&e(a,c)},"!":function(a,c,d){return!d(a,c)},"=":!0,"|":!0}),Bf={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},Vb=function(a){this.options=a};Vb.prototype={constructor:Vb,lex:function(a){this.text=a;this.index=0;this.ch=s;for(this.tokens=[];this.index<this.text.length;)if(this.ch=
+this.text.charAt(this.index),this.is("\"'"))this.readString(this.ch);else if(this.isNumber(this.ch)||this.is(".")&&this.isNumber(this.peek()))this.readNumber();else if(this.isIdent(this.ch))this.readIdent();else if(this.is("(){}[].,;:?"))this.tokens.push({index:this.index,text:this.ch}),this.index++;else if(this.isWhitespace(this.ch))this.index++;else{a=this.ch+this.peek();var c=a+this.peek(2),d=Yb[this.ch],e=Yb[a],f=Yb[c];f?(this.tokens.push({index:this.index,text:c,fn:f}),this.index+=3):e?(this.tokens.push({index:this.index,
+text:a,fn:e}),this.index+=2):d?(this.tokens.push({index:this.index,text:this.ch,fn:d}),this.index+=1):this.throwError("Unexpected next character ",this.index,this.index+1)}return this.tokens},is:function(a){return-1!==a.indexOf(this.ch)},peek:function(a){a=a||1;return this.index+a<this.text.length?this.text.charAt(this.index+a):!1},isNumber:function(a){return"0"<=a&&"9">=a},isWhitespace:function(a){return" "===a||"\r"===a||"\t"===a||"\n"===a||"\v"===a||"\u00a0"===a},isIdent:function(a){return"a"<=
+a&&"z">=a||"A"<=a&&"Z">=a||"_"===a||"$"===a},isExpOperator:function(a){return"-"===a||"+"===a||this.isNumber(a)},throwError:function(a,c,d){d=d||this.index;c=x(c)?"s "+c+"-"+this.index+" ["+this.text.substring(c,d)+"]":" "+d;throw oa("lexerr",a,c,this.text);},readNumber:function(){for(var a="",c=this.index;this.index<this.text.length;){var d=R(this.text.charAt(this.index));if("."==d||this.isNumber(d))a+=d;else{var e=this.peek();if("e"==d&&this.isExpOperator(e))a+=d;else if(this.isExpOperator(d)&&
+e&&this.isNumber(e)&&"e"==a.charAt(a.length-1))a+=d;else if(!this.isExpOperator(d)||e&&this.isNumber(e)||"e"!=a.charAt(a.length-1))break;else this.throwError("Invalid exponent")}this.index++}a*=1;this.tokens.push({index:c,text:a,constant:!0,fn:function(){return a}})},readIdent:function(){for(var a=this.text,c="",d=this.index,e,f,g,h;this.index<this.text.length;){h=this.text.charAt(this.index);if("."===h||this.isIdent(h)||this.isNumber(h))"."===h&&(e=this.index),c+=h;else break;this.index++}e&&"."===
+c[c.length-1]&&(this.index--,c=c.slice(0,-1),e=c.lastIndexOf("."),-1===e&&(e=s));if(e)for(f=this.index;f<this.text.length;){h=this.text.charAt(f);if("("===h){g=c.substr(e-d+1);c=c.substr(0,e-d);this.index=f;break}if(this.isWhitespace(h))f++;else break}this.tokens.push({index:d,text:c,fn:kd[c]||Sc(c,this.options,a)});g&&(this.tokens.push({index:e,text:"."}),this.tokens.push({index:e+1,text:g}))},readString:function(a){var c=this.index;this.index++;for(var d="",e=a,f=!1;this.index<this.text.length;){var g=
+this.text.charAt(this.index),e=e+g;if(f)"u"===g?(f=this.text.substring(this.index+1,this.index+5),f.match(/[\da-f]{4}/i)||this.throwError("Invalid unicode escape [\\u"+f+"]"),this.index+=4,d+=String.fromCharCode(parseInt(f,16))):d+=Bf[g]||g,f=!1;else if("\\"===g)f=!0;else{if(g===a){this.index++;this.tokens.push({index:c,text:e,string:d,constant:!0,fn:function(){return d}});return}d+=g}this.index++}this.throwError("Unterminated quote",c)}};var Za=function(a,c,d){this.lexer=a;this.$filter=c;this.options=
+d};Za.ZERO=v(function(){return 0},{sharedGetter:!0,constant:!0});Za.prototype={constructor:Za,parse:function(a){this.text=a;this.tokens=this.lexer.lex(a);a=this.statements();0!==this.tokens.length&&this.throwError("is an unexpected token",this.tokens[0]);a.literal=!!a.literal;a.constant=!!a.constant;return a},primary:function(){var a;if(this.expect("("))a=this.filterChain(),this.consume(")");else if(this.expect("["))a=this.arrayDeclaration();else if(this.expect("{"))a=this.object();else{var c=this.expect();
+(a=c.fn)||this.throwError("not a primary expression",c);c.constant&&(a.constant=!0,a.literal=!0)}for(var d;c=this.expect("(","[",".");)"("===c.text?(a=this.functionCall(a,d),d=null):"["===c.text?(d=a,a=this.objectIndex(a)):"."===c.text?(d=a,a=this.fieldAccess(a)):this.throwError("IMPOSSIBLE");return a},throwError:function(a,c){throw oa("syntax",c.text,a,c.index+1,this.text,this.text.substring(c.index));},peekToken:function(){if(0===this.tokens.length)throw oa("ueoe",this.text);return this.tokens[0]},
+peek:function(a,c,d,e){if(0<this.tokens.length){var f=this.tokens[0],g=f.text;if(g===a||g===c||g===d||g===e||!(a||c||d||e))return f}return!1},expect:function(a,c,d,e){return(a=this.peek(a,c,d,e))?(this.tokens.shift(),a):!1},consume:function(a){this.expect(a)||this.throwError("is unexpected, expecting ["+a+"]",this.peek())},unaryFn:function(a,c){return v(function(d,e){return a(d,e,c)},{constant:c.constant,inputs:[c]})},binaryFn:function(a,c,d,e){return v(function(e,g){return c(e,g,a,d)},{constant:a.constant&&
+d.constant,inputs:!e&&[a,d]})},statements:function(){for(var a=[];;)if(0<this.tokens.length&&!this.peek("}",")",";","]")&&a.push(this.filterChain()),!this.expect(";"))return 1===a.length?a[0]:function(c,d){for(var e,f=0,g=a.length;f<g;f++)e=a[f](c,d);return e}},filterChain:function(){for(var a=this.expression();this.expect("|");)a=this.filter(a);return a},filter:function(a){var c=this.expect(),d=this.$filter(c.text),e,f;if(this.peek(":"))for(e=[],f=[];this.expect(":");)e.push(this.expression());c=
+[a].concat(e||[]);return v(function(c,h){var k=a(c,h);if(f){f[0]=k;for(k=e.length;k--;)f[k+1]=e[k](c,h);return d.apply(s,f)}return d(k)},{constant:!d.$stateful&&c.every(Ub),inputs:!d.$stateful&&c})},expression:function(){return this.assignment()},assignment:function(){var a=this.ternary(),c,d;return(d=this.expect("="))?(a.assign||this.throwError("implies assignment but ["+this.text.substring(0,d.index)+"] can not be assigned to",d),c=this.ternary(),v(function(d,f){return a.assign(d,c(d,f),f)},{inputs:[a,
+c]})):a},ternary:function(){var a=this.logicalOR(),c,d;if(d=this.expect("?")){c=this.assignment();if(d=this.expect(":")){var e=this.assignment();return v(function(d,g){return a(d,g)?c(d,g):e(d,g)},{constant:a.constant&&c.constant&&e.constant})}this.throwError("expected :",d)}return a},logicalOR:function(){for(var a=this.logicalAND(),c;c=this.expect("||");)a=this.binaryFn(a,c.fn,this.logicalAND(),!0);return a},logicalAND:function(){var a=this.equality(),c;if(c=this.expect("&&"))a=this.binaryFn(a,c.fn,
+this.logicalAND(),!0);return a},equality:function(){var a=this.relational(),c;if(c=this.expect("==","!=","===","!=="))a=this.binaryFn(a,c.fn,this.equality());return a},relational:function(){var a=this.additive(),c;if(c=this.expect("<",">","<=",">="))a=this.binaryFn(a,c.fn,this.relational());return a},additive:function(){for(var a=this.multiplicative(),c;c=this.expect("+","-");)a=this.binaryFn(a,c.fn,this.multiplicative());return a},multiplicative:function(){for(var a=this.unary(),c;c=this.expect("*",
+"/","%");)a=this.binaryFn(a,c.fn,this.unary());return a},unary:function(){var a;return this.expect("+")?this.primary():(a=this.expect("-"))?this.binaryFn(Za.ZERO,a.fn,this.unary()):(a=this.expect("!"))?this.unaryFn(a.fn,this.unary()):this.primary()},fieldAccess:function(a){var c=this.text,d=this.expect().text,e=Sc(d,this.options,c);return v(function(c,d,h){return e(h||a(c,d))},{assign:function(e,g,h){(h=a(e,h))||a.assign(e,h={});return La(h,d,g,c)}})},objectIndex:function(a){var c=this.text,d=this.expression();
+this.consume("]");return v(function(e,f){var g=a(e,f),h=d(e,f);na(h,c);return g?Aa(g[h],c):s},{assign:function(e,f,g){var h=na(d(e,g),c);(g=Aa(a(e,g),c))||a.assign(e,g={});return g[h]=f}})},functionCall:function(a,c){var d=[];if(")"!==this.peekToken().text){do d.push(this.expression());while(this.expect(","))}this.consume(")");var e=this.text,f=d.length?[]:null;return function(g,h){var k=c?c(g,h):g,l=a(g,h,k)||z;if(f)for(var n=d.length;n--;)f[n]=Aa(d[n](g,h),e);Aa(k,e);if(l){if(l.constructor===l)throw oa("isecfn",
+e);if(l===yf||l===zf||l===Af)throw oa("isecff",e);}k=l.apply?l.apply(k,f):l(f[0],f[1],f[2],f[3],f[4]);return Aa(k,e)}},arrayDeclaration:function(){var a=[];if("]"!==this.peekToken().text){do{if(this.peek("]"))break;var c=this.expression();a.push(c)}while(this.expect(","))}this.consume("]");return v(function(c,e){for(var f=[],g=0,h=a.length;g<h;g++)f.push(a[g](c,e));return f},{literal:!0,constant:a.every(Ub),inputs:a})},object:function(){var a=[],c=[];if("}"!==this.peekToken().text){do{if(this.peek("}"))break;
+var d=this.expect();a.push(d.string||d.text);this.consume(":");d=this.expression();c.push(d)}while(this.expect(","))}this.consume("}");return v(function(d,f){for(var g={},h=0,k=c.length;h<k;h++)g[a[h]]=c[h](d,f);return g},{literal:!0,constant:c.every(Ub),inputs:c})}};var Tc=Object.create(null),Ba=Q("$sce"),la={HTML:"html",CSS:"css",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},ja=Q("$compile"),ba=Y.createElement("a"),Wc=za(O.location.href,!0);sc.$inject=["$provide"];Xc.$inject=["$locale"];Zc.$inject=
+["$locale"];var bd=".",pf={yyyy:da("FullYear",4),yy:da("FullYear",2,0,!0),y:da("FullYear",1),MMMM:xb("Month"),MMM:xb("Month",!0),MM:da("Month",2,1),M:da("Month",1,1),dd:da("Date",2),d:da("Date",1),HH:da("Hours",2),H:da("Hours",1),hh:da("Hours",2,-12),h:da("Hours",1,-12),mm:da("Minutes",2),m:da("Minutes",1),ss:da("Seconds",2),s:da("Seconds",1),sss:da("Milliseconds",3),EEEE:xb("Day"),EEE:xb("Day",!0),a:function(a,c){return 12>a.getHours()?c.AMPMS[0]:c.AMPMS[1]},Z:function(a){a=-1*a.getTimezoneOffset();
+return a=(0<=a?"+":"")+(wb(Math[0<a?"floor":"ceil"](a/60),2)+wb(Math.abs(a%60),2))},ww:dd(2),w:dd(1)},of=/((?:[^yMdHhmsaZEw']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z|w+))(.*)/,nf=/^\-?\d+$/;Yc.$inject=["$locale"];var lf=ga(R),mf=ga(kb);$c.$inject=["$parse"];var Hd=ga({restrict:"E",compile:function(a,c){8>=aa&&(c.href||c.name||c.$set("href",""),a.append(Y.createComment("IE fix")));if(!c.href&&!c.xlinkHref&&!c.name)return function(a,c){var f="[object SVGAnimatedString]"===Fa.call(c.prop("href"))?
+"xlink:href":"href";c.on("click",function(a){c.attr(f)||a.preventDefault()})}}}),mb={};r(sb,function(a,c){if("multiple"!=a){var d=va("ng-"+c);mb[d]=function(){return{restrict:"A",priority:100,link:function(a,f,g){a.$watch(g[d],function(a){g.$set(c,!!a)})}}}}});r(Cc,function(a,c){mb[c]=function(){return{priority:100,link:function(a,e,f){if("ngPattern"===c&&"/"==f.ngPattern.charAt(0)&&(e=f.ngPattern.match(tf))){f.$set("ngPattern",new RegExp(e[1],e[2]));return}a.$watch(f[c],function(a){f.$set(c,a)})}}}});
+r(["src","srcset","href"],function(a){var c=va("ng-"+a);mb[c]=function(){return{priority:99,link:function(d,e,f){var g=a,h=a;"href"===a&&"[object SVGAnimatedString]"===Fa.call(e.prop("href"))&&(h="xlinkHref",f.$attr[h]="xlink:href",g=null);f.$observe(c,function(c){c?(f.$set(h,c),aa&&g&&e.prop(g,f[h])):"href"===a&&f.$set(h,null)})}}}});var $a={$addControl:z,$$renameControl:function(a,c){a.$name=c},$removeControl:z,$setValidity:z,$$setPending:z,$setDirty:z,$setPristine:z,$setSubmitted:z,$$clearControlValidity:z};
+ed.$inject=["$element","$attrs","$scope","$animate","$interpolate"];var ld=function(a){return["$timeout",function(c){return{name:"form",restrict:a?"EAC":"E",controller:ed,compile:function(){return{pre:function(a,e,f,g){if(!f.action){var h=function(c){a.$apply(function(){g.$commitViewValue();g.$setSubmitted()});c.preventDefault?c.preventDefault():c.returnValue=!1};e[0].addEventListener("submit",h,!1);e.on("$destroy",function(){c(function(){e[0].removeEventListener("submit",h,!1)},0,!1)})}var k=g.$$parentForm,
+l=g.$name;l&&(La(a,l,g,l),f.$observe(f.name?"name":"ngForm",function(c){l!==c&&(La(a,l,s,l),l=c,La(a,l,g,l),k.$$renameControl(g,l))}));if(k!==$a)e.on("$destroy",function(){k.$removeControl(g);l&&La(a,l,s,l);v(g,$a)})}}}}}]},Id=ld(),Vd=ld(!0),qf=/\d{4}-[01]\d-[0-3]\dT[0-2]\d:[0-5]\d:[0-5]\d\.\d+([+-][0-2]\d:[0-5]\d|Z)/,Cf=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/,Df=/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,
+Ef=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/,md=/^(\d{4})-(\d{2})-(\d{2})$/,nd=/^(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,Zb=/^(\d{4})-W(\d\d)$/,od=/^(\d{4})-(\d\d)$/,pd=/^(\d\d):(\d\d)(?::(\d\d)(\.\d{1,3})?)?$/,Ff=/(\s+|^)default(\s+|$)/,$b=new Q("ngModel"),qd={text:function(a,c,d,e,f,g){ab(a,c,d,e,f,g);Wb(e)},date:bb("date",md,zb(md,["yyyy","MM","dd"]),"yyyy-MM-dd"),"datetime-local":bb("datetimelocal",nd,zb(nd,"yyyy MM dd HH mm ss sss".split(" ")),"yyyy-MM-ddTHH:mm:ss.sss"),time:bb("time",
+pd,zb(pd,["HH","mm","ss","sss"]),"HH:mm:ss.sss"),week:bb("week",Zb,function(a,c){if(ha(a))return a;if(C(a)){Zb.lastIndex=0;var d=Zb.exec(a);if(d){var e=+d[1],f=+d[2],g=d=0,h=0,k=0,l=cd(e),f=7*(f-1);c&&(d=c.getHours(),g=c.getMinutes(),h=c.getSeconds(),k=c.getMilliseconds());return new Date(e,0,l.getDate()+f,d,g,h,k)}}return NaN},"yyyy-Www"),month:bb("month",od,zb(od,["yyyy","MM"]),"yyyy-MM"),number:function(a,c,d,e,f,g){gd(a,c,d,e);ab(a,c,d,e,f,g);e.$$parserName="number";e.$parsers.push(function(a){return e.$isEmpty(a)?
+null:Ef.test(a)?parseFloat(a):s});e.$formatters.push(function(a){if(!e.$isEmpty(a)){if(!ea(a))throw $b("numfmt",a);a=a.toString()}return a});if(d.min||d.ngMin){var h;e.$validators.min=function(a){return e.$isEmpty(a)||w(h)||a>=h};d.$observe("min",function(a){x(a)&&!ea(a)&&(a=parseFloat(a,10));h=ea(a)&&!isNaN(a)?a:s;e.$validate()})}if(d.max||d.ngMax){var k;e.$validators.max=function(a){return e.$isEmpty(a)||w(k)||a<=k};d.$observe("max",function(a){x(a)&&!ea(a)&&(a=parseFloat(a,10));k=ea(a)&&!isNaN(a)?
+a:s;e.$validate()})}},url:function(a,c,d,e,f,g){ab(a,c,d,e,f,g);Wb(e);e.$$parserName="url";e.$validators.url=function(a){return e.$isEmpty(a)||Cf.test(a)}},email:function(a,c,d,e,f,g){ab(a,c,d,e,f,g);Wb(e);e.$$parserName="email";e.$validators.email=function(a){return e.$isEmpty(a)||Df.test(a)}},radio:function(a,c,d,e){w(d.name)&&c.attr("name",++cb);c.on("click",function(a){c[0].checked&&e.$setViewValue(d.value,a&&a.type)});e.$render=function(){c[0].checked=d.value==e.$viewValue};d.$observe("value",
+e.$render)},checkbox:function(a,c,d,e,f,g,h,k){var l=hd(k,a,"ngTrueValue",d.ngTrueValue,!0),n=hd(k,a,"ngFalseValue",d.ngFalseValue,!1);c.on("click",function(a){e.$setViewValue(c[0].checked,a&&a.type)});e.$render=function(){c[0].checked=e.$viewValue};e.$isEmpty=function(a){return a!==l};e.$formatters.push(function(a){return ra(a,l)});e.$parsers.push(function(a){return a?l:n})},hidden:z,button:z,submit:z,reset:z,file:z},mc=["$browser","$sniffer","$filter","$parse",function(a,c,d,e){return{restrict:"E",
+require:["?ngModel"],link:function(f,g,h,k){k[0]&&(qd[R(h.type)]||qd.text)(f,g,h,k[0],c,a,d,e)}}}],rf="ng-valid",sf="ng-invalid",Ma="ng-pristine",yb="ng-dirty",jd="ng-pending",Gf=["$scope","$exceptionHandler","$attrs","$element","$parse","$animate","$timeout","$rootScope","$q","$interpolate",function(a,c,d,e,f,g,h,k,l,n){this.$modelValue=this.$viewValue=Number.NaN;this.$validators={};this.$asyncValidators={};this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=[];this.$untouched=!0;this.$touched=
+!1;this.$pristine=!0;this.$dirty=!1;this.$valid=!0;this.$invalid=!1;this.$error={};this.$$success={};this.$pending=s;this.$name=n(d.name||"",!1)(a);var p=f(d.ngModel),q=null,m=this,t=function(){var c=p(a);m.$options&&m.$options.getterSetter&&F(c)&&(c=c());return c},u=function(c){var d;m.$options&&m.$options.getterSetter&&F(d=p(a))?d(m.$modelValue):p.assign(a,m.$modelValue)};this.$$setOptions=function(a){m.$options=a;if(!(p.assign||a&&a.getterSetter))throw $b("nonassign",d.ngModel,ta(e));};this.$render=
+z;this.$isEmpty=function(a){return w(a)||""===a||null===a||a!==a};var H=e.inheritedData("$formController")||$a,A=0;e.addClass(Ma).addClass("ng-untouched");fd({ctrl:this,$element:e,set:function(a,c){a[c]=!0},unset:function(a,c){delete a[c]},parentForm:H,$animate:g});this.$setPristine=function(){m.$dirty=!1;m.$pristine=!0;g.removeClass(e,yb);g.addClass(e,Ma)};this.$setUntouched=function(){m.$touched=!1;m.$untouched=!0;g.setClass(e,"ng-untouched","ng-touched")};this.$setTouched=function(){m.$touched=
+!0;m.$untouched=!1;g.setClass(e,"ng-touched","ng-untouched")};this.$rollbackViewValue=function(){h.cancel(q);m.$viewValue=m.$$lastCommittedViewValue;m.$render()};this.$validate=function(){ea(m.$modelValue)&&isNaN(m.$modelValue)||this.$$parseAndValidate()};this.$$runValidators=function(a,c,d,e){function f(){var a=!0;r(m.$validators,function(e,f){var g=e(c,d);a=a&&g;h(f,g)});return a?!0:(r(m.$asyncValidators,function(a,c){h(c,null)}),!1)}function g(){var a=[],e=!0;r(m.$asyncValidators,function(f,g){var k=
+f(c,d);if(!k||!F(k.then))throw $b("$asyncValidators",k);h(g,s);a.push(k.then(function(){h(g,!0)},function(a){e=!1;h(g,!1)}))});a.length?l.all(a).then(function(){k(e)},z):k(!0)}function h(a,c){p===A&&m.$setValidity(a,c)}function k(a){p===A&&e(a)}A++;var p=A;(function(a){var c=m.$$parserName||"parse";if(a===s)h(c,null);else if(h(c,a),!a)return r(m.$validators,function(a,c){h(c,null)}),r(m.$asyncValidators,function(a,c){h(c,null)}),!1;return!0})(a)?f()?g():k(!1):k(!1)};this.$commitViewValue=function(){var a=
+m.$viewValue;h.cancel(q);if(m.$$lastCommittedViewValue!==a||""===a&&m.$$hasNativeValidators)m.$$lastCommittedViewValue=a,m.$pristine&&(m.$dirty=!0,m.$pristine=!1,g.removeClass(e,Ma),g.addClass(e,yb),H.$setDirty()),this.$$parseAndValidate()};this.$$parseAndValidate=function(){for(var a=!0,c=m.$$lastCommittedViewValue,d=c,e=0;e<m.$parsers.length;e++)if(d=m.$parsers[e](d),w(d)){a=!1;break}ea(m.$modelValue)&&isNaN(m.$modelValue)&&(m.$modelValue=t());var f=m.$modelValue,g=m.$options&&m.$options.allowInvalid;
+g&&(m.$modelValue=d,m.$modelValue!==f&&m.$$writeModelToScope());m.$$runValidators(a,d,c,function(a){g||(m.$modelValue=a?d:s,m.$modelValue!==f&&m.$$writeModelToScope())})};this.$$writeModelToScope=function(){u(m.$modelValue);r(m.$viewChangeListeners,function(a){try{a()}catch(d){c(d)}})};this.$setViewValue=function(a,c){m.$viewValue=a;m.$options&&!m.$options.updateOnDefault||m.$$debounceViewValueCommit(c)};this.$$debounceViewValueCommit=function(c){var d=0,e=m.$options;e&&x(e.debounce)&&(e=e.debounce,
+ea(e)?d=e:ea(e[c])?d=e[c]:ea(e["default"])&&(d=e["default"]));h.cancel(q);d?q=h(function(){m.$commitViewValue()},d):k.$$phase?m.$commitViewValue():a.$apply(function(){m.$commitViewValue()})};a.$watch(function(){var a=t();if(a!==m.$modelValue){m.$modelValue=a;for(var c=m.$formatters,d=c.length,e=a;d--;)e=c[d](e);m.$viewValue!==e&&(m.$viewValue=m.$$lastCommittedViewValue=e,m.$render(),m.$$runValidators(s,a,e,z))}return a})}],je=function(){return{restrict:"A",require:["ngModel","^?form","^?ngModelOptions"],
+controller:Gf,link:{pre:function(a,c,d,e){var f=e[0],g=e[1]||$a;f.$$setOptions(e[2]&&e[2].$options);g.$addControl(f);d.$observe("name",function(a){f.$name!==a&&g.$$renameControl(f,a)});a.$on("$destroy",function(){g.$removeControl(f)})},post:function(a,c,d,e){var f=e[0];if(f.$options&&f.$options.updateOn)c.on(f.$options.updateOn,function(a){f.$$debounceViewValueCommit(a&&a.type)});c.on("blur",function(c){f.$touched||a.$apply(function(){f.$setTouched()})})}}}},le=ga({restrict:"A",require:"ngModel",
+link:function(a,c,d,e){e.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),oc=function(){return{restrict:"A",require:"?ngModel",link:function(a,c,d,e){e&&(d.required=!0,e.$validators.required=function(a){return!d.required||!e.$isEmpty(a)},d.$observe("required",function(){e.$validate()}))}}},nc=function(){return{restrict:"A",require:"?ngModel",link:function(a,c,d,e){if(e){var f,g=d.ngPattern||d.pattern;d.$observe("pattern",function(a){C(a)&&0<a.length&&(a=new RegExp(a));if(a&&!a.test)throw Q("ngPattern")("noregexp",
+g,a,ta(c));f=a||s;e.$validate()});e.$validators.pattern=function(a){return e.$isEmpty(a)||w(f)||f.test(a)}}}}},qc=function(){return{restrict:"A",require:"?ngModel",link:function(a,c,d,e){if(e){var f=0;d.$observe("maxlength",function(a){f=Z(a)||0;e.$validate()});e.$validators.maxlength=function(a,c){return e.$isEmpty(a)||c.length<=f}}}}},pc=function(){return{restrict:"A",require:"?ngModel",link:function(a,c,d,e){if(e){var f=0;d.$observe("minlength",function(a){f=Z(a)||0;e.$validate()});e.$validators.minlength=
+function(a,c){return e.$isEmpty(a)||c.length>=f}}}}},ke=function(){return{restrict:"A",priority:100,require:"ngModel",link:function(a,c,d,e){var f=c.attr(d.$attr.ngList)||", ",g="false"!==d.ngTrim,h=g?ca(f):f;e.$parsers.push(function(a){if(!w(a)){var c=[];a&&r(a.split(h),function(a){a&&c.push(g?ca(a):a)});return c}});e.$formatters.push(function(a){return M(a)?a.join(f):s});e.$isEmpty=function(a){return!a||!a.length}}}},Hf=/^(true|false|\d+)$/,me=function(){return{restrict:"A",priority:100,compile:function(a,
+c){return Hf.test(c.ngValue)?function(a,c,f){f.$set("value",a.$eval(f.ngValue))}:function(a,c,f){a.$watch(f.ngValue,function(a){f.$set("value",a)})}}}},ne=function(){return{restrict:"A",controller:["$scope","$attrs",function(a,c){var d=this;this.$options=a.$eval(c.ngModelOptions);this.$options.updateOn!==s?(this.$options.updateOnDefault=!1,this.$options.updateOn=ca(this.$options.updateOn.replace(Ff,function(){d.$options.updateOnDefault=!0;return" "}))):this.$options.updateOnDefault=!0}]}},Nd=["$compile",
+function(a){return{restrict:"AC",compile:function(c){a.$$addBindingClass(c);return function(c,e,f){a.$$addBindingInfo(e,f.ngBind);c.$watch(f.ngBind,function(a){e.text(a==s?"":a)})}}}}],Pd=["$interpolate","$compile",function(a,c){return{compile:function(d){c.$$addBindingClass(d);return function(d,f,g){d=a(f.attr(g.$attr.ngBindTemplate));c.$$addBindingInfo(f,d.expressions);g.$observe("ngBindTemplate",function(a){f.text(a)})}}}}],Od=["$sce","$parse","$compile",function(a,c,d){return{restrict:"A",compile:function(e,
+f){var g=c(f.ngBindHtml),h=c(f.ngBindHtml,function(a){return(a||"").toString()});d.$$addBindingClass(e);return function(c,e,f){d.$$addBindingInfo(e,f.ngBindHtml);c.$watch(h,function(){e.html(a.getTrustedHtml(g(c))||"")})}}}}],Qd=Xb("",!0),Sd=Xb("Odd",0),Rd=Xb("Even",1),Td=Ea({compile:function(a,c){c.$set("ngCloak",s);a.removeClass("ng-cloak")}}),Ud=[function(){return{restrict:"A",scope:!0,controller:"@",priority:500}}],rc={},If={blur:!0,focus:!0};r("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),
+function(a){var c=va("ng-"+a);rc[c]=["$parse","$rootScope",function(d,e){return{restrict:"A",compile:function(f,g){var h=d(g[c]);return function(c,d){d.on(a,function(d){var f=function(){h(c,{$event:d})};If[a]&&e.$$phase?c.$evalAsync(f):c.$apply(f)})}}}}]});var Xd=["$animate",function(a){return{multiElement:!0,transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(c,d,e,f,g){var h,k,l;c.$watch(e.ngIf,function(c){c?k||g(function(c,f){k=f;c[c.length++]=Y.createComment(" end ngIf: "+
+e.ngIf+" ");h={clone:c};a.enter(c,d.parent(),d)}):(l&&(l.remove(),l=null),k&&(k.$destroy(),k=null),h&&(l=jb(h.clone),a.leave(l).then(function(){l=null}),h=null))})}}}],Yd=["$templateRequest","$anchorScroll","$animate","$sce",function(a,c,d,e){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:Da.noop,compile:function(f,g){var h=g.ngInclude||g.src,k=g.onload||"",l=g.autoscroll;return function(f,g,q,m,r){var u=0,s,A,y,E=function(){A&&(A.remove(),A=null);s&&(s.$destroy(),
+s=null);y&&(d.leave(y).then(function(){A=null}),A=y,y=null)};f.$watch(e.parseAsResourceUrl(h),function(e){var h=function(){!x(l)||l&&!f.$eval(l)||c()},q=++u;e?(a(e,!0).then(function(a){if(q===u){var c=f.$new();m.template=a;a=r(c,function(a){E();d.enter(a,null,g).then(h)});s=c;y=a;s.$emit("$includeContentLoaded",e);f.$eval(k)}},function(){q===u&&(E(),f.$emit("$includeContentError",e))}),f.$emit("$includeContentRequested",e)):(E(),m.template=null)})}}}}],oe=["$compile",function(a){return{restrict:"ECA",
+priority:-400,require:"ngInclude",link:function(c,d,e,f){/SVG/.test(d[0].toString())?(d.empty(),a(uc(f.template,Y).childNodes)(c,function(a){d.append(a)},s,s,d)):(d.html(f.template),a(d.contents())(c))}}}],Zd=Ea({priority:450,compile:function(){return{pre:function(a,c,d){a.$eval(d.ngInit)}}}}),$d=Ea({terminal:!0,priority:1E3}),ae=["$locale","$interpolate",function(a,c){var d=/{}/g;return{restrict:"EA",link:function(e,f,g){var h=g.count,k=g.$attr.when&&f.attr(g.$attr.when),l=g.offset||0,n=e.$eval(k)||
+{},p={},q=c.startSymbol(),m=c.endSymbol(),s=/^when(Minus)?(.+)$/;r(g,function(a,c){s.test(c)&&(n[R(c.replace("when","").replace("Minus","-"))]=f.attr(g.$attr[c]))});r(n,function(a,e){p[e]=c(a.replace(d,q+h+"-"+l+m))});e.$watch(function(){var c=parseFloat(e.$eval(h));if(isNaN(c))return"";c in n||(c=a.pluralCat(c-l));return p[c](e)},function(a){f.text(a)})}}}],be=["$parse","$animate",function(a,c){var d=Q("ngRepeat"),e=function(a,c,d,e,l,n,p){a[d]=e;l&&(a[l]=n);a.$index=c;a.$first=0===c;a.$last=c===
+p-1;a.$middle=!(a.$first||a.$last);a.$odd=!(a.$even=0===(c&1))};return{restrict:"A",multiElement:!0,transclude:"element",priority:1E3,terminal:!0,$$tlb:!0,compile:function(f,g){var h=g.ngRepeat,k=Y.createComment(" end ngRepeat: "+h+" "),l=h.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);if(!l)throw d("iexp",h);var n=l[1],p=l[2],q=l[3],m=l[4],l=n.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);if(!l)throw d("iidexp",n);var t=l[3]||l[1],u=
+l[2];if(q&&(!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(q)||/^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent)$/.test(q)))throw d("badident",q);var v,A,y,E,x={$id:Ja};m?v=a(m):(y=function(a,c){return Ja(c)},E=function(a){return a});return function(a,f,g,m,l){v&&(A=function(c,d,e){u&&(x[u]=c);x[t]=d;x.$index=e;return v(a,x)});var n=Object.create(null);a.$watchCollection(p,function(g){var m,p,K=f[0],x,v=Object.create(null),L,z,H,w,G,V,fa;q&&(a[q]=g);if(Na(g))G=g,p=A||y;else{p=A||E;
+G=[];for(fa in g)g.hasOwnProperty(fa)&&"$"!=fa.charAt(0)&&G.push(fa);G.sort()}L=G.length;fa=Array(L);for(m=0;m<L;m++)if(z=g===G?m:G[m],H=g[z],w=p(z,H,m),n[w])V=n[w],delete n[w],v[w]=V,fa[m]=V;else{if(v[w])throw r(fa,function(a){a&&a.scope&&(n[a.id]=a)}),d("dupes",h,w,sa(H));fa[m]={id:w,scope:s,clone:s};v[w]=!0}for(x in n){V=n[x];w=jb(V.clone);c.leave(w);if(w[0].parentNode)for(m=0,p=w.length;m<p;m++)w[m].$$NG_REMOVED=!0;V.scope.$destroy()}for(m=0;m<L;m++)if(z=g===G?m:G[m],H=g[z],V=fa[m],V.scope){x=
+K;do x=x.nextSibling;while(x&&x.$$NG_REMOVED);V.clone[0]!=x&&c.move(jb(V.clone),null,D(K));K=V.clone[V.clone.length-1];e(V.scope,m,t,H,u,z,L)}else l(function(a,d){V.scope=d;var f=k.cloneNode(!1);a[a.length++]=f;c.enter(a,null,D(K));K=f;V.clone=a;v[V.id]=V;e(V.scope,m,t,H,u,z,L)});n=v})}}}}],ce=["$animate",function(a){return{restrict:"A",multiElement:!0,link:function(c,d,e){c.$watch(e.ngShow,function(c){a[c?"removeClass":"addClass"](d,"ng-hide")})}}}],Wd=["$animate",function(a){return{restrict:"A",
+multiElement:!0,link:function(c,d,e){c.$watch(e.ngHide,function(c){a[c?"addClass":"removeClass"](d,"ng-hide")})}}}],de=Ea(function(a,c,d){a.$watch(d.ngStyle,function(a,d){d&&a!==d&&r(d,function(a,d){c.css(d,"")});a&&c.css(a)},!0)}),ee=["$animate",function(a){return{restrict:"EA",require:"ngSwitch",controller:["$scope",function(){this.cases={}}],link:function(c,d,e,f){var g=[],h=[],k=[],l=[],n=function(a,c){return function(){a.splice(c,1)}};c.$watch(e.ngSwitch||e.on,function(c){var d,e;d=0;for(e=k.length;d<
+e;++d)a.cancel(k[d]);d=k.length=0;for(e=l.length;d<e;++d){var s=jb(h[d].clone);l[d].$destroy();(k[d]=a.leave(s)).then(n(k,d))}h.length=0;l.length=0;(g=f.cases["!"+c]||f.cases["?"])&&r(g,function(c){c.transclude(function(d,e){l.push(e);var f=c.element;d[d.length++]=Y.createComment(" end ngSwitchWhen: ");h.push({clone:d});a.enter(d,f.parent(),f)})})})}}}],fe=Ea({transclude:"element",priority:1200,require:"^ngSwitch",multiElement:!0,link:function(a,c,d,e,f){e.cases["!"+d.ngSwitchWhen]=e.cases["!"+d.ngSwitchWhen]||
+[];e.cases["!"+d.ngSwitchWhen].push({transclude:f,element:c})}}),ge=Ea({transclude:"element",priority:1200,require:"^ngSwitch",multiElement:!0,link:function(a,c,d,e,f){e.cases["?"]=e.cases["?"]||[];e.cases["?"].push({transclude:f,element:c})}}),ie=Ea({restrict:"EAC",link:function(a,c,d,e,f){if(!f)throw Q("ngTransclude")("orphan",ta(c));f(function(a){c.empty();c.append(a)})}}),Jd=["$templateCache",function(a){return{restrict:"E",terminal:!0,compile:function(c,d){"text/ng-template"==d.type&&a.put(d.id,
+c[0].text)}}}],Jf=Q("ngOptions"),he=ga({restrict:"A",terminal:!0}),Kd=["$compile","$parse",function(a,c){var d=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,e={$setViewValue:z};return{restrict:"E",require:["select","?ngModel"],controller:["$element","$scope","$attrs",function(a,c,d){var k=this,l={},n=e,p;k.databound=d.ngModel;k.init=function(a,
+c,d){n=a;p=d};k.addOption=function(c,d){Ia(c,'"option value"');l[c]=!0;n.$viewValue==c&&(a.val(c),p.parent()&&p.remove());d[0].hasAttribute("selected")&&(d[0].selected=!0)};k.removeOption=function(a){this.hasOption(a)&&(delete l[a],n.$viewValue==a&&this.renderUnknownOption(a))};k.renderUnknownOption=function(c){c="? "+Ja(c)+" ?";p.val(c);a.prepend(p);a.val(c);p.prop("selected",!0)};k.hasOption=function(a){return l.hasOwnProperty(a)};c.$on("$destroy",function(){k.renderUnknownOption=z})}],link:function(e,
+g,h,k){function l(a,c,d,e){d.$render=function(){var a=d.$viewValue;e.hasOption(a)?(z.parent()&&z.remove(),c.val(a),""===a&&v.prop("selected",!0)):w(a)&&v?c.val(""):e.renderUnknownOption(a)};c.on("change",function(){a.$apply(function(){z.parent()&&z.remove();d.$setViewValue(c.val())})})}function n(a,c,d){var e;d.$render=function(){var a=new Xa(d.$viewValue);r(c.find("option"),function(c){c.selected=x(a.get(c.value))})};a.$watch(function(){ra(e,d.$viewValue)||(e=qa(d.$viewValue),d.$render())});c.on("change",
+function(){a.$apply(function(){var a=[];r(c.find("option"),function(c){c.selected&&a.push(c.value)});d.$setViewValue(a)})})}function p(e,f,g){function h(){A||(e.$$postDigest(k),A=!0)}function k(){A=!1;var a={"":[]},c=[""],d,h,l,s,t;l=g.$modelValue;s=z(e)||[];var G=q?ac(s):s,H,B,C;B={};C=!1;if(m)if(h=g.$modelValue,w&&M(h))for(C=new Xa([]),d={},t=0;t<h.length;t++)d[n]=h[t],C.put(w(e,d),h[t]);else C=new Xa(h);t=C;var F,J;for(C=0;H=G.length,C<H;C++){h=C;if(q){h=G[C];if("$"===h.charAt(0))continue;B[q]=
+h}B[n]=s[h];d=r(e,B)||"";(h=a[d])||(h=a[d]=[],c.push(d));m?d=x(t.remove(w?w(e,B):v(e,B))):(w?(d={},d[n]=l,d=w(e,d)===w(e,B)):d=l===v(e,B),t=t||d);F=p(e,B);F=x(F)?F:"";h.push({id:w?w(e,B):q?G[C]:C,label:F,selected:d})}m||(u||null===l?a[""].unshift({id:"",label:"",selected:!t}):t||a[""].unshift({id:"?",label:"",selected:!0}));B=0;for(G=c.length;B<G;B++){d=c[B];h=a[d];D.length<=B?(l={element:E.clone().attr("label",d),label:h.label},s=[l],D.push(s),f.append(l.element)):(s=D[B],l=s[0],l.label!=d&&l.element.attr("label",
+l.label=d));F=null;C=0;for(H=h.length;C<H;C++)d=h[C],(t=s[C+1])?(F=t.element,t.label!==d.label&&F.text(t.label=d.label),t.id!==d.id&&F.val(t.id=d.id),F[0].selected!==d.selected&&(F.prop("selected",t.selected=d.selected),aa&&F.prop("selected",t.selected))):(""===d.id&&u?J=u:(J=y.clone()).val(d.id).prop("selected",d.selected).attr("selected",d.selected).text(d.label),s.push({element:J,label:d.label,id:d.id,selected:d.selected}),F?F.after(J):l.element.append(J),F=J);for(C++;s.length>C;)s.pop().element.remove()}for(;D.length>
+B;)D.pop()[0].element.remove()}var l;if(!(l=t.match(d)))throw Jf("iexp",t,ta(f));var p=c(l[2]||l[1]),n=l[4]||l[6],q=l[5],r=c(l[3]||""),v=c(l[2]?l[1]:n),z=c(l[7]),w=l[8]?c(l[8]):null,D=[[{element:f,label:""}]];u&&(a(u)(e),u.removeClass("ng-scope"),u.remove());f.empty();f.on("change",function(){e.$apply(function(){var a,c=z(e)||[],d={},h,l,p,r,t,x,u;if(m)for(l=[],r=0,x=D.length;r<x;r++)for(a=D[r],p=1,t=a.length;p<t;p++){if((h=a[p].element)[0].selected){h=h.val();q&&(d[q]=h);if(w)for(u=0;u<c.length&&
+(d[n]=c[u],w(e,d)!=h);u++);else d[n]=c[h];l.push(v(e,d))}}else if(h=f.val(),"?"==h)l=s;else if(""===h)l=null;else if(w)for(u=0;u<c.length;u++){if(d[n]=c[u],w(e,d)==h){l=v(e,d);break}}else d[n]=c[h],q&&(d[q]=h),l=v(e,d);g.$setViewValue(l);k()})});g.$render=k;e.$watchCollection(z,h);e.$watchCollection(function(){var a={},c=z(e);if(c){for(var d=Array(c.length),f=0,g=c.length;f<g;f++)a[n]=c[f],d[f]=p(e,a);return d}},h);m&&e.$watchCollection(function(){return g.$modelValue},h)}if(k[1]){var q=k[0];k=k[1];
+var m=h.multiple,t=h.ngOptions,u=!1,v,A=!1,y=D(Y.createElement("option")),E=D(Y.createElement("optgroup")),z=y.clone();h=0;for(var B=g.children(),C=B.length;h<C;h++)if(""===B[h].value){v=u=B.eq(h);break}q.init(k,u,z);m&&(k.$isEmpty=function(a){return!a||0===a.length});t?p(e,g,k):m?n(e,g,k):l(e,g,k,q)}}}}],Md=["$interpolate",function(a){var c={addOption:z,removeOption:z};return{restrict:"E",priority:100,compile:function(d,e){if(w(e.value)){var f=a(d.text(),!0);f||e.$set("value",d.text())}return function(a,
+d,e){var l=d.parent(),n=l.data("$selectController")||l.parent().data("$selectController");n&&n.databound?d.prop("selected",!1):n=c;f?a.$watch(f,function(a,c){e.$set("value",a);c!==a&&n.removeOption(c);n.addOption(a,d)}):n.addOption(e.value,d);d.on("$destroy",function(){n.removeOption(e.value)})}}}}],Ld=ga({restrict:"E",terminal:!1});O.angular.bootstrap?console.log("WARNING: Tried to load angular more than once."):(Bd(),Dd(Da),D(Y).ready(function(){xd(Y,ic)}))})(window,document);
+!window.angular.$$csp()&&window.angular.element(document).find("head").prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide:not(.ng-animate){display:none !important;}ng\\:form{display:block;}</style>');
+//# sourceMappingURL=angular.min.js.map
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/app.js b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/app.js
new file mode 100644
index 0000000..c90e0bb
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/app.js
@@ -0,0 +1,785 @@
+angular.module('app', ['uiSwitch']).controller('MainController', function($scope,$http,$interval,$q) {
+
+	// add contains method to String
+	String.prototype.contains = function(it) { return this.indexOf(it) != -1; };
+
+	var canceler = $q.defer();
+	var cameraCanceler = $q.defer();
+	var timerForDevicesUpdate = null;
+	var timerForNotifications = null;
+	
+	$scope.imgModules = {
+			'temperature':'temp.jpg',
+			'noise':'noise.jpg',
+			'relativeHumidity':'humidity.png',
+			'atmosphericPressureSensor':'pressure.jpg',
+			'extendedCarbonDioxideSensor':'co2.png',
+			'contactSensor':'open_door_35.png',
+			'motionSensor':'motion_sensor.png',
+			'energyConsumption': 'power_consumption.png'
+	};
+	
+	$scope.moduleFilterDefinition = {
+			'temperature':'curT0',
+			'noise':'noise',
+			'relativeHumidity':'relHy',
+			'atmosphericPressureSensor':'atmPe',
+			'extendedCarbonDioxideSensor':'cDeVe',
+			'contactSensor':'alarm',
+			'motionSensor':'alarm',
+			'energyConsumption':'power'
+	};
+	
+	$scope.datapointsNamePerModule = {
+		"binarySwitch" : ["powSe"],
+		"temperature" : ["minVe", "unit", "curT0", "maxVe"],
+		"noise" : ["noise"],
+		"extendedCarbonDioxideSensor" : ["cDeVe", "alarm"],
+		"atmosphericPressureSensor" : ["atmPe"],
+		"relativeHumidity" : ["relHy"],
+		"contactSensor" : ["alarm"],
+		"streaming" : ["frmt", "psWd", "login", "url"], 
+		"personSensor" : ["detPs"],
+		"motionSensor" : ["alarm"],
+		"colour" : ["colour"],
+		"energyConsumption" : ["volte", "currt", "power"],
+		"lock" : ["dooLk", "opeOy"],
+		"battery" : ["discg", "charg", "level", "capay"],
+		"doorStatus": ["dooSt"]
+	};
+
+	$scope.devices = {};
+	$scope.cams = [];
+	$scope.hideHlsVideo = true;
+	$scope.hideMjpegVideo = false;
+	$scope.hls = null;
+	$scope.mjpegPlayer = null;
+	$scope.credentials ='';
+
+	$scope.imgPath = "dot.png";
+
+	$scope.urlBase = window.location.protocol + "//" + window.location.host;
+	
+	$scope.cseContext = "~/in-cse/in-name";
+	
+	$scope.name="";
+	
+	$scope.currentUrl = new URL(window.location);
+	$scope.sessionId = $scope.currentUrl.searchParams.get("sessionId");
+	
+	$scope.load = function() {
+		var req = {
+				method: 'GET',
+				url: $scope.urlBase + '/Home_Monitoring_Application/in-cse/context',
+				params: {sessionId: $scope.sessionId}
+		};
+		$http(req).success(function (response, status, headers, config)  {
+			$scope.cseContext = response;
+		});
+		
+	
+	}; /*"~/dt-in-cse/dt-in-name"*/ /* ~/cseId/cseName */
+	$scope.load();
+
+	$scope.count = 0;
+
+	// device polling interval
+	var devicePolling = 10000;
+	// default polling interval in ms
+	var defaultModulePolling = 180000;
+
+	// blacklist module  polling interval in ms
+	var blModules = ["runMode","streaming","colour","colourSaturation","faultDetection"];
+
+	// fast polling interval in ms
+	var fastModulePolling = 3000;
+	var fastModules = ["binarySwitch","energyConsumption","lock"];
+	
+	$scope.getDevicesAsArray = function() {
+		return Object.values($scope.devices);
+	};
+	
+	$scope.getModulesFromDevice = function(device) {
+		console.log("getModules called");
+		return Object.values(device.modules);
+	};
+
+	$scope.moduleFilter = function (module) { 
+		return module.value !== ''; 
+	};
+
+	$scope.switchFilter = function (module) {
+		if (!((module.name === 'binarySwitch') || (module.name === 'lock'))) {
+			return false;
+		}
+		return true; 
+	};
+
+	//filter to remove any device which contains a streaming module from the display device list
+	$scope.deviceFilter = function (device) { 
+		if (device.desc === '') {
+			return false;
+		}
+		return !(device.desc === 'org.onem2m.home.device.deviceCamera');
+	};
+
+	/*************************************************/
+	$scope.getDevices = function() {
+		var req = {
+				method: 'GET',
+				url: $scope.urlBase + '/' + $scope.cseContext 
+					+ '?fu=1&drt=2&lbl=object.type/device',
+				headers: {
+					'Content-Type': 'application/json',
+					'Accept': 'application/json',
+					'X-M2M-Origin': $scope.credentials
+				}
+		};
+		$http(req).success(function (response, status, headers, config)  {
+			
+			var jsonData = response;
+			var key = $scope.getRootKey(jsonData);
+			var devices;
+			devices = jsonData[key];
+			// devices is an array containing device FlexContainer resourceId
+			
+			// remove old devices 
+			$scope.removeOldDevices(devices);
+
+			// treat new discovered devices			
+			var newDevices = $scope.getNewDevices(devices);
+			// newDevices is an array containg new-device FlexContainer resourceId
+			for (i=0; i<newDevices.length; i++) {
+				var deviceRi = newDevices[i];
+				
+				var getDeviceReq = {
+						method: 'GET',
+						url: $scope.urlBase + '/~' + deviceRi + '?rcn=7',
+						headers: {
+							'Content-Type': 'application/json',
+							'Accept': 'application/json',
+							'X-M2M-Origin': $scope.credentials
+						}, 
+						deviceRi: deviceRi // add device ri in request
+				};
+
+				$http(getDeviceReq).success(function (response, status, headers, config)  {
+					
+					var device = {'id':'', 'name':'','desc':'',
+							'modules':{},'properties':[]};
+					var jsonData = response;
+					var key = $scope.getRootKey(jsonData);
+					var jsonDevice = jsonData[key];
+
+					var labels = jsonDevice.lbl;
+					var id = $scope.getIdFromLabel (labels);
+					device.id = id;
+					device.name = $scope.getNameFromLabel(labels);
+					device.desc = jsonDevice.cnd;
+					device.isUpdated = false;
+					device.fcntRi = jsonDevice.ri;
+					device.fcntaRi = config.deviceRi;
+					deviceRi = config.deviceRi; // deviceRi is the address of the device in the context of INCSE
+					// so it could be the "true" device ri if the device is hosted by the CSE
+					// or it could be the ri of the FlexContainerAnnc object representing the device
+					// In this latter case, the device is hosted somewhere else.
+
+					for (key in jsonDevice) {
+						// starts with prop
+						var value = jsonDevice[key];
+						if (typeof value !== "undefined") {
+							// override name if there is a propDeviceName
+							if (key === 'prDNe') {
+								device.name = value;
+							}
+							var propName = key;
+							device.properties.push({'name':propName,
+								'value':value});
+						}
+					}
+					
+					// add new device in devices list
+					$scope.devices[deviceRi] = device;
+
+
+					// get all the modules for the given device
+					$scope.getModules(device);
+				}).error(function (response, status, headers, config) {
+					console.log("error getNewDevices " + response);
+				});
+			}
+		}).error(function (response, status, headers, config) {
+			console.log("error getDevices " + response);
+			// called asynchronously if an error occurs
+			// or server returns response with an error status.
+			
+			// this is not a big issue here 
+			// as the device will be detected again as a new device
+		});
+	};
+
+	$scope.getModules = function (device) {
+		
+		var getModulesRiReq = {
+				method: 'GET',
+				url: $scope.urlBase + '/' + $scope.cseContext 
+				+ '?fu=1&drt=2&lbl=object.type/module&lbl=device.id/' + device.id,
+				headers: {
+					'Content-Type': 'application/json',
+					'Accept': 'application/json',
+					'X-M2M-Origin': $scope.credentials
+				},
+				device: device
+		};
+		
+		$http(getModulesRiReq).success(function (response, status, headers, config)  {
+			var jsonData = response;	
+			var key = $scope.getRootKey(jsonData);
+			var modules = jsonData[key];
+			// modules is an array. It contains module resource id
+			
+			// TODO : fix issue related to missing modules
+			// in some cases (access right), some modules take time to become available.
+			
+			modules.forEach(
+				function(moduleRi) {
+					// retrieve module data
+					$scope.getModule(config.device, moduleRi);
+				}	
+			);
+			
+		}).error(function (response, status, headers, config)  {
+			console.log("error getModules " + response);
+		});
+	}
+
+	$scope.getModule = function (device, moduleRi) {
+		
+		var getModuleReq = {
+				method: 'GET',
+				url: $scope.urlBase + '/~' + moduleRi + '?rcn=7',
+				headers: {
+					'Content-Type': 'application/json',
+					'Accept': 'application/json',
+					'X-M2M-Origin':$scope.credentials
+				},
+				device: device
+		};
+		
+		$http(getModuleReq).success(function (response, status, headers, config)  {
+			var jsonData = response;
+			var key = $scope.getRootKey(jsonData);
+			var root = jsonData[key];
+			
+			var module = {'id':'','name':'','colorClass':'','datapoints':{},
+					'actions':[],'img':'','value':'','interval': {},'started':false,
+					'url':config.url,'deviceName':config.device.name,'hideSpinning':true, 'state':false};
+
+			// fill the module name
+			var tab = root.cnd.split(".");
+			var moduleName = tab[tab.length -1];
+			var label = root.lbl;
+			var id = $scope.getPidFromLabel (label);
+			module.id = id;
+			module.ri = root.ri;
+			module.name = moduleName;
+			module.img = 'images/'+$scope.getImageModule(moduleName);
+			// fill the class with the module name to define the text color. see css file.
+			module.colorClass = tab[tab.length -1];
+
+			module.datapoints = {};
+			module.actions = [];
+
+			// create the attributes
+			var dpNames = $scope.datapointsNamePerModule[module.name];
+			if (dpNames) {
+				dpNames.forEach(
+					function(dpName) {
+						module.datapoints[dpName] = {"name": dpName, "value":root[dpName]};
+					}
+				);
+			}
+			
+
+			var propName = $scope.getPropValueModule(moduleName);
+			if (propName) {
+				module.value = module.datapoints[propName].value;	
+			}
+			 
+
+
+			if (module.name === 'streaming') {
+				var index = $scope.getCamModuleIndex(module.id);
+				if (index == -1) {
+					$scope.cams.push(module);
+				}
+				if ($scope.cams.length == 1) {
+					$scope.loadWebcam(module);
+				}
+			}
+			
+			if (module.name === 'binarySwitch') {
+				module.state = (module.datapoints.powSe.value === 'true') ;
+			}
+			
+			if (module.name === 'lock') {
+				module.state = (module.datapoints.dooLk.value === 'true')
+			}
+
+			// add module in device
+			config.device.modules[module.ri] = module;
+			
+			$scope.createSubscription(root.ri);
+		}).error(function (response, status, headers, config)  {
+			console.log("error getModule " + response);
+		});
+	}
+	
+	$scope.createSubscription = function(toBeSubscribedResource) {
+		req = {
+				method : 'POST',
+				url : $scope.urlBase + '/Home_Monitoring_Application/in-cse/context',
+				data : {
+							resourceId:toBeSubscribedResource,
+							sessionId: $scope.sessionId
+						},
+				headers : {
+					'Content-Type' : 'application/json'
+				}
+		};
+		// don't care about response
+		$http(req);
+		
+	}
+	
+	$scope.getNotifications = function() {
+		req = {
+				method : 'GET',
+				url : $scope.urlBase + '/Home_Monitoring_Application/in-cse/context/notifications',
+				params: {sessionId: $scope.sessionId},
+				headers : {
+					'Accept' : 'application/json'
+				}
+		};
+		
+		$http(req).success(
+				function(response, status, headers, config) {
+					// for each notification --> update device & module model
+					 var notifications = response;
+					 // notifications is an array
+					notifications.forEach(
+							function(notification) {
+								console.log(notification);
+								var sgn = notification["m2m:sgn"];
+								var nev = null;
+								if (sgn !== null) {
+									nev = sgn["m2m:nev"];
+								}
+								var rep = null;
+								if (nev != null) {
+									rep = nev["m2m:rep"];
+								}
+								
+								var moduleRep = null;
+								if (rep != null) {
+									var key = $scope.getRootKey(rep);
+									moduleRep = rep[key];
+								}
+								
+								if (moduleRep != null) {
+									var internalModule = $scope.getModuleByRi(moduleRep.ri, moduleRep.pi);
+									console.log(internalModule);
+									
+									
+									var propValueModule = $scope.getPropValueModule(internalModule.name);
+									if (propValueModule) {
+										var value = moduleRep[propValueModule];
+										if (internalModule.value) {
+											internalModule.value = value;
+										}
+									}
+									
+									if (moduleRep.powSe) {
+										console.log('powSe value:' + moduleRep.powSe);
+										var datapoints = internalModule.datapoints;
+										var powSeValue = (moduleRep.powSe === 'true');
+										datapoints.powSe.value = powSeValue;
+										if (internalModule.state != powSeValue) {
+											internalModule.state = powSeValue;
+										}
+										
+										console.log('powSe updated!!!!!!!!!!!!!!!!!');
+									}
+									
+									if (moduleRep.dooLk) {
+										console.log('dooLk value:' + moduleRep.dooLk);
+										var datapoints = internalModule.datapoints;
+										var dooLkValue = (moduleRep.dooLk ==='true');
+										datapoints.dooLk.value = dooLkValue;
+										if (internalModule.state != dooLkValue) {
+											internalModule.state = dooLkValue;
+										}
+									}
+									
+									// put background red
+									// here we need to be carefull with device = moduleRep.pi
+									// as we have announced device.
+									device = $scope.getDeviceByRi(moduleRep.pi);
+									if (device) {
+										device.isUpdated=true;
+									}
+									// remove background after 1,5s
+									$interval(function() {
+										device.isUpdated = false;
+									}, 1500,1);
+									
+								}
+							}
+						);
+				}
+		);
+	}
+	
+	// called when the user clicks on the witch widget in the HMI
+	$scope.changeState = function(device,switchModule) {
+		var req;
+		switchModule.hideSpinning = false;
+
+		if (switchModule.name === 'lock') {
+			var openOnly = $scope.getValueFromModule(switchModule, "opeOy");
+			console.log("openOnly: " + openOnly);
+			if (switchModule.state || (openOnly == null) || (openOnly === 'false')) {
+				switchModule.newState = switchModule.state;
+				var lk = switchModule.state;
+				// switch on/off
+				req = {
+						method : 'PUT',
+						url : switchModule.url,
+						data : '{\"hd:lock\": {\"dooLk\": \"' + lk + '\"}}',
+						headers : {
+							'Content-Type' : 'application/json',
+							'X-M2M-Origin' : $scope.credentials
+						},
+						valueToBeSet: lk,
+						currentSwitch: switchModule
+				};
+				$http(req).success(function(response, status, headers, config) {
+						console.log("binary lock state changed");
+						
+						// config = switchModule
+						config.currentSwitch.hideSpinning = true;
+						if (config.currentSwitch.state !== config.valueToBeSet) {
+							config.currentSwitch.state = config.valueToBeSet;	
+						}
+						
+						var datapoints = config.currentSwitch.datapoints;
+						datapoints.dooLk.value = config.valueToBeSet;
+						console.log("door lock state changed");
+						
+					}).error(function(response, status, headers, config) {
+						console.log("error on lock state change action");
+						config.currentSwitch.hideSpinning = true;
+						config.currentSwitch.state = !config.valueToBeSet;
+						
+					});
+			}			
+		} else if (switchModule.name === 'binarySwitch') {
+			switchModule.newState = switchModule.state;
+			req = {
+					method : 'PUT',
+					url : switchModule.url,
+					data : '{\"hd:binSh\": {\"powSe\": \"' + switchModule.state + '\"}}',
+					headers : {
+						'Content-Type' : 'application/json',
+						'X-M2M-Origin' : $scope.credentials
+					}, 
+					valueToBeSet : switchModule.state,
+					currentSwitch : switchModule
+					
+			};
+			$http(req).success(
+					function(response, status, headers, config) {
+						// binarySwitchModule.state = !binarySwitchModule.state;
+						config.currentSwitch.hideSpinning = true;
+						if (config.currentSwitch.state !== config.valueToBeSet) {
+							config.currentSwitch.state = config.valueToBeSet;	
+						}
+						
+						var datapoints = config.currentSwitch.datapoints;
+						datapoints.powSe.value = config.valueToBeSet;
+						console.log("binary switch state changed");
+					}).error(function(response, status, headers, config) {
+							config.currentSwitch.hideSpinning = true;
+							config.currentSwitch.state = !config.valueToBeSet;
+							console.log("error on binary switch state change action");
+						});
+		}
+	}
+
+	$scope.getIdFromLabel = function(labels) {
+		for(label in labels) {
+			var labelValue = labels[label];
+			if (labelValue.contains('id/')) {
+				return labelValue.replace('id/','');
+			}
+		}		
+		return null;
+	}
+
+	$scope.getPidFromLabel = function(labels) {
+		for(label in labels) {
+			var labelValue = labels[label];
+			if (labelValue.contains('pid/')) {
+				return labelValue.replace('pid/','');
+			}
+		}
+		return null;
+	}
+
+	$scope.getNameFromLabel = function(labels) {
+		for(label in labels) {
+			var labelValue = labels[label];
+			if (labelValue.contains('name/')) {
+				return labelValue.replace('name/','');
+			}
+		}
+		return null;
+	}
+
+	$scope.getRootKey = function(rootObj) {
+		for (var key in rootObj) {
+			return key;
+		}		
+		return null;
+	}
+
+	$scope.getImageModule = function(moduleName) {
+		return $scope.imgModules[moduleName];
+	}
+
+	$scope.getPropValueModule = function(moduleName) {
+		var propName = $scope.moduleFilterDefinition[moduleName];
+		return propName;
+	}
+	
+	$scope.getPropValueFromDevice = function (device, propName) {
+		for (var i = 0; i< device.properties.length; i++) {
+			if (device.properties[i].name == propName) {
+				return device.properties[i].value;
+			}					
+		}
+		return null;
+	}
+
+	$scope.getNewDevices = function(deviceList) {
+		var newDevices = [];
+		deviceList.forEach(function (device) {
+			// device = device resource id
+			if (!$scope.devices[device]) {
+				newDevices.push(device);
+			}
+		});
+		
+		return newDevices;
+	}
+
+	$scope.removeOldDevices = function(deviceList) {
+		
+		for(deviceRi in $scope.devices) {
+			if (!deviceList.includes(deviceRi)) {
+				// the device must be removed from the $scope.devices object
+				// as this device does not exist anymore.
+				delete $scope.devices[deviceRi];
+			}
+		}
+		
+//		var registeredDevice,returnDevice,returnDeviceId;
+//		var sortedDeviceList = [];
+//		var found;
+//		for (i=0; i<$scope.devices.length; i++) {
+//			found = false;
+//			registeredDevice = $scope.devices[i];
+//			for (j=0; j<deviceList.length; j++) {
+//				returnDevice = deviceList[j];
+//				if (returnDevice === registeredDevice.link) {
+//					found = true;
+//					break;
+//				}
+//			}			
+//			if (found) {
+//				sortedDeviceList.push(registeredDevice);
+//			} else {
+//				// stop requests of old modules
+//				for (k = 0; k<registeredDevice.modules.length; k++) {
+//					var module = registeredDevice.modules[k];
+//					var index = $scope.getCamModuleIndex(module.id);
+//					if (index != -1) {
+//						var newCams = [];
+//						for(var i = 0; i< $scope.cams.length;i++) {
+//							if (i != index) {
+//								newCams.push($scope.cams[i]);
+//							}
+//						}
+//						var selectedCamDestroyed = $scope.cams[index].btnClass == 'selectedCam';
+//						$scope.cams = newCams;
+//						if (selectedCamDestroyed) {
+//							if ($scope.cams.length != 0) {
+//								// load the first cam in the array
+//								$scope.loadWebcam($scope.cams[0]);
+//							} else {
+//								// no more cams, stop everything
+//								if ($scope.mjpegPlayer != null) {
+//									$scope.mjpegPlayer.stop();
+//									$scope.mjpegPlayer = null;
+//								}
+//								if ($scope.hls != null) {
+//									$scope.hls.destroy();
+//									$scope.hls = null;
+//								}
+//								$scope.hideHlsVideo = false;
+//								$scope.hideMjpegVideo = false;
+//							}
+//						}
+//					}
+//					module = null;
+//				}
+//				registeredDevice = null;
+//			}
+//		}
+//		$scope.devices = sortedDeviceList;
+	}
+
+	$scope.arrayContains = function (array, label) {
+		for (i = 0; i < array.length; i++) {
+			if (label === array[i]) {
+				return true;
+			}
+		}
+		return false;
+	}
+
+	$scope.loadWebcam = function (cam) {
+		for ( var i = 0; i < $scope.cams.length; i++) {
+			$scope.cams[i].btnClass = '';
+		}
+		cam.btnClass = 'selectedCam';
+		if ($scope.cams.length != 0) {
+			var url = $scope.getValueFromModule(cam, "url");
+			var format = $scope.getValueFromModule(cam, "frmt");
+			console.log("url/format: " + url + "/" + format);
+			if (format === "HLS") {
+//				$scope.camera = "";
+				if ($scope.hls != null) {
+//					$scope.hls.stop();
+					$scope.hls.destroy();
+					$scope.hls = null;
+				}
+
+				if ($scope.mjpegPlayer != null) {
+					$scope.mjpegPlayer.stop();
+					$scope.mjpegPlayer = null;
+				}
+
+				$scope.hideHlsVideo = false;
+				$scope.hideMjpegVideo = true;
+				var playerElement = document.getElementById("clappr");
+				$scope.hls = new Clappr.Player({
+					source: url,
+					mute: true,
+					height: 360,
+					width: 480
+				});
+				$scope.hls.attachTo(playerElement);
+				$scope.hls.play();
+
+			} else if (format === "MJPEG") {
+				if ($scope.hls != null) {
+//					$scope.hls.stop();
+					$scope.hls.destroy();
+					$scope.hls = null;
+				}
+
+				if ($scope.mjpegPlayer != null) {
+					$scope.mjpegPlayer.stop();
+					$scope.mjpegPlayer = null;
+				}											
+
+				$scope.mjpegPlayer = new MJPEG.Player("player", url);
+				$scope.mjpegPlayer.start();
+
+				$scope.hideHlsVideo = true;
+				$scope.hideMjpegVideo = false;
+			}
+		}
+	}
+	
+	$scope.getValueFromModule = function (module, propName) {
+		return module.datapoints[propName].value;
+	}
+
+	$scope.getCamModuleIndex = function (moduleId) {
+		for (var i=0; i<$scope.cams.length; i++) {
+			if (moduleId == $scope.cams[i].id) {
+				return i;
+			}
+		}
+		return -1;
+	}
+
+	$scope.test = function() {
+		$scope.mjpegPlayer.stop();
+	}
+
+	$scope.test2 = function(device,switchModule) {
+		$scope.hide=true;
+	}
+	
+	$scope.getModuleByRi = function(moduleResourceId, deviceResourceId) {
+		device = $scope.getDeviceByRi(deviceResourceId);
+		module = null;
+		if (device) {
+			module = device.modules[moduleResourceId]
+		}
+		return module;
+	}
+	
+	$scope.getDeviceByRi = function (deviceResourceId) {
+		device =  $scope.devices[deviceResourceId];
+		if (!device) {
+			// try to find device by trueRi
+			for(dri in $scope.devices) {
+				currentDevice = $scope.devices[dri];
+				if (currentDevice.fcntRi === deviceResourceId) {
+					device = currentDevice;
+					break;
+				}
+			}
+		}
+		
+		return device;
+	}
+	
+	var init = function () {
+		var req = {
+				method: 'GET',
+				url: '../security/cred',
+				params : {sessionId: $scope.sessionId},
+				headers: {
+					'Content-Type': 'application/json'
+				}
+		};
+		$http(req).success(function (response, status, headers, config)  {
+			$scope.credentials = response.credentials;
+			$scope.name = response.name;
+			$scope.getDevices();
+			timerForDevicesUpdate = $interval(function() { $scope.getDevices(); }, devicePolling);
+			timerForNotifications = $interval(function() { $scope.getNotifications(); }, 3000);
+		});
+	};
+
+	init();
+});
+
+function jsonp_callback() {
+	alert("jsonp_callback");
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/clappr.min.js b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/clappr.min.js
new file mode 100644
index 0000000..ba145ab
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/clappr.min.js
@@ -0,0 +1,16 @@
+!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.Clappr=e():t.Clappr=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="<%=baseUrl%>/",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(46),o=r(i),a=n(2),s=r(a),l=n(1),u=r(l),c=n(3),d=r(c),f=n(13),h=r(f),p=n(12),y=r(p),g=n(17),v=r(g),m=n(14),b=r(m),_=n(9),E=r(_),T=n(10),A=r(T),k=n(8),w=r(k),S=n(24),L=r(S),R=n(25),O=r(R),C=n(26),P=r(C),D=n(11),I=r(D),x=n(27),N=r(x),M=n(15),F=r(M),B=n(18),U=r(B),j=n(28),G=r(j),Y=n(29),V=r(Y),K=n(30),$=r(K),H=n(31),z=r(H),W=n(16),q=r(W),X=n(32),Z=r(X),J=n(33),Q=r(J),tt=n(34),et=r(tt),nt=n(19),rt=r(nt),it=n(4),ot=r(it),at=n(20),st=r(at),lt=n(6),ut=r(lt),ct=n(5),dt=r(ct),ft="0.2.64";e.default={Player:o.default,Mediator:I.default,Events:u.default,Browser:w.default,PlayerInfo:F.default,MediaControl:N.default,ContainerPlugin:h.default,UIContainerPlugin:b.default,CorePlugin:y.default,UICorePlugin:v.default,Playback:d.default,Container:L.default,Core:O.default,Loader:P.default,BaseObject:E.default,UIObject:A.default,Utils:s.default,BaseFlashPlayback:U.default,Flash:G.default,FlasHLS:V.default,HLS:$.default,HTML5Audio:z.default,HTML5Video:q.default,HTMLImg:Z.default,NoOp:Q.default,Poster:et.default,Log:rt.default,Styler:ot.default,Vendor:st.default,version:ft,template:ut.default,$:dt.default},t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},a=n(19),s=r(a),l=n(2),u=n(101),c=r(u),d=Array.prototype.slice,f=/\s+/,h=function(t,e,n,r){if(!n)return!0;if("object"===("undefined"==typeof n?"undefined":o(n))){for(var i in n)t[e].apply(t,[i,n[i]].concat(r));return!1}if(f.test(n)){for(var a=n.split(f),s=0,l=a.length;s<l;s++)t[e].apply(t,[a[s]].concat(r));return!1}return!0},p=function(t,e,n,r){function i(){try{switch(e.length){case 0:for(;++a<l;)(o=t[a]).callback.call(o.ctx);return;case 1:for(;++a<l;)(o=t[a]).callback.call(o.ctx,u);return;case 2:for(;++a<l;)(o=t[a]).callback.call(o.ctx,u,c);return;case 3:for(;++a<l;)(o=t[a]).callback.call(o.ctx,u,c,d);return;default:for(;++a<l;)(o=t[a]).callback.apply(o.ctx,e);return}}catch(t){s.default.error.apply(s.default,[n,"error on event",r,"trigger","-",t]),i()}}var o=void 0,a=-1,l=t.length,u=e[0],c=e[1],d=e[2];i()},y=function(){function t(){i(this,t)}return t.prototype.on=function(t,e,n){if(!h(this,"on",t,[e,n])||!e)return this;this._events||(this._events={});var r=this._events[t]||(this._events[t]=[]);return r.push({callback:e,context:n,ctx:n||this}),this},t.prototype.once=function t(e,n,r){if(!h(this,"once",e,[n,r])||!n)return this;var i=this,t=(0,c.default)(function(){i.off(e,t),n.apply(this,arguments)});return t._callback=n,this.on(e,t,r)},t.prototype.off=function(t,e,n){var r=void 0,i=void 0,o=void 0,a=void 0,s=void 0,l=void 0,u=void 0,c=void 0;if(!this._events||!h(this,"off",t,[e,n]))return this;if(!t&&!e&&!n)return this._events=void 0,this;for(a=t?[t]:Object.keys(this._events),s=0,l=a.length;s<l;s++)if(t=a[s],o=this._events[t]){if(this._events[t]=r=[],e||n)for(u=0,c=o.length;u<c;u++)i=o[u],(e&&e!==i.callback&&e!==i.callback._callback||n&&n!==i.context)&&r.push(i);r.length||delete this._events[t]}return this},t.prototype.trigger=function(t){var e=this.name||this.constructor.name;if(s.default.debug.apply(s.default,[e].concat(Array.prototype.slice.call(arguments))),!this._events)return this;var n=d.call(arguments,1);if(!h(this,"trigger",t,n))return this;var r=this._events[t],i=this._events.all;return r&&p(r,n,e,t),i&&p(i,arguments,e,t),this},t.prototype.stopListening=function(t,e,n){var r=this._listeningTo;if(!r)return this;var i=!e&&!n;n||"object"!==("undefined"==typeof e?"undefined":o(e))||(n=this),t&&((r={})[t._listenId]=t);for(var a in r)t=r[a],t.off(e,n,this),(i||0===Object.keys(t._events).length)&&delete this._listeningTo[a];return this},t}();e.default=y;var g={listenTo:"on",listenToOnce:"once"};Object.keys(g).forEach(function(t){y.prototype[t]=function(e,n,r){var i=this._listeningTo||(this._listeningTo={}),a=e._listenId||(e._listenId=(0,l.uniqueId)("l"));return i[a]=e,r||"object"!==("undefined"==typeof n?"undefined":o(n))||(r=this),e[g[t]](n,r,this),this}}),y.PLAYER_READY="ready",y.PLAYER_RESIZE="resize",y.PLAYER_FULLSCREEN="fullscreen",y.PLAYER_PLAY="play",y.PLAYER_PAUSE="pause",y.PLAYER_STOP="stop",y.PLAYER_ENDED="ended",y.PLAYER_SEEK="seek",y.PLAYER_ERROR="error",y.PLAYER_TIMEUPDATE="timeupdate",y.PLAYER_VOLUMEUPDATE="volumeupdate",y.PLAYBACK_PROGRESS="playback:progress",y.PLAYBACK_TIMEUPDATE="playback:timeupdate",y.PLAYBACK_READY="playback:ready",y.PLAYBACK_BUFFERING="playback:buffering",y.PLAYBACK_BUFFERFULL="playback:bufferfull",y.PLAYBACK_SETTINGSUPDATE="playback:settingsupdate",y.PLAYBACK_LOADEDMETADATA="playback:loadedmetadata",y.PLAYBACK_HIGHDEFINITIONUPDATE="playback:highdefinitionupdate",y.PLAYBACK_BITRATE="playback:bitrate",y.PLAYBACK_LEVELS_AVAILABLE="playback:levels:available",y.PLAYBACK_LEVEL_SWITCH_START="playback:levels:switch:start",y.PLAYBACK_LEVEL_SWITCH_END="playback:levels:switch:end",y.PLAYBACK_PLAYBACKSTATE="playback:playbackstate",y.PLAYBACK_DVR="playback:dvr",y.PLAYBACK_MEDIACONTROL_DISABLE="playback:mediacontrol:disable",y.PLAYBACK_MEDIACONTROL_ENABLE="playback:mediacontrol:enable",y.PLAYBACK_ENDED="playback:ended",y.PLAYBACK_PLAY_INTENT="playback:play:intent",y.PLAYBACK_PLAY="playback:play",y.PLAYBACK_PAUSE="playback:pause",y.PLAYBACK_STOP="playback:stop",y.PLAYBACK_ERROR="playback:error",y.PLAYBACK_STATS_ADD="playback:stats:add",y.PLAYBACK_FRAGMENT_LOADED="playback:fragment:loaded",y.PLAYBACK_LEVEL_SWITCH="playback:level:switch",y.CORE_OPTIONS_CHANGE="core:options:change",y.CORE_READY="core:ready",y.CORE_FULLSCREEN="core:fullscreen",y.CONTAINER_PLAYBACKSTATE="container:playbackstate",y.CONTAINER_PLAYBACKDVRSTATECHANGED="container:dvr",y.CONTAINER_BITRATE="container:bitrate",y.CONTAINER_STATS_REPORT="container:stats:report",y.CONTAINER_DESTROYED="container:destroyed",y.CONTAINER_READY="container:ready",y.CONTAINER_ERROR="container:error",y.CONTAINER_LOADEDMETADATA="container:loadedmetadata",y.CONTAINER_TIMEUPDATE="container:timeupdate",y.CONTAINER_PROGRESS="container:progress",y.CONTAINER_PLAY="container:play",y.CONTAINER_STOP="container:stop",y.CONTAINER_PAUSE="container:pause",y.CONTAINER_ENDED="container:ended",y.CONTAINER_CLICK="container:click",y.CONTAINER_DBLCLICK="container:dblclick",y.CONTAINER_CONTEXTMENU="container:contextmenu",y.CONTAINER_MOUSE_ENTER="container:mouseenter",y.CONTAINER_MOUSE_LEAVE="container:mouseleave",y.CONTAINER_SEEK="container:seek",y.CONTAINER_VOLUME="container:volume",y.CONTAINER_FULLSCREEN="container:fullscreen",y.CONTAINER_STATE_BUFFERING="container:state:buffering",y.CONTAINER_STATE_BUFFERFULL="container:state:bufferfull",y.CONTAINER_SETTINGSUPDATE="container:settingsupdate",y.CONTAINER_HIGHDEFINITIONUPDATE="container:highdefinitionupdate",y.CONTAINER_MEDIACONTROL_SHOW="container:mediacontrol:show",y.CONTAINER_MEDIACONTROL_HIDE="container:mediacontrol:hide",y.CONTAINER_MEDIACONTROL_DISABLE="container:mediacontrol:disable",y.CONTAINER_MEDIACONTROL_ENABLE="container:mediacontrol:enable",y.CONTAINER_STATS_ADD="container:stats:add",y.CONTAINER_OPTIONS_CHANGE="container:options:change",y.MEDIACONTROL_RENDERED="mediacontrol:rendered",y.MEDIACONTROL_FULLSCREEN="mediacontrol:fullscreen",y.MEDIACONTROL_SHOW="mediacontrol:show",y.MEDIACONTROL_HIDE="mediacontrol:hide",y.MEDIACONTROL_MOUSEMOVE_SEEKBAR="mediacontrol:mousemove:seekbar",y.MEDIACONTROL_MOUSELEAVE_SEEKBAR="mediacontrol:mouseleave:seekbar",y.MEDIACONTROL_PLAYING="mediacontrol:playing",y.MEDIACONTROL_NOTPLAYING="mediacontrol:notplaying",y.MEDIACONTROL_CONTAINERCHANGED="mediacontrol:containerchanged",y.CORE_CONTAINERS_CREATED="core:containers:created",t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function s(t,e){if(e)for(var n in e){var r=Object.getOwnPropertyDescriptor(e,n);r?Object.defineProperty(t,n,r):t[n]=e[n]}return t}function l(t,e){var n=function(t){function n(){i(this,n);for(var r=arguments.length,a=Array(r),s=0;s<r;s++)a[s]=arguments[s];var l=o(this,t.call.apply(t,[this].concat(a)));return e.initialize&&e.initialize.apply(l,a),l}return a(n,t),n}(t);return s(n.prototype,e),n}function u(t,e){if(!isFinite(t))return"--:--";t*=1e3,t=parseInt(t/1e3);var n=t%60;t=parseInt(t/60);var r=t%60;t=parseInt(t/60);var i=t%24,o=parseInt(t/24),a="";return o&&o>0&&(a+=o+":",i<1&&(a+="00:")),(i&&i>0||e)&&(a+=("0"+i).slice(-2)+":"),a+=("0"+r).slice(-2)+":",a+=("0"+n).slice(-2),a.trim()}function c(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"t",e=0,n=T.params[t]||T.hashParams[t]||"",r=n.match(/[0-9]+[hms]+/g)||[];return r.length>0?!function(){var t={h:3600,m:60,s:1};r.forEach(function(n){if(n){var r=n[n.length-1],i=parseInt(n.slice(0,n.length-1),10);e+=i*t[r]}})}():n&&(e=parseInt(n,10)),e}function d(t){A[t]||(A[t]=0);var e=++A[t];return t+e}function f(t){return t-parseFloat(t)+1>=0}function h(){var t=document.getElementsByTagName("script");return t.length?t[t.length-1].src:""}function p(){return window.navigator&&window.navigator.language}function y(){return window.performance&&window.performance.now?performance.now():Date.now()}function g(t,e){var n=t.indexOf(e);n>=0&&t.splice(n,1)}Object.defineProperty(e,"__esModule",{value:!0}),e.cancelAnimationFrame=e.requestAnimationFrame=e.QueryString=e.Config=e.Fullscreen=void 0;var v=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}();e.extend=l,e.formatTime=u,e.seekStringToSeconds=c,e.uniqueId=d,e.isNumber=f,e.currentScriptUrl=h,e.getBrowserLanguage=p,e.now=y,e.removeArrayItem=g;var m=n(8),b=r(m),_=e.Fullscreen={isFullscreen:function(){return!!(document.webkitFullscreenElement||document.webkitIsFullScreen||document.mozFullScreen||document.msFullscreenElement)},requestFullscreen:function(t){t.requestFullscreen?t.requestFullscreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.mozRequestFullScreen?t.mozRequestFullScreen():t.msRequestFullscreen?t.msRequestFullscreen():t.querySelector&&t.querySelector("video")&&t.querySelector("video").webkitEnterFullScreen&&t.querySelector("video").webkitEnterFullScreen()},cancelFullscreen:function(){document.exitFullscreen?document.exitFullscreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen&&document.msExitFullscreen()},fullscreenEnabled:function(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}},E=e.Config=function(){function t(){i(this,t)}return t._defaultConfig=function(){return{volume:{value:100,parse:parseInt}}},t._defaultValueFor=function(t){try{return this._defaultConfig()[t].parse(this._defaultConfig()[t].value)}catch(t){return}},t._createKeyspace=function(t){return"clappr."+document.domain+"."+t},t.restore=function(t){return b.default.hasLocalstorage&&localStorage[this._createKeyspace(t)]?this._defaultConfig()[t].parse(localStorage[this._createKeyspace(t)]):this._defaultValueFor(t)},t.persist=function(t,e){if(b.default.hasLocalstorage)try{return localStorage[this._createKeyspace(t)]=e,!0}catch(t){return!1}},t}(),T=e.QueryString=function(){function t(){i(this,t)}return t.parse=function(t){for(var e=void 0,n=/\+/g,r=/([^&=]+)=?([^&]*)/g,i=function(t){return decodeURIComponent(t.replace(n," "))},o={};e=r.exec(t);)o[i(e[1]).toLowerCase()]=i(e[2]);return o},v(t,null,[{key:"params",get:function(){var t=window.location.search.substring(1);return t!==this.query&&(this._urlParams=this.parse(t),this.query=t),this._urlParams}},{key:"hashParams",get:function(){var t=window.location.hash.substring(1);return t!==this.hash&&(this._hashParams=this.parse(t),this.hash=t),this._hashParams}}]),t}(),A={},k=e.requestAnimationFrame=(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||function(t){window.setTimeout(t,1e3/60)}).bind(window),w=e.cancelAnimationFrame=(window.cancelAnimationFrame||window.mozCancelAnimationFrame||window.webkitCancelAnimationFrame||window.clearTimeout).bind(window);e.default={Config:E,Fullscreen:_,QueryString:T,extend:l,formatTime:u,seekStringToSeconds:c,uniqueId:d,currentScriptUrl:h,isNumber:f,requestAnimationFrame:k,cancelAnimationFrame:w,getBrowserLanguage:p,now:y,removeArrayItem:g}},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(2),u=n(10),c=r(u),d=function(t){function e(n,r){i(this,e);var a=o(this,t.call(this,n));return a.settings={},a._i18n=r,a}return a(e,t),s(e,[{key:"isAudioOnly",get:function(){return!1}},{key:"ended",get:function(){return!1}},{key:"i18n",get:function(){return this._i18n}},{key:"buffering",get:function(){return!1}}]),e.prototype.play=function(){},e.prototype.pause=function(){},e.prototype.stop=function(){},e.prototype.seek=function(t){},e.prototype.seekPercentage=function(t){},e.prototype.getStartTimeOffset=function(){return 0},e.prototype.getDuration=function(){return 0},e.prototype.isPlaying=function(){return!1},e.prototype.getPlaybackType=function(){return e.NO_OP},e.prototype.isHighDefinitionInUse=function(){return!1},e.prototype.volume=function(t){},e.prototype.destroy=function(){this.$el.remove()},s(e,[{key:"isReady",get:function(){return!1}}]),e}(c.default);e.default=d,d.extend=function(t){return(0,l.extend)(d,t)},d.canPlay=function(t,e){return!1},d.VOD="vod",d.AOD="aod",d.LIVE="live",d.NO_OP="no_op",d.type="playback",t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(5),o=r(i),a=n(6),s=r(a),l={getStyleFor:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{baseUrl:""};return(0,o.default)('<style class="clappr-style"></style>').html((0,s.default)(t.toString())(e))}};e.default=l,t.exports=e.default},function(t,e){var n=function(){function t(t){return null==t?String(t):W[q.call(t)]||"object"}function e(e){return"function"==t(e)}function n(t){return null!=t&&t==t.window}function r(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function i(e){return"object"==t(e)}function o(t){return i(t)&&!n(t)&&Object.getPrototypeOf(t)==Object.prototype}function a(t){return"number"==typeof t.length}function s(t){return C.call(t,function(t){return null!=t})}function l(t){return t.length>0?k.fn.concat.apply([],t):t}function u(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function c(t){return t in x?x[t]:x[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function d(t,e){return"number"!=typeof e||N[u(t)]?e:e+"px"}function f(t){var e,n;return I[t]||(e=D.createElement(t),D.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),I[t]=n),I[t]}function h(t){return"children"in t?P.call(t.children):k.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function p(t,e){var n,r=t?t.length:0;for(n=0;r>n;n++)this[n]=t[n];this.length=r,this.selector=e||""}function y(t,e,n){for(A in e)n&&(o(e[A])||Q(e[A]))?(o(e[A])&&!o(t[A])&&(t[A]={}),Q(e[A])&&!Q(t[A])&&(t[A]=[]),y(t[A],e[A],n)):e[A]!==T&&(t[A]=e[A])}function g(t,e){return null==e?k(t):k(t).filter(e)}function v(t,n,r,i){return e(n)?n.call(t,r,i):n}function m(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function b(t,e){var n=t.className||"",r=n&&n.baseVal!==T;return e===T?r?n.baseVal:n:void(r?n.baseVal=e:t.className=e)}function _(t){try{return t?"true"==t||"false"!=t&&("null"==t?null:+t+""==t?+t:/^[\[\{]/.test(t)?k.parseJSON(t):t):t}catch(e){return t}}function E(t,e){e(t);for(var n=0,r=t.childNodes.length;r>n;n++)E(t.childNodes[n],e)}var T,A,k,w,S,L,R=[],O=R.concat,C=R.filter,P=R.slice,D=window.document,I={},x={},N={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},M=/^\s*<(\w+|!)[^>]*>/,F=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,B=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,U=/^(?:body|html)$/i,j=/([A-Z])/g,G=["val","css","html","text","data","width","height","offset"],Y=["after","prepend","before","append"],V=D.createElement("table"),K=D.createElement("tr"),$={tr:D.createElement("tbody"),tbody:V,thead:V,tfoot:V,td:K,th:K,"*":D.createElement("div")},H=/complete|loaded|interactive/,z=/^[\w-]*$/,W={},q=W.toString,X={},Z=D.createElement("div"),J={tabindex:"tabIndex",readonly:"readOnly",for:"htmlFor",class:"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},Q=Array.isArray||function(t){return t instanceof Array};return X.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var r,i=t.parentNode,o=!i;return o&&(i=Z).appendChild(t),r=~X.qsa(i,e).indexOf(t),o&&Z.removeChild(t),r},S=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},L=function(t){return C.call(t,function(e,n){return t.indexOf(e)==n})},X.fragment=function(t,e,n){var r,i,a;return F.test(t)&&(r=k(D.createElement(RegExp.$1))),r||(t.replace&&(t=t.replace(B,"<$1></$2>")),e===T&&(e=M.test(t)&&RegExp.$1),e in $||(e="*"),a=$[e],a.innerHTML=""+t,r=k.each(P.call(a.childNodes),function(){a.removeChild(this)})),o(n)&&(i=k(r),k.each(n,function(t,e){G.indexOf(t)>-1?i[t](e):i.attr(t,e)})),r},X.Z=function(t,e){return new p(t,e)},X.isZ=function(t){return t instanceof X.Z},X.init=function(t,n){var r;if(!t)return X.Z();if("string"==typeof t)if(t=t.trim(),"<"==t[0]&&M.test(t))r=X.fragment(t,RegExp.$1,n),t=null;else{if(n!==T)return k(n).find(t);r=X.qsa(D,t)}else{if(e(t))return k(D).ready(t);if(X.isZ(t))return t;if(Q(t))r=s(t);else if(i(t))r=[t],t=null;else if(M.test(t))r=X.fragment(t.trim(),RegExp.$1,n),t=null;else{if(n!==T)return k(n).find(t);r=X.qsa(D,t)}}return X.Z(r,t)},k=function(t,e){return X.init(t,e)},k.extend=function(t){var e,n=P.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){y(t,n,e)}),t},X.qsa=function(t,e){var n,r="#"==e[0],i=!r&&"."==e[0],o=r||i?e.slice(1):e,a=z.test(o);return t.getElementById&&a&&r?(n=t.getElementById(o))?[n]:[]:1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType?[]:P.call(a&&!r&&t.getElementsByClassName?i?t.getElementsByClassName(o):t.getElementsByTagName(e):t.querySelectorAll(e))},k.contains=D.documentElement.contains?function(t,e){return t!==e&&t.contains(e)}:function(t,e){for(;e&&(e=e.parentNode);)if(e===t)return!0;return!1},k.type=t,k.isFunction=e,k.isWindow=n,k.isArray=Q,k.isPlainObject=o,k.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},k.inArray=function(t,e,n){return R.indexOf.call(e,t,n)},k.camelCase=S,k.trim=function(t){return null==t?"":String.prototype.trim.call(t)},k.uuid=0,k.support={},k.expr={},k.noop=function(){},k.map=function(t,e){var n,r,i,o=[];if(a(t))for(r=0;r<t.length;r++)n=e(t[r],r),null!=n&&o.push(n);else for(i in t)n=e(t[i],i),null!=n&&o.push(n);return l(o)},k.each=function(t,e){var n,r;if(a(t)){for(n=0;n<t.length;n++)if(e.call(t[n],n,t[n])===!1)return t}else for(r in t)if(e.call(t[r],r,t[r])===!1)return t;return t},k.grep=function(t,e){return C.call(t,e)},window.JSON&&(k.parseJSON=JSON.parse),k.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(t,e){W["[object "+e+"]"]=e.toLowerCase()}),k.fn={constructor:X.Z,length:0,forEach:R.forEach,reduce:R.reduce,push:R.push,sort:R.sort,splice:R.splice,indexOf:R.indexOf,concat:function(){var t,e,n=[];for(t=0;t<arguments.length;t++)e=arguments[t],n[t]=X.isZ(e)?e.toArray():e;return O.apply(X.isZ(this)?this.toArray():this,n)},map:function(t){return k(k.map(this,function(e,n){return t.call(e,n,e)}))},slice:function(){return k(P.apply(this,arguments))},ready:function(t){return H.test(D.readyState)&&D.body?t(k):D.addEventListener("DOMContentLoaded",function(){t(k)},!1),this},get:function(t){return t===T?P.call(this):this[t>=0?t:t+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return R.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return e(t)?this.not(this.not(t)):k(C.call(this,function(e){return X.matches(e,t)}))},add:function(t,e){return k(L(this.concat(k(t,e))))},is:function(t){return this.length>0&&X.matches(this[0],t)},not:function(t){var n=[];if(e(t)&&t.call!==T)this.each(function(e){t.call(this,e)||n.push(this)});else{var r="string"==typeof t?this.filter(t):a(t)&&e(t.item)?P.call(t):k(t);this.forEach(function(t){r.indexOf(t)<0&&n.push(t)})}return k(n)},has:function(t){return this.filter(function(){return i(t)?k.contains(this,t):k(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!i(t)?t:k(t)},last:function(){var t=this[this.length-1];return t&&!i(t)?t:k(t)},find:function(t){var e,n=this;return e=t?"object"==typeof t?k(t).filter(function(){var t=this;return R.some.call(n,function(e){return k.contains(e,t)})}):1==this.length?k(X.qsa(this[0],t)):this.map(function(){return X.qsa(this,t)}):k()},closest:function(t,e){var n=this[0],i=!1;for("object"==typeof t&&(i=k(t));n&&!(i?i.indexOf(n)>=0:X.matches(n,t));)n=n!==e&&!r(n)&&n.parentNode;return k(n)},parents:function(t){for(var e=[],n=this;n.length>0;)n=k.map(n,function(t){return(t=t.parentNode)&&!r(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return g(e,t)},parent:function(t){return g(L(this.pluck("parentNode")),t)},children:function(t){return g(this.map(function(){return h(this)}),t)},contents:function(){return this.map(function(){return this.contentDocument||P.call(this.childNodes)})},siblings:function(t){return g(this.map(function(t,e){return C.call(h(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return k.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=f(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var n=e(t);if(this[0]&&!n)var r=k(t).get(0),i=r.parentNode||this.length>1;return this.each(function(e){k(this).wrapAll(n?t.call(this,e):i?r.cloneNode(!0):r)})},wrapAll:function(t){if(this[0]){k(this[0]).before(t=k(t));for(var e;(e=t.children()).length;)t=e.first();k(t).append(this)}return this},wrapInner:function(t){var n=e(t);return this.each(function(e){var r=k(this),i=r.contents(),o=n?t.call(this,e):t;i.length?i.wrapAll(o):r.append(o)})},unwrap:function(){return this.parent().each(function(){k(this).replaceWith(k(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(t){return this.each(function(){var e=k(this);(t===T?"none"==e.css("display"):t)?e.show():e.hide()})},prev:function(t){return k(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return k(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0 in arguments?this.each(function(e){var n=this.innerHTML;k(this).empty().append(v(this,t,e,n))}):0 in this?this[0].innerHTML:null},text:function(t){return 0 in arguments?this.each(function(e){var n=v(this,t,e,this.textContent);this.textContent=null==n?"":""+n}):0 in this?this[0].textContent:null},attr:function(t,e){var n;return"string"!=typeof t||1 in arguments?this.each(function(n){if(1===this.nodeType)if(i(t))for(A in t)m(this,A,t[A]);else m(this,t,v(this,e,n,this.getAttribute(t)))}):this.length&&1===this[0].nodeType?!(n=this[0].getAttribute(t))&&t in this[0]?this[0][t]:n:T},removeAttr:function(t){return this.each(function(){1===this.nodeType&&t.split(" ").forEach(function(t){m(this,t)},this)})},prop:function(t,e){return t=J[t]||t,1 in arguments?this.each(function(n){this[t]=v(this,e,n,this[t])}):this[0]&&this[0][t]},data:function(t,e){var n="data-"+t.replace(j,"-$1").toLowerCase(),r=1 in arguments?this.attr(n,e):this.attr(n);return null!==r?_(r):T},val:function(t){return 0 in arguments?this.each(function(e){this.value=v(this,t,e,this.value)}):this[0]&&(this[0].multiple?k(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value)},offset:function(t){if(t)return this.each(function(e){var n=k(this),r=v(this,t,e,n.offset()),i=n.offsetParent().offset(),o={top:r.top-i.top,left:r.left-i.left};"static"==n.css("position")&&(o.position="relative"),n.css(o)});if(!this.length)return null;if(!k.contains(D.documentElement,this[0]))return{top:0,left:0};var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(e,n){if(arguments.length<2){var r,i=this[0];if(!i)return;if(r=getComputedStyle(i,""),"string"==typeof e)return i.style[S(e)]||r.getPropertyValue(e);if(Q(e)){var o={};return k.each(e,function(t,e){o[e]=i.style[S(e)]||r.getPropertyValue(e)}),o}}var a="";if("string"==t(e))n||0===n?a=u(e)+":"+d(e,n):this.each(function(){this.style.removeProperty(u(e))});else for(A in e)e[A]||0===e[A]?a+=u(A)+":"+d(A,e[A])+";":this.each(function(){this.style.removeProperty(u(A))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(k(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return!!t&&R.some.call(this,function(t){return this.test(b(t))},c(t))},addClass:function(t){return t?this.each(function(e){if("className"in this){w=[];var n=b(this),r=v(this,t,e,n);r.split(/\s+/g).forEach(function(t){k(this).hasClass(t)||w.push(t)},this),w.length&&b(this,n+(n?" ":"")+w.join(" "))}}):this},removeClass:function(t){return this.each(function(e){if("className"in this){if(t===T)return b(this,"");w=b(this),v(this,t,e,w).split(/\s+/g).forEach(function(t){w=w.replace(c(t)," ")}),b(this,w.trim())}})},toggleClass:function(t,e){return t?this.each(function(n){var r=k(this),i=v(this,t,n,b(this));i.split(/\s+/g).forEach(function(t){(e===T?!r.hasClass(t):e)?r.addClass(t):r.removeClass(t)})}):this},scrollTop:function(t){if(this.length){var e="scrollTop"in this[0];return t===T?e?this[0].scrollTop:this[0].pageYOffset:this.each(e?function(){this.scrollTop=t}:function(){this.scrollTo(this.scrollX,t)})}},scrollLeft:function(t){if(this.length){var e="scrollLeft"in this[0];return t===T?e?this[0].scrollLeft:this[0].pageXOffset:this.each(e?function(){this.scrollLeft=t}:function(){this.scrollTo(t,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),n=this.offset(),r=U.test(e[0].nodeName)?{top:0,left:0}:e.offset();return n.top-=parseFloat(k(t).css("margin-top"))||0,n.left-=parseFloat(k(t).css("margin-left"))||0,r.top+=parseFloat(k(e[0]).css("border-top-width"))||0,r.left+=parseFloat(k(e[0]).css("border-left-width"))||0,{top:n.top-r.top,left:n.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||D.body;t&&!U.test(t.nodeName)&&"static"==k(t).css("position");)t=t.offsetParent;return t})}},k.fn.detach=k.fn.remove,["width","height"].forEach(function(t){var e=t.replace(/./,function(t){return t[0].toUpperCase()});k.fn[t]=function(i){var o,a=this[0];return i===T?n(a)?a["inner"+e]:r(a)?a.documentElement["scroll"+e]:(o=this.offset())&&o[t]:this.each(function(e){a=k(this),a.css(t,v(this,i,e,a[t]()))})}}),Y.forEach(function(e,n){var r=n%2;k.fn[e]=function(){var e,i,o=k.map(arguments,function(n){return e=t(n),"object"==e||"array"==e||null==n?n:X.fragment(n)}),a=this.length>1;return o.length<1?this:this.each(function(t,e){i=r?e:e.parentNode,e=0==n?e.nextSibling:1==n?e.firstChild:2==n?e:null;var s=k.contains(D.documentElement,i);o.forEach(function(t){if(a)t=t.cloneNode(!0);else if(!i)return k(t).remove();i.insertBefore(t,e),s&&E(t,function(t){null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src||window.eval.call(window,t.innerHTML)})})})},k.fn[r?e+"To":"insert"+(n?"Before":"After")]=function(t){return k(t)[e](this),this}}),X.Z.prototype=p.prototype=k.fn,X.uniq=L,X.deserializeValue=_,k.zepto=X,k}();window.Zepto=n,void 0===window.$&&(window.$=n),function(t){function e(t){return t._zid||(t._zid=f++)}function n(t,n,o,a){if(n=r(n),n.ns)var s=i(n.ns);return(g[e(t)]||[]).filter(function(t){return!(!t||n.e&&t.e!=n.e||n.ns&&!s.test(t.ns)||o&&e(t.fn)!==e(o)||a&&t.sel!=a)})}function r(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function i(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function o(t,e){return t.del&&!m&&t.e in b||!!e}function a(t){return _[t]||m&&b[t]||t}function s(n,i,s,l,c,f,h){var p=e(n),y=g[p]||(g[p]=[]);i.split(/\s/).forEach(function(e){if("ready"==e)return t(document).ready(s);var i=r(e);i.fn=s,i.sel=c,i.e in _&&(s=function(e){var n=e.relatedTarget;return!n||n!==this&&!t.contains(this,n)?i.fn.apply(this,arguments):void 0}),i.del=f;var p=f||s;i.proxy=function(t){if(t=u(t),!t.isImmediatePropagationStopped()){t.data=l;var e=p.apply(n,t._args==d?[t]:[t].concat(t._args));return e===!1&&(t.preventDefault(),t.stopPropagation()),e}},i.i=y.length,y.push(i),"addEventListener"in n&&n.addEventListener(a(i.e),i.proxy,o(i,h))})}function l(t,r,i,s,l){var u=e(t);(r||"").split(/\s/).forEach(function(e){n(t,e,i,s).forEach(function(e){delete g[u][e.i],
+"removeEventListener"in t&&t.removeEventListener(a(e.e),e.proxy,o(e,l))})})}function u(e,n){return(n||!e.isDefaultPrevented)&&(n||(n=e),t.each(k,function(t,r){var i=n[t];e[t]=function(){return this[r]=E,i&&i.apply(n,arguments)},e[r]=T}),(n.defaultPrevented!==d?n.defaultPrevented:"returnValue"in n?n.returnValue===!1:n.getPreventDefault&&n.getPreventDefault())&&(e.isDefaultPrevented=E)),e}function c(t){var e,n={originalEvent:t};for(e in t)A.test(e)||t[e]===d||(n[e]=t[e]);return u(n,t)}var d,f=1,h=Array.prototype.slice,p=t.isFunction,y=function(t){return"string"==typeof t},g={},v={},m="onfocusin"in window,b={focus:"focusin",blur:"focusout"},_={mouseenter:"mouseover",mouseleave:"mouseout"};v.click=v.mousedown=v.mouseup=v.mousemove="MouseEvents",t.event={add:s,remove:l},t.proxy=function(n,r){var i=2 in arguments&&h.call(arguments,2);if(p(n)){var o=function(){return n.apply(r,i?i.concat(h.call(arguments)):arguments)};return o._zid=e(n),o}if(y(r))return i?(i.unshift(n[r],n),t.proxy.apply(null,i)):t.proxy(n[r],n);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,r){return this.on(t,e,n,r,1)};var E=function(){return!0},T=function(){return!1},A=/^([A-Z]|returnValue$|layer[XY]$)/,k={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,n,r,i,o){var a,u,f=this;return e&&!y(e)?(t.each(e,function(t,e){f.on(t,n,r,e,o)}),f):(y(n)||p(i)||i===!1||(i=r,r=n,n=d),(i===d||r===!1)&&(i=r,r=d),i===!1&&(i=T),f.each(function(d,f){o&&(a=function(t){return l(f,t.type,i),i.apply(this,arguments)}),n&&(u=function(e){var r,o=t(e.target).closest(n,f).get(0);return o&&o!==f?(r=t.extend(c(e),{currentTarget:o,liveFired:f}),(a||i).apply(o,[r].concat(h.call(arguments,1)))):void 0}),s(f,e,i,r,n,u||a)}))},t.fn.off=function(e,n,r){var i=this;return e&&!y(e)?(t.each(e,function(t,e){i.off(t,n,e)}),i):(y(n)||p(r)||r===!1||(r=n,n=d),r===!1&&(r=T),i.each(function(){l(this,e,r,n)}))},t.fn.trigger=function(e,n){return e=y(e)||t.isPlainObject(e)?t.Event(e):u(e),e._args=n,this.each(function(){e.type in b&&"function"==typeof this[e.type]?this[e.type]():"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)})},t.fn.triggerHandler=function(e,r){var i,o;return this.each(function(a,s){i=c(y(e)?t.Event(e):e),i._args=r,i.target=s,t.each(n(s,e.type||e),function(t,e){return o=e.proxy(i),!i.isImmediatePropagationStopped()&&void 0})}),o},"focusin focusout focus blur load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){t.fn[e]=function(t){return 0 in arguments?this.bind(e,t):this.trigger(e)}}),t.Event=function(t,e){y(t)||(e=t,t=e.type);var n=document.createEvent(v[t]||"Events"),r=!0;if(e)for(var i in e)"bubbles"==i?r=!!e[i]:n[i]=e[i];return n.initEvent(t,r,!0),u(n)}}(n),function(t){function e(e,n,r){var i=t.Event(n);return t(e).trigger(i,r),!i.isDefaultPrevented()}function n(t,n,r,i){return t.global?e(n||m,r,i):void 0}function r(e){e.global&&0===t.active++&&n(e,null,"ajaxStart")}function i(e){e.global&&!--t.active&&n(e,null,"ajaxStop")}function o(t,e){var r=e.context;return e.beforeSend.call(r,t,e)!==!1&&n(e,r,"ajaxBeforeSend",[t,e])!==!1&&void n(e,r,"ajaxSend",[t,e])}function a(t,e,r,i){var o=r.context,a="success";r.success.call(o,t,a,e),i&&i.resolveWith(o,[t,a,e]),n(r,o,"ajaxSuccess",[e,r,t]),l(a,e,r)}function s(t,e,r,i,o){var a=i.context;i.error.call(a,r,e,t),o&&o.rejectWith(a,[r,e,t]),n(i,a,"ajaxError",[r,i,t||e]),l(e,r,i)}function l(t,e,r){var o=r.context;r.complete.call(o,e,t),n(r,o,"ajaxComplete",[e,r]),i(r)}function u(){}function c(t){return t&&(t=t.split(";",2)[0]),t&&(t==A?"html":t==T?"json":_.test(t)?"script":E.test(t)&&"xml")||"text"}function d(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function f(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()||(e.url=d(e.url,e.data),e.data=void 0)}function h(e,n,r,i){return t.isFunction(n)&&(i=r,r=n,n=void 0),t.isFunction(r)||(i=r,r=void 0),{url:e,data:n,success:r,dataType:i}}function p(e,n,r,i){var o,a=t.isArray(n),s=t.isPlainObject(n);t.each(n,function(n,l){o=t.type(l),i&&(n=r?i:i+"["+(s||"object"==o||"array"==o?n:"")+"]"),!i&&a?e.add(l.name,l.value):"array"==o||!r&&"object"==o?p(e,l,r,n):e.add(n,l)})}var y,g,v=0,m=window.document,b=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,_=/^(?:text|application)\/javascript/i,E=/^(?:text|application)\/xml/i,T="application/json",A="text/html",k=/^\s*$/,w=m.createElement("a");w.href=window.location.href,t.active=0,t.ajaxJSONP=function(e,n){if(!("type"in e))return t.ajax(e);var r,i,l=e.jsonpCallback,u=(t.isFunction(l)?l():l)||"jsonp"+ ++v,c=m.createElement("script"),d=window[u],f=function(e){t(c).triggerHandler("error",e||"abort")},h={abort:f};return n&&n.promise(h),t(c).on("load error",function(o,l){clearTimeout(i),t(c).off().remove(),"error"!=o.type&&r?a(r[0],h,e,n):s(null,l||"error",h,e,n),window[u]=d,r&&t.isFunction(d)&&d(r[0]),d=r=void 0}),o(h,e)===!1?(f("abort"),h):(window[u]=function(){r=arguments},c.src=e.url.replace(/\?(.+)=\?/,"?$1="+u),m.head.appendChild(c),e.timeout>0&&(i=setTimeout(function(){f("timeout")},e.timeout)),h)},t.ajaxSettings={type:"GET",beforeSend:u,success:u,error:u,complete:u,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:T,xml:"application/xml, text/xml",html:A,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},t.ajax=function(e){var n,i,l=t.extend({},e||{}),h=t.Deferred&&t.Deferred();for(y in t.ajaxSettings)void 0===l[y]&&(l[y]=t.ajaxSettings[y]);r(l),l.crossDomain||(n=m.createElement("a"),n.href=l.url,n.href=n.href,l.crossDomain=w.protocol+"//"+w.host!=n.protocol+"//"+n.host),l.url||(l.url=window.location.toString()),(i=l.url.indexOf("#"))>-1&&(l.url=l.url.slice(0,i)),f(l);var p=l.dataType,v=/\?.+=\?/.test(l.url);if(v&&(p="jsonp"),l.cache!==!1&&(e&&e.cache===!0||"script"!=p&&"jsonp"!=p)||(l.url=d(l.url,"_="+Date.now())),"jsonp"==p)return v||(l.url=d(l.url,l.jsonp?l.jsonp+"=?":l.jsonp===!1?"":"callback=?")),t.ajaxJSONP(l,h);var b,_=l.accepts[p],E={},T=function(t,e){E[t.toLowerCase()]=[t,e]},A=/^([\w-]+:)\/\//.test(l.url)?RegExp.$1:window.location.protocol,S=l.xhr(),L=S.setRequestHeader;if(h&&h.promise(S),l.crossDomain||T("X-Requested-With","XMLHttpRequest"),T("Accept",_||"*/*"),(_=l.mimeType||_)&&(_.indexOf(",")>-1&&(_=_.split(",",2)[0]),S.overrideMimeType&&S.overrideMimeType(_)),(l.contentType||l.contentType!==!1&&l.data&&"GET"!=l.type.toUpperCase())&&T("Content-Type",l.contentType||"application/x-www-form-urlencoded"),l.headers)for(g in l.headers)T(g,l.headers[g]);if(S.setRequestHeader=T,S.onreadystatechange=function(){if(4==S.readyState){S.onreadystatechange=u,clearTimeout(b);var e,n=!1;if(S.status>=200&&S.status<300||304==S.status||0==S.status&&"file:"==A){p=p||c(l.mimeType||S.getResponseHeader("content-type")),e=S.responseText;try{"script"==p?(0,eval)(e):"xml"==p?e=S.responseXML:"json"==p&&(e=k.test(e)?null:t.parseJSON(e))}catch(t){n=t}n?s(n,"parsererror",S,l,h):a(e,S,l,h)}else s(S.statusText||null,S.status?"error":"abort",S,l,h)}},o(S,l)===!1)return S.abort(),s(null,"abort",S,l,h),S;if(l.xhrFields)for(g in l.xhrFields)S[g]=l.xhrFields[g];var R=!("async"in l)||l.async;S.open(l.type,l.url,R,l.username,l.password);for(g in E)L.apply(S,E[g]);return l.timeout>0&&(b=setTimeout(function(){S.onreadystatechange=u,S.abort(),s(null,"timeout",S,l,h)},l.timeout)),S.send(l.data?l.data:null),S},t.get=function(){return t.ajax(h.apply(null,arguments))},t.post=function(){var e=h.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=h.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,r){if(!this.length)return this;var i,o=this,a=e.split(/\s/),s=h(e,n,r),l=s.success;return a.length>1&&(s.url=a[0],i=a[1]),s.success=function(e){o.html(i?t("<div>").html(e.replace(b,"")).find(i):e),l&&l.apply(o,arguments)},t.ajax(s),this};var S=encodeURIComponent;t.param=function(e,n){var r=[];return r.add=function(e,n){t.isFunction(n)&&(n=n()),null==n&&(n=""),this.push(S(e)+"="+S(n))},p(r,e,n),r.join("&").replace(/%20/g,"+")}}(n),function(t){t.Callbacks=function(e){e=t.extend({},e);var n,r,i,o,a,s,l=[],u=!e.once&&[],c=function(t){for(n=e.memory&&t,r=!0,s=o||0,o=0,a=l.length,i=!0;l&&a>s;++s)if(l[s].apply(t[0],t[1])===!1&&e.stopOnFalse){n=!1;break}i=!1,l&&(u?u.length&&c(u.shift()):n?l.length=0:d.disable())},d={add:function(){if(l){var r=l.length,s=function(n){t.each(n,function(t,n){"function"==typeof n?e.unique&&d.has(n)||l.push(n):n&&n.length&&"string"!=typeof n&&s(n)})};s(arguments),i?a=l.length:n&&(o=r,c(n))}return this},remove:function(){return l&&t.each(arguments,function(e,n){for(var r;(r=t.inArray(n,l,r))>-1;)l.splice(r,1),i&&(a>=r&&--a,s>=r&&--s)}),this},has:function(e){return!(!l||!(e?t.inArray(e,l)>-1:l.length))},empty:function(){return a=l.length=0,this},disable:function(){return l=u=n=void 0,this},disabled:function(){return!l},lock:function(){return u=void 0,n||d.disable(),this},locked:function(){return!u},fireWith:function(t,e){return!l||r&&!u||(e=e||[],e=[t,e.slice?e.slice():e],i?u.push(e):c(e)),this},fire:function(){return d.fireWith(this,arguments)},fired:function(){return!!r}};return d}}(n),function(t){function e(n){var r=[["resolve","done",t.Callbacks({once:1,memory:1}),"resolved"],["reject","fail",t.Callbacks({once:1,memory:1}),"rejected"],["notify","progress",t.Callbacks({memory:1})]],i="pending",o={state:function(){return i},always:function(){return a.done(arguments).fail(arguments),this},then:function(){var n=arguments;return e(function(e){t.each(r,function(r,i){var s=t.isFunction(n[r])&&n[r];a[i[1]](function(){var n=s&&s.apply(this,arguments);if(n&&t.isFunction(n.promise))n.promise().done(e.resolve).fail(e.reject).progress(e.notify);else{var r=this===o?e.promise():this,a=s?[n]:arguments;e[i[0]+"With"](r,a)}})}),n=null}).promise()},promise:function(e){return null!=e?t.extend(e,o):o}},a={};return t.each(r,function(t,e){var n=e[2],s=e[3];o[e[1]]=n.add,s&&n.add(function(){i=s},r[1^t][2].disable,r[2][2].lock),a[e[0]]=function(){return a[e[0]+"With"](this===a?o:this,arguments),this},a[e[0]+"With"]=n.fireWith}),o.promise(a),n&&n.call(a,a),a}var n=Array.prototype.slice;t.when=function(r){var i,o,a,s=n.call(arguments),l=s.length,u=0,c=1!==l||r&&t.isFunction(r.promise)?l:0,d=1===c?r:e(),f=function(t,e,r){return function(o){e[t]=this,r[t]=arguments.length>1?n.call(arguments):o,r===i?d.notifyWith(e,r):--c||d.resolveWith(e,r)}};if(l>1)for(i=new Array(l),o=new Array(l),a=new Array(l);l>u;++u)s[u]&&t.isFunction(s[u].promise)?s[u].promise().done(f(u,a,s)).fail(d.reject).progress(f(u,o,i)):--c;return c||d.resolveWith(a,s),d.promise()},t.Deferred=e}(n),function(t){function e(t,e,n,r){return Math.abs(t-e)>=Math.abs(n-r)?t-e>0?"Left":"Right":n-r>0?"Up":"Down"}function n(){c=null,f.last&&(f.el.trigger("longTap"),f={})}function r(){c&&clearTimeout(c),c=null}function i(){s&&clearTimeout(s),l&&clearTimeout(l),u&&clearTimeout(u),c&&clearTimeout(c),s=l=u=c=null,f={}}function o(t){return("touch"==t.pointerType||t.pointerType==t.MSPOINTER_TYPE_TOUCH)&&t.isPrimary}function a(t,e){return t.type=="pointer"+e||t.type.toLowerCase()=="mspointer"+e}var s,l,u,c,d,f={},h=750;t(document).ready(function(){var p,y,g,v,m=0,b=0;"MSGesture"in window&&(d=new MSGesture,d.target=document.body),t(document).bind("MSGestureEnd",function(t){var e=t.velocityX>1?"Right":t.velocityX<-1?"Left":t.velocityY>1?"Down":t.velocityY<-1?"Up":null;e&&(f.el.trigger("swipe"),f.el.trigger("swipe"+e))}).on("touchstart MSPointerDown pointerdown",function(e){(!(v=a(e,"down"))||o(e))&&(g=v?e:e.touches[0],e.touches&&1===e.touches.length&&f.x2&&(f.x2=void 0,f.y2=void 0),p=Date.now(),y=p-(f.last||p),f.el=t("tagName"in g.target?g.target:g.target.parentNode),s&&clearTimeout(s),f.x1=g.pageX,f.y1=g.pageY,y>0&&250>=y&&(f.isDoubleTap=!0),f.last=p,c=setTimeout(n,h),d&&v&&d.addPointer(e.pointerId))}).on("touchmove MSPointerMove pointermove",function(t){(!(v=a(t,"move"))||o(t))&&(g=v?t:t.touches[0],r(),f.x2=g.pageX,f.y2=g.pageY,m+=Math.abs(f.x1-f.x2),b+=Math.abs(f.y1-f.y2))}).on("touchend MSPointerUp pointerup",function(n){(!(v=a(n,"up"))||o(n))&&(r(),f.x2&&Math.abs(f.x1-f.x2)>30||f.y2&&Math.abs(f.y1-f.y2)>30?u=setTimeout(function(){f.el.trigger("swipe"),f.el.trigger("swipe"+e(f.x1,f.x2,f.y1,f.y2)),f={}},0):"last"in f&&(30>m&&30>b?l=setTimeout(function(){var e=t.Event("tap");e.cancelTouch=i,f.el.trigger(e),f.isDoubleTap?(f.el&&f.el.trigger("doubleTap"),f={}):s=setTimeout(function(){s=null,f.el&&f.el.trigger("singleTap"),f={}},250)},0):f={}),m=b=0)}).on("touchcancel MSPointerCancel pointercancel",i),t(window).on("scroll",i)}),["swipe","swipeLeft","swipeRight","swipeUp","swipeDown","doubleTap","tap","singleTap","longTap"].forEach(function(e){t.fn[e]=function(t){return this.on(e,t)}})}(n),function(t){function e(e){return e=t(e),!(!e.width()&&!e.height())&&"none"!==e.css("display")}function n(t,e){t=t.replace(/=#\]/g,'="#"]');var n,r,i=s.exec(t);if(i&&i[2]in a&&(n=a[i[2]],r=i[3],t=i[1],r)){var o=Number(r);r=isNaN(o)?r.replace(/^["']|["']$/g,""):o}return e(t,n,r)}var r=t.zepto,i=r.qsa,o=r.matches,a=t.expr[":"]={visible:function(){return e(this)?this:void 0},hidden:function(){return e(this)?void 0:this},selected:function(){return this.selected?this:void 0},checked:function(){return this.checked?this:void 0},parent:function(){return this.parentNode},first:function(t){return 0===t?this:void 0},last:function(t,e){return t===e.length-1?this:void 0},eq:function(t,e,n){return t===n?this:void 0},contains:function(e,n,r){return t(this).text().indexOf(r)>-1?this:void 0},has:function(t,e,n){return r.qsa(this,n).length?this:void 0}},s=new RegExp("(.*):(\\w+)(?:\\(([^)]+)\\))?$\\s*"),l=/^\s*>/,u="Zepto"+ +new Date;r.qsa=function(e,o){return n(o,function(n,a,s){try{var c;!n&&a?n="*":l.test(n)&&(c=t(e).addClass(u),n="."+u+" "+n);var d=i(e,n)}catch(t){throw console.error("error performing selector: %o",o),t}finally{c&&c.removeClass(u)}return a?r.uniq(t.map(d,function(t,e){return a.call(t,e,d,s)})):d})},r.matches=function(t,e){return n(e,function(e,n,r){return!(e&&!o(t,e)||n&&n.call(t,null,r)!==t)})}}(n),function(){try{getComputedStyle(void 0)}catch(e){var t=getComputedStyle;window.getComputedStyle=function(e){try{return t(e)}catch(t){return null}}}}(),t.exports=n},function(t,e){"use strict";var n={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},r=/(.)^/,i={"'":"'","\\":"\\","\r":"r","\n":"n","\t":"t","\u2028":"u2028","\u2029":"u2029"},o=/\\|'|\r|\n|\t|\u2028|\u2029/g,a={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;"},s=new RegExp("[&<>\"']","g"),l=function(t){return null===t?"":(""+t).replace(s,function(t){return a[t]})},u=0,c=function(t,e){var a,s=new RegExp([(n.escape||r).source,(n.interpolate||r).source,(n.evaluate||r).source].join("|")+"|$","g"),c=0,d="__p+='";t.replace(s,function(e,n,r,a,s){return d+=t.slice(c,s).replace(o,function(t){return"\\"+i[t]}),n&&(d+="'+\n((__t=("+n+"))==null?'':escapeExpr(__t))+\n'"),r&&(d+="'+\n((__t=("+r+"))==null?'':__t)+\n'"),a&&(d+="';\n"+a+"\n__p+='"),c=s+e.length,e}),d+="';\n",n.variable||(d="with(obj||{}){\n"+d+"}\n"),d="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+d+"return __p;\n//# sourceURL=/microtemplates/source["+u++ +"]";try{a=new Function(n.variable||"obj","escapeExpr",d)}catch(t){throw t.source=d,t}if(e)return a(e,l);var f=function(t){return a.call(this,t,l)};return f.source="function("+(n.variable||"obj")+"){\n"+d+"}",f};c.settings=n,t.exports=c},function(t,e){t.exports=function(){var t=[];return t.toString=function(){for(var t=[],e=0;e<this.length;e++){var n=this[e];n[2]?t.push("@media "+n[2]+"{"+n[1]+"}"):t.push(n[1])}return t.join("")},t.i=function(e,n){"string"==typeof e&&(e=[[null,e,""]]);for(var r={},i=0;i<this.length;i++){var o=this[i][0];"number"==typeof o&&(r[o]=!0)}for(i=0;i<e.length;i++){var a=e[i];"number"==typeof a[0]&&r[a[0]]||(n&&!a[2]?a[2]=n:n&&(a[2]="("+a[2]+") and ("+n+")"),t.push(a))}},t}},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n={},r=function(){try{return localStorage.setItem("clappr","clappr"),localStorage.removeItem("clappr"),!0}catch(t){return!1}},i=function(){try{var t=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");return!!t}catch(t){return!(!navigator.mimeTypes||void 0===navigator.mimeTypes["application/x-shockwave-flash"]||!navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)}},o=function(){var t=navigator.userAgent,e=t.match(/\b(playstation 4|nx|opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i)||[],n=void 0;return/trident/i.test(e[1])?(n=/\brv[ :]+(\d+)/g.exec(t)||[],{name:"IE",version:parseInt(n[1]||"")}):"Chrome"===e[1]&&(n=t.match(/\bOPR\/(\d+)/),null!=n)?{name:"Opera",version:parseInt(n[1])}:(e=e[2]?[e[1],e[2]]:[navigator.appName,navigator.appVersion,"-?"],(n=t.match(/version\/(\d+)/i))&&e.splice(1,1,n[1]),{name:e[0],version:parseInt(e[1])})},a=o();n.isSafari=/safari/i.test(navigator.userAgent)&&navigator.userAgent.indexOf("Chrome")===-1,n.isChrome=/chrome/i.test(navigator.userAgent),n.isFirefox=/firefox/i.test(navigator.userAgent),n.isLegacyIE=!!window.ActiveXObject,n.isIE=n.isLegacyIE||/trident.*rv:1\d/i.test(navigator.userAgent),n.isIE11=/trident.*rv:11/i.test(navigator.userAgent),n.isChromecast=n.isChrome&&/CrKey/i.test(navigator.userAgent),n.isMobile=/Android|webOS|iPhone|iPad|iPod|BlackBerry|Windows Phone|IEMobile|Opera Mini/i.test(navigator.userAgent),n.isiOS=/iPad|iPhone|iPod/i.test(navigator.userAgent),n.isAndroid=/Android/i.test(navigator.userAgent),n.isWindowsPhone=/Windows Phone/i.test(navigator.userAgent),n.isWin8App=/MSAppHost/i.test(navigator.userAgent),n.isWiiU=/WiiU/i.test(navigator.userAgent),n.isPS4=/PlayStation 4/i.test(navigator.userAgent),n.hasLocalstorage=r(),n.hasFlash=i(),n.name=a.name,n.version=a.version,e.default=n,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(2),u=n(1),c=r(u),d=function(t){function e(){var n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};i(this,e);var r=o(this,t.call(this,n));return r._options=n,r.uniqueId=(0,l.uniqueId)("o"),r}return a(e,t),s(e,[{key:"options",get:function(){return this._options}}]),e}(c.default);e.default=d,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(2),u=n(5),c=r(u),d=n(102),f=r(d),h=n(9),p=r(h),y=/^(\S+)\s*(.*)$/,g=function(t){function e(n){i(this,e);var r=o(this,t.call(this,n));return r.cid=(0,l.uniqueId)("c"),r._ensureElement(),r.delegateEvents(),r}return a(e,t),s(e,[{key:"tagName",get:function(){return"div"}},{key:"events",get:function(){return{}}},{key:"attributes",get:function(){return{}}}]),e.prototype.$=function(t){return this.$el.find(t)},e.prototype.render=function(){return this},e.prototype.remove=function(){return this.$el.remove(),this.stopListening(),this.undelegateEvents(),this},e.prototype.setElement=function(t,e){return this.$el&&this.undelegateEvents(),this.$el=t instanceof c.default?t:(0,c.default)(t),this.el=this.$el[0],e!==!1&&this.delegateEvents(),this},e.prototype.delegateEvents=function(t){if(!t&&!(t=(0,f.default)(this,"events")))return this;this.undelegateEvents();for(var e in t){var n=t[e];if(n&&n.constructor!==Function&&(n=this[t[e]]),n){var r=e.match(y),i=r[1],o=r[2];i+=".delegateEvents"+this.cid,""===o?this.$el.on(i,n.bind(this)):this.$el.on(i,o,n.bind(this))}}return this},e.prototype.undelegateEvents=function(){return this.$el.off(".delegateEvents"+this.cid),this},e.prototype._ensureElement=function(){if(this.el)this.setElement((0,f.default)(this,"el"),!1);else{var t=c.default.extend({},(0,f.default)(this,"attributes"));this.id&&(t.id=(0,f.default)(this,"id")),this.className&&(t.class=(0,f.default)(this,"className"));var e=(0,c.default)("<"+(0,f.default)(this,"tagName")+">").attr(t);this.setElement(e,!1)}},e}(p.default);e.default=g,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=n(1),a=r(o),s=new a.default,l=function t(){i(this,t)};e.default=l,l.on=function(t,e,n){s.on(t,e,n)},l.once=function(t,e,n){s.once(t,e,n)},l.off=function(t,e,n){s.off(t,e,n)},l.trigger=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];s.trigger.apply(s,[t].concat(n))},l.stopListening=function(t,e,n){s.stopListening(t,e,n)},t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=n(2),l=n(9),u=r(l),c=function(t){function e(n){i(this,e);var r=o(this,t.call(this,n.options));return r.core=n,r.enabled=!0,r.bindEvents(),r}return a(e,t),e.prototype.bindEvents=function(){},e.prototype.enable=function(){this.enabled||(this.bindEvents(),this.enabled=!0)},e.prototype.disable=function(){this.enabled&&(this.stopListening(),this.enabled=!1)},e.prototype.getExternalInterface=function(){return{}},e.prototype.destroy=function(){this.stopListening()},e}(u.default);e.default=c,c.extend=function(t){return(0,s.extend)(c,t)},c.type="core",t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=n(9),l=r(s),u=n(2),c=function(t){function e(n){i(this,e);var r=o(this,t.call(this,n.options));return r.container=n,r.enabled=!0,r.bindEvents(),r}return a(e,t),e.prototype.enable=function(){this.enabled||(this.bindEvents(),this.enabled=!0)},e.prototype.disable=function(){this.enabled&&(this.stopListening(),this.enabled=!1)},e.prototype.bindEvents=function(){},e.prototype.destroy=function(){this.stopListening()},e}(l.default);e.default=c,c.extend=function(t){return(0,u.extend)(c,t)},c.type="container",t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=n(2),l=n(10),u=r(l),c=function(t){function e(n){i(this,e);var r=o(this,t.call(this,n.options));return r.container=n,r.enabled=!0,r.bindEvents(),r}return a(e,t),e.prototype.enable=function(){this.enabled||(this.bindEvents(),this.$el.show(),this.enabled=!0)},e.prototype.disable=function(){this.stopListening(),this.$el.hide(),this.enabled=!1},e.prototype.bindEvents=function(){},e.prototype.destroy=function(){this.remove()},e}(u.default);e.default=c,c.extend=function(t){return(0,s.extend)(c,t)},c.type="container",t.exports=e.default},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function t(){n(this,t),this.options={},this.playbackPlugins=[],this.currentSize={width:0,height:0}};r._players={},r.getInstance=function(t){return r._players[t]||(r._players[t]=new r)},e.default=r,t.exports=e.default},function(t,e,n){"use strict";t.exports=n(53)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=n(2),l=n(10),u=r(l),c=function(t){function e(n){i(this,e);var r=o(this,t.call(this,n.options));return r.core=n,r.enabled=!0,r.bindEvents(),r.render(),r}return a(e,t),e.prototype.bindEvents=function(){},e.prototype.getExternalInterface=function(){return{}},e.prototype.enable=function(){this.enabled||(this.bindEvents(),this.$el.show(),this.enabled=!0)},e.prototype.disable=function(){this.stopListening(),this.$el.hide(),this.enabled=!1},e.prototype.destroy=function(){this.remove()},e.prototype.render=function(){return this},e}(u.default);e.default=c,c.extend=function(t){return(0,s.extend)(c,t)},c.type="core",t.exports=e.default},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),e.default=n(47),t.exports=e.default},function(t,e,n){"use strict";t.exports=n(65)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(77),o=r(i);e.default={Kibo:o.default},t.exports=e.default},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(t){if(c===setTimeout)return setTimeout(t,0);if((c===n||!c)&&setTimeout)return c=setTimeout,setTimeout(t,0);try{return c(t,0)}catch(e){try{return c.call(null,t,0)}catch(e){return c.call(this,t,0)}}}function o(t){if(d===clearTimeout)return clearTimeout(t);if((d===r||!d)&&clearTimeout)return d=clearTimeout,clearTimeout(t);try{return d(t)}catch(e){try{return d.call(null,t)}catch(e){return d.call(this,t)}}}function a(){y&&h&&(y=!1,h.length?p=h.concat(p):g=-1,p.length&&s())}function s(){if(!y){var t=i(a);y=!0;for(var e=p.length;e;){for(h=p,p=[];++g<e;)h&&h[g].run();g=-1,e=p.length}h=null,y=!1,o(t)}}function l(t,e){this.fun=t,this.array=e}function u(){}var c,d,f=t.exports={};!function(){try{c="function"==typeof setTimeout?setTimeout:n}catch(t){c=n}try{d="function"==typeof clearTimeout?clearTimeout:r}catch(t){d=r}}();var h,p=[],y=!1,g=-1;f.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];p.push(new l(t,e)),1!==p.length||y||i(s)},l.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=u,f.addListener=u,f.once=u,f.off=u,f.removeListener=u,f.removeAllListeners=u,f.emit=u,f.binding=function(t){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(t){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#010101" d="M1.425.35L14.575 8l-13.15 7.65V.35z"></path></svg>'},function(t,e){t.exports=function(t){return t.webpackPolyfill||(t.deprecate=function(){},t.paths=[],t.children=[],t.webpackPolyfill=1),t}},function(t,e,n){"use strict";t.exports=n(38)},function(t,e,n){"use strict";t.exports=n(41)},function(t,e,n){"use strict";t.exports=n(44)},function(t,e,n){"use strict";t.exports=n(45)},function(t,e,n){"use strict";t.exports=n(48)},function(t,e,n){"use strict";t.exports=n(49)},function(t,e,n){"use strict";t.exports=n(51)},function(t,e,n){"use strict";t.exports=n(52)},function(t,e,n){"use strict";t.exports=n(54)},function(t,e,n){"use strict";t.exports=n(55)},function(t,e,n){"use strict";t.exports=n(66)},function(t,e,n){(function(t,n){function r(t,e){return t.set(e[0],e[1]),t}function i(t,e){return t.add(e),t}function o(t,e,n){switch(n.length){case 0:return t.call(e);case 1:return t.call(e,n[0]);case 2:return t.call(e,n[0],n[1]);case 3:return t.call(e,n[0],n[1],n[2])}return t.apply(e,n)}function a(t,e){for(var n=-1,r=t?t.length:0;++n<r&&e(t[n],n,t)!==!1;);return t}function s(t,e){for(var n=-1,r=e.length,i=t.length;++n<r;)t[i+n]=e[n];return t}function l(t,e,n,r){var i=-1,o=t?t.length:0;for(r&&o&&(n=t[++i]);++i<o;)n=e(n,t[i],i,t);return n}function u(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function c(t){return function(e){return t(e)}}function d(t,e){return null==t?void 0:t[e]}function f(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"");
+}catch(t){}return e}function h(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function p(t,e){return function(n){return t(e(n))}}function y(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function g(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function v(){this.__data__=on?on(null):{}}function m(t){return this.has(t)&&delete this.__data__[t]}function b(t){var e=this.__data__;if(on){var n=e[t];return n===Yt?void 0:n}return Be.call(e,t)?e[t]:void 0}function _(t){var e=this.__data__;return on?void 0!==e[t]:Be.call(e,t)}function E(t,e){var n=this.__data__;return n[t]=on&&void 0===e?Yt:e,this}function T(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function A(){this.__data__=[]}function k(t){var e=this.__data__,n=V(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():We.call(e,n,1),!0}function w(t){var e=this.__data__,n=V(e,t);return n<0?void 0:e[n][1]}function S(t){return V(this.__data__,t)>-1}function L(t,e){var n=this.__data__,r=V(n,t);return r<0?n.push([t,e]):n[r][1]=e,this}function R(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function O(){this.__data__={hash:new g,map:new(tn||T),string:new g}}function C(t){return yt(this,t).delete(t)}function P(t){return yt(this,t).get(t)}function D(t){return yt(this,t).has(t)}function I(t,e){return yt(this,t).set(t,e),this}function x(t){this.__data__=new T(t)}function N(){this.__data__=new T}function M(t){return this.__data__.delete(t)}function F(t){return this.__data__.get(t)}function B(t){return this.__data__.has(t)}function U(t,e){var n=this.__data__;if(n instanceof T){var r=n.__data__;if(!tn||r.length<Gt-1)return r.push([t,e]),this;n=this.__data__=new R(r)}return n.set(t,e),this}function j(t,e){var n=yn(t)||Rt(t)?u(t.length,String):[],r=n.length,i=!!r;for(var o in t)!e&&!Be.call(t,o)||i&&("length"==o||_t(o,r))||n.push(o);return n}function G(t,e,n){(void 0===n||Lt(t[e],n))&&("number"!=typeof e||void 0!==n||e in t)||(t[e]=n)}function Y(t,e,n){var r=t[e];Be.call(t,e)&&Lt(r,n)&&(void 0!==n||e in t)||(t[e]=n)}function V(t,e){for(var n=t.length;n--;)if(Lt(t[n][0],e))return n;return-1}function K(t,e){return t&&dt(e,Ft(e),t)}function $(t,e,n,r,i,o,s){var l;if(r&&(l=o?r(t,i,o,s):r(t)),void 0!==l)return l;if(!It(t))return t;var u=yn(t);if(u){if(l=vt(t),!e)return ct(t,l)}else{var c=pn(t),d=c==qt||c==Xt;if(gn(t))return nt(t,e);if(c==Qt||c==Kt||d&&!o){if(f(t))return o?t:{};if(l=mt(d?{}:t),!e)return ft(t,K(l,t))}else{if(!Te[c])return o?t:{};l=bt(t,c,$,e)}}s||(s=new x);var h=s.get(t);if(h)return h;if(s.set(t,l),!u)var p=n?pt(t):Ft(t);return a(p||t,function(i,o){p&&(o=i,i=t[o]),Y(l,o,$(i,e,n,r,o,t,s))}),l}function H(t){return It(t)?He(t):{}}function z(t,e,n){var r=e(t);return yn(t)?r:s(r,n(t))}function W(t){return je.call(t)}function q(t){if(!It(t)||At(t))return!1;var e=Pt(t)||f(t)?Ge:be;return e.test(St(t))}function X(t){return xt(t)&&Dt(t.length)&&!!Ee[je.call(t)]}function Z(t){if(!kt(t))return Ze(t);var e=[];for(var n in Object(t))Be.call(t,n)&&"constructor"!=n&&e.push(n);return e}function J(t){if(!It(t))return wt(t);var e=kt(t),n=[];for(var r in t)("constructor"!=r||!e&&Be.call(t,r))&&n.push(r);return n}function Q(t,e,n,r,i){if(t!==e){if(!yn(e)&&!vn(e))var o=J(e);a(o||e,function(a,s){if(o&&(s=a,a=e[s]),It(a))i||(i=new x),tt(t,e,s,n,Q,r,i);else{var l=r?r(t[s],a,s+"",t,e,i):void 0;void 0===l&&(l=a),G(t,s,l)}})}}function tt(t,e,n,r,i,o,a){var s=t[n],l=e[n],u=a.get(l);if(u)return void G(t,n,u);var c=o?o(s,l,n+"",t,e,a):void 0,d=void 0===c;d&&(c=l,yn(l)||vn(l)?yn(s)?c=s:Ct(s)?c=ct(s):(d=!1,c=$(l,!0)):Nt(l)||Rt(l)?Rt(s)?c=Mt(s):!It(s)||r&&Pt(s)?(d=!1,c=$(l,!0)):c=s:d=!1),d&&(a.set(l,c),i(c,l,r,o,a),a.delete(l)),G(t,n,c)}function et(t,e){return e=Je(void 0===e?t.length-1:e,0),function(){for(var n=arguments,r=-1,i=Je(n.length-e,0),a=Array(i);++r<i;)a[r]=n[e+r];r=-1;for(var s=Array(e+1);++r<e;)s[r]=n[r];return s[e]=a,o(t,this,s)}}function nt(t,e){if(e)return t.slice();var n=new t.constructor(t.length);return t.copy(n),n}function rt(t){var e=new t.constructor(t.byteLength);return new Ke(e).set(new Ke(t)),e}function it(t,e){var n=e?rt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.byteLength)}function ot(t,e,n){var i=e?n(h(t),!0):h(t);return l(i,r,new t.constructor)}function at(t){var e=new t.constructor(t.source,me.exec(t));return e.lastIndex=t.lastIndex,e}function st(t,e,n){var r=e?n(y(t),!0):y(t);return l(r,i,new t.constructor)}function lt(t){return fn?Object(fn.call(t)):{}}function ut(t,e){var n=e?rt(t.buffer):t.buffer;return new t.constructor(n,t.byteOffset,t.length)}function ct(t,e){var n=-1,r=t.length;for(e||(e=Array(r));++n<r;)e[n]=t[n];return e}function dt(t,e,n,r){n||(n={});for(var i=-1,o=e.length;++i<o;){var a=e[i],s=r?r(n[a],t[a],a,n,t):void 0;Y(n,a,void 0===s?t[a]:s)}return n}function ft(t,e){return dt(t,hn(t),e)}function ht(t){return et(function(e,n){var r=-1,i=n.length,o=i>1?n[i-1]:void 0,a=i>2?n[2]:void 0;for(o=t.length>3&&"function"==typeof o?(i--,o):void 0,a&&Et(n[0],n[1],a)&&(o=i<3?void 0:o,i=1),e=Object(e);++r<i;){var s=n[r];s&&t(e,s,r,o)}return e})}function pt(t){return z(t,Ft,hn)}function yt(t,e){var n=t.__data__;return Tt(e)?n["string"==typeof e?"string":"hash"]:n.map}function gt(t,e){var n=d(t,e);return q(n)?n:void 0}function vt(t){var e=t.length,n=t.constructor(e);return e&&"string"==typeof t[0]&&Be.call(t,"index")&&(n.index=t.index,n.input=t.input),n}function mt(t){return"function"!=typeof t.constructor||kt(t)?{}:H($e(t))}function bt(t,e,n,r){var i=t.constructor;switch(e){case ae:return rt(t);case Ht:case zt:return new i(+t);case se:return it(t,r);case le:case ue:case ce:case de:case fe:case he:case pe:case ye:case ge:return ut(t,r);case Zt:return ot(t,r,n);case Jt:case re:return new i(t);case ee:return at(t);case ne:return st(t,r,n);case ie:return lt(t)}}function _t(t,e){return e=null==e?Vt:e,!!e&&("number"==typeof t||_e.test(t))&&t>-1&&t%1==0&&t<e}function Et(t,e,n){if(!It(n))return!1;var r=typeof e;return!!("number"==r?Ot(n)&&_t(e,n.length):"string"==r&&e in n)&&Lt(n[e],t)}function Tt(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function At(t){return!!Me&&Me in t}function kt(t){var e=t&&t.constructor,n="function"==typeof e&&e.prototype||xe;return t===n}function wt(t){var e=[];if(null!=t)for(var n in Object(t))e.push(n);return e}function St(t){if(null!=t){try{return Fe.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function Lt(t,e){return t===e||t!==t&&e!==e}function Rt(t){return Ct(t)&&Be.call(t,"callee")&&(!ze.call(t,"callee")||je.call(t)==Kt)}function Ot(t){return null!=t&&Dt(t.length)&&!Pt(t)}function Ct(t){return xt(t)&&Ot(t)}function Pt(t){var e=It(t)?je.call(t):"";return e==qt||e==Xt}function Dt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=Vt}function It(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function xt(t){return!!t&&"object"==typeof t}function Nt(t){if(!xt(t)||je.call(t)!=Qt||f(t))return!1;var e=$e(t);if(null===e)return!0;var n=Be.call(e,"constructor")&&e.constructor;return"function"==typeof n&&n instanceof n&&Fe.call(n)==Ue}function Mt(t){return dt(t,Bt(t))}function Ft(t){return Ot(t)?j(t):Z(t)}function Bt(t){return Ot(t)?j(t,!0):J(t)}function Ut(){return[]}function jt(){return!1}var Gt=200,Yt="__lodash_hash_undefined__",Vt=9007199254740991,Kt="[object Arguments]",$t="[object Array]",Ht="[object Boolean]",zt="[object Date]",Wt="[object Error]",qt="[object Function]",Xt="[object GeneratorFunction]",Zt="[object Map]",Jt="[object Number]",Qt="[object Object]",te="[object Promise]",ee="[object RegExp]",ne="[object Set]",re="[object String]",ie="[object Symbol]",oe="[object WeakMap]",ae="[object ArrayBuffer]",se="[object DataView]",le="[object Float32Array]",ue="[object Float64Array]",ce="[object Int8Array]",de="[object Int16Array]",fe="[object Int32Array]",he="[object Uint8Array]",pe="[object Uint8ClampedArray]",ye="[object Uint16Array]",ge="[object Uint32Array]",ve=/[\\^$.*+?()[\]{}|]/g,me=/\w*$/,be=/^\[object .+?Constructor\]$/,_e=/^(?:0|[1-9]\d*)$/,Ee={};Ee[le]=Ee[ue]=Ee[ce]=Ee[de]=Ee[fe]=Ee[he]=Ee[pe]=Ee[ye]=Ee[ge]=!0,Ee[Kt]=Ee[$t]=Ee[ae]=Ee[Ht]=Ee[se]=Ee[zt]=Ee[Wt]=Ee[qt]=Ee[Zt]=Ee[Jt]=Ee[Qt]=Ee[ee]=Ee[ne]=Ee[re]=Ee[oe]=!1;var Te={};Te[Kt]=Te[$t]=Te[ae]=Te[se]=Te[Ht]=Te[zt]=Te[le]=Te[ue]=Te[ce]=Te[de]=Te[fe]=Te[Zt]=Te[Jt]=Te[Qt]=Te[ee]=Te[ne]=Te[re]=Te[ie]=Te[he]=Te[pe]=Te[ye]=Te[ge]=!0,Te[Wt]=Te[qt]=Te[oe]=!1;var Ae="object"==typeof t&&t&&t.Object===Object&&t,ke="object"==typeof self&&self&&self.Object===Object&&self,we=Ae||ke||Function("return this")(),Se="object"==typeof e&&e&&!e.nodeType&&e,Le=Se&&"object"==typeof n&&n&&!n.nodeType&&n,Re=Le&&Le.exports===Se,Oe=Re&&Ae.process,Ce=function(){try{return Oe&&Oe.binding("util")}catch(t){}}(),Pe=Ce&&Ce.isTypedArray,De=Array.prototype,Ie=Function.prototype,xe=Object.prototype,Ne=we["__core-js_shared__"],Me=function(){var t=/[^.]+$/.exec(Ne&&Ne.keys&&Ne.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),Fe=Ie.toString,Be=xe.hasOwnProperty,Ue=Fe.call(Object),je=xe.toString,Ge=RegExp("^"+Fe.call(Be).replace(ve,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ye=Re?we.Buffer:void 0,Ve=we.Symbol,Ke=we.Uint8Array,$e=p(Object.getPrototypeOf,Object),He=Object.create,ze=xe.propertyIsEnumerable,We=De.splice,qe=Object.getOwnPropertySymbols,Xe=Ye?Ye.isBuffer:void 0,Ze=p(Object.keys,Object),Je=Math.max,Qe=gt(we,"DataView"),tn=gt(we,"Map"),en=gt(we,"Promise"),nn=gt(we,"Set"),rn=gt(we,"WeakMap"),on=gt(Object,"create"),an=St(Qe),sn=St(tn),ln=St(en),un=St(nn),cn=St(rn),dn=Ve?Ve.prototype:void 0,fn=dn?dn.valueOf:void 0;g.prototype.clear=v,g.prototype.delete=m,g.prototype.get=b,g.prototype.has=_,g.prototype.set=E,T.prototype.clear=A,T.prototype.delete=k,T.prototype.get=w,T.prototype.has=S,T.prototype.set=L,R.prototype.clear=O,R.prototype.delete=C,R.prototype.get=P,R.prototype.has=D,R.prototype.set=I,x.prototype.clear=N,x.prototype.delete=M,x.prototype.get=F,x.prototype.has=B,x.prototype.set=U;var hn=qe?p(qe,Object):Ut,pn=W;(Qe&&pn(new Qe(new ArrayBuffer(1)))!=se||tn&&pn(new tn)!=Zt||en&&pn(en.resolve())!=te||nn&&pn(new nn)!=ne||rn&&pn(new rn)!=oe)&&(pn=function(t){var e=je.call(t),n=e==Qt?t.constructor:void 0,r=n?St(n):void 0;if(r)switch(r){case an:return se;case sn:return Zt;case ln:return te;case un:return ne;case cn:return oe}return e});var yn=Array.isArray,gn=Xe||jt,vn=Pe?c(Pe):X,mn=ht(function(t,e,n){Q(t,e,n)});n.exports=mn}).call(e,function(){return this}(),n(23)(t))},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" fill="#010101" d="M1.712 14.76H6.43V1.24H1.71v13.52zm7.86-13.52v13.52h4.716V1.24H9.573z"></path></svg>'},function(t,e,n){t.exports=n.p+"a8c874b93b3d848f39a71260c57e3863.cur"},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(1),u=r(l),c=n(10),d=r(c),f=n(4),h=r(f),p=n(78),y=r(p),g=n(5),v=r(g),m=function(t){function e(n,r){i(this,e);var a=o(this,t.call(this,n));return a._i18n=r,a.currentTime=0,a.volume=100,a.playback=n.playback,a.settings=v.default.extend({},a.playback.settings),a.isReady=!1,a.mediaControlDisabled=!1,a.plugins=[a.playback],a.bindEvents(),a}return a(e,t),s(e,[{key:"name",get:function(){return"Container"}},{key:"attributes",get:function(){return{class:"container","data-container":""}}},{key:"events",get:function(){return{click:"clicked",dblclick:"dblClicked",doubleTap:"dblClicked",contextmenu:"onContextMenu",mouseenter:"mouseEnter",mouseleave:"mouseLeave"}}},{key:"ended",get:function(){return this.playback.ended}},{key:"buffering",get:function(){return this.playback.buffering}},{key:"i18n",get:function(){return this._i18n}}]),e.prototype.bindEvents=function(){this.listenTo(this.playback,u.default.PLAYBACK_PROGRESS,this.progress),this.listenTo(this.playback,u.default.PLAYBACK_TIMEUPDATE,this.timeUpdated),this.listenTo(this.playback,u.default.PLAYBACK_READY,this.ready),this.listenTo(this.playback,u.default.PLAYBACK_BUFFERING,this.onBuffering),this.listenTo(this.playback,u.default.PLAYBACK_BUFFERFULL,this.bufferfull),this.listenTo(this.playback,u.default.PLAYBACK_SETTINGSUPDATE,this.settingsUpdate),this.listenTo(this.playback,u.default.PLAYBACK_LOADEDMETADATA,this.loadedMetadata),this.listenTo(this.playback,u.default.PLAYBACK_HIGHDEFINITIONUPDATE,this.highDefinitionUpdate),this.listenTo(this.playback,u.default.PLAYBACK_BITRATE,this.updateBitrate),this.listenTo(this.playback,u.default.PLAYBACK_PLAYBACKSTATE,this.playbackStateChanged),this.listenTo(this.playback,u.default.PLAYBACK_DVR,this.playbackDvrStateChanged),this.listenTo(this.playback,u.default.PLAYBACK_MEDIACONTROL_DISABLE,this.disableMediaControl),this.listenTo(this.playback,u.default.PLAYBACK_MEDIACONTROL_ENABLE,this.enableMediaControl),this.listenTo(this.playback,u.default.PLAYBACK_ENDED,this.onEnded),this.listenTo(this.playback,u.default.PLAYBACK_PLAY,this.playing),this.listenTo(this.playback,u.default.PLAYBACK_PAUSE,this.paused),this.listenTo(this.playback,u.default.PLAYBACK_STOP,this.stopped),this.listenTo(this.playback,u.default.PLAYBACK_ERROR,this.error)},e.prototype.playbackStateChanged=function(t){this.trigger(u.default.CONTAINER_PLAYBACKSTATE,t)},e.prototype.playbackDvrStateChanged=function(t){this.settings=this.playback.settings,this.dvrInUse=t,this.trigger(u.default.CONTAINER_PLAYBACKDVRSTATECHANGED,t)},e.prototype.updateBitrate=function(t){this.trigger(u.default.CONTAINER_BITRATE,t)},e.prototype.statsReport=function(t){this.trigger(u.default.CONTAINER_STATS_REPORT,t)},e.prototype.getPlaybackType=function(){return this.playback.getPlaybackType()},e.prototype.isDvrEnabled=function(){return!!this.playback.dvrEnabled},e.prototype.isDvrInUse=function(){return!!this.dvrInUse},e.prototype.destroy=function(){this.trigger(u.default.CONTAINER_DESTROYED,this,this.name),this.stopListening(),this.plugins.forEach(function(t){return t.destroy()}),this.$el.remove()},e.prototype.setStyle=function(t){this.$el.css(t)},e.prototype.animate=function(t,e){return this.$el.animate(t,e).promise()},e.prototype.ready=function(){this.isReady=!0,this.trigger(u.default.CONTAINER_READY,this.name)},e.prototype.isPlaying=function(){return this.playback.isPlaying()},e.prototype.getStartTimeOffset=function(){return this.playback.getStartTimeOffset()},e.prototype.getCurrentTime=function(){return this.currentTime},e.prototype.getDuration=function(){return this.playback.getDuration()},e.prototype.error=function(t){this.isReady||this.ready(),this.trigger(u.default.CONTAINER_ERROR,{error:t,container:this},this.name)},e.prototype.loadedMetadata=function(t){this.trigger(u.default.CONTAINER_LOADEDMETADATA,t)},e.prototype.timeUpdated=function(t){this.currentTime=t.current,this.trigger(u.default.CONTAINER_TIMEUPDATE,t,this.name)},e.prototype.progress=function(){for(var t=arguments.length,e=Array(t),n=0;n<t;n++)e[n]=arguments[n];this.trigger.apply(this,[u.default.CONTAINER_PROGRESS].concat(e,[this.name]))},e.prototype.playing=function(){this.trigger(u.default.CONTAINER_PLAY,this.name)},e.prototype.paused=function(){this.trigger(u.default.CONTAINER_PAUSE,this.name)},e.prototype.play=function(){this.playback.play()},e.prototype.stop=function(){this.playback.stop(),this.currentTime=0},e.prototype.pause=function(){this.playback.pause()},e.prototype.onEnded=function(){this.trigger(u.default.CONTAINER_ENDED,this,this.name),this.currentTime=0},e.prototype.stopped=function(){this.trigger(u.default.CONTAINER_STOP)},e.prototype.clicked=function(){this.options.chromeless&&!this.options.allowUserInteraction||this.trigger(u.default.CONTAINER_CLICK,this,this.name)},e.prototype.dblClicked=function(){this.options.chromeless&&!this.options.allowUserInteraction||this.trigger(u.default.CONTAINER_DBLCLICK,this,this.name)},e.prototype.onContextMenu=function(){this.options.chromeless&&!this.options.allowUserInteraction||this.trigger(u.default.CONTAINER_CONTEXTMENU,this,this.name)},e.prototype.seek=function(t){this.trigger(u.default.CONTAINER_SEEK,t,this.name),this.playback.seek(t)},e.prototype.seekPercentage=function(t){var e=this.getDuration();if(t>=0&&t<=100){var n=e*(t/100);this.seek(n)}},e.prototype.setVolume=function(t){this.volume=parseInt(t,10),this.trigger(u.default.CONTAINER_VOLUME,t,this.name),this.playback.volume(t)},e.prototype.fullscreen=function(){this.trigger(u.default.CONTAINER_FULLSCREEN,this.name)},e.prototype.onBuffering=function(){this.trigger(u.default.CONTAINER_STATE_BUFFERING,this.name)},e.prototype.bufferfull=function(){this.trigger(u.default.CONTAINER_STATE_BUFFERFULL,this.name)},e.prototype.addPlugin=function(t){this.plugins.push(t)},e.prototype.hasPlugin=function(t){return!!this.getPlugin(t)},e.prototype.getPlugin=function(t){return this.plugins.filter(function(e){return e.name===t})[0]},e.prototype.mouseEnter=function(){this.options.chromeless&&!this.options.allowUserInteraction||this.trigger(u.default.CONTAINER_MOUSE_ENTER)},e.prototype.mouseLeave=function(){this.options.chromeless&&!this.options.allowUserInteraction||this.trigger(u.default.CONTAINER_MOUSE_LEAVE)},e.prototype.settingsUpdate=function(){this.settings=this.playback.settings,this.trigger(u.default.CONTAINER_SETTINGSUPDATE)},e.prototype.highDefinitionUpdate=function(t){this.trigger(u.default.CONTAINER_HIGHDEFINITIONUPDATE,t)},e.prototype.isHighDefinitionInUse=function(){return this.playback.isHighDefinitionInUse()},e.prototype.disableMediaControl=function(){this.mediaControlDisabled||(this.mediaControlDisabled=!0,this.trigger(u.default.CONTAINER_MEDIACONTROL_DISABLE))},e.prototype.enableMediaControl=function(){this.mediaControlDisabled&&(this.mediaControlDisabled=!1,this.trigger(u.default.CONTAINER_MEDIACONTROL_ENABLE))},e.prototype.updateStyle=function(){!this.options.chromeless||this.options.allowUserInteraction?this.$el.removeClass("chromeless"):this.$el.addClass("chromeless")},e.prototype.configure=function(t){this._options=v.default.extend(this._options,t),this.updateStyle(),this.trigger(u.default.CONTAINER_OPTIONS_CHANGE)},e.prototype.render=function(){var t=h.default.getStyleFor(y.default);return this.$el.append(t),this.$el.append(this.playback.render().el),this.updateStyle(),this},e}(d.default);e.default=m,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(9),u=r(l),c=n(1),d=r(c),f=n(24),h=r(f),p=n(5),y=r(p),g=n(100),v=r(g),m=function(t){function e(n,r,a){i(this,e);var s=o(this,t.call(this,n));return s._i18n=a,s.loader=r,s}return a(e,t),s(e,[{key:"options",get:function(){return this._options},set:function(t){this._options=t}}]),e.prototype.createContainers=function(){var t=this;return y.default.Deferred(function(e){e.resolve(t.options.sources.map(function(e){return t.createContainer(e)}))})},e.prototype.findPlaybackPlugin=function(t,e){return this.loader.playbackPlugins.filter(function(n){return n.canPlay(t,e)})[0]},e.prototype.createContainer=function(t){var e=null,n=this.options.mimeType;(0,v.default)(t)?(e=t.source.toString(),t.mimeType&&(n=t.mimeType)):e=t.toString(),e.match(/^\/\//)&&(e=window.location.protocol+e);var r=y.default.extend({},this.options,{src:e,mimeType:n}),i=this.findPlaybackPlugin(e,n),o=new i(r,this._i18n);r=y.default.extend({},r,{playback:o});var a=new h.default(r,this._i18n),s=y.default.Deferred();return s.promise(a),this.addContainerPlugins(a),this.listenToOnce(a,d.default.CONTAINER_READY,function(){return s.resolve(a)}),a},e.prototype.addContainerPlugins=function(t){this.loader.containerPlugins.forEach(function(e){t.addPlugin(new e(t))})},e}(u.default);e.default=m,t.exports=e.default},function(t,e,n){"use strict";t.exports=n(39)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(2),u=n(1),c=r(u),d=n(4),f=r(d),h=n(10),p=r(h),y=n(8),g=r(y),v=n(40),m=r(v),b=n(27),_=r(b),E=n(11),T=r(E),A=n(15),k=r(A),w=n(5),S=r(w),L=n(79),R=r(L),O=function(t){function e(n){i(this,e);var r=o(this,t.call(this,n));return r.playerInfo=k.default.getInstance(n.playerId),r.firstResize=!0,r.plugins=[],r.containers=[],r.setupMediaControl(null),r._boundFullscreenHandler=function(){return r.handleFullscreenChange()},(0,S.default)(document).bind("fullscreenchange",r._boundFullscreenHandler),(0,S.default)(document).bind("MSFullscreenChange",r._boundFullscreenHandler),(0,S.default)(document).bind("mozfullscreenchange",r._boundFullscreenHandler),r}return a(e,t),s(e,[{key:"events",get:function(){return{webkitfullscreenchange:"handleFullscreenChange",mousemove:"showMediaControl",mouseleave:"hideMediaControl"}}},{key:"attributes",get:function(){return{"data-player":"",tabindex:9999}}},{key:"isReady",get:function(){return!!this.ready}},{key:"i18n",get:function(){return this.getPlugin("strings")||{t:function(t){return t}}}}]),e.prototype.createContainers=function(t){var e=this;this.defer=S.default.Deferred(),this.defer.promise(this),this.containerFactory=new m.default(t,t.loader,this.i18n),this.containerFactory.createContainers().then(function(t){return e.setupContainers(t)}).then(function(t){return e.resolveOnContainersReady(t)})},e.prototype.updateSize=function(){l.Fullscreen.isFullscreen()?this.setFullscreen():this.setPlayerSize()},e.prototype.setFullscreen=function(){g.default.isiOS||(this.$el.addClass("fullscreen"),this.$el.removeAttr("style"),this.playerInfo.previousSize={width:this.options.width,height:this.options.height},this.playerInfo.currentSize={width:(0,S.default)(window).width(),height:(0,S.default)(window).height()})},e.prototype.setPlayerSize=function(){this.$el.removeClass("fullscreen"),this.playerInfo.currentSize=this.playerInfo.previousSize,this.playerInfo.previousSize={width:(0,S.default)(window).width(),height:(0,S.default)(window).height()},this.resize(this.playerInfo.currentSize)},e.prototype.resize=function(t){(0,l.isNumber)(t.height)||(0,l.isNumber)(t.width)?(this.el.style.height=t.height+"px",this.el.style.width=t.width+"px"):(this.el.style.height=""+t.height,this.el.style.width=""+t.width),this.playerInfo.previousSize={width:this.options.width,height:this.options.height},this.options.width=t.width,this.options.height=t.height,this.playerInfo.currentSize=t,this.triggerResize(this.playerInfo.currentSize)},e.prototype.enableResizeObserver=function(){var t=this,e=function(){t.playerInfo.computedSize.width==t.el.clientWidth&&t.playerInfo.computedSize.height==t.el.clientHeight||(t.playerInfo.computedSize={width:t.el.clientWidth,height:t.el.clientHeight},t.triggerResize(t.playerInfo.computedSize))};this.resizeObserverInterval=setInterval(e,500)},e.prototype.triggerResize=function(t){var e=this.firstResize||this.oldHeight!==t.height||this.oldWidth!==t.width;e&&(T.default.trigger(this.options.playerId+":"+c.default.PLAYER_RESIZE,t),this.oldHeight=t.height,this.oldWidth=t.width,this.firstResize=!1)},e.prototype.disableResizeObserver=function(){this.resizeObserverInterval&&clearInterval(this.resizeObserverInterval)},e.prototype.resolveOnContainersReady=function(t){var e=this;S.default.when.apply(S.default,t).done(function(){e.defer.resolve(e),e.ready=!0,e.trigger(c.default.CORE_READY)})},e.prototype.addPlugin=function(t){this.plugins.push(t)},e.prototype.hasPlugin=function(t){return!!this.getPlugin(t)},e.prototype.getPlugin=function(t){return this.plugins.filter(function(e){return e.name===t})[0]},e.prototype.load=function(t,e){var n=this;this.options.mimeType=e,t=t&&t.constructor===Array?t:[t],this.containers.forEach(function(t){return t.destroy()}),this.mediaControl.container=null,this.containerFactory.options=S.default.extend(this.options,{sources:t}),this.containerFactory.createContainers().then(function(t){n.setupContainers(t)})},e.prototype.destroy=function(){this.disableResizeObserver(),this.containers.forEach(function(t){return t.destroy()}),this.plugins.forEach(function(t){return t.destroy()}),this.$el.remove(),this.mediaControl.destroy(),(0,S.default)(document).unbind("fullscreenchange",this._boundFullscreenHandler),(0,S.default)(document).unbind("MSFullscreenChange",this._boundFullscreenHandler),(0,S.default)(document).unbind("mozfullscreenchange",this._boundFullscreenHandler)},e.prototype.handleFullscreenChange=function(){this.trigger(c.default.CORE_FULLSCREEN,l.Fullscreen.isFullscreen()),this.updateSize(),this.mediaControl.show()},e.prototype.setMediaControlContainer=function(t){this.mediaControl.setContainer(t),this.mediaControl.render()},e.prototype.disableMediaControl=function(){this.mediaControl.disable(),this.$el.removeClass("nocursor")},e.prototype.enableMediaControl=function(){this.mediaControl.enable()},e.prototype.removeContainer=function(t){this.stopListening(t),this.containers=this.containers.filter(function(e){return e!==t})},e.prototype.appendContainer=function(t){this.listenTo(t,c.default.CONTAINER_DESTROYED,this.removeContainer),this.containers.push(t)},e.prototype.setupContainers=function(t){return t.map(this.appendContainer.bind(this)),this.trigger(c.default.CORE_CONTAINERS_CREATED),this.renderContainers(),this.setupMediaControl(this.getCurrentContainer()),this.render(),this.$el.appendTo(this.options.parentElement),this.containers},e.prototype.renderContainers=function(){var t=this;this.containers.map(function(e){return t.el.appendChild(e.render().el)})},e.prototype.createContainer=function(t,e){var n=this.containerFactory.createContainer(t,e);return this.appendContainer(n),this.el.appendChild(n.render().el),n},e.prototype.setupMediaControl=function(t){this.mediaControl?this.mediaControl.setContainer(t):(this.mediaControl=this.createMediaControl(S.default.extend({container:t,focusElement:this.el},this.options)),this.listenTo(this.mediaControl,c.default.MEDIACONTROL_FULLSCREEN,this.toggleFullscreen),this.listenTo(this.mediaControl,c.default.MEDIACONTROL_SHOW,this.onMediaControlShow.bind(this,!0)),this.listenTo(this.mediaControl,c.default.MEDIACONTROL_HIDE,this.onMediaControlShow.bind(this,!1)))},e.prototype.createMediaControl=function(t){return t.mediacontrol&&t.mediacontrol.external?new t.mediacontrol.external(t).render():new _.default(t).render()},e.prototype.getCurrentContainer=function(){return this.mediaControl&&this.mediaControl.container?this.mediaControl.container:this.containers[0]},e.prototype.getCurrentPlayback=function(){var t=this.getCurrentContainer();return t&&t.playback},e.prototype.getPlaybackType=function(){var t=this.getCurrentContainer();return t&&t.getPlaybackType()},e.prototype.toggleFullscreen=function(){l.Fullscreen.isFullscreen()?(l.Fullscreen.cancelFullscreen(),g.default.isiOS||this.$el.removeClass("fullscreen nocursor")):(l.Fullscreen.requestFullscreen(this.el),g.default.isiOS||this.$el.addClass("fullscreen")),this.mediaControl.show()},e.prototype.showMediaControl=function(t){this.mediaControl.show(t)},e.prototype.hideMediaControl=function(){this.mediaControl.hide(this.options.hideMediaControlDelay)},e.prototype.onMediaControlShow=function(t){this.getCurrentContainer().trigger(t?c.default.CONTAINER_MEDIACONTROL_SHOW:c.default.CONTAINER_MEDIACONTROL_HIDE),t?this.$el.removeClass("nocursor"):l.Fullscreen.isFullscreen()&&this.$el.addClass("nocursor")},e.prototype.configure=function(t){var e=this;this._options=S.default.extend(this._options,t);var n=t.source||t.sources;n?this.load(n,t.mimeType||this.options.mimeType):(this.trigger(c.default.CORE_OPTIONS_CHANGE),this.containers.forEach(function(t){t.configure(e.options)}))},e.prototype.render=function(){var t=f.default.getStyleFor(R.default,{baseUrl:this.options.baseUrl});this.$el.append(t),this.$el.append(this.mediaControl.render().el),this.options.width=this.options.width||this.$el.width(),this.options.height=this.options.height||this.$el.height();var e={width:this.options.width,height:this.options.height};return this.playerInfo.previousSize=this.playerInfo.currentSize=this.playerInfo.computedSize=e,this.updateSize(),this.previousSize={width:this.$el.width(),height:this.$el.height()},this.enableResizeObserver(),this},e}(p.default);e.default=O,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(9),u=r(l),c=n(25),d=r(c),f=function(t){function e(n){i(this,e);var r=o(this,t.call(this));return r.player=n,r._options=n.options,r}return a(e,t),s(e,[{key:"loader",get:function(){return this.player.loader}}]),e.prototype.create=function(){return this.options.loader=this.loader,this.core=new d.default(this.options),this.addCorePlugins(),this.core.createContainers(this.options),this.core},e.prototype.addCorePlugins=function(){
+var t=this;return this.loader.corePlugins.forEach(function(e){var n=new e(t.core);t.core.addPlugin(n),t.setupExternalInterface(n)}),this.core},e.prototype.setupExternalInterface=function(t){var e=t.getExternalInterface();for(var n in e)this.player[n]=e[n].bind(t)},e}(u.default);e.default=f,t.exports=e.default},function(t,e,n){"use strict";t.exports=n(42)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=n(9),l=r(s),u=n(15),c=r(u),d=n(103),f=r(d),h=n(16),p=r(h),y=n(28),g=r(y),v=n(31),m=r(v),b=n(29),_=r(b),E=n(30),T=r(E),A=n(32),k=r(A),w=n(33),S=r(w),L=n(70),R=r(L),O=n(72),C=r(O),P=n(75),D=r(P),I=n(34),x=r(I),N=n(64),M=r(N),F=n(57),B=r(F),U=n(59),j=r(U),G=n(62),Y=r(G),V=n(67),K=r(V),$=n(69),H=r($),z=n(60),W=r(z),q=n(74),X=r(q),Z=function(t){function e(n,r){i(this,e);var a=o(this,t.call(this));return a.playerId=r,a.playbackPlugins=[T.default,p.default,m.default,g.default,_.default,k.default,S.default],a.containerPlugins=[R.default,D.default,x.default,C.default,M.default,B.default],a.corePlugins=[j.default,Y.default,K.default,H.default,W.default,X.default],n&&(Array.isArray(n)||a.validateExternalPluginsType(n),a.addExternalPlugins(n)),a}return a(e,t),e.prototype.groupPluginsByType=function(t){return Array.isArray(t)&&(t=t.reduce(function(t,e){return t[e.type]||(t[e.type]=[]),t[e.type].push(e),t},{})),t},e.prototype.addExternalPlugins=function(t){t=this.groupPluginsByType(t);var e=function(t){return t.prototype.name};t.playback&&(this.playbackPlugins=(0,f.default)(t.playback.concat(this.playbackPlugins),e)),t.container&&(this.containerPlugins=(0,f.default)(t.container.concat(this.containerPlugins),e)),t.core&&(this.corePlugins=(0,f.default)(t.core.concat(this.corePlugins),e)),c.default.getInstance(this.playerId).playbackPlugins=this.playbackPlugins},e.prototype.validateExternalPluginsType=function(t){var e=["playback","container","core"];e.forEach(function(e){(t[e]||[]).forEach(function(t){var n="external "+t.type+" plugin on "+e+" array";if(t.type!==e)throw new ReferenceError(n)})})},e}(l.default);e.default=Z,t.exports=e.default},function(t,e,n){(function(r){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=n(2),c=n(20),d=n(1),f=i(d),h=n(4),p=i(h),y=n(10),g=i(y),v=n(8),m=i(v),b=n(11),_=i(b),E=n(6),T=i(E),A=n(3),k=i(A),w=n(5),S=i(w),L=n(35),R=i(L),O=n(80),C=i(O),P=n(91),D=i(P),I=n(22),x=i(I),N=n(36),M=i(N),F=n(104),B=i(F),U=n(105),j=i(U),G=n(106),Y=i(G),V=n(107),K=i(V),$=n(108),H=i($),z=n(109),W=i(z),q=function(t){function e(n){o(this,e);var r=a(this,t.call(this,n));r.persistConfig=r.options.persistConfig,r.container=n.container,r.currentPositionValue=null,r.currentDurationValue=null;var i=r.persistConfig?u.Config.restore("volume"):100;return r.setVolume(r.options.mute?0:i),r.keepVisible=!1,r.fullScreenOnVideoTagSupported=null,r.addEventListeners(),r.settings={left:["play","stop","pause"],right:["volume"],default:["position","seekbar","duration"]},r.container?S.default.isEmptyObject(r.container.settings)||(r.settings=S.default.extend({},r.container.settings)):r.settings={},r.userDisabled=!1,(r.container&&r.container.mediaControlDisabled||r.options.chromeless)&&r.disable(),r.stopDragHandler=function(t){return r.stopDrag(t)},r.updateDragHandler=function(t){return r.updateDrag(t)},(0,S.default)(document).bind("mouseup",r.stopDragHandler),(0,S.default)(document).bind("mousemove",r.updateDragHandler),r}return s(e,t),l(e,[{key:"name",get:function(){return"MediaControl"}},{key:"disabled",get:function(){return this.userDisabled||this.container&&this.container.getPlaybackType()===k.default.NO_OP}},{key:"attributes",get:function(){return{class:"media-control","data-media-control":""}}},{key:"events",get:function(){return{"click [data-play]":"play","click [data-pause]":"pause","click [data-playpause]":"togglePlayPause","click [data-stop]":"stop","click [data-playstop]":"togglePlayStop","click [data-fullscreen]":"toggleFullscreen","click .bar-container[data-seekbar]":"seek","click .bar-container[data-volume]":"onVolumeClick","click .drawer-icon[data-volume]":"toggleMute","mouseenter .drawer-container[data-volume]":"showVolumeBar","mouseleave .drawer-container[data-volume]":"hideVolumeBar","mousedown .bar-container[data-volume]":"startVolumeDrag","mousemove .bar-container[data-volume]":"mousemoveOnVolumeBar","mousedown .bar-scrubber[data-seekbar]":"startSeekDrag","mousemove .bar-container[data-seekbar]":"mousemoveOnSeekBar","mouseleave .bar-container[data-seekbar]":"mouseleaveOnSeekBar","mouseenter .media-control-layer[data-controls]":"setUserKeepVisible","mouseleave .media-control-layer[data-controls]":"resetUserKeepVisible"}}},{key:"template",get:function(){return(0,T.default)(D.default)}},{key:"stylesheet",get:function(){return p.default.getStyleFor(C.default,{baseUrl:this.options.baseUrl})}},{key:"volume",get:function(){return this.container&&this.container.isReady?this.container.volume:this.intendedVolume}},{key:"muted",get:function(){return 0===this.volume}}]),e.prototype.addEventListeners=function(){this.container&&(_.default.on(this.options.playerId+":"+f.default.PLAYER_RESIZE,this.playerResize,this),this.listenTo(this.container,f.default.CONTAINER_PLAY,this.changeTogglePlay),this.listenTo(this.container,f.default.CONTAINER_PAUSE,this.changeTogglePlay),this.listenTo(this.container,f.default.CONTAINER_DBLCLICK,this.toggleFullscreen),this.listenTo(this.container,f.default.CONTAINER_TIMEUPDATE,this.onTimeUpdate),this.listenTo(this.container,f.default.CONTAINER_PROGRESS,this.updateProgressBar),this.listenTo(this.container,f.default.CONTAINER_SETTINGSUPDATE,this.settingsUpdate),this.listenTo(this.container,f.default.CONTAINER_PLAYBACKDVRSTATECHANGED,this.settingsUpdate),this.listenTo(this.container,f.default.CONTAINER_HIGHDEFINITIONUPDATE,this.highDefinitionUpdate),this.listenTo(this.container,f.default.CONTAINER_MEDIACONTROL_DISABLE,this.disable),this.listenTo(this.container,f.default.CONTAINER_MEDIACONTROL_ENABLE,this.enable),this.listenTo(this.container,f.default.CONTAINER_ENDED,this.ended),this.listenTo(this.container,f.default.CONTAINER_VOLUME,this.onVolumeChanged),"video"===this.container.playback.el.nodeName.toLowerCase()&&this.listenToOnce(this.container,f.default.CONTAINER_LOADEDMETADATA,this.onLoadedMetadataOnVideoTag))},e.prototype.disable=function(){this.userDisabled=!0,this.hide(),this.$el.hide()},e.prototype.enable=function(){this.options.chromeless||(this.userDisabled=!1,this.show())},e.prototype.play=function(){this.container.play()},e.prototype.pause=function(){this.container.pause()},e.prototype.stop=function(){this.container.stop()},e.prototype.onVolumeChanged=function(){this.updateVolumeUI()},e.prototype.onLoadedMetadataOnVideoTag=function(){var t=this.container.playback.el;!u.Fullscreen.fullscreenEnabled()&&t.webkitSupportsFullscreen&&(this.fullScreenOnVideoTagSupported=!0,this.settingsUpdate())},e.prototype.updateVolumeUI=function(){if(this.rendered){this.$volumeBarContainer.find(".bar-fill-2").css({});var t=this.$volumeBarContainer.width(),e=this.$volumeBarBackground.width(),n=(t-e)/2,r=e*this.volume/100+n;this.$volumeBarFill.css({width:this.volume+"%"}),this.$volumeBarScrubber.css({left:r}),this.$volumeBarContainer.find(".segmented-bar-element").removeClass("fill");var i=Math.ceil(this.volume/10);this.$volumeBarContainer.find(".segmented-bar-element").slice(0,i).addClass("fill"),this.$volumeIcon.html(""),this.$volumeIcon.removeClass("muted"),this.muted?(this.$volumeIcon.append(Y.default),this.$volumeIcon.addClass("muted")):this.$volumeIcon.append(j.default),this.applyButtonStyle(this.$volumeIcon)}},e.prototype.changeTogglePlay=function(){this.$playPauseToggle.html(""),this.$playStopToggle.html(""),this.container&&this.container.isPlaying()?(this.$playPauseToggle.append(M.default),this.$playStopToggle.append(B.default),this.trigger(f.default.MEDIACONTROL_PLAYING)):(this.$playPauseToggle.append(x.default),this.$playStopToggle.append(x.default),this.trigger(f.default.MEDIACONTROL_NOTPLAYING),m.default.isMobile&&this.show()),this.applyButtonStyle(this.$playPauseToggle),this.applyButtonStyle(this.$playStopToggle)},e.prototype.mousemoveOnSeekBar=function(t){if(this.settings.seekEnabled){var e=t.pageX-this.$seekBarContainer.offset().left-this.$seekBarHover.width()/2;this.$seekBarHover.css({left:e})}this.trigger(f.default.MEDIACONTROL_MOUSEMOVE_SEEKBAR,t)},e.prototype.mouseleaveOnSeekBar=function(t){this.trigger(f.default.MEDIACONTROL_MOUSELEAVE_SEEKBAR,t)},e.prototype.onVolumeClick=function(t){this.setVolume(this.getVolumeFromUIEvent(t))},e.prototype.mousemoveOnVolumeBar=function(t){this.draggingVolumeBar&&this.setVolume(this.getVolumeFromUIEvent(t))},e.prototype.playerResize=function(t){this.$fullscreenToggle.html(""),u.Fullscreen.isFullscreen()?this.$fullscreenToggle.append(H.default):this.$fullscreenToggle.append(K.default),this.applyButtonStyle(this.$fullscreenToggle),this.$el.removeClass("w320"),(t.width<=320||this.options.hideVolumeBar)&&this.$el.addClass("w320")},e.prototype.togglePlayPause=function(){return this.container.isPlaying()?this.container.pause():this.container.play(),!1},e.prototype.togglePlayStop=function(){this.container.isPlaying()?this.container.stop():this.container.play()},e.prototype.startSeekDrag=function(t){this.settings.seekEnabled&&(this.draggingSeekBar=!0,this.$el.addClass("dragging"),this.$seekBarLoaded.addClass("media-control-notransition"),this.$seekBarPosition.addClass("media-control-notransition"),this.$seekBarScrubber.addClass("media-control-notransition"),t&&t.preventDefault())},e.prototype.startVolumeDrag=function(t){this.draggingVolumeBar=!0,this.$el.addClass("dragging"),t&&t.preventDefault()},e.prototype.stopDrag=function(t){this.draggingSeekBar&&this.seek(t),this.$el.removeClass("dragging"),this.$seekBarLoaded.removeClass("media-control-notransition"),this.$seekBarPosition.removeClass("media-control-notransition"),this.$seekBarScrubber.removeClass("media-control-notransition dragging"),this.draggingSeekBar=!1,this.draggingVolumeBar=!1},e.prototype.updateDrag=function(t){if(this.draggingSeekBar){t.preventDefault();var e=t.pageX-this.$seekBarContainer.offset().left,n=e/this.$seekBarContainer.width()*100;n=Math.min(100,Math.max(n,0)),this.setSeekPercentage(n)}else this.draggingVolumeBar&&(t.preventDefault(),this.setVolume(this.getVolumeFromUIEvent(t)))},e.prototype.getVolumeFromUIEvent=function(t){var e=t.pageX-this.$volumeBarContainer.offset().left,n=e/this.$volumeBarContainer.width()*100;return n},e.prototype.toggleMute=function(){this.setVolume(this.muted?100:0)},e.prototype.setVolume=function(t){var e=this;t=Math.min(100,Math.max(t,0)),this.intendedVolume=t,this.persistConfig&&u.Config.persist("volume",t);var n=function(){e.container.isReady?e.container.setVolume(t):e.listenToOnce(e.container,f.default.CONTAINER_READY,function(){e.container.setVolume(t)})};this.container?n():this.listenToOnce(this,f.default.MEDIACONTROL_CONTAINERCHANGED,function(){n()})},e.prototype.toggleFullscreen=function(){this.trigger(f.default.MEDIACONTROL_FULLSCREEN,this.name),this.container.fullscreen(),this.resetUserKeepVisible()},e.prototype.setContainer=function(t){this.container&&(this.stopListening(this.container),this.fullScreenOnVideoTagSupported=null),_.default.off(this.options.playerId+":"+f.default.PLAYER_RESIZE,this.playerResize,this),this.container=t,this.setVolume(this.intendedVolume),this.changeTogglePlay(),this.addEventListeners(),this.settingsUpdate(),this.container.trigger(f.default.CONTAINER_PLAYBACKDVRSTATECHANGED,this.container.isDvrInUse()),this.container.mediaControlDisabled&&this.disable(),this.trigger(f.default.MEDIACONTROL_CONTAINERCHANGED)},e.prototype.showVolumeBar=function(){this.hideVolumeId&&clearTimeout(this.hideVolumeId),this.$volumeBarContainer.removeClass("volume-bar-hide")},e.prototype.hideVolumeBar=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:400;this.$volumeBarContainer&&(this.draggingVolumeBar?this.hideVolumeId=setTimeout(function(){return t.hideVolumeBar()},e):(this.hideVolumeId&&clearTimeout(this.hideVolumeId),this.hideVolumeId=setTimeout(function(){return t.$volumeBarContainer.addClass("volume-bar-hide")},e)))},e.prototype.ended=function(){this.changeTogglePlay()},e.prototype.updateProgressBar=function(t){var e=t.start/t.total*100,n=t.current/t.total*100;this.$seekBarLoaded.css({left:e+"%",width:n-e+"%"})},e.prototype.onTimeUpdate=function(t){if(!this.draggingSeekBar){var e=t.current<0?t.total:t.current;this.currentPositionValue=e,this.currentDurationValue=t.total,this.renderSeekBar()}},e.prototype.renderSeekBar=function(){if(null!==this.currentPositionValue&&null!==this.currentDurationValue){this.currentSeekBarPercentage=100,(this.container.getPlaybackType()!==k.default.LIVE||this.container.isDvrInUse())&&(this.currentSeekBarPercentage=this.currentPositionValue/this.currentDurationValue*100),this.setSeekPercentage(this.currentSeekBarPercentage);var t=(0,u.formatTime)(this.currentPositionValue),e=(0,u.formatTime)(this.currentDurationValue);t!==this.displayedPosition&&(this.$position.text(t),this.displayedPosition=t),e!==this.displayedDuration&&(this.$duration.text(e),this.displayedDuration=e)}},e.prototype.seek=function(t){if(this.settings.seekEnabled){var e=t.pageX-this.$seekBarContainer.offset().left,n=e/this.$seekBarContainer.width()*100;return n=Math.min(100,Math.max(n,0)),this.container.seekPercentage(n),this.setSeekPercentage(n),!1}},e.prototype.setKeepVisible=function(){this.keepVisible=!0},e.prototype.resetKeepVisible=function(){this.keepVisible=!1},e.prototype.setUserKeepVisible=function(){this.userKeepVisible=!0},e.prototype.resetUserKeepVisible=function(){this.userKeepVisible=!1},e.prototype.isVisible=function(){return!this.$el.hasClass("media-control-hide")},e.prototype.show=function(t){var e=this;if(!this.disabled){var n=2e3;(!t||t.clientX!==this.lastMouseX&&t.clientY!==this.lastMouseY||navigator.userAgent.match(/firefox/i))&&(clearTimeout(this.hideId),this.$el.show(),this.trigger(f.default.MEDIACONTROL_SHOW,this.name),this.$el.removeClass("media-control-hide"),this.hideId=setTimeout(function(){return e.hide()},n),t&&(this.lastMouseX=t.clientX,this.lastMouseY=t.clientY))}},e.prototype.hide=function(){var t=this,e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(this.isVisible()&&(!m.default.isMobile||this.container.isPlaying())){var n=e||2e3;clearTimeout(this.hideId),(this.disabled||this.options.hideMediaControl!==!1)&&(!this.disabled&&(e||this.userKeepVisible||this.keepVisible||this.draggingSeekBar||this.draggingVolumeBar)?this.hideId=setTimeout(function(){return t.hide()},n):(this.trigger(f.default.MEDIACONTROL_HIDE,this.name),this.$el.addClass("media-control-hide"),this.hideVolumeBar(0)))}},e.prototype.settingsUpdate=function(){var t=this.getSettings();!t||this.fullScreenOnVideoTagSupported||u.Fullscreen.fullscreenEnabled()||(t.default&&(0,u.removeArrayItem)(t.default,"fullscreen"),t.left&&(0,u.removeArrayItem)(t.left,"fullscreen"),t.right&&(0,u.removeArrayItem)(t.right,"fullscreen"));var e=JSON.stringify(this.settings)!==JSON.stringify(t);e&&(this.settings=t,this.render())},e.prototype.getSettings=function(){return(0,R.default)({},this.container.settings)},e.prototype.highDefinitionUpdate=function(t){var e=t?"addClass":"removeClass";this.$hdIndicator[e]("enabled")},e.prototype.createCachedElements=function(){var t=this.$el.find(".media-control-layer");this.$duration=t.find(".media-control-indicator[data-duration]"),this.$fullscreenToggle=t.find("button.media-control-button[data-fullscreen]"),this.$playPauseToggle=t.find("button.media-control-button[data-playpause]"),this.$playStopToggle=t.find("button.media-control-button[data-playstop]"),this.$position=t.find(".media-control-indicator[data-position]"),this.$seekBarContainer=t.find(".bar-container[data-seekbar]"),this.$seekBarHover=t.find(".bar-hover[data-seekbar]"),this.$seekBarLoaded=t.find(".bar-fill-1[data-seekbar]"),this.$seekBarPosition=t.find(".bar-fill-2[data-seekbar]"),this.$seekBarScrubber=t.find(".bar-scrubber[data-seekbar]"),this.$volumeBarContainer=t.find(".bar-container[data-volume]"),this.$volumeContainer=t.find(".drawer-container[data-volume]"),this.$volumeIcon=t.find(".drawer-icon[data-volume]"),this.$volumeBarBackground=this.$el.find(".bar-background[data-volume]"),this.$volumeBarFill=this.$el.find(".bar-fill-1[data-volume]"),this.$volumeBarScrubber=this.$el.find(".bar-scrubber[data-volume]"),this.$hdIndicator=this.$el.find("button.media-control-button[data-hd-indicator]"),this.resetIndicators(),this.initializeIcons()},e.prototype.resetIndicators=function(){this.displayedPosition=this.$position.text(),this.displayedDuration=this.$duration.text()},e.prototype.initializeIcons=function(){var t=this.$el.find(".media-control-layer");t.find("button.media-control-button[data-play]").append(x.default),t.find("button.media-control-button[data-pause]").append(M.default),t.find("button.media-control-button[data-stop]").append(B.default),this.$playPauseToggle.append(x.default),this.$playStopToggle.append(x.default),this.$volumeIcon.append(j.default),this.$fullscreenToggle.append(K.default),this.$hdIndicator.append(W.default)},e.prototype.setSeekPercentage=function(t){t=Math.max(Math.min(t,100),0),this.displayedSeekBarPercentage!==t&&(this.displayedSeekBarPercentage=t,this.$seekBarPosition.removeClass("media-control-notransition"),this.$seekBarScrubber.removeClass("media-control-notransition"),this.$seekBarPosition.css({width:t+"%"}),this.$seekBarScrubber.css({left:t+"%"}))},e.prototype.seekRelative=function(t){if(this.settings.seekEnabled){var e=this.container.getCurrentTime(),n=this.container.getDuration(),r=Math.min(Math.max(e+t,0),n);r=Math.min(100*r/n,100),this.container.seekPercentage(r)}},e.prototype.bindKeyEvents=function(){var t=this;this.unbindKeyEvents(),this.kibo=new c.Kibo(this.options.focusElement),this.kibo.down(["space"],function(){return t.togglePlayPause()}),this.kibo.down(["left"],function(){return t.seekRelative(-15)}),this.kibo.down(["right"],function(){return t.seekRelative(15)});var e=[1,2,3,4,5,6,7,8,9,0];e.forEach(function(e){t.kibo.down(e.toString(),function(){return t.settings.seekEnabled&&t.container.seekPercentage(10*e)})})},e.prototype.unbindKeyEvents=function(){this.kibo&&(this.kibo.off("space"),this.kibo.off("left"),this.kibo.off("right"),this.kibo.off([1,2,3,4,5,6,7,8,9,0]))},e.prototype.parseColors=function(){if(this.options.mediacontrol){this.buttonsColor=this.options.mediacontrol.buttons;var t=this.options.mediacontrol.seekbar;this.$el.find(".bar-fill-2[data-seekbar]").css("background-color",t),this.$el.find(".media-control-icon svg path").css("fill",this.buttonsColor),this.$el.find(".segmented-bar-element[data-volume]").css("boxShadow","inset 2px 0 0 "+this.buttonsColor)}},e.prototype.applyButtonStyle=function(t){this.buttonsColor&&t&&(0,S.default)(t).find("svg path").css("fill",this.buttonsColor)},e.prototype.destroy=function(){this.remove(),(0,S.default)(document).unbind("mouseup",this.stopDragHandler),(0,S.default)(document).unbind("mousemove",this.updateDragHandler),this.unbindKeyEvents()},e.prototype.render=function(){var t=this,e=1e3;this.$el.html(this.template({settings:this.settings})),this.$el.append(this.stylesheet),this.createCachedElements(),this.$playPauseToggle.addClass("paused"),this.$playStopToggle.addClass("stopped"),this.changeTogglePlay(),this.hideId=setTimeout(function(){return t.hide()},e),this.disabled&&this.hide(),m.default.isSafari&&m.default.isMobile&&this.$volumeContainer.css("display","none"),this.$seekBarPosition.addClass("media-control-notransition"),this.$seekBarScrubber.addClass("media-control-notransition");var n=0;return this.displayedSeekBarPercentage&&(n=this.displayedSeekBarPercentage),this.displayedSeekBarPercentage=null,this.setSeekPercentage(n),r.nextTick(function(){t.settings.seekEnabled||t.$seekBarContainer.addClass("seek-disabled"),t.options.disableKeyboardShortcuts||t.bindKeyEvents(),t.playerResize({width:t.options.width,height:t.options.height}),t.hideVolumeBar(0)}),this.parseColors(),this.highDefinitionUpdate(),this.rendered=!0,this.updateVolumeUI(),this.trigger(f.default.MEDIACONTROL_RENDERED),this},e}(g.default);e.default=q,q.extend=function(t){return(0,u.extend)(q,t)},t.exports=e.default}).call(e,n(21))},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(2),u=n(9),c=r(u),d=n(1),f=r(d),h=n(8),p=r(h),y=n(43),g=r(y),v=n(26),m=r(v),b=n(15),_=r(b),E=n(5),T=r(E),A=(0,l.currentScriptUrl)().replace(/\/[^\/]+$/,""),k=function(t){function e(n){i(this,e);var r=o(this,t.call(this,n)),a={playerId:(0,l.uniqueId)(""),persistConfig:!0,width:640,height:360,baseUrl:A,allowUserInteraction:p.default.isMobile};return r._options=T.default.extend(a,n),r.options.sources=r._normalizeSources(n),r.options.chromeless||(r.options.allowUserInteraction=!0),r.options.allowUserInteraction||(r.options.disableKeyboardShortcuts=!0),r._registerOptionEventListeners(),r._coreFactory=new g.default(r),r.playerInfo=_.default.getInstance(r.options.playerId),r.playerInfo.currentSize={width:n.width,height:n.height},r.playerInfo.options=r.options,r.options.parentId?r.setParentId(r.options.parentId):r.options.parent&&r.attachTo(r.options.parent),r}return a(e,t),s(e,[{key:"loader",set:function(t){this._loader=t},get:function(){return this._loader||(this._loader=new m.default(this.options.plugins||{},this.options.playerId)),this._loader}},{key:"ended",get:function(){return this.core.mediaControl.container.ended}},{key:"buffering",get:function(){return this.core.mediaControl.container.buffering}},{key:"isReady",get:function(){return!!this._ready}},{key:"eventsMapping",get:function(){return{onReady:f.default.PLAYER_READY,onResize:f.default.PLAYER_RESIZE,onPlay:f.default.PLAYER_PLAY,onPause:f.default.PLAYER_PAUSE,onStop:f.default.PLAYER_STOP,onEnded:f.default.PLAYER_ENDED,onSeek:f.default.PLAYER_SEEK,onError:f.default.PLAYER_ERROR,onTimeUpdate:f.default.PLAYER_TIMEUPDATE,onVolumeUpdate:f.default.PLAYER_VOLUMEUPDATE}}}]),e.prototype.setParentId=function(t){var e=document.querySelector(t);return e&&this.attachTo(e),this},e.prototype.attachTo=function(t){return this.options.parentElement=t,this.core=this._coreFactory.create(),this._addEventListeners(),this},e.prototype._addEventListeners=function(){return this.core.isReady?this._onReady():this.listenToOnce(this.core,f.default.CORE_READY,this._onReady),this.listenTo(this.core.mediaControl,f.default.MEDIACONTROL_CONTAINERCHANGED,this._containerChanged),this.listenTo(this.core,f.default.CORE_FULLSCREEN,this._onFullscreenChange),this},e.prototype._addContainerEventListeners=function(){var t=this.core.mediaControl.container;return t&&(this.listenTo(t,f.default.CONTAINER_PLAY,this._onPlay),this.listenTo(t,f.default.CONTAINER_PAUSE,this._onPause),this.listenTo(t,f.default.CONTAINER_STOP,this._onStop),this.listenTo(t,f.default.CONTAINER_ENDED,this._onEnded),this.listenTo(t,f.default.CONTAINER_SEEK,this._onSeek),this.listenTo(t,f.default.CONTAINER_ERROR,this._onError),this.listenTo(t,f.default.CONTAINER_TIMEUPDATE,this._onTimeUpdate),this.listenTo(t,f.default.CONTAINER_VOLUME,this._onVolumeUpdate)),this},e.prototype._registerOptionEventListeners=function(){var t=this,e=this.options.events||{};return Object.keys(e).forEach(function(n){var r=t.eventsMapping[n];if(r){var i=e[n];i="function"==typeof i&&i,i&&t.on(r,i)}}),this},e.prototype._containerChanged=function(){this.stopListening(),this._addEventListeners()},e.prototype._onReady=function(){this._ready=!0,this._addContainerEventListeners(),this.trigger(f.default.PLAYER_READY)},e.prototype._onFullscreenChange=function(t){this.trigger(f.default.PLAYER_FULLSCREEN,t)},e.prototype._onVolumeUpdate=function(t){this.trigger(f.default.PLAYER_VOLUMEUPDATE,t)},e.prototype._onPlay=function(){this.trigger(f.default.PLAYER_PLAY)},e.prototype._onPause=function(){this.trigger(f.default.PLAYER_PAUSE)},e.prototype._onStop=function(){this.trigger(f.default.PLAYER_STOP,this.getCurrentTime())},e.prototype._onEnded=function(){this.trigger(f.default.PLAYER_ENDED)},e.prototype._onSeek=function(t){this.trigger(f.default.PLAYER_SEEK,t)},e.prototype._onTimeUpdate=function(t){this.trigger(f.default.PLAYER_TIMEUPDATE,t)},e.prototype._onError=function(t){this.trigger(f.default.PLAYER_ERROR,t)},e.prototype._normalizeSources=function(t){var e=t.sources||(void 0!==t.source?[t.source]:[]);return 0===e.length?[{source:"",mimeType:""}]:e},e.prototype.resize=function(t){return this.core.resize(t),this},e.prototype.load=function(t,e,n){return void 0!==n&&this.configure({autoPlay:!!n}),this.core.load(t,e),this},e.prototype.destroy=function(){return this.core.destroy(),this},e.prototype.play=function(){return this.core.mediaControl.container.play(),this},e.prototype.pause=function(){return this.core.mediaControl.container.pause(),this},e.prototype.stop=function(){return this.core.mediaControl.container.stop(),this},e.prototype.seek=function(t){return this.core.mediaControl.container.seek(t),this},e.prototype.seekPercentage=function(t){return this.core.mediaControl.container.seekPercentage(t),this},e.prototype.setVolume=function(t){return this.core&&this.core.mediaControl&&this.core.mediaControl.setVolume(t),this},e.prototype.getVolume=function(){return this.core&&this.core.mediaControl?this.core.mediaControl.volume:0},e.prototype.mute=function(){return this._mutedVolume=this.getVolume(),this.setVolume(0),this},e.prototype.unmute=function(){return this.setVolume("number"==typeof this._mutedVolume?this._mutedVolume:100),this._mutedVolume=null,this},e.prototype.isPlaying=function(){return this.core.mediaControl.container.isPlaying()},e.prototype.isDvrEnabled=function(){return this.core.mediaControl.container.isDvrEnabled()},e.prototype.isDvrInUse=function(){return this.core.mediaControl.container.isDvrInUse()},e.prototype.configure=function(t){return this.core.configure(t),this},e.prototype.getPlugin=function(t){var e=this.core.plugins.concat(this.core.mediaControl.container.plugins);return e.filter(function(e){return e.name===t})[0]},e.prototype.getCurrentTime=function(){return this.core.mediaControl.container.getCurrentTime()},e.prototype.getStartTimeOffset=function(){return this.core.mediaControl.container.getStartTimeOffset()},e.prototype.getDuration=function(){return this.core.mediaControl.container.getDuration()},e}(c.default);e.default=k,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(3),u=r(l),c=n(4),d=r(c),f=n(6),h=r(f),p=n(8),y=r(p),g=n(92),v=r(g),m=n(81),b=r(m),_="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000",E=function(t){function e(){return i(this,e),o(this,t.apply(this,arguments))}return a(e,t),e.prototype.setElement=function(t){this.$el=t,this.el=t[0]},e.prototype._setupFirefox=function(){var t=this.$("embed");t.attr("data-flash-playback",this.name),t.addClass(this.attributes.class),this.setElement(t)},e.prototype.render=function(){return this.$el.html(this.template({cid:this.cid,swfPath:this.swfPath,baseUrl:this.baseUrl,playbackId:this.uniqueId,wmode:this.wmode,callbackName:"window.Clappr.flashlsCallbacks."+this.cid})),y.default.isIE&&(this.$("embed").remove(),y.default.isLegacyIE&&this.$el.attr("classid",_)),y.default.isFirefox&&this._setupFirefox(),this.el.id=this.cid,this.$el.append(d.default.getStyleFor(b.default)),this},s(e,[{key:"tagName",get:function(){return"object"}},{key:"swfPath",get:function(){return""}},{key:"wmode",get:function(){return"transparent"}},{key:"template",get:function(){return(0,h.default)(v.default)}},{key:"attributes",get:function(){var t="application/x-shockwave-flash";return y.default.isLegacyIE&&(t=""),{class:"clappr-flash-playback",type:t,width:"100%",height:"100%","data-flash-playback":this.name}}}]),e}(u.default);e.default=E,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),
+e}}(),l=n(2),u=n(18),c=r(u),d=n(8),f=r(d),h=n(11),p=r(h),y=n(6),g=r(y),v=n(5),m=r(v),b=n(1),_=r(b),E=n(3),T=r(E),A=n(111),k=r(A),w=60,S=function(t){function e(){i(this,e);for(var n=arguments.length,r=Array(n),a=0;a<n;a++)r[a]=arguments[a];var s=o(this,t.call.apply(t,[this].concat(r)));return s._src=s.options.src,s._baseUrl=s.options.baseUrl,s._autoPlay=s.options.autoPlay,s.settings={default:["seekbar"]},s.settings.left=["playpause","position","duration"],s.settings.right=["fullscreen","volume"],s.settings.seekEnabled=!0,s._isReadyState=!1,s._addListeners(),s}return a(e,t),s(e,[{key:"name",get:function(){return"flash"}},{key:"swfPath",get:function(){return(0,g.default)(k.default)({baseUrl:this._baseUrl})}},{key:"ended",get:function(){return"ENDED"===this._currentState}},{key:"buffering",get:function(){return!!this._bufferingState&&"ENDED"!==this._currentState}}]),e.prototype._bootstrap=function(){var t=this;this.el.playerPlay?(this.el.width="100%",this.el.height="100%","PLAYING"===this._currentState?this._firstPlay():(this._currentState="IDLE",this._autoPlay&&this.play()),(0,m.default)('<div style="position: absolute; top: 0; left: 0; width: 100%; height: 100%" />').insertAfter(this.$el),this.getDuration()>0?this._metadataLoaded():p.default.once(this.uniqueId+":timeupdate",this._metadataLoaded,this)):(this._attempts=this._attempts||0,++this._attempts<=w?setTimeout(function(){return t._bootstrap()},50):this.trigger(_.default.PLAYBACK_ERROR,{message:"Max number of attempts reached"},this.name))},e.prototype._metadataLoaded=function(){this._isReadyState=!0,this.trigger(_.default.PLAYBACK_READY,this.name),this.trigger(_.default.PLAYBACK_SETTINGSUPDATE,this.name)},e.prototype.getPlaybackType=function(){return T.default.VOD},e.prototype.isHighDefinitionInUse=function(){return!1},e.prototype._updateTime=function(){this.trigger(_.default.PLAYBACK_TIMEUPDATE,{current:this.el.getPosition(),total:this.el.getDuration()},this.name)},e.prototype._addListeners=function(){p.default.on(this.uniqueId+":progress",this._progress,this),p.default.on(this.uniqueId+":timeupdate",this._updateTime,this),p.default.on(this.uniqueId+":statechanged",this._checkState,this),p.default.on(this.uniqueId+":flashready",this._bootstrap,this)},e.prototype.stopListening=function(){t.prototype.stopListening.call(this),p.default.off(this.uniqueId+":progress"),p.default.off(this.uniqueId+":timeupdate"),p.default.off(this.uniqueId+":statechanged"),p.default.off(this.uniqueId+":flashready")},e.prototype._checkState=function(){this._isIdle||"PAUSED"===this._currentState||("PLAYING_BUFFERING"!==this._currentState&&"PLAYING_BUFFERING"===this.el.getState()?(this._bufferingState=!0,this.trigger(_.default.PLAYBACK_BUFFERING,this.name),this._currentState="PLAYING_BUFFERING"):"PLAYING"===this.el.getState()?(this._bufferingState=!1,this.trigger(_.default.PLAYBACK_BUFFERFULL,this.name),this._currentState="PLAYING"):"IDLE"===this.el.getState()?this._currentState="IDLE":"ENDED"===this.el.getState()&&(this.trigger(_.default.PLAYBACK_ENDED,this.name),this.trigger(_.default.PLAYBACK_TIMEUPDATE,{current:0,total:this.el.getDuration()},this.name),this._currentState="ENDED",this._isIdle=!0))},e.prototype._progress=function(){"IDLE"!==this._currentState&&"ENDED"!==this._currentState&&this.trigger(_.default.PLAYBACK_PROGRESS,{start:0,current:this.el.getBytesLoaded(),total:this.el.getBytesTotal()})},e.prototype._firstPlay=function(){var t=this;this.el.playerPlay?(this._isIdle=!1,this.el.playerPlay(this._src),this.listenToOnce(this,_.default.PLAYBACK_BUFFERFULL,function(){return t._checkInitialSeek()}),this._currentState="PLAYING"):this.listenToOnce(this,_.default.PLAYBACK_READY,this._firstPlay)},e.prototype._checkInitialSeek=function(){var t=(0,l.seekStringToSeconds)(window.location.href);0!==t&&this.seekSeconds(t)},e.prototype.play=function(){this.trigger(_.default.PLAYBACK_PLAY_INTENT),"PAUSED"===this._currentState||"PLAYING_BUFFERING"===this._currentState?(this._currentState="PLAYING",this.el.playerResume(),this.trigger(_.default.PLAYBACK_PLAY,this.name)):"PLAYING"!==this._currentState&&(this._firstPlay(),this.trigger(_.default.PLAYBACK_PLAY,this.name))},e.prototype.volume=function(t){var e=this;this.isReady?this.el.playerVolume(t):this.listenToOnce(this,_.default.PLAYBACK_BUFFERFULL,function(){return e.volume(t)})},e.prototype.pause=function(){this._currentState="PAUSED",this.el.playerPause(),this.trigger(_.default.PLAYBACK_PAUSE,this.name)},e.prototype.stop=function(){this.el.playerStop(),this.trigger(_.default.PLAYBACK_STOP),this.trigger(_.default.PLAYBACK_TIMEUPDATE,{current:0,total:0},this.name)},e.prototype.isPlaying=function(){return!!(this.isReady&&this._currentState.indexOf("PLAYING")>-1)},e.prototype.getDuration=function(){return this.el.getDuration()},e.prototype.seekPercentage=function(t){var e=this;if(this.el.getDuration()>0){var n=this.el.getDuration()*(t/100);this.seek(n)}else this.listenToOnce(this,_.default.PLAYBACK_BUFFERFULL,function(){return e.seekPercentage(t)})},e.prototype.seek=function(t){var e=this;this.isReady&&this.el.playerSeek?(this.el.playerSeek(t),this.trigger(_.default.PLAYBACK_TIMEUPDATE,{current:t,total:this.el.getDuration()},this.name),"PAUSED"===this._currentState&&this.el.playerPause()):this.listenToOnce(this,_.default.PLAYBACK_BUFFERFULL,function(){return e.seek(t)})},e.prototype.destroy=function(){clearInterval(this.bootstrapId),t.prototype.stopListening.call(this),this.$el.remove()},s(e,[{key:"isReady",get:function(){return this._isReadyState}}]),e}(c.default);e.default=S,S.canPlay=function(t){if(f.default.hasFlash&&t&&t.constructor===String){var e=t.split("?")[0].match(/.*\.(.*)$/)||[];return e.length>1&&!f.default.isMobile&&e[1].toLowerCase().match(/^(mp4|mov|f4v|3gpp|3gp)$/)}return!1},t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(18),u=r(l),c=n(1),d=r(c),f=n(6),h=r(f),p=n(3),y=r(p),g=n(11),v=r(g),m=n(8),b=r(m),_=n(50),E=r(_),T=n(112),A=r(T),k=n(5),w=r(k),S=60,L=-1,R=function(t){function e(){i(this,e);for(var n=arguments.length,r=Array(n),a=0;a<n;a++)r[a]=arguments[a];var s=o(this,t.call.apply(t,[this].concat(r)));return s._src=s.options.src,s._baseUrl=s.options.baseUrl,s._initHlsParameters(s.options),s.highDefinition=!1,s._autoPlay=s.options.autoPlay,s._loop=s.options.loop,s._defaultSettings={left:["playstop"],default:["seekbar"],right:["fullscreen","volume","hd-indicator"],seekEnabled:!1},s.settings=w.default.extend({},s._defaultSettings),s._playbackType=y.default.LIVE,s._hasEnded=!1,s._addListeners(),s}return a(e,t),s(e,[{key:"name",get:function(){return"flashls"}},{key:"swfPath",get:function(){return(0,h.default)(A.default)({baseUrl:this._baseUrl})}},{key:"levels",get:function(){return this._levels||[]}},{key:"currentLevel",get:function(){return null===this._currentLevel||void 0===this._currentLevel?L:this._currentLevel},set:function(t){this._currentLevel=t,this.trigger(d.default.PLAYBACK_LEVEL_SWITCH_START),this.el.playerSetCurrentLevel(t)}},{key:"ended",get:function(){return this._hasEnded}},{key:"buffering",get:function(){return!!this._bufferingState&&!this._hasEnded}}]),e.prototype._initHlsParameters=function(t){this._autoStartLoad=void 0===t.autoStartLoad||t.autoStartLoad,this._capLevelToStage=void 0!==t.capLevelToStage&&t.capLevelToStage,this._maxLevelCappingMode=void 0===t.maxLevelCappingMode?"downscale":t.maxLevelCappingMode,this._minBufferLength=void 0===t.minBufferLength?-1:t.minBufferLength,this._minBufferLengthCapping=void 0===t.minBufferLengthCapping?-1:t.minBufferLengthCapping,this._maxBufferLength=void 0===t.maxBufferLength?120:t.maxBufferLength,this._maxBackBufferLength=void 0===t.maxBackBufferLength?30:t.maxBackBufferLength,this._lowBufferLength=void 0===t.lowBufferLength?3:t.lowBufferLength,this._mediaTimePeriod=void 0===t.mediaTimePeriod?100:t.mediaTimePeriod,this._fpsDroppedMonitoringPeriod=void 0===t.fpsDroppedMonitoringPeriod?5e3:t.fpsDroppedMonitoringPeriod,this._fpsDroppedMonitoringThreshold=void 0===t.fpsDroppedMonitoringThreshold?.2:t.fpsDroppedMonitoringThreshold,this._capLevelonFPSDrop=void 0!==t.capLevelonFPSDrop&&t.capLevelonFPSDrop,this._smoothAutoSwitchonFPSDrop=void 0===t.smoothAutoSwitchonFPSDrop?this.capLevelonFPSDrop:t.smoothAutoSwitchonFPSDrop,this._switchDownOnLevelError=void 0===t.switchDownOnLevelError||t.switchDownOnLevelError,this._seekMode=void 0===t.seekMode?"ACCURATE":t.seekMode,this._keyLoadMaxRetry=void 0===t.keyLoadMaxRetry?3:t.keyLoadMaxRetry,this._keyLoadMaxRetryTimeout=void 0===t.keyLoadMaxRetryTimeout?64e3:t.keyLoadMaxRetryTimeout,this._fragmentLoadMaxRetry=void 0===t.fragmentLoadMaxRetry?3:t.fragmentLoadMaxRetry,this._fragmentLoadMaxRetryTimeout=void 0===t.fragmentLoadMaxRetryTimeout?4e3:t.fragmentLoadMaxRetryTimeout,this._fragmentLoadSkipAfterMaxRetry=void 0===t.fragmentLoadSkipAfterMaxRetry||t.fragmentLoadSkipAfterMaxRetry,this._maxSkippedFragments=void 0===t.maxSkippedFragments?5:t.maxSkippedFragments,this._flushLiveURLCache=void 0!==t.flushLiveURLCache&&t.flushLiveURLCache,this._initialLiveManifestSize=void 0===t.initialLiveManifestSize?1:t.initialLiveManifestSize,this._manifestLoadMaxRetry=void 0===t.manifestLoadMaxRetry?3:t.manifestLoadMaxRetry,this._manifestLoadMaxRetryTimeout=void 0===t.manifestLoadMaxRetryTimeout?64e3:t.manifestLoadMaxRetryTimeout,this._manifestRedundantLoadmaxRetry=void 0===t.manifestRedundantLoadmaxRetry?3:t.manifestRedundantLoadmaxRetry,this._startFromBitrate=void 0===t.startFromBitrate?-1:t.startFromBitrate,this._startFromLevel=void 0===t.startFromLevel?-1:t.startFromLevel,this._autoStartMaxDuration=void 0===t.autoStartMaxDuration?-1:t.autoStartMaxDuration,this._seekFromLevel=void 0===t.seekFromLevel?-1:t.seekFromLevel,this._useHardwareVideoDecoder=void 0!==t.useHardwareVideoDecoder&&t.useHardwareVideoDecoder,this._hlsLogEnabled=void 0===t.hlsLogEnabled||t.hlsLogEnabled,this._logDebug=void 0!==t.logDebug&&t.logDebug,this._logDebug2=void 0!==t.logDebug2&&t.logDebug2,this._logWarn=void 0===t.logWarn||t.logWarn,this._logError=void 0===t.logError||t.logError,this._hlsMinimumDvrSize=void 0===t.hlsMinimumDvrSize?60:t.hlsMinimumDvrSize},e.prototype._addListeners=function(){var t=this;v.default.on(this.cid+":flashready",function(){return t._bootstrap()}),v.default.on(this.cid+":timeupdate",function(e){return t._updateTime(e)}),v.default.on(this.cid+":playbackstate",function(e){return t._setPlaybackState(e)}),v.default.on(this.cid+":levelchanged",function(e){return t._levelChanged(e)}),v.default.on(this.cid+":error",function(e,n,r){return t._flashPlaybackError(e,n,r)}),v.default.on(this.cid+":fragmentloaded",function(e){return t._onFragmentLoaded(e)}),v.default.on(this.cid+":levelendlist",function(e){return t._onLevelEndlist(e)})},e.prototype.stopListening=function(){t.prototype.stopListening.call(this),v.default.off(this.cid+":flashready"),v.default.off(this.cid+":timeupdate"),v.default.off(this.cid+":playbackstate"),v.default.off(this.cid+":levelchanged"),v.default.off(this.cid+":playbackerror"),v.default.off(this.cid+":fragmentloaded"),v.default.off(this.cid+":manifestloaded"),v.default.off(this.cid+":levelendlist")},e.prototype._bootstrap=function(){var t=this;this.el.playerLoad?(this.el.width="100%",this.el.height="100%",this._isReadyState=!0,this._srcLoaded=!1,this._currentState="IDLE",this._setFlashSettings(),this._updatePlaybackType(),(this._autoPlay||this._shouldPlayOnManifestLoaded)&&this.play(),this.trigger(d.default.PLAYBACK_READY,this.name)):(this._bootstrapAttempts=this._bootstrapAttempts||0,++this._bootstrapAttempts<=S?setTimeout(function(){return t._bootstrap()},50):this.trigger(d.default.PLAYBACK_ERROR,{message:"Max number of attempts reached"},this.name))},e.prototype._setFlashSettings=function(){this.el.playerSetAutoStartLoad(this._autoStartLoad),this.el.playerSetCapLevelToStage(this._capLevelToStage),this.el.playerSetMaxLevelCappingMode(this._maxLevelCappingMode),this.el.playerSetMinBufferLength(this._minBufferLength),this.el.playerSetMinBufferLengthCapping(this._minBufferLengthCapping),this.el.playerSetMaxBufferLength(this._maxBufferLength),this.el.playerSetMaxBackBufferLength(this._maxBackBufferLength),this.el.playerSetLowBufferLength(this._lowBufferLength),this.el.playerSetMediaTimePeriod(this._mediaTimePeriod),this.el.playerSetFpsDroppedMonitoringPeriod(this._fpsDroppedMonitoringPeriod),this.el.playerSetFpsDroppedMonitoringThreshold(this._fpsDroppedMonitoringThreshold),this.el.playerSetCapLevelonFPSDrop(this._capLevelonFPSDrop),this.el.playerSetSmoothAutoSwitchonFPSDrop(this._smoothAutoSwitchonFPSDrop),this.el.playerSetSwitchDownOnLevelError(this._switchDownOnLevelError),this.el.playerSetSeekMode(this._seekMode),this.el.playerSetKeyLoadMaxRetry(this._keyLoadMaxRetry),this.el.playerSetKeyLoadMaxRetryTimeout(this._keyLoadMaxRetryTimeout),this.el.playerSetFragmentLoadMaxRetry(this._fragmentLoadMaxRetry),this.el.playerSetFragmentLoadMaxRetryTimeout(this._fragmentLoadMaxRetryTimeout),this.el.playerSetFragmentLoadSkipAfterMaxRetry(this._fragmentLoadSkipAfterMaxRetry),this.el.playerSetMaxSkippedFragments(this._maxSkippedFragments),this.el.playerSetFlushLiveURLCache(this._flushLiveURLCache),this.el.playerSetInitialLiveManifestSize(this._initialLiveManifestSize),this.el.playerSetManifestLoadMaxRetry(this._manifestLoadMaxRetry),this.el.playerSetManifestLoadMaxRetryTimeout(this._manifestLoadMaxRetryTimeout),this.el.playerSetManifestRedundantLoadmaxRetry(this._manifestRedundantLoadmaxRetry),this.el.playerSetStartFromBitrate(this._startFromBitrate),this.el.playerSetStartFromLevel(this._startFromLevel),this.el.playerSetAutoStartMaxDuration(this._autoStartMaxDuration),this.el.playerSetSeekFromLevel(this._seekFromLevel),this.el.playerSetUseHardwareVideoDecoder(this._useHardwareVideoDecoder),this.el.playerSetLogInfo(this._hlsLogEnabled),this.el.playerSetLogDebug(this._logDebug),this.el.playerSetLogDebug2(this._logDebug2),this.el.playerSetLogWarn(this._logWarn),this.el.playerSetLogError(this._logError)},e.prototype.setAutoStartLoad=function(t){this._autoStartLoad=t,this.el.playerSetAutoStartLoad(this._autoStartLoad)},e.prototype.setCapLevelToStage=function(t){this._capLevelToStage=t,this.el.playerSetCapLevelToStage(this._capLevelToStage)},e.prototype.setMaxLevelCappingMode=function(t){this._maxLevelCappingMode=t,this.el.playerSetMaxLevelCappingMode(this._maxLevelCappingMode)},e.prototype.setSetMinBufferLength=function(t){this._minBufferLength=t,this.el.playerSetMinBufferLength(this._minBufferLength)},e.prototype.setMinBufferLengthCapping=function(t){this._minBufferLengthCapping=t,this.el.playerSetMinBufferLengthCapping(this._minBufferLengthCapping)},e.prototype.setMaxBufferLength=function(t){this._maxBufferLength=t,this.el.playerSetMaxBufferLength(this._maxBufferLength)},e.prototype.setMaxBackBufferLength=function(t){this._maxBackBufferLength=t,this.el.playerSetMaxBackBufferLength(this._maxBackBufferLength)},e.prototype.setLowBufferLength=function(t){this._lowBufferLength=t,this.el.playerSetLowBufferLength(this._lowBufferLength)},e.prototype.setMediaTimePeriod=function(t){this._mediaTimePeriod=t,this.el.playerSetMediaTimePeriod(this._mediaTimePeriod)},e.prototype.setFpsDroppedMonitoringPeriod=function(t){this._fpsDroppedMonitoringPeriod=t,this.el.playerSetFpsDroppedMonitoringPeriod(this._fpsDroppedMonitoringPeriod)},e.prototype.setFpsDroppedMonitoringThreshold=function(t){this._fpsDroppedMonitoringThreshold=t,this.el.playerSetFpsDroppedMonitoringThreshold(this._fpsDroppedMonitoringThreshold)},e.prototype.setCapLevelonFPSDrop=function(t){this._capLevelonFPSDrop=t,this.el.playerSetCapLevelonFPSDrop(this._capLevelonFPSDrop)},e.prototype.setSmoothAutoSwitchonFPSDrop=function(t){this._smoothAutoSwitchonFPSDrop=t,this.el.playerSetSmoothAutoSwitchonFPSDrop(this._smoothAutoSwitchonFPSDrop)},e.prototype.setSwitchDownOnLevelError=function(t){this._switchDownOnLevelError=t,this.el.playerSetSwitchDownOnLevelError(this._switchDownOnLevelError)},e.prototype.setSeekMode=function(t){this._seekMode=t,this.el.playerSetSeekMode(this._seekMode)},e.prototype.setKeyLoadMaxRetry=function(t){this._keyLoadMaxRetry=t,this.el.playerSetKeyLoadMaxRetry(this._keyLoadMaxRetry)},e.prototype.setKeyLoadMaxRetryTimeout=function(t){this._keyLoadMaxRetryTimeout=t,this.el.playerSetKeyLoadMaxRetryTimeout(this._keyLoadMaxRetryTimeout)},e.prototype.setFragmentLoadMaxRetry=function(t){this._fragmentLoadMaxRetry=t,this.el.playerSetFragmentLoadMaxRetry(this._fragmentLoadMaxRetry)},e.prototype.setFragmentLoadMaxRetryTimeout=function(t){this._fragmentLoadMaxRetryTimeout=t,this.el.playerSetFragmentLoadMaxRetryTimeout(this._fragmentLoadMaxRetryTimeout)},e.prototype.setFragmentLoadSkipAfterMaxRetry=function(t){this._fragmentLoadSkipAfterMaxRetry=t,this.el.playerSetFragmentLoadSkipAfterMaxRetry(this._fragmentLoadSkipAfterMaxRetry)},e.prototype.setMaxSkippedFragments=function(t){this._maxSkippedFragments=t,this.el.playerSetMaxSkippedFragments(this._maxSkippedFragments)},e.prototype.setFlushLiveURLCache=function(t){this._flushLiveURLCache=t,this.el.playerSetFlushLiveURLCache(this._flushLiveURLCache)},e.prototype.setInitialLiveManifestSize=function(t){this._initialLiveManifestSize=t,this.el.playerSetInitialLiveManifestSize(this._initialLiveManifestSize)},e.prototype.setManifestLoadMaxRetry=function(t){this._manifestLoadMaxRetry=t,this.el.playerSetManifestLoadMaxRetry(this._manifestLoadMaxRetry)},e.prototype.setManifestLoadMaxRetryTimeout=function(t){this._manifestLoadMaxRetryTimeout=t,this.el.playerSetManifestLoadMaxRetryTimeout(this._manifestLoadMaxRetryTimeout)},e.prototype.setManifestRedundantLoadmaxRetry=function(t){this._manifestRedundantLoadmaxRetry=t,this.el.playerSetManifestRedundantLoadmaxRetry(this._manifestRedundantLoadmaxRetry)},e.prototype.setStartFromBitrate=function(t){this._startFromBitrate=t,this.el.playerSetStartFromBitrate(this._startFromBitrate)},e.prototype.setStartFromLevel=function(t){this._startFromLevel=t,this.el.playerSetStartFromLevel(this._startFromLevel)},e.prototype.setAutoStartMaxDuration=function(t){this._autoStartMaxDuration=t,this.el.playerSetAutoStartMaxDuration(this._autoStartMaxDuration)},e.prototype.setSeekFromLevel=function(t){this._seekFromLevel=t,this.el.playerSetSeekFromLevel(this._seekFromLevel)},e.prototype.setUseHardwareVideoDecoder=function(t){this._useHardwareVideoDecoder=t,this.el.playerSetUseHardwareVideoDecoder(this._useHardwareVideoDecoder)},e.prototype.setSetLogInfo=function(t){this._hlsLogEnabled=t,this.el.playerSetLogInfo(this._hlsLogEnabled)},e.prototype.setLogDebug=function(t){this._logDebug=t,this.el.playerSetLogDebug(this._logDebug)},e.prototype.setLogDebug2=function(t){this._logDebug2=t,this.el.playerSetLogDebug2(this._logDebug2)},e.prototype.setLogWarn=function(t){this._logWarn=t,this.el.playerSetLogWarn(this._logWarn)},e.prototype.setLogError=function(t){this._logError=t,this.el.playerSetLogError(this._logError)},e.prototype._levelChanged=function(t){var e=this.el.getLevels()[t];e&&(this.highDefinition=e.height>=720||e.bitrate/1e3>=2e3,this.trigger(d.default.PLAYBACK_HIGHDEFINITIONUPDATE,this.highDefinition),this._levels&&0!==this._levels.length||this._fillLevels(),this.trigger(d.default.PLAYBACK_BITRATE,{height:e.height,width:e.width,bandwidth:e.bitrate,bitrate:e.bitrate,level:t}),this.trigger(d.default.PLAYBACK_LEVEL_SWITCH_END))},e.prototype._updateTime=function(t){if("IDLE"!==this._currentState){var e=this._normalizeDuration(t.duration),n=Math.min(Math.max(t.position,0),e),r=this._dvrEnabled,i=this._playbackType===y.default.LIVE;this._dvrEnabled=i&&e>this._hlsMinimumDvrSize,100!==e&&void 0!==i&&(this._dvrEnabled!==r&&(this._updateSettings(),this.trigger(d.default.PLAYBACK_SETTINGSUPDATE,this.name)),!i||this._dvrEnabled&&this._dvrInUse||(n=e),this.trigger(d.default.PLAYBACK_TIMEUPDATE,{current:n,total:e},this.name))}},e.prototype.play=function(){this.trigger(d.default.PLAYBACK_PLAY_INTENT),"PAUSED"===this._currentState?this.el.playerResume():this._srcLoaded||"PLAYING"===this._currentState?this.el.playerPlay():this._firstPlay()},e.prototype.getPlaybackType=function(){return this._playbackType?this._playbackType:null},e.prototype.getCurrentLevelIndex=function(){return this._currentLevel},e.prototype.getCurrentLevel=function(){return this.levels[this.currentLevel]},e.prototype.getCurrentBitrate=function(){return this.levels[this.currentLevel].bitrate},e.prototype.setCurrentLevel=function(t){this.currentLevel=t},e.prototype.isHighDefinitionInUse=function(){return this.highDefinition},e.prototype.getLevels=function(){return this.levels},e.prototype._setPlaybackState=function(t){["PLAYING_BUFFERING","PAUSED_BUFFERING"].indexOf(t)>=0?(this._bufferingState=!0,this.trigger(d.default.PLAYBACK_BUFFERING,this.name),this._updateCurrentState(t)):["PLAYING","PAUSED"].indexOf(t)>=0?(["PLAYING_BUFFERING","PAUSED_BUFFERING","IDLE"].indexOf(this._currentState)>=0&&(this._bufferingState=!1,this.trigger(d.default.PLAYBACK_BUFFERFULL,this.name)),this._updateCurrentState(t)):"IDLE"===t&&(this._srcLoaded=!1,this._loop&&["PLAYING_BUFFERING","PLAYING"].indexOf(this._currentState)>=0?(this.play(),this.seek(0)):(this._updateCurrentState(t),this._hasEnded=!0,this.trigger(d.default.PLAYBACK_TIMEUPDATE,{current:0,total:this.getDuration()},this.name),this.trigger(d.default.PLAYBACK_ENDED,this.name)))},e.prototype._updateCurrentState=function(t){this._currentState=t,"IDLE"!==t&&(this._hasEnded=!1),this._updatePlaybackType(),"PLAYING"===t?this.trigger(d.default.PLAYBACK_PLAY,this.name):"PAUSED"===t&&this.trigger(d.default.PLAYBACK_PAUSE,this.name)},e.prototype._updatePlaybackType=function(){this._playbackType=this.el.getType(),this._playbackType&&(this._playbackType=this._playbackType.toLowerCase(),this._playbackType===y.default.VOD?this._startReportingProgress():this._stopReportingProgress()),this.trigger(d.default.PLAYBACK_PLAYBACKSTATE,{type:this._playbackType})},e.prototype._startReportingProgress=function(){this._reportingProgress||(this._reportingProgress=!0)},e.prototype._stopReportingProgress=function(){this._reportingProgress=!1},e.prototype._onFragmentLoaded=function(t){if(this.trigger(d.default.PLAYBACK_FRAGMENT_LOADED,t),this._reportingProgress&&this.el.getPosition){var e=this.el.getPosition()+this.el.getbufferLength();this.trigger(d.default.PLAYBACK_PROGRESS,{start:this.el.getPosition(),current:e,total:this.el.getDuration()})}},e.prototype._onLevelEndlist=function(){this._updatePlaybackType()},e.prototype._firstPlay=function(){var t=this;this._shouldPlayOnManifestLoaded=!0,this.el.playerLoad&&(v.default.once(this.cid+":manifestloaded",function(e,n){return t._manifestLoaded(e,n)}),this._setFlashSettings(),this.el.playerLoad(this._src),this._srcLoaded=!0)},e.prototype.volume=function(t){var e=this;this.isReady?this.el.playerVolume(t):this.listenToOnce(this,d.default.PLAYBACK_BUFFERFULL,function(){return e.volume(t)})},e.prototype.pause=function(){(this._playbackType!==y.default.LIVE||this._dvrEnabled)&&(this.el.playerPause(),this._playbackType===y.default.LIVE&&this._dvrEnabled&&this._updateDvr(!0))},e.prototype.stop=function(){this._srcLoaded=!1,this.el.playerStop(),this.trigger(d.default.PLAYBACK_STOP),this.trigger(d.default.PLAYBACK_TIMEUPDATE,{current:0,total:0},this.name)},e.prototype.isPlaying=function(){return!!this._currentState&&!!this._currentState.match(/playing/i)},e.prototype.getDuration=function(){return this._normalizeDuration(this.el.getDuration())},e.prototype._normalizeDuration=function(t){return this._playbackType===y.default.LIVE&&(t=Math.max(0,t-10)),t},e.prototype.seekPercentage=function(t){var e=this.el.getDuration(),n=0;t>0&&(n=e*t/100),this.seek(n)},e.prototype.seek=function(t){var e=this.getDuration();if(this._playbackType===y.default.LIVE){var n=e-t>3;this._updateDvr(n)}this.el.playerSeek(t),this.trigger(d.default.PLAYBACK_TIMEUPDATE,{current:t,total:e},this.name)},e.prototype._updateDvr=function(t){var e=!!this._dvrInUse;this._dvrInUse=t,this._dvrInUse!==e&&(this._updateSettings(),this.trigger(d.default.PLAYBACK_DVR,this._dvrInUse),this.trigger(d.default.PLAYBACK_STATS_ADD,{dvr:this._dvrInUse}))},e.prototype._flashPlaybackError=function(t,e,n){this.trigger(d.default.PLAYBACK_ERROR,{code:t,url:e,message:n}),this.trigger(d.default.PLAYBACK_STOP)},e.prototype._manifestLoaded=function(t,e){this._shouldPlayOnManifestLoaded&&(this._shouldPlayOnManifestLoaded=!1,this.el.playerPlay()),this._fillLevels(),this.trigger(d.default.PLAYBACK_LOADEDMETADATA,{duration:t,data:e})},e.prototype._fillLevels=function(){var t=this.el.getLevels(),e=t.length;this._levels=[];for(var n=0;n<e;n++)this._levels.push({id:n,label:t[n].height+"p",level:t[n]});this.trigger(d.default.PLAYBACK_LEVELS_AVAILABLE,this._levels)},e.prototype.destroy=function(){this.stopListening(),this.$el.remove()},e.prototype._updateSettings=function(){this.settings=w.default.extend({},this._defaultSettings),this._playbackType===y.default.VOD||this._dvrInUse?(this.settings.left=["playpause","position","duration"],this.settings.seekEnabled=!0):this._dvrEnabled?(this.settings.left=["playpause"],this.settings.seekEnabled=!0):this.settings.seekEnabled=!1},e.prototype._createCallbacks=function(){var t=this;window.Clappr||(window.Clappr={}),window.Clappr.flashlsCallbacks||(window.Clappr.flashlsCallbacks={}),this.flashlsEvents=new E.default(this.cid),window.Clappr.flashlsCallbacks[this.cid]=function(e,n){t.flashlsEvents[e].apply(t.flashlsEvents,n)}},e.prototype.render=function(){return t.prototype.render.call(this),this._createCallbacks(),this},s(e,[{key:"isReady",get:function(){return this._isReadyState}},{key:"dvrEnabled",get:function(){return!!this._dvrEnabled}}]),e}(u.default);e.default=R,R.canPlay=function(t,e){var n=t.split("?")[0].match(/.*\.(.*)$/)||[];return b.default.hasFlash&&(n.length>1&&"m3u8"===n[1].toLowerCase()||"application/x-mpegURL"===e||"application/vnd.apple.mpegurl"===e)},t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var o=n(11),a=r(o),s=function(){function t(e){i(this,t),this.instanceId=e}return t.prototype.ready=function(){a.default.trigger(this.instanceId+":flashready")},t.prototype.videoSize=function(t,e){a.default.trigger(this.instanceId+":videosizechanged",t,e)},t.prototype.complete=function(){a.default.trigger(this.instanceId+":complete")},t.prototype.error=function(t,e,n){a.default.trigger(this.instanceId+":error",t,e,n)},t.prototype.manifest=function(t,e){a.default.trigger(this.instanceId+":manifestloaded",t,e)},t.prototype.audioLevelLoaded=function(t){a.default.trigger(this.instanceId+":audiolevelloaded",t)},t.prototype.levelLoaded=function(t){a.default.trigger(this.instanceId+":levelloaded",t)},t.prototype.levelEndlist=function(t){a.default.trigger(this.instanceId+":levelendlist",t)},t.prototype.fragmentLoaded=function(t){a.default.trigger(this.instanceId+":fragmentloaded",t)},t.prototype.fragmentPlaying=function(t){a.default.trigger(this.instanceId+":fragmentplaying",t)},t.prototype.position=function(t){a.default.trigger(this.instanceId+":timeupdate",t)},t.prototype.state=function(t){a.default.trigger(this.instanceId+":playbackstate",t)},t.prototype.seekState=function(t){a.default.trigger(this.instanceId+":seekstate",t)},t.prototype.switch=function(t){a.default.trigger(this.instanceId+":levelchanged",t)},t.prototype.audioTracksListChange=function(t){a.default.trigger(this.instanceId+":audiotracklistchanged",t)},t.prototype.audioTrackChange=function(t){a.default.trigger(this.instanceId+":audiotrackchanged",t)},t}();e.default=s,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=n(16),c=r(u),d=n(90),f=r(d),h=n(99),p=r(h),y=n(1),g=r(y),v=n(3),m=r(v),b=n(8),_=r(b),E=n(2),T=n(19),A=r(T),k=-1,w=function(t){function e(){o(this,e);for(var n=arguments.length,r=Array(n),i=0;i<n;i++)r[i]=arguments[i];var s=a(this,t.call.apply(t,[this].concat(r)));return s.options.playback||(s.options.playback=s.options),s._minDvrSize="undefined"==typeof s.options.hlsMinimumDvrSize?60:s.options.hlsMinimumDvrSize,s._extrapolatedWindowNumSegments=s.options.playback&&"undefined"!=typeof s.options.playback.extrapolatedWindowNumSegments?s.options.playback.extrapolatedWindowNumSegments:2,s._playbackType=m.default.VOD,s._lastTimeUpdate=null,s._lastDuration=null,s._playableRegionStartTime=0,s._localStartTimeCorrelation=null,s._localEndTimeCorrelation=null,s._playableRegionDuration=0,s._durationExcludesAfterLiveSyncPoint=!1,s._segmentTargetDuration=null,s._playlistType=null,s._recoverAttemptsRemaining=s.options.hlsRecoverAttempts||16,s._startTimeUpdateTimer(),s}return s(e,t),l(e,[{key:"name",get:function(){return"hls"}},{key:"levels",get:function(){return this._levels||[]}},{key:"currentLevel",get:function(){return null===this._currentLevel||void 0===this._currentLevel?k:this._currentLevel},set:function(t){this._currentLevel=t,this.trigger(g.default.PLAYBACK_LEVEL_SWITCH_START),this._hls.currentLevel=this._currentLevel}},{key:"_startTime",get:function(){return this._playbackType===m.default.LIVE&&"EVENT"!==this._playlistType?this._extrapolatedStartTime:this._playableRegionStartTime}},{key:"_now",get:function(){return(0,E.now)()}},{key:"_extrapolatedStartTime",get:function(){if(!this._localStartTimeCorrelation)return this._playableRegionStartTime;var t=this._localStartTimeCorrelation,e=this._now-t.local,n=(t.remote+e)/1e3;return Math.min(n,this._playableRegionStartTime+this._extrapolatedWindowDuration)}},{key:"_extrapolatedEndTime",get:function(){var t=this._playableRegionStartTime+this._playableRegionDuration;if(!this._localEndTimeCorrelation)return t;var e=this._localEndTimeCorrelation,n=this._now-e.local,r=(e.remote+n)/1e3;return Math.max(t-this._extrapolatedWindowDuration,Math.min(r,t))}},{key:"_duration",get:function(){return this._extrapolatedEndTime-this._startTime}},{key:"_extrapolatedWindowDuration",get:function(){return null===this._segmentTargetDuration?0:this._extrapolatedWindowNumSegments*this._segmentTargetDuration}}]),e.prototype._setupHls=function(){
+var t=this;this._hls=new f.default(this.options.playback.hlsjsConfig||{}),this._hls.on(f.default.Events.MEDIA_ATTACHED,function(){return t._hls.loadSource(t.options.src)}),this._hls.on(f.default.Events.LEVEL_LOADED,function(e,n){return t._updatePlaybackType(e,n)}),this._hls.on(f.default.Events.LEVEL_UPDATED,function(e,n){return t._onLevelUpdated(e,n)}),this._hls.on(f.default.Events.LEVEL_SWITCH,function(e,n){return t._onLevelSwitch(e,n)}),this._hls.on(f.default.Events.FRAG_LOADED,function(e,n){return t._onFragmentLoaded(e,n)}),this._hls.on(f.default.Events.ERROR,function(e,n){return t._onHLSJSError(e,n)}),this._hls.attachMedia(this.el)},e.prototype._recover=function(t,e){this._recoveredDecodingError?this._recoveredAudioCodecError?(A.default.error("hlsjs: failed to recover"),this.trigger(g.default.PLAYBACK_ERROR,"hlsjs: could not recover from error, evt "+t+", data "+e+" ",this.name)):(this._recoveredAudioCodecError=!0,this._hls.swapAudioCodec(),this._hls.recoverMediaError()):(this._recoveredDecodingError=!0,this._hls.recoverMediaError())},e.prototype._setupSrc=function(t){},e.prototype._startTimeUpdateTimer=function(){var t=this;this._timeUpdateTimer=setInterval(function(){t._onDurationChange(),t._onTimeUpdate()},100)},e.prototype._stopTimeUpdateTimer=function(){clearInterval(this._timeUpdateTimer)},e.prototype.getDuration=function(){return this._duration},e.prototype.getCurrentTime=function(){return Math.max(0,this.el.currentTime-this._startTime)},e.prototype.getStartTimeOffset=function(){return this._startTime},e.prototype.seekPercentage=function(t){var e=this._duration;t>0&&(e=this._duration*(t/100)),this.seek(e)},e.prototype.seek=function(e){e<0&&(A.default.warn("Attempt to seek to a negative time. Resetting to live point. Use seekToLivePoint() to seek to the live point."),e=this.getDuration()),this.dvrEnabled&&this._updateDvr(e<this.getDuration()-3),e+=this._startTime,t.prototype.seek.call(this,e)},e.prototype.seekToLivePoint=function(){this.seek(this.getDuration())},e.prototype._updateDvr=function(t){this.trigger(g.default.PLAYBACK_DVR,t),this.trigger(g.default.PLAYBACK_STATS_ADD,{dvr:t})},e.prototype._updateSettings=function(){this._playbackType===m.default.VOD?this.settings.left=["playpause","position","duration"]:this.dvrEnabled?this.settings.left=["playpause"]:this.settings.left=["playstop"],this.settings.seekEnabled=this.isSeekEnabled(),this.trigger(g.default.PLAYBACK_SETTINGSUPDATE)},e.prototype._onHLSJSError=function(t,e){if(e.fatal)if(this._recoverAttemptsRemaining>0)switch(this._recoverAttemptsRemaining-=1,e.type){case f.default.ErrorTypes.NETWORK_ERROR:A.default.warn("hlsjs: trying to recover from network error, evt "+t+", data "+e+" "),this._hls.startLoad();break;case f.default.ErrorTypes.MEDIA_ERROR:A.default.warn("hlsjs: trying to recover from media error, evt "+t+", data "+e+" "),this._recover(t,e);break;default:A.default.error("hlsjs: trying to recover from error, evt "+t+", data "+e+" "),this.trigger(g.default.PLAYBACK_ERROR,"hlsjs: could not recover from error, evt "+t+", data "+e+" ",this.name)}else A.default.error("hlsjs: could not recover from error after maximum number of attempts, evt "+t+", data "+e+" "),this.trigger(g.default.PLAYBACK_ERROR,{evt:t,data:e},this.name);else A.default.warn("hlsjs: non-fatal error occurred, evt "+t+", data "+e+" ")},e.prototype._onTimeUpdate=function(){var t={current:this.getCurrentTime(),total:this.getDuration()};(0,p.default)(t,this._lastTimeUpdate)||(this._lastTimeUpdate=t,this.trigger(g.default.PLAYBACK_TIMEUPDATE,t,this.name))},e.prototype._onDurationChange=function(){var e=this.getDuration();this._lastDuration!==e&&(this._lastDuration=e,t.prototype._onDurationChange.call(this))},e.prototype._onProgress=function(){if(this.el.buffered.length){for(var t=[],e=0,n=0;n<this.el.buffered.length;n++)t=[].concat(i(t),[{start:Math.max(0,this.el.buffered.start(n)-this._playableRegionStartTime),end:Math.max(0,this.el.buffered.end(n)-this._playableRegionStartTime)}]),this.el.currentTime>=t[n].start&&this.el.currentTime<=t[n].end&&(e=n);var r={start:t[e].start,current:t[e].end,total:this.getDuration()};this.trigger(g.default.PLAYBACK_PROGRESS,r,t)}},e.prototype.play=function(){this._hls||this._setupHls(),t.prototype.play.call(this)},e.prototype.pause=function(){this._hls&&(t.prototype.pause.call(this),this.dvrEnabled&&this._updateDvr(!0))},e.prototype.stop=function(){this._hls&&(t.prototype.stop.call(this),this._hls.destroy(),delete this._hls)},e.prototype.destroy=function(){this._stopTimeUpdateTimer(),this._hls&&(this._hls.destroy(),delete this._hls),t.prototype.destroy.call(this)},e.prototype._updatePlaybackType=function(t,e){this._playbackType=e.details.live?m.default.LIVE:m.default.VOD,this._fillLevels(),this._onLevelUpdated(t,e)},e.prototype._fillLevels=function(){this._levels=this._hls.levels.map(function(t,e){return{id:e,level:t,label:t.bitrate/1e3+"Kbps"}}),this.trigger(g.default.PLAYBACK_LEVELS_AVAILABLE,this._levels)},e.prototype._onLevelUpdated=function(t,e){this._segmentTargetDuration=e.details.targetduration,this._playlistType=e.details.type||null;var n=!1,r=!1,i=e.details.fragments,o=this._playableRegionStartTime,a=this._playableRegionDuration;if(0!==i.length){if(this._playableRegionStartTime!==i[0].start&&(n=!0,this._playableRegionStartTime=i[0].start),n)if(this._localStartTimeCorrelation){var s=this._localStartTimeCorrelation,l=this._now-s.local,u=(s.remote+l)/1e3;u<i[0].start?this._localStartTimeCorrelation={local:this._now,remote:1e3*i[0].start}:u>o+this._extrapolatedWindowDuration&&(this._localStartTimeCorrelation={local:this._now,remote:1e3*Math.max(i[0].start,o+this._extrapolatedWindowDuration)})}else this._localStartTimeCorrelation={local:this._now,remote:1e3*(i[0].start+this._extrapolatedWindowDuration/2)};var c=e.details.totalduration;if(this._playbackType===m.default.LIVE){var d=e.details.targetduration,h=this.options.playback||{},p=h.liveSyncDurationCount||f.default.DefaultConfig.liveSyncDurationCount,y=d*p;y<=c?(c-=y,this._durationExcludesAfterLiveSyncPoint=!0):this._durationExcludesAfterLiveSyncPoint=!1}c!==this._playableRegionDuration&&(r=!0,this._playableRegionDuration=c);var g=i[0].start+c,v=o+a,b=g!==v;if(b)if(this._localEndTimeCorrelation){var _=this._localEndTimeCorrelation,E=this._now-_.local,T=(_.remote+E)/1e3;T>g?this._localEndTimeCorrelation={local:this._now,remote:1e3*g}:T<g-this._extrapolatedWindowDuration?this._localEndTimeCorrelation={local:this._now,remote:1e3*(g-this._extrapolatedWindowDuration)}:T>v&&(this._localEndTimeCorrelation={local:this._now,remote:1e3*v})}else this._localEndTimeCorrelation={local:this._now,remote:1e3*g};r&&this._onDurationChange(),n&&this._onProgress()}},e.prototype._onFragmentLoaded=function(t,e){this.trigger(g.default.PLAYBACK_FRAGMENT_LOADED,e)},e.prototype._onLevelSwitch=function(t,e){this.levels.length||this._fillLevels(),this.trigger(g.default.PLAYBACK_LEVEL_SWITCH_END),this.trigger(g.default.PLAYBACK_LEVEL_SWITCH,e);var n=this._hls.levels[e.level];n&&(this.highDefinition=n.height>=720||n.bitrate/1e3>=2e3,this.trigger(g.default.PLAYBACK_HIGHDEFINITIONUPDATE,this.highDefinition),this.trigger(g.default.PLAYBACK_BITRATE,{height:n.height,width:n.width,bandwidth:n.bitrate,bitrate:n.bitrate,level:e.level}))},e.prototype.getPlaybackType=function(){return this._playbackType},e.prototype.isSeekEnabled=function(){return this._playbackType===m.default.VOD||this.dvrEnabled},l(e,[{key:"dvrEnabled",get:function(){return this._durationExcludesAfterLiveSyncPoint&&this._duration>=this._minDvrSize&&this.getPlaybackType()===m.default.LIVE}}]),e}(c.default);e.default=w,w.canPlay=function(t,e){var n=t.split("?")[0].match(/.*\.(.*)$/)||[],r=n.length>1&&"m3u8"===n[1].toLowerCase()||"application/x-mpegURL"===e||"application/vnd.apple.mpegurl"===e;return!(!f.default.isSupported()||!r||_.default.isSafari)},t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(1),u=r(l),c=n(3),d=r(c),f=n(16),h=r(f),p=function(t){function e(){return i(this,e),o(this,t.apply(this,arguments))}return a(e,t),e.prototype.updateSettings=function(){this.settings.left=["playpause","position","duration"],this.settings.seekEnabled=this.isSeekEnabled(),this.trigger(u.default.PLAYBACK_SETTINGSUPDATE)},e.prototype.getPlaybackType=function(){return d.default.AOD},s(e,[{key:"name",get:function(){return"html5_audio"}},{key:"tagName",get:function(){return"audio"}},{key:"isAudioOnly",get:function(){return!0}}]),e}(h.default);e.default=p,p.canPlay=function(t,e){var n={wav:["audio/wav"],mp3:["audio/mp3",'audio/mpeg;codecs="mp3"'],aac:['audio/mp4;codecs="mp4a.40.5"'],oga:["audio/ogg"]};return h.default._canPlay("audio",n,t,e)},t.exports=e.default},function(t,e,n){(function(r){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}function l(t){if(Array.isArray(t)){for(var e=0,n=Array(t.length);e<t.length;e++)n[e]=t[e];return n}return Array.from(t)}Object.defineProperty(e,"__esModule",{value:!0});var u=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),c=n(2),d=n(3),f=i(d),h=n(4),p=i(h),y=n(8),g=i(y),v=n(1),m=i(v),b=n(82),_=i(b),E=n(5),T=i(E),A={mp4:["avc1.42E01E","avc1.58A01E","avc1.4D401E","avc1.64001E","mp4v.20.8","mp4v.20.240","mp4a.40.2"].map(function(t){return'video/mp4; codecs="'+t+', mp4a.40.2"'}),ogg:['video/ogg; codecs="theora, vorbis"','video/ogg; codecs="dirac"','video/ogg; codecs="theora, speex"'],"3gpp":['video/3gpp; codecs="mp4v.20.8, samr"'],webm:['video/webm; codecs="vp8, vorbis"'],mkv:['video/x-matroska; codecs="theora, vorbis"'],m3u8:["application/x-mpegurl"]};A.ogv=A.ogg,A["3gp"]=A["3gpp"];var k={wav:["audio/wav"],mp3:["audio/mp3",'audio/mpeg;codecs="mp3"'],aac:['audio/mp4;codecs="mp4a.40.5"'],oga:["audio/ogg"]},w=Object.keys(k).reduce(function(t,e){return[].concat(l(t),l(k[e]))},[]),S=function(t){function e(){o(this,e);for(var n=arguments.length,i=Array(n),s=0;s<n;s++)i[s]=arguments[s];var l=a(this,t.call.apply(t,[this].concat(i)));l._loadStarted=!1,l._playheadMoving=!1,l._playheadMovingTimer=null,l._stopped=!1,l._setupSrc(l.options.src),l.options.playback||(l.options.playback=l.options||{}),l.options.playback.disableContextMenu=l.options.playback.disableContextMenu||l.options.disableVideoTagContextMenu;var u=l.options.playback,c=u.preload||(g.default.isSafari?"auto":l.options.preload);return T.default.extend(l.el,{loop:l.options.loop,poster:l.options.poster,preload:c||"metadata",controls:(u.controls||l.options.useVideoTagDefaultControls)&&"controls",crossOrigin:u.crossOrigin,"x-webkit-playsinline":u.playInline}),l.settings={default:["seekbar"]},l.settings.left=["playpause","position","duration"],l.settings.right=["fullscreen","volume","hd-indicator"],l.options.autoPlay&&r.nextTick(function(){return l.play()}),l}return s(e,t),u(e,[{key:"name",get:function(){return"html5_video"}},{key:"tagName",get:function(){return this.isAudioOnly?"audio":"video"}},{key:"isAudioOnly",get:function(){var t=this.options.src,n=e._mimeTypesForUrl(t,k,this.options.mimeType);return this.options.playback&&this.options.playback.audioOnly||this.options.audioOnly||w.indexOf(n[0])>=0}},{key:"attributes",get:function(){return{"data-html5-video":""}}},{key:"events",get:function(){return{canplay:"_onCanPlay",canplaythrough:"_handleBufferingEvents",durationchange:"_onDurationChange",ended:"_onEnded",error:"_onError",loadeddata:"_onLoadedData",loadedmetadata:"_onLoadedMetadata",pause:"_onPause",playing:"_onPlaying",progress:"_onProgress",seeked:"_handleBufferingEvents",seeking:"_handleBufferingEvents",stalled:"_handleBufferingEvents",timeupdate:"_onTimeUpdate",waiting:"_onWaiting"}}},{key:"ended",get:function(){return this.el.ended}},{key:"buffering",get:function(){return!!this._bufferingState}}]),e.prototype._setupSrc=function(t){this.el.src!==t&&(this._src=t,this.el.src=t)},e.prototype._onLoadedMetadata=function(t){this._handleBufferingEvents(),this.trigger(m.default.PLAYBACK_LOADEDMETADATA,{duration:t.target.duration,data:t}),this._updateSettings();var e="undefined"==typeof this._options.autoSeekFromUrl||this._options.autoSeekFromUrl;this.getPlaybackType()!==f.default.LIVE&&e&&this._checkInitialSeek()},e.prototype._onDurationChange=function(){this._updateSettings(),this._onTimeUpdate(),this._onProgress()},e.prototype._updateSettings=function(){this.getPlaybackType()===f.default.VOD||this.getPlaybackType()===f.default.AOD?this.settings.left=["playpause","position","duration"]:this.settings.left=["playstop"],this.settings.seekEnabled=this.isSeekEnabled(),this.trigger(m.default.PLAYBACK_SETTINGSUPDATE)},e.prototype.isSeekEnabled=function(){return isFinite(this.getDuration())},e.prototype.getPlaybackType=function(){var t="audio"===this.tagName?f.default.AOD:f.default.VOD;return[0,void 0,1/0].indexOf(this.el.duration)>=0?f.default.LIVE:t},e.prototype.isHighDefinitionInUse=function(){return!1},e.prototype.play=function(){this.trigger(m.default.PLAYBACK_PLAY_INTENT),this._stopped=!1,this._setupSrc(this._src),this._handleBufferingEvents(),this.el.play()},e.prototype.pause=function(){this.el.pause()},e.prototype.stop=function(){this.pause(),this._stopped=!0,this.el.removeAttribute("src"),this._stopPlayheadMovingChecks(),this._handleBufferingEvents(),this.trigger(m.default.PLAYBACK_STOP)},e.prototype.volume=function(t){this.el.volume=t/100},e.prototype.mute=function(){this.el.volume=0},e.prototype.unmute=function(){this.el.volume=1},e.prototype.isMuted=function(){return!!this.el.volume},e.prototype.isPlaying=function(){return!this.el.paused&&!this.el.ended},e.prototype._startPlayheadMovingChecks=function(){null===this._playheadMovingTimer&&(this._playheadMovingTimeOnCheck=null,this._determineIfPlayheadMoving(),this._playheadMovingTimer=setInterval(this._determineIfPlayheadMoving.bind(this),500))},e.prototype._stopPlayheadMovingChecks=function(){null!==this._playheadMovingTimer&&(clearInterval(this._playheadMovingTimer),this._playheadMovingTimer=null,this._playheadMoving=!1)},e.prototype._determineIfPlayheadMoving=function(){var t=this._playheadMovingTimeOnCheck,e=this.el.currentTime;this._playheadMoving=t!==e,this._playheadMovingTimeOnCheck=e,this._handleBufferingEvents()},e.prototype._onWaiting=function(){this._loadStarted=!0,this._handleBufferingEvents()},e.prototype._onLoadedData=function(){this._loadStarted=!0,this._handleBufferingEvents()},e.prototype._onCanPlay=function(){this._handleBufferingEvents()},e.prototype._onPlaying=function(){this._startPlayheadMovingChecks(),this._handleBufferingEvents(),this.trigger(m.default.PLAYBACK_PLAY)},e.prototype._onPause=function(){this._stopPlayheadMovingChecks(),this._handleBufferingEvents(),this.trigger(m.default.PLAYBACK_PAUSE)},e.prototype._onEnded=function(){this._handleBufferingEvents(),this.trigger(m.default.PLAYBACK_ENDED,this.name)},e.prototype._handleBufferingEvents=function(){var t=!this.el.ended&&!this.el.paused,e=this._loadStarted&&!this.el.ended&&!this._stopped&&(t&&!this._playheadMoving||this.el.readyState<this.el.HAVE_FUTURE_DATA);this._bufferingState!==e&&(this._bufferingState=e,e?this.trigger(m.default.PLAYBACK_BUFFERING,this.name):this.trigger(m.default.PLAYBACK_BUFFERFULL,this.name))},e.prototype._onError=function(){this.trigger(m.default.PLAYBACK_ERROR,this.el.error,this.name)},e.prototype.destroy=function(){this.$el.remove(),this.el.src="",this._src=null},e.prototype.seek=function(t){this.el.currentTime=t},e.prototype.seekPercentage=function(t){var e=this.el.duration*(t/100);this.seek(e)},e.prototype._checkInitialSeek=function(){var t=(0,c.seekStringToSeconds)(window.location.href);0!==t&&this.seek(t)},e.prototype.getCurrentTime=function(){return this.el.currentTime},e.prototype.getDuration=function(){return this.el.duration},e.prototype._onTimeUpdate=function(){this._handleBufferingEvents(),this.getPlaybackType()===f.default.LIVE?this.trigger(m.default.PLAYBACK_TIMEUPDATE,{current:1,total:1},this.name):this.trigger(m.default.PLAYBACK_TIMEUPDATE,{current:this.el.currentTime,total:this.el.duration},this.name)},e.prototype._onProgress=function(){if(this.el.buffered.length){for(var t=[],e=0,n=0;n<this.el.buffered.length;n++)t=[].concat(l(t),[{start:this.el.buffered.start(n),end:this.el.buffered.end(n)}]),this.el.currentTime>=t[n].start&&this.el.currentTime<=t[n].end&&(e=n);var r={start:t[e].start,current:t[e].end,total:this.el.duration};this.trigger(m.default.PLAYBACK_PROGRESS,r,t)}},e.prototype._typeFor=function(t){var n=e._mimeTypesForUrl(t,A,this.options.mimeType);0==n.length&&(n=e._mimeTypesForUrl(t,k,this.options.mimeType));var r=n[0]||"";return r.split(";")[0]},e.prototype._ready=function(){this._isReadyState||(this._isReadyState=!0,this.trigger(m.default.PLAYBACK_READY,this.name))},e.prototype.render=function(){var t=p.default.getStyleFor(_.default);return this.options.playback.disableContextMenu&&this.$el.on("contextmenu",function(){return!1}),this.$el.append(t),this._ready(),this},u(e,[{key:"isReady",get:function(){return this._isReadyState}}]),e}(f.default);e.default=S,S._mimeTypesForUrl=function(t,e,n){var r=(t.split("?")[0].match(/.*\.(.*)$/)||[])[1],i=n||r&&e[r.toLowerCase()]||[];return i.constructor===Array?i:[i]},S._canPlay=function(t,e,n,r){var i=S._mimeTypesForUrl(n,e,r),o=document.createElement(t);return!!i.filter(function(t){return!!o.canPlayType(t).replace(/no/,"")})[0]},S.canPlay=function(t,e){return S._canPlay("audio",k,t,e)||S._canPlay("video",A,t,e)},t.exports=S,t.exports=e.default}).call(e,n(21))},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(3),u=r(l),c=n(4),d=r(c),f=n(83),h=r(f),p=n(1),y=r(p),g=function(t){function e(n){i(this,e);var r=o(this,t.call(this,n));return r.el.src=n.src,r}return a(e,t),e.prototype.getPlaybackType=function(){return u.default.NO_OP},s(e,[{key:"name",get:function(){return"html_img"}},{key:"tagName",get:function(){return"img"}},{key:"attributes",get:function(){return{"data-html-img":""}}},{key:"events",get:function(){return{load:"_onLoad",abort:"_onError",error:"_onError"}}}]),e.prototype.render=function(){var t=d.default.getStyleFor(h.default);return this.$el.append(t),this.trigger(y.default.PLAYBACK_READY,this.name),this},e.prototype._onLoad=function(){this.trigger(y.default.PLAYBACK_ENDED,this.name)},e.prototype._onError=function(t){var e="error"===t.type?"load error":"loading aborted";this.trigger(y.default.PLAYBACK_ERROR,{message:e},this.name)},e}(u.default);e.default=g,g.canPlay=function(t){return/\.(png|jpg|jpeg|gif|bmp|tiff|pgm|pnm|webp)(|\?.*)$/i.test(t)},t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(2),u=n(3),c=r(u),d=n(6),f=r(d),h=n(4),p=r(h),y=n(1),g=r(y),v=n(84),m=r(v),b=n(93),_=r(b),E=function(t){function e(){i(this,e);for(var n=arguments.length,r=Array(n),a=0;a<n;a++)r[a]=arguments[a];var s=o(this,t.call.apply(t,[this].concat(r)));return s._noiseFrameNum=-1,s._started=!1,s}return a(e,t),s(e,[{key:"name",get:function(){return"no_op"}},{key:"template",get:function(){return(0,f.default)(_.default)}},{key:"attributes",get:function(){return{"data-no-op":""}}}]),e.prototype.render=function(){var t=p.default.getStyleFor(m.default),e=this.options.playbackNotSupportedMessage||this.i18n.t("playback_not_supported");this.$el.html(this.template({message:e})),this.$el.append(t),this.trigger(g.default.PLAYBACK_READY,this.name);var n=!(!this.options.poster||!this.options.poster.showForNoOp);return!this.options.autoPlay&&n||this.play(),this},e.prototype.play=function(){this._started||(this._started=!0,this.trigger(g.default.PLAYBACK_PLAY),this._animate())},e.prototype._noise=function(){if(this._noiseFrameNum=(this._noiseFrameNum+1)%5,!this._noiseFrameNum){var t=this.context.createImageData(this.context.canvas.width,this.context.canvas.height),e=void 0;try{e=new Uint32Array(t.data.buffer)}catch(i){e=new Uint32Array(this.context.canvas.width*this.context.canvas.height*4);for(var n=t.data,r=0;r<n.length;r++)e[r]=n[r]}for(var i=e.length,o=6*Math.random()+4,a=0,s=0,l=0;l<i;){if(a<0){a=o*Math.random();var u=Math.pow(Math.random(),.4);s=255*u<<24}a-=1,e[l++]=s}this.context.putImageData(t,0,0)}},e.prototype._loop=function(){var t=this;this._stop||(this._noise(),this._animationHandle=(0,l.requestAnimationFrame)(function(){return t._loop()}))},e.prototype.destroy=function(){this._animationHandle&&((0,l.cancelAnimationFrame)(this._animationHandle),this._stop=!0)},e.prototype._animate=function(){this.canvas=this.$el.find("canvas[data-no-op-canvas]")[0],this.context=this.canvas.getContext("2d"),this._loop()},e}(c.default);e.default=E,E.canPlay=function(t){return!0},t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(13),u=r(l),c=n(1),d=r(c),f=n(3),h=r(f),p=function(t){function e(n){return i(this,e),o(this,t.call(this,n))}return a(e,t),s(e,[{key:"name",get:function(){return"click_to_pause"}}]),e.prototype.bindEvents=function(){this.listenTo(this.container,d.default.CONTAINER_CLICK,this.click),this.listenTo(this.container,d.default.CONTAINER_SETTINGSUPDATE,this.settingsUpdate)},e.prototype.click=function(){(this.container.getPlaybackType()!==h.default.LIVE||this.container.isDvrEnabled())&&(this.container.isPlaying()?this.container.pause():this.container.play())},e.prototype.settingsUpdate=function(){this.container.$el.removeClass("pointer-enabled"),(this.container.getPlaybackType()!==h.default.LIVE||this.container.isDvrEnabled())&&this.container.$el.addClass("pointer-enabled")},e}(u.default);e.default=p,t.exports=e.default},function(t,e,n){"use strict";t.exports=n(56)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(17),u=r(l),c=n(6),d=r(c),f=n(3),h=r(f),p=n(4),y=r(p),g=n(1),v=r(g),m=n(85),b=r(m),_=n(94),E=r(_),T=function(t){function e(n){i(this,e);var r=o(this,t.call(this,n));return r.settingsUpdate(),r}return a(e,t),s(e,[{key:"template",get:function(){return(0,d.default)(E.default)}},{key:"name",get:function(){return"dvr_controls"}},{key:"events",get:function(){return{"click .live-button":"click"}}},{key:"attributes",get:function(){return{class:"dvr-controls","data-dvr-controls":""}}}]),e.prototype.bindEvents=function(){this.listenTo(this.core.mediaControl,v.default.MEDIACONTROL_CONTAINERCHANGED,this.containerChanged),this.listenTo(this.core.mediaControl,v.default.MEDIACONTROL_RENDERED,this.settingsUpdate),this.listenTo(this.core,v.default.CORE_OPTIONS_CHANGE,this.render),this.core.getCurrentContainer()&&(this.listenToOnce(this.core.getCurrentContainer(),v.default.CONTAINER_TIMEUPDATE,this.render),this.listenTo(this.core.getCurrentContainer(),v.default.CONTAINER_PLAYBACKDVRSTATECHANGED,this.dvrChanged))},e.prototype.containerChanged=function(){this.stopListening(),this.bindEvents()},e.prototype.dvrChanged=function(t){this.settingsUpdate(),this.core.mediaControl.$el.addClass("live"),t?(this.core.mediaControl.$el.addClass("dvr"),this.core.mediaControl.$el.find(".media-control-indicator[data-position], .media-control-indicator[data-duration]").hide()):this.core.mediaControl.$el.removeClass("dvr")},e.prototype.click=function(){var t=this.core.mediaControl,e=t.container;e.isPlaying()||e.play(),t.$el.hasClass("dvr")&&e.seek(e.getDuration())},e.prototype.settingsUpdate=function(){var t=this;this.stopListening(),this.shouldRender()&&(this.render(),this.$el.click(function(){return t.click()})),this.bindEvents()},e.prototype.shouldRender=function(){var t=void 0===this.core.options.useDvrControls||!!this.core.options.useDvrControls;return t&&this.core.getPlaybackType()===h.default.LIVE},e.prototype.render=function(){return this.style=this.style||y.default.getStyleFor(b.default,{baseUrl:this.core.options.baseUrl}),this.$el.html(this.template({live:this.core.i18n.t("live"),backToLive:this.core.i18n.t("back_to_live")})),this.$el.append(this.style),this.shouldRender()&&(this.core.mediaControl.$el.addClass("live"),this.core.mediaControl.$(".media-control-left-panel[data-media-control]").append(this.$el)),this},e}(u.default);e.default=T,t.exports=e.default},function(t,e,n){"use strict";t.exports=n(58)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(1),u=r(l),c=n(12),d=r(c),f=n(2),h=function(t){function e(){return i(this,e),o(this,t.apply(this,arguments))}return a(e,t),e.prototype.bindEvents=function(){this.listenTo(this.core.mediaControl,u.default.MEDIACONTROL_CONTAINERCHANGED,this.containerChanged);var t=this.core.getCurrentContainer();t&&(this.listenTo(t,u.default.CONTAINER_ENDED,this.ended),this.listenTo(t,u.default.CONTAINER_STOP,this.ended))},e.prototype.containerChanged=function(){this.stopListening(),this.bindEvents()},e.prototype.ended=function(){var t="undefined"==typeof this.core.options.exitFullscreenOnEnd||this.core.options.exitFullscreenOnEnd;t&&f.Fullscreen.isFullscreen()&&this.core.toggleFullscreen()},s(e,[{key:"name",get:function(){return"end_video"}}]),e}(d.default);e.default=h,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(12),u=r(l),c=n(1),d=r(c),f=n(5),h=r(f),p=n(22),y=r(p),g=n(36),v=r(g),m=(0,h.default)('link[rel="shortcut icon"]'),b=function(t){function e(n){i(this,e);var r=o(this,t.call(this,n));
+return r._container=null,r.configure(),r}return a(e,t),s(e,[{key:"name",get:function(){return"favicon"}},{key:"oldIcon",get:function(){return m}}]),e.prototype.configure=function(){this.core.options.changeFavicon?this.enabled||(this.stopListening(this.core,d.default.CORE_OPTIONS_CHANGE),this.enable()):this.enabled&&(this.disable(),this.listenTo(this.core,d.default.CORE_OPTIONS_CHANGE,this.configure))},e.prototype.bindEvents=function(){this.listenTo(this.core,d.default.CORE_OPTIONS_CHANGE,this.configure),this.listenTo(this.core.mediaControl,d.default.MEDIACONTROL_CONTAINERCHANGED,this.containerChanged),this.core.mediaControl.container&&this.containerChanged()},e.prototype.containerChanged=function(){this._container&&this.stopListening(this._container),this._container=this.core.mediaControl.container,this.listenTo(this._container,d.default.CONTAINER_PLAY,this.setPlayIcon),this.listenTo(this._container,d.default.CONTAINER_PAUSE,this.setPauseIcon),this.listenTo(this._container,d.default.CONTAINER_STOP,this.resetIcon),this.listenTo(this._container,d.default.CONTAINER_ENDED,this.resetIcon),this.listenTo(this._container,d.default.CONTAINER_ERROR,this.resetIcon),this.resetIcon()},e.prototype.disable=function(){t.prototype.disable.call(this),this.resetIcon()},e.prototype.destroy=function(){t.prototype.destroy.call(this),this.resetIcon()},e.prototype.createIcon=function(t){var e=(0,h.default)("<canvas/>");e[0].width=16,e[0].height=16;var n=e[0].getContext("2d");n.fillStyle="#000";var r=(0,h.default)(t).find("path").attr("d"),i=new Path2D(r);n.fill(i);var o=(0,h.default)('<link rel="shortcut icon" type="image/png"/>');return o.attr("href",e[0].toDataURL("image/png")),o},e.prototype.setPlayIcon=function(){this.playIcon||(this.playIcon=this.createIcon(y.default)),this.changeIcon(this.playIcon)},e.prototype.setPauseIcon=function(){this.pauseIcon||(this.pauseIcon=this.createIcon(v.default)),this.changeIcon(this.pauseIcon)},e.prototype.resetIcon=function(){(0,h.default)('link[rel="shortcut icon"]').remove(),(0,h.default)("head").append(this.oldIcon)},e.prototype.changeIcon=function(t){t&&((0,h.default)('link[rel="shortcut icon"]').remove(),(0,h.default)("head").append(t))},e}(u.default);e.default=b,t.exports=e.default},function(t,e,n){"use strict";t.exports=n(61)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(13),u=r(l),c=n(1),d=r(c),f=function(t){function e(n){i(this,e);var r=o(this,t.call(this,n));return r.container.options.gaAccount&&(r.account=r.container.options.gaAccount,r.trackerName=r.container.options.gaTrackerName?r.container.options.gaTrackerName+".":"Clappr.",r.domainName=r.container.options.gaDomainName,r.currentHDState=void 0,r.embedScript()),r}return a(e,t),s(e,[{key:"name",get:function(){return"google_analytics"}}]),e.prototype.embedScript=function(){var t=this;if(window._gat)this.addEventListeners();else{var e=document.createElement("script");e.setAttribute("type","text/javascript"),e.setAttribute("async","async"),e.setAttribute("src","//www.google-analytics.com/ga.js"),e.onload=function(){return t.addEventListeners()},document.body.appendChild(e)}},e.prototype.addEventListeners=function(){var t=this;this.container&&(this.listenTo(this.container,d.default.CONTAINER_READY,this.onReady),this.listenTo(this.container,d.default.CONTAINER_PLAY,this.onPlay),this.listenTo(this.container,d.default.CONTAINER_STOP,this.onStop),this.listenTo(this.container,d.default.CONTAINER_PAUSE,this.onPause),this.listenTo(this.container,d.default.CONTAINER_ENDED,this.onEnded),this.listenTo(this.container,d.default.CONTAINER_STATE_BUFFERING,this.onBuffering),this.listenTo(this.container,d.default.CONTAINER_STATE_BUFFERFULL,this.onBufferFull),this.listenTo(this.container,d.default.CONTAINER_ERROR,this.onError),this.listenTo(this.container,d.default.CONTAINER_PLAYBACKSTATE,this.onPlaybackChanged),this.listenTo(this.container,d.default.CONTAINER_VOLUME,function(e){return t.onVolumeChanged(e)}),this.listenTo(this.container,d.default.CONTAINER_SEEK,function(e){return t.onSeek(e)}),this.listenTo(this.container,d.default.CONTAINER_FULL_SCREEN,this.onFullscreen),this.listenTo(this.container,d.default.CONTAINER_HIGHDEFINITIONUPDATE,this.onHD),this.listenTo(this.container,d.default.CONTAINER_PLAYBACKDVRSTATECHANGED,this.onDVR)),_gaq.push([this.trackerName+"_setAccount",this.account]),this.domainName&&_gaq.push([this.trackerName+"_setDomainName",this.domainName])},e.prototype.onReady=function(){this.push(["Video","Playback",this.container.playback.name])},e.prototype.onPlay=function(){this.push(["Video","Play",this.container.playback.src])},e.prototype.onStop=function(){this.push(["Video","Stop",this.container.playback.src])},e.prototype.onEnded=function(){this.push(["Video","Ended",this.container.playback.src])},e.prototype.onBuffering=function(){this.push(["Video","Buffering",this.container.playback.src])},e.prototype.onBufferFull=function(){this.push(["Video","Bufferfull",this.container.playback.src])},e.prototype.onError=function(){this.push(["Video","Error",this.container.playback.src])},e.prototype.onHD=function(t){var e=t?"ON":"OFF";e!==this.currentHDState&&(this.currentHDState=e,this.push(["Video","HD - "+e,this.container.playback.src]))},e.prototype.onPlaybackChanged=function(t){null!==t.type&&this.push(["Video","Playback Type - "+t.type,this.container.playback.src])},e.prototype.onDVR=function(t){var e=t?"ON":"OFF";this.push(["Interaction","DVR - "+e,this.container.playback.src])},e.prototype.onPause=function(){this.push(["Video","Pause",this.container.playback.src])},e.prototype.onSeek=function(){this.push(["Video","Seek",this.container.playback.src])},e.prototype.onVolumeChanged=function(){this.push(["Interaction","Volume",this.container.playback.src])},e.prototype.onFullscreen=function(){this.push(["Interaction","Fullscreen",this.container.playback.src])},e.prototype.push=function(t){var e=[this.trackerName+"_trackEvent"].concat(t);_gaq.push(e)},e}(u.default);e.default=f,t.exports=e.default},function(t,e,n){"use strict";t.exports=n(63)},function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var i=n(20),o="font-weight: bold; font-size: 13px;",a="color: #006600;"+o,s="color: #0000ff;"+o,l="color: #ff8000;"+o,u="color: #ff0000;"+o,c=0,d=1,f=2,h=3,p=h,y=[s,a,l,u,u],g=["debug","info","warn","error","disabled"],v=function(){function t(){var e=this,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:d,o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p;r(this,t),this.kibo=new i.Kibo,this.kibo.down(["ctrl shift d"],function(){return e.onOff()}),this.BLACKLIST=["timeupdate","playback:timeupdate","playback:progress","container:hover","container:timeupdate","container:progress"],this.level=n,this.offLevel=o}return t.prototype.debug=function(t){this.log(t,c,Array.prototype.slice.call(arguments,1))},t.prototype.info=function(t){this.log(t,d,Array.prototype.slice.call(arguments,1))},t.prototype.warn=function(t){this.log(t,f,Array.prototype.slice.call(arguments,1))},t.prototype.error=function(t){this.log(t,h,Array.prototype.slice.call(arguments,1))},t.prototype.onOff=function(){this.level===this.offLevel?this.level=this.previousLevel:(this.previousLevel=this.level,this.level=this.offLevel),window.console&&window.console.log&&window.console.log("%c[Clappr.Log] set log level to "+g[this.level],l)},t.prototype.level=function(t){this.level=t},t.prototype.log=function(t,e,n){if(!(this.BLACKLIST.indexOf(n[0])>=0||e<this.level)){n||(n=t,t=null);var r=y[e],i="";t&&(i="["+t+"]"),window.console&&window.console.log&&window.console.log.apply(console,["%c["+g[e]+"]"+i,r].concat(n))}},t}();e.default=v,v.LEVEL_DEBUG=c,v.LEVEL_INFO=d,v.LEVEL_WARN=f,v.LEVEL_ERROR=h,v.getInstance=function(){return void 0===this._instance&&(this._instance=new this,this._instance.previousLevel=this._instance.level,this._instance.level=this._instance.offLevel),this._instance},v.setLevel=function(t){this.getInstance().level=t},v.debug=function(){this.getInstance().debug.apply(this.getInstance(),arguments)},v.info=function(){this.getInstance().info.apply(this.getInstance(),arguments)},v.warn=function(){this.getInstance().warn.apply(this.getInstance(),arguments)},v.error=function(){this.getInstance().error.apply(this.getInstance(),arguments)},t.exports=e.default},function(t,e,n){(function(r){"use strict";function i(t){return t&&t.__esModule?t:{default:t}}function o(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function a(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var l=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),u=n(14),c=i(u),d=n(1),f=i(d),h=n(4),p=i(h),y=n(6),g=i(y),v=n(3),m=i(v),b=n(86),_=i(b),E=n(95),T=i(E),A=n(22),k=i(A),w=function(t){function e(n){o(this,e);var i=a(this,t.call(this,n));return i.hasStartedPlaying=!1,i.playRequested=!1,i.render(),r.nextTick(function(){return i.update()}),i}return s(e,t),l(e,[{key:"name",get:function(){return"poster"}},{key:"template",get:function(){return(0,g.default)(T.default)}},{key:"shouldRender",get:function(){var t=!(!this.options.poster||!this.options.poster.showForNoOp);return"html_img"!==this.container.playback.name&&(this.container.playback.getPlaybackType()!==m.default.NO_OP||t)}},{key:"attributes",get:function(){return{class:"player-poster","data-poster":""}}},{key:"events",get:function(){return{click:"clicked"}}},{key:"showOnVideoEnd",get:function(){return!this.options.poster||this.options.poster.showOnVideoEnd||void 0===this.options.poster.showOnVideoEnd}}]),e.prototype.bindEvents=function(){this.listenTo(this.container,f.default.CONTAINER_STOP,this.onStop),this.listenTo(this.container,f.default.CONTAINER_PLAY,this.onPlay),this.listenTo(this.container,f.default.CONTAINER_STATE_BUFFERING,this.update),this.listenTo(this.container,f.default.CONTAINER_STATE_BUFFERFULL,this.update),this.listenTo(this.container,f.default.CONTAINER_OPTIONS_CHANGE,this.render),this.showOnVideoEnd&&this.listenTo(this.container,f.default.CONTAINER_ENDED,this.onStop)},e.prototype.stopListening=function(){t.prototype.stopListening.call(this)},e.prototype.onPlay=function(){this.hasStartedPlaying=!0,this.update()},e.prototype.onStop=function(){this.hasStartedPlaying=!1,this.playRequested=!1,this.update()},e.prototype.showPlayButton=function(t){!t||this.options.chromeless&&!this.options.allowUserInteraction?(this.$playButton.hide(),this.$el.removeClass("clickable")):(this.$playButton.show(),this.$el.addClass("clickable"))},e.prototype.clicked=function(){return this.options.chromeless&&!this.options.allowUserInteraction||(this.playRequested=!0,this.update(),this.container.play()),!1},e.prototype.shouldHideOnPlay=function(){return!this.container.playback.isAudioOnly},e.prototype.update=function(){if(this.shouldRender){var t=!this.playRequested&&!this.hasStartedPlaying&&!this.container.buffering;this.showPlayButton(t),this.hasStartedPlaying?(this.container.enableMediaControl(),this.shouldHideOnPlay()&&this.$el.hide()):(this.container.disableMediaControl(),this.$el.show())}},e.prototype.render=function(){if(this.shouldRender){var t=p.default.getStyleFor(_.default,{baseUrl:this.options.baseUrl});if(this.$el.html(this.template()),this.$el.append(t),this.options.poster){var e=this.options.poster.url||this.options.poster;this.$el.css({"background-image":"url("+e+")"})}this.container.$el.append(this.el),this.$playWrapper=this.$el.find(".play-wrapper"),this.$playWrapper.append(k.default),this.$playButton=this.$playWrapper.find("svg"),this.$playButton.addClass("poster-icon"),this.$playButton.attr("data-poster","");var n=this.options.mediacontrol&&this.options.mediacontrol.buttons;return n&&this.$el.find("svg path").css("fill",n),this.options.mediacontrol&&this.options.mediacontrol.buttons&&(n=this.options.mediacontrol.buttons,this.$playButton.css("color",n)),this.update(),this}},e}(c.default);e.default=w,t.exports=e.default}).call(e,n(21))},function(t,e,n){"use strict";t.exports=n(68)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(2),u=n(17),c=r(u),d=n(4),f=r(d),h=n(6),p=r(h),y=n(1),g=r(y),v=n(3),m=r(v),b=n(87),_=r(b),E=n(96),T=r(E),A=function(t){function e(n){i(this,e);var r=o(this,t.call(this,n));return r.hoveringOverSeekBar=!1,r.hoverPosition=null,r.duration=null,r.actualLiveTime=!!r.mediaControl.options.actualLiveTime,r.actualLiveTime&&(r.mediaControl.options.actualLiveServerTime?r.actualLiveServerTimeDiff=(new Date).getTime()-new Date(r.mediaControl.options.actualLiveServerTime).getTime():r.actualLiveServerTimeDiff=0),r}return a(e,t),s(e,[{key:"name",get:function(){return"seek_time"}},{key:"template",get:function(){return(0,p.default)(T.default)}},{key:"attributes",get:function(){return{class:"seek-time","data-seek-time":""}}},{key:"mediaControl",get:function(){return this.core.mediaControl}},{key:"mediaControlContainer",get:function(){return this.mediaControl.container}},{key:"isLiveStreamWithDvr",get:function(){return this.mediaControlContainer&&this.mediaControlContainer.getPlaybackType()===m.default.LIVE&&this.mediaControlContainer.isDvrEnabled()}},{key:"durationShown",get:function(){return this.isLiveStreamWithDvr&&!this.useActualLiveTime}},{key:"useActualLiveTime",get:function(){return this.actualLiveTime&&this.isLiveStreamWithDvr}}]),e.prototype.bindEvents=function(){this.listenTo(this.mediaControl,g.default.MEDIACONTROL_RENDERED,this.render),this.listenTo(this.mediaControl,g.default.MEDIACONTROL_MOUSEMOVE_SEEKBAR,this.showTime),this.listenTo(this.mediaControl,g.default.MEDIACONTROL_MOUSELEAVE_SEEKBAR,this.hideTime),this.listenTo(this.mediaControl,g.default.MEDIACONTROL_CONTAINERCHANGED,this.onContainerChanged),this.mediaControlContainer&&(this.listenTo(this.mediaControlContainer,g.default.CONTAINER_PLAYBACKDVRSTATECHANGED,this.update),this.listenTo(this.mediaControlContainer,g.default.CONTAINER_TIMEUPDATE,this.updateDuration))},e.prototype.onContainerChanged=function(){this.stopListening(),this.bindEvents()},e.prototype.updateDuration=function(t){this.duration=t.total,this.update()},e.prototype.showTime=function(t){this.hoveringOverSeekBar=!0,this.calculateHoverPosition(t),this.update()},e.prototype.hideTime=function(){this.hoveringOverSeekBar=!1,this.update()},e.prototype.calculateHoverPosition=function(t){var e=t.pageX-this.mediaControl.$seekBarContainer.offset().left;this.hoverPosition=Math.min(1,Math.max(e/this.mediaControl.$seekBarContainer.width(),0))},e.prototype.getSeekTime=function(){var t=void 0,e=void 0;if(this.useActualLiveTime){var n=new Date((new Date).getTime()-this.actualLiveServerTimeDiff),r=new Date(n);e=(r-n.setHours(0,0,0,0))/1e3,t=e-this.duration+this.hoverPosition*this.duration,t<0&&(t+=86400)}else t=this.hoverPosition*this.duration;return{seekTime:t,secondsSinceMidnight:e}},e.prototype.update=function(){if(this.rendered)if(this.shouldBeVisible()){var t=this.getSeekTime(),e=(0,l.formatTime)(t.seekTime,this.useActualLiveTime);if(e!==this.displayedSeekTime&&(this.$seekTimeEl.text(e),this.displayedSeekTime=e),this.durationShown){this.$durationEl.show();var n=(0,l.formatTime)(this.actualLiveTime?t.secondsSinceMidnight:this.duration,this.actualLiveTime);n!==this.displayedDuration&&(this.$durationEl.text(n),this.displayedDuration=n)}else this.$durationEl.hide();this.$el.show();var r=this.mediaControl.$seekBarContainer.width(),i=this.$el.width(),o=this.hoverPosition*r;o-=i/2,o=Math.max(0,Math.min(o,r-i)),this.$el.css("left",o)}else this.$el.hide(),this.$el.css("left","-100%")},e.prototype.shouldBeVisible=function(){return this.mediaControlContainer&&this.mediaControlContainer.settings.seekEnabled&&this.hoveringOverSeekBar&&null!==this.hoverPosition&&null!==this.duration},e.prototype.render=function(){this.rendered=!0,this.displayedDuration=null,this.displayedSeekTime=null;var t=f.default.getStyleFor(_.default);this.$el.html(this.template()),this.$el.append(t),this.$el.hide(),this.mediaControl.$el.append(this.el),this.$seekTimeEl=this.$el.find("[data-seek-time]"),this.$durationEl=this.$el.find("[data-duration]"),this.$durationEl.hide(),this.update()},e}(c.default);e.default=A,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(12),u=r(l),c=n(1),d=r(c),f=function(t){function e(){return i(this,e),o(this,t.apply(this,arguments))}return a(e,t),e.prototype.bindEvents=function(){this.listenTo(this.core,d.default.CORE_CONTAINERS_CREATED,this.onContainersCreated)},e.prototype.onContainersCreated=function(){var t=this.core.containers.filter(function(t){return"no_op"!==t.playback.name})[0]||this.core.containers[0];t&&this.core.containers.forEach(function(e){e!==t&&e.destroy()})},s(e,[{key:"name",get:function(){return"sources"}}]),e}(u.default);e.default=f,t.exports=e.default},function(t,e,n){"use strict";t.exports=n(71)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(14),u=r(l),c=n(1),d=r(c),f=n(4),h=r(f),p=n(6),y=r(p),g=n(97),v=r(g),m=n(88),b=r(m),_=function(t){function e(n){i(this,e);var r=o(this,t.call(this,n));return r.template=(0,y.default)(v.default),r.showTimeout=null,r.listenTo(r.container,d.default.CONTAINER_STATE_BUFFERING,r.onBuffering),r.listenTo(r.container,d.default.CONTAINER_STATE_BUFFERFULL,r.onBufferFull),r.listenTo(r.container,d.default.CONTAINER_STOP,r.onStop),r.listenTo(r.container,d.default.CONTAINER_ENDED,r.onStop),r.listenTo(r.container,d.default.CONTAINER_ERROR,r.onStop),r.render(),r}return a(e,t),s(e,[{key:"name",get:function(){return"spinner"}},{key:"attributes",get:function(){return{"data-spinner":"",class:"spinner-three-bounce"}}}]),e.prototype.onBuffering=function(){this.show()},e.prototype.onBufferFull=function(){this.hide()},e.prototype.onStop=function(){this.hide()},e.prototype.show=function(){var t=this;null===this.showTimeout&&(this.showTimeout=setTimeout(function(){return t.$el.show()},300))},e.prototype.hide=function(){null!==this.showTimeout&&(clearTimeout(this.showTimeout),this.showTimeout=null),this.$el.hide()},e.prototype.render=function(){this.$el.html(this.template());var t=h.default.getStyleFor(b.default);return this.container.$el.append(t),this.container.$el.append(this.$el),this.$el.hide(),this.container.buffering&&this.onBuffering(),this},e}(u.default);e.default=_,t.exports=e.default},function(t,e,n){"use strict";t.exports=n(73)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(13),u=r(l),c=n(1),d=r(c),f=n(5),h=r(f),p=function(t){function e(n){i(this,e);var r=o(this,t.call(this,n));return r.setInitialAttrs(),r.reportInterval=r.options.reportInterval||5e3,r.state="IDLE",r}return a(e,t),s(e,[{key:"name",get:function(){return"stats"}}]),e.prototype.bindEvents=function(){this.listenTo(this.container.playback,d.default.PLAYBACK_PLAY,this.onPlay),this.listenTo(this.container,d.default.CONTAINER_STOP,this.onStop),this.listenTo(this.container,d.default.CONTAINER_ENDED,this.onStop),this.listenTo(this.container,d.default.CONTAINER_DESTROYED,this.onStop),this.listenTo(this.container,d.default.CONTAINER_STATE_BUFFERING,this.onBuffering),this.listenTo(this.container,d.default.CONTAINER_STATE_BUFFERFULL,this.onBufferFull),this.listenTo(this.container,d.default.CONTAINER_STATS_ADD,this.onStatsAdd),this.listenTo(this.container,d.default.CONTAINER_BITRATE,this.onStatsAdd),this.listenTo(this.container.playback,d.default.PLAYBACK_STATS_ADD,this.onStatsAdd)},e.prototype.setInitialAttrs=function(){this.firstPlay=!0,this.startupTime=0,this.rebufferingTime=0,this.watchingTime=0,this.rebuffers=0,this.externalMetrics={}},e.prototype.onPlay=function(){this.state="PLAYING",this.watchingTimeInit=Date.now(),this.intervalId||(this.intervalId=setInterval(this.report.bind(this),this.reportInterval))},e.prototype.onStop=function(){clearInterval(this.intervalId),this.report(),this.intervalId=void 0,this.state="STOPPED"},e.prototype.onBuffering=function(){this.firstPlay?this.startupTimeInit=Date.now():this.rebufferingTimeInit=Date.now(),this.state="BUFFERING",this.rebuffers++},e.prototype.onBufferFull=function(){this.firstPlay&&this.startupTimeInit?(this.firstPlay=!1,this.startupTime=Date.now()-this.startupTimeInit,this.watchingTimeInit=Date.now()):this.rebufferingTimeInit&&(this.rebufferingTime+=this.getRebufferingTime()),this.rebufferingTimeInit=void 0,this.state="PLAYING"},e.prototype.getRebufferingTime=function(){return Date.now()-this.rebufferingTimeInit},e.prototype.getWatchingTime=function(){var t=Date.now()-this.watchingTimeInit;return t-this.rebufferingTime},e.prototype.isRebuffering=function(){return!!this.rebufferingTimeInit},e.prototype.onStatsAdd=function(t){h.default.extend(this.externalMetrics,t)},e.prototype.getStats=function(){var t={startupTime:this.startupTime,rebuffers:this.rebuffers,rebufferingTime:this.isRebuffering()?this.rebufferingTime+this.getRebufferingTime():this.rebufferingTime,watchingTime:this.isRebuffering()?this.getWatchingTime()-this.getRebufferingTime():this.getWatchingTime()};return h.default.extend(t,this.externalMetrics),t},e.prototype.report=function(){this.container.statsReport(this.getStats())},e}(u.default);e.default=p,t.exports=e.default},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(2),u=n(12),c=r(u),d=n(35),f=r(d),h=function(t){function e(n){i(this,e);var r=o(this,t.call(this,n));return r._initializeMessages(),r}return a(e,t),s(e,[{key:"name",get:function(){return"strings"}}]),e.prototype.t=function(t){var e=this._language(),n=e&&this._messages[e]||this._messages.en;return n[t]||t},e.prototype._language=function(){return this.core.options.language||(0,l.getBrowserLanguage)()},e.prototype._initializeMessages=function(){this._messages=(0,f.default)({en:{live:"live",back_to_live:"back to live",playback_not_supported:"Your browser does not support the playback of this video. Please try using a different browser."},pt:{live:"ao vivo",back_to_live:"voltar para o ao vivo",playback_not_supported:"Seu navegador não supporta a reprodução deste video. Por favor, tente usar um navegador diferente."},es:{live:"vivo",back_to_live:"volver en vivo",playback_not_supported:"Su navegador no soporta la reproducción de un video. Por favor, trate de usar un navegador diferente."},ru:{live:"прямой эфир",back_to_live:"к прямому эфиру",playback_not_supported:"Ваш браузер не поддерживает воспроизведение этого видео. Пожалуйста, попробуйте другой браузер."}},this.core.options.strings||{}),this._messages["pt-BR"]=this._messages.pt,this._messages["en-US"]=this._messages.en,this._messages["es-419"]=this._messages.es},e}(c.default);e.default=h,t.exports=e.default},function(t,e,n){"use strict";t.exports=n(76)},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(e,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=n(14),u=r(l),c=n(1),d=r(c),f=n(4),h=r(f),p=n(6),y=r(p),g=n(89),v=r(g),m=n(98),b=r(m),_=function(t){function e(n){i(this,e);var r=o(this,t.call(this,n));return r.configure(),r}return a(e,t),s(e,[{key:"name",get:function(){return"watermark"}},{key:"template",get:function(){return(0,y.default)(b.default)}}]),e.prototype.bindEvents=function(){this.listenTo(this.container,d.default.CONTAINER_PLAY,this.onPlay),this.listenTo(this.container,d.default.CONTAINER_STOP,this.onStop),this.listenTo(this.container,d.default.CONTAINER_OPTIONS_CHANGE,this.configure)},e.prototype.configure=function(){this.position=this.options.position||"bottom-right",this.options.watermark?(this.imageUrl=this.options.watermark,this.imageLink=this.options.watermarkLink,this.render()):this.$el.remove()},e.prototype.onPlay=function(){this.hidden||this.$el.show()},e.prototype.onStop=function(){this.$el.hide()},e.prototype.render=function(){this.$el.hide();var t={position:this.position,imageUrl:this.imageUrl,imageLink:this.imageLink};this.$el.html(this.template(t));var e=h.default.getStyleFor(v.default);return this.container.$el.append(e),this.container.$el.append(this.$el),this},e}(u.default);e.default=_,t.exports=e.default},function(t,e){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=function(t){this.element=t||window.document,this.initialize()};n.KEY_NAMES_BY_CODE={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"caps_lock",27:"esc",32:"space",37:"left",38:"up",39:"right",40:"down",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12"},n.KEY_CODES_BY_NAME={},function(){for(var t in n.KEY_NAMES_BY_CODE)Object.prototype.hasOwnProperty.call(n.KEY_NAMES_BY_CODE,t)&&(n.KEY_CODES_BY_NAME[n.KEY_NAMES_BY_CODE[t]]=+t)}(),n.MODIFIERS=["shift","ctrl","alt"],n.registerEvent=function(){return document.addEventListener?function(t,e,n){t.addEventListener(e,n,!1)}:document.attachEvent?function(t,e,n){t.attachEvent("on"+e,n)}:void 0}(),n.unregisterEvent=function(){return document.removeEventListener?function(t,e,n){t.removeEventListener(e,n,!1)}:document.detachEvent?function(t,e,n){t.detachEvent("on"+e,n)}:void 0;
+}(),n.stringContains=function(t,e){return t.indexOf(e)!==-1},n.neatString=function(t){return t.replace(/^\s+|\s+$/g,"").replace(/\s+/g," ")},n.capitalize=function(t){return t.toLowerCase().replace(/^./,function(t){return t.toUpperCase()})},n.isString=function(t){return n.stringContains(Object.prototype.toString.call(t),"String")},n.arrayIncludes=function(){return Array.prototype.indexOf?function(t,e){return t.indexOf(e)!==-1}:function(t,e){for(var n=0;n<t.length;n++)if(t[n]===e)return!0;return!1}}(),n.extractModifiers=function(t){var e,r;for(e=[],r=0;r<n.MODIFIERS.length;r++)n.stringContains(t,n.MODIFIERS[r])&&e.push(n.MODIFIERS[r]);return e},n.extractKey=function(t){var e,r;for(e=n.neatString(t).split(" "),r=0;r<e.length;r++)if(!n.arrayIncludes(n.MODIFIERS,e[r]))return e[r]},n.modifiersAndKey=function(t){var e,r;return n.stringContains(t,"any")?n.neatString(t).split(" ").slice(0,2).join(" "):(e=n.extractModifiers(t),r=n.extractKey(t),r&&!n.arrayIncludes(n.MODIFIERS,r)&&e.push(r),e.join(" "))},n.keyName=function(t){return n.KEY_NAMES_BY_CODE[t+""]},n.keyCode=function(t){return+n.KEY_CODES_BY_NAME[t]},n.prototype.initialize=function(){var t,e=this;for(this.lastKeyCode=-1,this.lastModifiers={},t=0;t<n.MODIFIERS.length;t++)this.lastModifiers[n.MODIFIERS[t]]=!1;this.keysDown={any:[]},this.keysUp={any:[]},this.downHandler=this.handler("down"),this.upHandler=this.handler("up"),n.registerEvent(this.element,"keydown",this.downHandler),n.registerEvent(this.element,"keyup",this.upHandler),n.registerEvent(window,"unload",function t(){n.unregisterEvent(e.element,"keydown",e.downHandler),n.unregisterEvent(e.element,"keyup",e.upHandler),n.unregisterEvent(window,"unload",t)})},n.prototype.handler=function(t){var e=this;return function(r){var i,o,a;for(r=r||window.event,e.lastKeyCode=r.keyCode,i=0;i<n.MODIFIERS.length;i++)e.lastModifiers[n.MODIFIERS[i]]=r[n.MODIFIERS[i]+"Key"];for(n.arrayIncludes(n.MODIFIERS,n.keyName(e.lastKeyCode))&&(e.lastModifiers[n.keyName(e.lastKeyCode)]=!0),o=e["keys"+n.capitalize(t)],i=0;i<o.any.length;i++)o.any[i](r)===!1&&r.preventDefault&&r.preventDefault();if(a=e.lastModifiersAndKey(),o[a])for(i=0;i<o[a].length;i++)o[a][i](r)===!1&&r.preventDefault&&r.preventDefault()}},n.prototype.registerKeys=function(t,e,r){var i,o,a=this["keys"+n.capitalize(t)];for(n.isString(e)&&(e=[e]),i=0;i<e.length;i++)o=e[i],o=n.modifiersAndKey(o+""),a[o]?a[o].push(r):a[o]=[r];return this},n.prototype.unregisterKeys=function(t,e,r){var i,o,a,s=this["keys"+n.capitalize(t)];for(n.isString(e)&&(e=[e]),i=0;i<e.length;i++)if(a=e[i],a=n.modifiersAndKey(a+""),null===r)delete s[a];else if(s[a])for(o=0;o<s[a].length;o++)if(String(s[a][o])===String(r)){s[a].splice(o,1);break}return this},n.prototype.off=function(t){return this.unregisterKeys("down",t,null)},n.prototype.delegate=function(t,e,n){return null!==n||void 0!==n?this.registerKeys(t,e,n):this.unregisterKeys(t,e,n)},n.prototype.down=function(t,e){return this.delegate("down",t,e)},n.prototype.up=function(t,e){return this.delegate("up",t,e)},n.prototype.lastKey=function(t){return t?this.lastModifiers[t]:n.keyName(this.lastKeyCode)},n.prototype.lastModifiersAndKey=function(){var t,e;for(t=[],e=0;e<n.MODIFIERS.length;e++)this.lastKey(n.MODIFIERS[e])&&t.push(n.MODIFIERS[e]);return n.arrayIncludes(t,this.lastKey())||t.push(this.lastKey()),t.join(" ")},e.default=n,t.exports=e.default},function(t,e,n){e=t.exports=n(7)(),e.push([t.id,".container[data-container]{position:absolute;background-color:#000;height:100%;width:100%}.container[data-container] .chromeless{cursor:default}[data-player]:not(.nocursor) .container[data-container]:not(.chromeless).pointer-enabled{cursor:pointer}",""])},function(t,e,n){e=t.exports=n(7)(),e.push([t.id,'@font-face{font-family:Roboto;font-style:normal;font-weight:400;src:local("Roboto"),local("Roboto-Regular"),url('+n(110)+') format("truetype")}[data-player]{-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;-o-user-select:none;user-select:none;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-transform:translateZ(0);transform:translateZ(0);position:relative;margin:0;padding:0;border:0;font-style:normal;font-weight:400;text-align:center;overflow:hidden;font-size:100%;font-family:Roboto,Open Sans,Arial,sans-serif;text-shadow:0 0 0;box-sizing:border-box}[data-player] a,[data-player] abbr,[data-player] acronym,[data-player] address,[data-player] applet,[data-player] article,[data-player] aside,[data-player] audio,[data-player] b,[data-player] big,[data-player] blockquote,[data-player] canvas,[data-player] caption,[data-player] center,[data-player] cite,[data-player] code,[data-player] dd,[data-player] del,[data-player] details,[data-player] dfn,[data-player] div,[data-player] dl,[data-player] dt,[data-player] em,[data-player] embed,[data-player] fieldset,[data-player] figcaption,[data-player] figure,[data-player] footer,[data-player] form,[data-player] h1,[data-player] h2,[data-player] h3,[data-player] h4,[data-player] h5,[data-player] h6,[data-player] header,[data-player] hgroup,[data-player] i,[data-player] iframe,[data-player] img,[data-player] ins,[data-player] kbd,[data-player] label,[data-player] legend,[data-player] li,[data-player] mark,[data-player] menu,[data-player] nav,[data-player] object,[data-player] ol,[data-player] output,[data-player] p,[data-player] pre,[data-player] q,[data-player] ruby,[data-player] s,[data-player] samp,[data-player] section,[data-player] small,[data-player] span,[data-player] strike,[data-player] strong,[data-player] sub,[data-player] summary,[data-player] sup,[data-player] table,[data-player] tbody,[data-player] td,[data-player] tfoot,[data-player] th,[data-player] thead,[data-player] time,[data-player] tr,[data-player] tt,[data-player] u,[data-player] ul,[data-player] var,[data-player] video{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline}[data-player] table{border-collapse:collapse;border-spacing:0}[data-player] caption,[data-player] td,[data-player] th{text-align:left;font-weight:400;vertical-align:middle}[data-player] blockquote,[data-player] q{quotes:none}[data-player] blockquote:after,[data-player] blockquote:before,[data-player] q:after,[data-player] q:before{content:"";content:none}[data-player] a img{border:none}[data-player]:focus{outline:0}[data-player] *{max-width:none;box-sizing:inherit;float:none}[data-player] div{display:block}[data-player].fullscreen{width:100%!important;height:100%!important;top:0;left:0}[data-player].nocursor{cursor:none}.clappr-style{display:none!important}',""])},function(t,e,n){e=t.exports=n(7)(),e.push([t.id,".media-control-notransition{-webkit-transition:none!important;transition:none!important}.media-control[data-media-control]{position:absolute;width:100%;height:100%;z-index:9999;pointer-events:none}.media-control[data-media-control].dragging{pointer-events:auto;cursor:-webkit-grabbing!important;cursor:grabbing!important;cursor:url("+n(37)+"),move}.media-control[data-media-control].dragging *{cursor:-webkit-grabbing!important;cursor:grabbing!important;cursor:url("+n(37)+'),move}.media-control[data-media-control] .media-control-background[data-background]{position:absolute;height:40%;width:100%;bottom:0;background:-webkit-linear-gradient(transparent,rgba(0,0,0,.9));background:linear-gradient(transparent,rgba(0,0,0,.9));-webkit-transition:opacity .6s ease-out;transition:opacity .6s ease-out}.media-control[data-media-control] .media-control-icon{line-height:0;letter-spacing:0;speak:none;color:#fff;opacity:.5;vertical-align:middle;text-align:left;-webkit-transition:all .1s ease;transition:all .1s ease}.media-control[data-media-control] .media-control-icon:hover{color:#fff;opacity:.75;text-shadow:hsla(0,0%,100%,.8) 0 0 5px}.media-control[data-media-control].media-control-hide .media-control-background[data-background]{opacity:0}.media-control[data-media-control].media-control-hide .media-control-layer[data-controls]{bottom:-50px}.media-control[data-media-control].media-control-hide .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-scrubber[data-seekbar]{opacity:0}.media-control[data-media-control] .media-control-layer[data-controls]{position:absolute;bottom:7px;width:100%;height:32px;font-size:0;vertical-align:middle;pointer-events:auto;-webkit-transition:bottom .4s ease-out;transition:bottom .4s ease-out}.media-control[data-media-control] .media-control-layer[data-controls] .media-control-left-panel[data-media-control]{position:absolute;top:0;left:4px;height:100%}.media-control[data-media-control] .media-control-layer[data-controls] .media-control-center-panel[data-media-control]{height:100%;text-align:center;line-height:32px}.media-control[data-media-control] .media-control-layer[data-controls] .media-control-right-panel[data-media-control]{position:absolute;top:0;right:4px;height:100%}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button{background-color:transparent;border:0;margin:0 6px;padding:0;cursor:pointer;display:inline-block;width:32px;height:100%}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button svg{width:100%;height:22px}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button svg path{fill:#fff}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button:focus{outline:none}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-pause],.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-play],.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-stop]{float:left;height:100%}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-fullscreen]{float:right;background-color:transparent;border:0;height:100%}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-hd-indicator]{cursor:default;float:right;background-color:transparent;border:0;height:100%;display:none}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-hd-indicator].enabled{opacity:1;display:block}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-hd-indicator].enabled:hover{opacity:1;text-shadow:none}.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playpause],.media-control[data-media-control] .media-control-layer[data-controls] button.media-control-button[data-playstop]{float:left}.media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-duration],.media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-position]{display:inline-block;font-size:10px;color:#fff;cursor:default;line-height:32px;position:relative}.media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-position]{margin:0 6px 0 7px}.media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-duration]{color:hsla(0,0%,100%,.5);margin-right:6px}.media-control[data-media-control] .media-control-layer[data-controls] .media-control-indicator[data-duration]:before{content:"|";margin-right:7px}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar]{position:absolute;top:-20px;left:0;display:inline-block;vertical-align:middle;width:100%;height:25px;cursor:pointer}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar]{width:100%;height:1px;position:relative;top:12px;background-color:#666}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-1[data-seekbar]{position:absolute;top:0;left:0;width:0;height:100%;background-color:#c2c2c2;-webkit-transition:all .1s ease-out;transition:all .1s ease-out}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-2[data-seekbar]{position:absolute;top:0;left:0;width:0;height:100%;background-color:#005aff;-webkit-transition:all .1s ease-out;transition:all .1s ease-out}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-hover[data-seekbar]{opacity:0;position:absolute;top:-3px;width:5px;height:7px;background-color:hsla(0,0%,100%,.5);-webkit-transition:opacity .1s ease;transition:opacity .1s ease}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar]:hover .bar-background[data-seekbar] .bar-hover[data-seekbar]{opacity:1}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar].seek-disabled{cursor:default}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar].seek-disabled:hover .bar-background[data-seekbar] .bar-hover[data-seekbar]{opacity:0}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-scrubber[data-seekbar]{position:absolute;-webkit-transform:translateX(-50%);transform:translateX(-50%);top:2px;left:0;width:20px;height:20px;opacity:1;-webkit-transition:all .1s ease-out;transition:all .1s ease-out}.media-control[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-scrubber[data-seekbar] .bar-scrubber-icon[data-seekbar]{position:absolute;left:6px;top:6px;width:8px;height:8px;border-radius:10px;box-shadow:0 0 0 6px hsla(0,0%,100%,.2);background-color:#fff}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume]{float:right;display:inline-block;height:32px;cursor:pointer;margin:0 6px;box-sizing:border-box}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume]{float:left;bottom:0}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume]{background-color:transparent;border:0;box-sizing:content-box;width:32px;height:32px;opacity:.5}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume]:hover{opacity:.75}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume] svg{height:24px;position:relative;top:3px}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume] svg path{fill:#fff}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .drawer-icon-container[data-volume] .drawer-icon[data-volume].muted svg{margin-left:2px}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume]{float:left;position:relative;overflow:hidden;top:6px;width:42px;height:18px;padding:3px 0;-webkit-transition:width .2s ease-out;transition:width .2s ease-out}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .bar-background[data-volume]{height:1px;position:relative;top:7px;margin:0 3px;background-color:#666}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .bar-background[data-volume] .bar-fill-1[data-volume]{position:absolute;top:0;left:0;width:0;height:100%;background-color:#c2c2c2;-webkit-transition:all .1s ease-out;transition:all .1s ease-out}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .bar-background[data-volume] .bar-fill-2[data-volume]{position:absolute;top:0;left:0;width:0;height:100%;background-color:#005aff;-webkit-transition:all .1s ease-out;transition:all .1s ease-out}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .bar-background[data-volume] .bar-hover[data-volume]{opacity:0;position:absolute;top:-3px;width:5px;height:7px;background-color:hsla(0,0%,100%,.5);-webkit-transition:opacity .1s ease;transition:opacity .1s ease}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .bar-scrubber[data-volume]{position:absolute;-webkit-transform:translateX(-50%);transform:translateX(-50%);top:0;left:0;width:20px;height:20px;opacity:1;-webkit-transition:all .1s ease-out;transition:all .1s ease-out}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .bar-scrubber[data-volume] .bar-scrubber-icon[data-volume]{position:absolute;left:6px;top:6px;width:8px;height:8px;border-radius:10px;box-shadow:0 0 0 6px hsla(0,0%,100%,.2);background-color:#fff}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume]{float:left;width:4px;padding-left:2px;height:12px;opacity:.5;box-shadow:inset 2px 0 0 #fff;-webkit-transition:-webkit-transform .2s ease-out;transition:transform .2s ease-out}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume].fill{box-shadow:inset 2px 0 0 #fff;opacity:1}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume]:nth-of-type(1){padding-left:0}.media-control[data-media-control] .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume] .segmented-bar-element[data-volume]:hover{-webkit-transform:scaleY(1.5);transform:scaleY(1.5)}.media-control[data-media-control].w320 .media-control-layer[data-controls] .drawer-container[data-volume] .bar-container[data-volume].volume-bar-hide{width:0;height:12px;top:9px;padding:0}',""])},function(t,e,n){e=t.exports=n(7)(),e.push([t.id,".clappr-flash-playback[data-flash-playback]{display:block;position:absolute;top:0;left:0;height:100%;width:100%;pointer-events:none}",""])},function(t,e,n){e=t.exports=n(7)(),e.push([t.id,"[data-html5-video]{position:absolute;height:100%;width:100%;display:block}",""])},function(t,e,n){e=t.exports=n(7)(),e.push([t.id,"[data-html-img]{max-width:100%;max-height:100%}",""])},function(t,e,n){e=t.exports=n(7)(),e.push([t.id,"[data-no-op]{position:absolute;height:100%;width:100%;text-align:center}[data-no-op] p[data-no-op-msg]{position:absolute;text-align:center;font-size:25px;left:0;right:0;color:#fff;padding:10px;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%);max-height:100%;overflow:auto}[data-no-op] canvas[data-no-op-canvas]{background-color:#777;height:100%;width:100%}",""])},function(t,e,n){e=t.exports=n(7)(),e.push([t.id,'.dvr-controls[data-dvr-controls]{display:inline-block;float:left;color:#fff;line-height:32px;font-size:10px;font-weight:700;margin-left:6px}.dvr-controls[data-dvr-controls] .live-info{cursor:default;font-family:Roboto,Open Sans,Arial,sans-serif;text-transform:uppercase}.dvr-controls[data-dvr-controls] .live-info:before{content:"";display:inline-block;position:relative;width:7px;height:7px;border-radius:3.5px;margin-right:3.5px;background-color:#ff0101}.dvr-controls[data-dvr-controls] .live-info.disabled{opacity:.3}.dvr-controls[data-dvr-controls] .live-info.disabled:before{background-color:#fff}.dvr-controls[data-dvr-controls] .live-button{cursor:pointer;outline:none;display:none;border:0;color:#fff;background-color:transparent;height:32px;padding:0;opacity:.7;font-family:Roboto,Open Sans,Arial,sans-serif;text-transform:uppercase;-webkit-transition:all .1s ease;transition:all .1s ease}.dvr-controls[data-dvr-controls] .live-button:before{content:"";display:inline-block;position:relative;width:7px;height:7px;border-radius:3.5px;margin-right:3.5px;background-color:#fff}.dvr-controls[data-dvr-controls] .live-button:hover{opacity:1;text-shadow:hsla(0,0%,100%,.75) 0 0 5px}.dvr .dvr-controls[data-dvr-controls] .live-info{display:none}.dvr .dvr-controls[data-dvr-controls] .live-button{display:block}.dvr.media-control.live[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-2[data-seekbar]{background-color:#005aff}.media-control.live[data-media-control] .media-control-layer[data-controls] .bar-container[data-seekbar] .bar-background[data-seekbar] .bar-fill-2[data-seekbar]{background-color:#ff0101}',""])},function(t,e,n){e=t.exports=n(7)(),e.push([t.id,".player-poster[data-poster]{display:-webkit-box;display:-moz-box;display:box;display:-moz-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:center;box-pack:center;-moz-justify-content:center;-ms-justify-content:center;-o-justify-content:center;justify-content:center;-ms-flex-pack:center;-webkit-box-align:center;box-align:center;-moz-align-items:center;-ms-align-items:center;-o-align-items:center;align-items:center;-ms-flex-align:center;position:absolute;height:100%;width:100%;z-index:998;top:0;left:0;background-color:#000;background-size:cover;background-repeat:no-repeat;background-position:50% 50%}.player-poster[data-poster].clickable{cursor:pointer}.player-poster[data-poster]:hover .play-wrapper[data-poster]{opacity:1}.player-poster[data-poster] .play-wrapper[data-poster]{width:100%;height:25%;margin:0 auto;opacity:.75;-webkit-transition:opacity .1s ease;transition:opacity .1s ease}.player-poster[data-poster] .play-wrapper[data-poster] svg{height:100%}.player-poster[data-poster] .play-wrapper[data-poster] svg path{fill:#fff}",""])},function(t,e,n){e=t.exports=n(7)(),e.push([t.id,'.seek-time[data-seek-time]{position:absolute;white-space:nowrap;height:20px;line-height:20px;font-size:0;left:-100%;bottom:55px;background-color:rgba(2,2,2,.5);z-index:9999;-webkit-transition:opacity .1s ease;transition:opacity .1s ease}.seek-time[data-seek-time].hidden[data-seek-time]{opacity:0}.seek-time[data-seek-time] [data-seek-time]{display:inline-block;color:#fff;font-size:10px;padding-left:7px;padding-right:7px;vertical-align:top}.seek-time[data-seek-time] [data-duration]{display:inline-block;color:hsla(0,0%,100%,.5);font-size:10px;padding-right:7px;vertical-align:top}.seek-time[data-seek-time] [data-duration]:before{content:"|";margin-right:7px}',""])},function(t,e,n){e=t.exports=n(7)(),e.push([t.id,".spinner-three-bounce[data-spinner]{position:absolute;margin:0 auto;width:70px;text-align:center;z-index:999;left:0;right:0;margin-left:auto;margin-right:auto;top:50%;-webkit-transform:translateY(-50%);transform:translateY(-50%)}.spinner-three-bounce[data-spinner]>div{width:18px;height:18px;background-color:#fff;border-radius:100%;display:inline-block;-webkit-animation:bouncedelay 1.4s infinite ease-in-out;animation:bouncedelay 1.4s infinite ease-in-out;-webkit-animation-fill-mode:both;animation-fill-mode:both}.spinner-three-bounce[data-spinner] [data-bounce1]{-webkit-animation-delay:-.32s;animation-delay:-.32s}.spinner-three-bounce[data-spinner] [data-bounce2]{-webkit-animation-delay:-.16s;animation-delay:-.16s}@-webkit-keyframes bouncedelay{0%,80%,to{-webkit-transform:scale(0)}40%{-webkit-transform:scale(1)}}@keyframes bouncedelay{0%,80%,to{-webkit-transform:scale(0);transform:scale(0)}40%{-webkit-transform:scale(1);transform:scale(1)}}",""])},function(t,e,n){e=t.exports=n(7)(),e.push([t.id,"[data-watermark]{position:absolute;min-width:70px;max-width:200px;width:12%;text-align:center;z-index:10}[data-watermark] a{outline:none;cursor:pointer}[data-watermark] img{max-width:100%}[data-watermark-bottom-left]{bottom:10px;left:10px}[data-watermark-bottom-right]{bottom:10px;right:42px}[data-watermark-top-left]{top:10px;left:10px}[data-watermark-top-right]{top:10px;right:37px}",""])},function(t,e,n){var r,r;!function(e){t.exports=e()}(function(){return function t(e,n,i){function o(s,l){if(!n[s]){if(!e[s]){var u="function"==typeof r&&r;if(!l&&u)return r(s,!0);if(a)return a(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var d=n[s]={exports:{}};e[s][0].call(d.exports,function(t){var n=e[s][1][t];return o(n?n:t)},d,d.exports,t,e,n,i)}return n[s].exports}for(var a="function"==typeof r&&r,s=0;s<i.length;s++)o(i[s]);return o}({1:[function(t,e,n){function r(){this._events=this._events||{},this._maxListeners=this._maxListeners||void 0}function i(t){return"function"==typeof t}function o(t){return"number"==typeof t}function a(t){return"object"==typeof t&&null!==t}function s(t){return void 0===t}e.exports=r,r.EventEmitter=r,r.prototype._events=void 0,r.prototype._maxListeners=void 0,r.defaultMaxListeners=10,r.prototype.setMaxListeners=function(t){if(!o(t)||t<0||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,n,r,o,l,u;if(this._events||(this._events={}),"error"===t&&(!this._events.error||a(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(n=this._events[t],s(n))return!1;if(i(n))switch(arguments.length){case 1:n.call(this);break;case 2:n.call(this,arguments[1]);break;case 3:n.call(this,arguments[1],arguments[2]);break;default:o=Array.prototype.slice.call(arguments,1),n.apply(this,o)}else if(a(n))for(o=Array.prototype.slice.call(arguments,1),u=n.slice(),r=u.length,l=0;l<r;l++)u[l].apply(this,o);return!0},r.prototype.addListener=function(t,e){var n;if(!i(e))throw TypeError("listener must be a function");return this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,i(e.listener)?e.listener:e),this._events[t]?a(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,a(this._events[t])&&!this._events[t].warned&&(n=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,n&&n>0&&this._events[t].length>n&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())),this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function n(){this.removeListener(t,n),r||(r=!0,e.apply(this,arguments))}if(!i(e))throw TypeError("listener must be a function");var r=!1;return n.listener=e,this.on(t,n),this},r.prototype.removeListener=function(t,e){var n,r,o,s;if(!i(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(n=this._events[t],o=n.length,r=-1,n===e||i(n.listener)&&n.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(a(n)){for(s=o;s-- >0;)if(n[s]===e||n[s].listener&&n[s].listener===e){r=s;break}if(r<0)return this;1===n.length?(n.length=0,delete this._events[t]):n.splice(r,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,n;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(n=this._events[t],i(n))this.removeListener(t,n);else if(n)for(;n.length;)this.removeListener(t,n[n.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?i(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.prototype.listenerCount=function(t){if(this._events){var e=this._events[t];if(i(e))return 1;if(e)return e.length}return 0},r.listenerCount=function(t,e){return t.listenerCount(e)}},{}],2:[function(t,e,n){var r=arguments[3],i=arguments[4],o=arguments[5],a=JSON.stringify;e.exports=function(t,e){function n(t){g[t]=!0;for(var e in i[t][1]){var r=i[t][1][e];g[r]||n(r)}}for(var s,l=Object.keys(o),u=0,c=l.length;u<c;u++){var d=l[u],f=o[d].exports;if(f===t||f&&f.default===t){s=d;break}}if(!s){s=Math.floor(Math.pow(16,8)*Math.random()).toString(16);for(var h={},u=0,c=l.length;u<c;u++){var d=l[u];h[d]=d}i[s]=[Function(["require","module","exports"],"("+t+")(self)"),h]}var p=Math.floor(Math.pow(16,8)*Math.random()).toString(16),y={};y[s]=s,i[p]=[Function(["require"],"var f = require("+a(s)+");(f.default ? f.default : f)(self);"),y];var g={};n(p);var v="("+r+")({"+Object.keys(g).map(function(t){return a(t)+":["+i[t][0]+","+a(i[t][1])+"]"}).join(",")+"},{},["+a(p)+"])",m=window.URL||window.webkitURL||window.mozURL||window.msURL,b=new Blob([v],{type:"text/javascript"});if(e&&e.bare)return b;var _=m.createObjectURL(b),E=new Worker(_);return E.objectURL=_,E}},{}],3:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=t(26),u=r(l),c=t(25),d=r(c),f=t(28),h=r(f),p=t(24),y=t(43),g=t(8),v=r(g),m=function(t){function e(t){i(this,e);var n=o(this,Object.getPrototypeOf(e).call(this,t,u.default.FRAG_LOADING,u.default.FRAG_LOADED,u.default.FRAG_BUFFERED,u.default.ERROR));return n.lastLoadedFragLevel=0,n._autoLevelCapping=-1,n._nextAutoLevel=-1,n.hls=t,n.onCheck=n.abandonRulesCheck.bind(n),n}return a(e,t),s(e,[{key:"destroy",value:function(){this.clearTimer(),d.default.prototype.destroy.call(this)}},{key:"onFragLoading",value:function(t){var e=t.frag;if("main"===e.type){if(this.timer||(this.timer=setInterval(this.onCheck,100)),!this.bwEstimator){var n=this.hls,r=t.frag.level,i=n.levels[r].details.live,o=n.config,a=void 0,s=void 0;i?(a=o.abrEwmaFastLive,s=o.abrEwmaSlowLive):(a=o.abrEwmaFastVoD,s=o.abrEwmaSlowVoD),this.bwEstimator=new v.default(n,s,a,o.abrEwmaDefaultEstimate)}this.fragCurrent=e}}},{key:"abandonRulesCheck",value:function(){var t=this.hls,e=t.media,n=this.fragCurrent,r=n.loader;if(!r||r.stats&&r.stats.aborted)return y.logger.warn("frag loader destroy or aborted, disarm abandonRules"),void this.clearTimer();var i=r.stats;if(e&&(!e.paused&&0!==e.playbackRate||!e.readyState)&&n.autoLevel&&n.level){var o=performance.now()-i.trequest,a=Math.abs(e.playbackRate);if(o>500*n.duration/a){var s=t.levels,l=Math.max(1,i.bw?i.bw/8:1e3*i.loaded/o),c=i.total?i.total:Math.max(i.loaded,Math.round(n.duration*s[n.level].bitrate/8)),d=e.currentTime,f=(c-i.loaded)/l,p=(h.default.bufferInfo(e,d,t.config.maxBufferHole).end-d)/a;
+if(p<2*n.duration/a&&f>p){var g=void 0,v=void 0;for(v=n.level-1;v>=0&&(g=n.duration*s[v].bitrate/(6.4*l),!(g<p));v--);g<f&&(v=Math.max(0,v),y.logger.warn("loading too slow, abort fragment loading and switch to level "+v+":fragLoadedDelay["+v+"]<fragLoadedDelay["+(n.level-1)+"];bufferStarvationDelay:"+g.toFixed(1)+"<"+f.toFixed(1)+":"+p.toFixed(1)),t.nextLoadLevel=v,this.bwEstimator.sample(o,i.loaded),r.abort(),this.clearTimer(),t.trigger(u.default.FRAG_LOAD_EMERGENCY_ABORTED,{frag:n,stats:i}))}}}}},{key:"onFragLoaded",value:function(t){var e=t.frag;if("main"===e.type&&(this.clearTimer(),this.lastLoadedFragLevel=e.level,this._nextAutoLevel=-1,t.frag.bitrateTest)){var n=t.stats;n.tparsed=n.tbuffered=n.tload,this.onFragBuffered(t)}}},{key:"onFragBuffered",value:function(t){var e=t.stats,n=t.frag;if(e.aborted!==!0&&1===n.loadCounter&&"main"===n.type&&(!n.bitrateTest||e.tload===e.tbuffered)){var r=e.tbuffered-e.trequest;y.logger.log("latency/loading/parsing/append/kbps:"+Math.round(e.tfirst-e.trequest)+"/"+Math.round(e.tload-e.tfirst)+"/"+Math.round(e.tparsed-e.tload)+"/"+Math.round(e.tbuffered-e.tparsed)+"/"+Math.round(8*e.loaded/(e.tbuffered-e.trequest))),this.bwEstimator.sample(r,e.loaded),n.bitrateTest?this.bitrateTestDelay=r/1e3:this.bitrateTestDelay=0}}},{key:"onError",value:function(t){switch(t.details){case p.ErrorDetails.FRAG_LOAD_ERROR:case p.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}}},{key:"clearTimer",value:function(){this.timer&&(clearInterval(this.timer),this.timer=null)}},{key:"findBestLevel",value:function(t,e,n,r,i,o,a,s,l){for(var u=i;u>=r;u--){var c=l[u],d=c.details,f=d?d.totalduration/d.fragments.length:e,h=void 0;h=u<=t?a*n:s*n;var p=l[u].bitrate,g=p*f/h;if(y.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+u+"/"+Math.round(h)+"/"+p+"/"+f+"/"+o+"/"+g),h>p&&(!g||g<o))return u}return-1}},{key:"autoLevelCapping",get:function(){return this._autoLevelCapping},set:function(t){this._autoLevelCapping=t}},{key:"nextAutoLevel",get:function(){var t=this._nextAutoLevel,e=this.bwEstimator,n=this.hls,r=n.levels,i=n.config.minAutoBitrate;if(!(t===-1||e&&e.canEstimate()))return Math.min(t,this.maxAutoLevel);var o=this.nextABRAutoLevel;if(t!==-1&&(o=Math.min(t,o)),void 0!==i)for(;r[o].bitrate<i;)o++;return o},set:function(t){this._nextAutoLevel=t}},{key:"minAutoLevel",get:function(){for(var t=this.hls,e=t.levels,n=t.config.minAutoBitrate,r=0;r<e.length;r++)if(e[r].bitrate>n)return r;return 0}},{key:"maxAutoLevel",get:function(){var t,e=this.hls.levels,n=this._autoLevelCapping;return t=n===-1&&e&&e.length?e.length-1:n}},{key:"nextABRAutoLevel",get:function(){var t=this.hls,e=this.maxAutoLevel,n=t.levels,r=t.config,i=this.minAutoLevel,o=t.media,a=this.lastLoadedFragLevel,s=this.fragCurrent?this.fragCurrent.duration:0,l=o?o.currentTime:0,u=o&&0!==o.playbackRate?Math.abs(o.playbackRate):1,c=this.bwEstimator?this.bwEstimator.getEstimate():r.abrEwmaDefaultEstimate,d=(h.default.bufferInfo(o,l,r.maxBufferHole).end-l)/u,f=this.findBestLevel(a,s,c,i,e,d,r.abrBandWidthFactor,r.abrBandWidthUpFactor,n);if(f>=0)return f;y.logger.trace("rebuffering expected to happen, lets try to find a quality level minimizing the rebuffering");var p=r.maxStarvationDelay,g=r.abrBandWidthFactor,v=r.abrBandWidthUpFactor;if(0===d){var m=this.bitrateTestDelay;m&&(p=r.maxLoadingDelay-m,y.logger.trace("bitrate test took "+Math.round(1e3*m)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*p)+" ms"),g=v=1)}return f=this.findBestLevel(a,s,c,i,e,d+p,g,v,n),Math.max(f,0)}}]),e}(d.default);n.default=m},{24:24,25:25,26:26,28:28,43:43,8:8}],4:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=t(39),u=r(l),c=t(28),d=r(c),f=t(20),h=r(f),p=t(26),y=r(p),g=t(25),v=r(g),m=t(29),b=r(m),_=t(45),E=r(_),T=t(24),A=t(43),k={STOPPED:"STOPPED",STARTING:"STARTING",IDLE:"IDLE",PAUSED:"PAUSED",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_TRACK:"WAITING_TRACK",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR"},w=function(t){function e(t){i(this,e);var n=o(this,Object.getPrototypeOf(e).call(this,t,y.default.MEDIA_ATTACHED,y.default.MEDIA_DETACHING,y.default.AUDIO_TRACKS_UPDATED,y.default.AUDIO_TRACK_SWITCH,y.default.AUDIO_TRACK_LOADED,y.default.KEY_LOADED,y.default.FRAG_LOADED,y.default.FRAG_PARSING_INIT_SEGMENT,y.default.FRAG_PARSING_DATA,y.default.FRAG_PARSED,y.default.ERROR,y.default.BUFFER_CREATED,y.default.BUFFER_APPENDED,y.default.BUFFER_FLUSHED));return n.config=t.config,n.audioCodecSwap=!1,n.ticks=0,n.ontick=n.tick.bind(n),n}return a(e,t),s(e,[{key:"destroy",value:function(){this.stopLoad(),this.timer&&(clearInterval(this.timer),this.timer=null),v.default.prototype.destroy.call(this),this.state=k.STOPPED}},{key:"startLoad",value:function(t){if(this.tracks){var e=this.media,n=this.lastCurrentTime;this.stopLoad(),this.timer||(this.timer=setInterval(this.ontick,100)),this.fragLoadError=0,e&&n?(A.logger.log("configure startPosition @"+n),this.state=k.IDLE):(this.lastCurrentTime=this.startPosition?this.startPosition:t,this.state=k.STARTING),this.nextLoadPosition=this.startPosition=this.lastCurrentTime,this.tick()}else this.startPosition=t,this.state=k.STOPPED}},{key:"stopLoad",value:function(){var t=this.fragCurrent;t&&(t.loader&&t.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=k.STOPPED}},{key:"tick",value:function(){this.ticks++,1===this.ticks&&(this.doTick(),this.ticks>1&&setTimeout(this.tick,1),this.ticks=0)}},{key:"doTick",value:function(){var t,e,n,r=this.hls,i=r.config;switch(this.state){case k.ERROR:case k.PAUSED:break;case k.STARTING:this.state=k.WAITING_TRACK,this.loadedmetadata=!1;break;case k.IDLE:if(!this.media&&(this.startFragRequested||!i.startFragPrefetch))break;t=this.loadedmetadata?this.media.currentTime:this.nextLoadPosition;var o=this.mediaBuffer?this.mediaBuffer:this.media,a=d.default.bufferInfo(o,t,i.maxBufferHole),s=a.len,l=a.end,c=this.fragPrevious,f=i.maxMaxBufferLength;if(s<f&&this.trackId<this.tracks.length){if(n=this.tracks[this.trackId].details,"undefined"==typeof n){this.state=k.WAITING_TRACK;break}if(!n.live&&c&&c.sn===n.endSN&&(!this.media.seeking||this.media.duration-l<c.duration/2)){this.hls.trigger(y.default.BUFFER_EOS,{type:"audio"}),this.state=k.ENDED;break}var h=n.fragments,p=h.length,g=h[0].start,v=h[p-1].start+h[p-1].duration,m=void 0;if(l<g?m=h[0]:!function(){var t=void 0,e=i.maxFragLookUpTolerance;l<v?(l>v-e&&(e=0),t=u.default.search(h,function(t){return t.start+t.duration-e<=l?1:t.start-e>l?-1:0})):t=h[p-1],t&&(m=t,g=t.start,c&&m.level===c.level&&m.sn===c.sn&&(m.sn<n.endSN?(m=h[m.sn+1-n.startSN],A.logger.log("SN just loaded, load next one: "+m.sn)):m=null))}(),m)if(null!=m.decryptdata.uri&&null==m.decryptdata.key)A.logger.log("Loading key for "+m.sn+" of ["+n.startSN+" ,"+n.endSN+"],track "+this.trackId),this.state=k.KEY_LOADING,r.trigger(y.default.KEY_LOADING,{frag:m});else{if(A.logger.log("Loading "+m.sn+" of ["+n.startSN+" ,"+n.endSN+"],track "+this.trackId+", currentTime:"+t+",bufferEnd:"+l.toFixed(3)),void 0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,m.loadCounter){m.loadCounter++;var b=i.fragLoadingLoopThreshold;if(m.loadCounter>b&&Math.abs(this.fragLoadIdx-m.loadIdx)<b)return void r.trigger(y.default.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_LOOP_LOADING_ERROR,fatal:!1,frag:m})}else m.loadCounter=1;m.loadIdx=this.fragLoadIdx,this.fragCurrent=m,this.startFragRequested=!0,r.trigger(y.default.FRAG_LOADING,{frag:m}),this.state=k.FRAG_LOADING}}break;case k.WAITING_TRACK:e=this.tracks[this.trackId],e&&e.details&&(this.state=k.IDLE);break;case k.FRAG_LOADING_WAITING_RETRY:var _=performance.now(),E=this.retryDate;o=this.media;var w=o&&o.seeking;(!E||_>=E||w)&&(A.logger.log("audioStreamController: retryDate reached, switch back to IDLE state"),this.state=k.IDLE);break;case k.STOPPED:case k.FRAG_LOADING:case k.PARSING:case k.PARSED:case k.ENDED:}}},{key:"onMediaAttached",value:function(t){var e=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),e.addEventListener("seeking",this.onvseeking),e.addEventListener("ended",this.onvended);var n=this.config;this.tracks&&n.autoStartLoad&&this.startLoad(n.startPosition)}},{key:"onMediaDetaching",value:function(){var t=this.media;t&&t.ended&&(A.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var e=this.tracks;e&&e.forEach(function(t){t.details&&t.details.fragments.forEach(function(t){t.loadCounter=void 0})}),t&&(t.removeEventListener("seeking",this.onvseeking),t.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=null,this.loadedmetadata=!1,this.stopLoad()}},{key:"onMediaSeeking",value:function(){this.state===k.ENDED&&(this.state=k.IDLE),this.media&&(this.lastCurrentTime=this.media.currentTime),void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold),this.tick()}},{key:"onMediaEnded",value:function(){this.startPosition=this.lastCurrentTime=0}},{key:"onAudioTracksUpdated",value:function(t){A.logger.log("audio tracks updated"),this.tracks=t.audioTracks}},{key:"onAudioTrackSwitch",value:function(t){var e=!!t.url;this.trackId=t.id,this.state=k.IDLE,this.fragCurrent=null,this.state=k.PAUSED,e?this.timer||(this.timer=setInterval(this.ontick,100)):this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.hls.trigger(y.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),this.tick()}},{key:"onAudioTrackLoaded",value:function(t){var e=t.details,n=t.id,r=this.tracks[n],i=e.totalduration;if(A.logger.log("track "+n+" loaded ["+e.startSN+","+e.endSN+"],duration:"+i),e.PTSKnown=!1,r.details=e,!this.startFragRequested){if(this.startPosition===-1){var o=e.startTimeOffset;isNaN(o)?this.startPosition=0:(A.logger.log("start time offset found in playlist, adjust startPosition to "+o),this.startPosition=o)}this.nextLoadPosition=this.startPosition}this.state===k.WAITING_TRACK&&(this.state=k.IDLE),this.tick()}},{key:"onKeyLoaded",value:function(){this.state===k.KEY_LOADING&&(this.state=k.IDLE,this.tick())}},{key:"onFragLoaded",value:function(t){var e=this.fragCurrent;if(this.state===k.FRAG_LOADING&&e&&"audio"===t.frag.type&&t.frag.level===e.level&&t.frag.sn===e.sn){this.state=k.PARSING,this.stats=t.stats;var n=this.tracks[this.trackId],r=n.details,i=r.totalduration,o=e.start,a=e.level,s=e.sn,l=this.config.defaultAudioCodec||n.audioCodec;this.pendingAppending=0,this.demuxer||(this.demuxer=new h.default(this.hls,"audio")),A.logger.log("Demuxing "+s+" of ["+r.startSN+" ,"+r.endSN+"],track "+a);var u=r.PTSKnown||!r.live;this.demuxer.push(t.payload,l,null,o,e.cc,a,s,i,e.decryptdata,u)}this.fragLoadError=0}},{key:"onFragParsingInitSegment",value:function(t){var e=this.fragCurrent;if(e&&"audio"===t.id&&t.sn===e.sn&&t.level===e.level&&this.state===k.PARSING){var n=t.tracks,r=void 0;if(r=n.audio){r.levelCodec="mp4a.40.2",r.id=t.id,this.hls.trigger(y.default.BUFFER_CODECS,n),A.logger.log("audio track:audio,container:"+r.container+",codecs[level/parsed]=["+r.levelCodec+"/"+r.codec+"]");var i=r.initSegment;i&&(this.pendingAppending++,this.hls.trigger(y.default.BUFFER_APPENDING,{type:"audio",data:i,parent:"audio",content:"initSegment"})),this.tick()}}}},{key:"onFragParsingData",value:function(t){var e=this,n=this.fragCurrent;if(n&&"audio"===t.id&&t.sn===n.sn&&t.level===n.level&&this.state===k.PARSING){var r=this.tracks[this.trackId],i=this.fragCurrent;A.logger.log("parsed "+t.type+",PTS:["+t.startPTS.toFixed(3)+","+t.endPTS.toFixed(3)+"],DTS:["+t.startDTS.toFixed(3)+"/"+t.endDTS.toFixed(3)+"],nb:"+t.nb),b.default.updateFragPTSDTS(r.details,i.sn,t.startPTS,t.endPTS),[t.data1,t.data2].forEach(function(n){n&&(e.pendingAppending++,e.hls.trigger(y.default.BUFFER_APPENDING,{type:t.type,data:n,parent:"audio",content:"data"}))}),this.nextLoadPosition=t.endPTS,this.tick()}}},{key:"onFragParsed",value:function(t){var e=this.fragCurrent;e&&"audio"===t.id&&t.sn===e.sn&&t.level===e.level&&this.state===k.PARSING&&(this.stats.tparsed=performance.now(),this.state=k.PARSED,this._checkAppendedParsed())}},{key:"onBufferCreated",value:function(t){var e=t.tracks.audio;e&&(this.mediaBuffer=e.buffer,this.loadedmetadata=!0)}},{key:"onBufferAppended",value:function(t){if("audio"===t.parent)switch(this.state){case k.PARSING:case k.PARSED:this.pendingAppending--,this._checkAppendedParsed()}}},{key:"_checkAppendedParsed",value:function(){if(this.state===k.PARSED&&0===this.pendingAppending){var t=this.fragCurrent,e=this.stats;if(t){this.fragPrevious=t,e.tbuffered=performance.now(),this.hls.trigger(y.default.FRAG_BUFFERED,{stats:e,frag:t,id:"audio"});var n=this.mediaBuffer?this.mediaBuffer:this.media;A.logger.log("audio buffered : "+E.default.toString(n.buffered)),this.state=k.IDLE}this.tick()}}},{key:"onError",value:function(t){var e=t.frag;if(!e||"audio"===e.type)switch(t.details){case T.ErrorDetails.FRAG_LOAD_ERROR:case T.ErrorDetails.FRAG_LOAD_TIMEOUT:if(!t.fatal){var n=this.fragLoadError;n?n++:n=1;var r=this.config;if(n<=r.fragLoadingMaxRetry){this.fragLoadError=n,e.loadCounter=0;var i=Math.min(Math.pow(2,n-1)*r.fragLoadingRetryDelay,r.fragLoadingMaxRetryTimeout);A.logger.warn("audioStreamController: frag loading failed, retry in "+i+" ms"),this.retryDate=performance.now()+i,this.state=k.FRAG_LOADING_WAITING_RETRY}else A.logger.error("audioStreamController: "+t.details+" reaches max retry, redispatch as fatal ..."),t.fatal=!0,this.hls.trigger(y.default.ERROR,t),this.state=k.ERROR}break;case T.ErrorDetails.FRAG_LOOP_LOADING_ERROR:case T.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case T.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:case T.ErrorDetails.KEY_LOAD_ERROR:case T.ErrorDetails.KEY_LOAD_TIMEOUT:this.state!==k.ERROR&&(this.state=t.fatal?k.ERROR:k.IDLE,A.logger.warn("audioStreamController: "+t.details+" while loading frag,switch to "+this.state+" state ..."))}}},{key:"onBufferFlushed",value:function(){this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.state=k.IDLE,this.fragPrevious=null,this.tick()}}]),e}(v.default);n.default=w},{20:20,24:24,25:25,26:26,28:28,29:29,39:39,43:43,45:45}],5:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=t(26),u=r(l),c=t(25),d=r(c),f=t(43),h=function(t){function e(t){return i(this,e),o(this,Object.getPrototypeOf(e).call(this,t,u.default.MANIFEST_LOADING,u.default.MANIFEST_LOADED,u.default.AUDIO_TRACK_LOADED))}return a(e,t),s(e,[{key:"destroy",value:function(){d.default.prototype.destroy.call(this)}},{key:"onManifestLoading",value:function(){this.tracks=[],this.trackId=-1}},{key:"onManifestLoaded",value:function(t){var e=this,n=t.audioTracks||[],r=!1;this.tracks=n,this.hls.trigger(u.default.AUDIO_TRACKS_UPDATED,{audioTracks:n});var i=0;n.forEach(function(t){return t.default?(e.audioTrack=i,void(r=!0)):void i++}),r===!1&&n.length&&(f.logger.log("no default audio track defined, use first audio track as default"),this.audioTrack=0)}},{key:"onAudioTrackLoaded",value:function(t){t.id<this.tracks.length&&(f.logger.log("audioTrack "+t.id+" loaded"),this.tracks[t.id].details=t.details,t.details.live&&!this.timer&&(this.timer=setInterval(this.ontick,1e3*t.details.targetduration)),!t.details.live&&this.timer&&(clearInterval(this.timer),this.timer=null))}},{key:"setAudioTrackInternal",value:function(t){if(t>=0&&t<this.tracks.length){this.timer&&(clearInterval(this.timer),this.timer=null),this.trackId=t,f.logger.log("switching to audioTrack "+t);var e=this.tracks[t],n=e.type,r=e.url;this.hls.trigger(u.default.AUDIO_TRACK_SWITCH,{id:t,type:n,url:r});var i=e.details;!r||void 0!==i&&i.live!==!0||(f.logger.log("(re)loading playlist for audioTrack "+t),this.hls.trigger(u.default.AUDIO_TRACK_LOADING,{url:r,id:t}))}}},{key:"audioTracks",get:function(){return this.tracks}},{key:"audioTrack",get:function(){return this.trackId},set:function(t){this.trackId===t&&void 0!==this.tracks[t].details||this.setAudioTrackInternal(t)}}]),e}(d.default);n.default=h},{25:25,26:26,43:43}],6:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=t(26),u=r(l),c=t(25),d=r(c),f=t(43),h=t(24),p=function(t){function e(t){i(this,e);var n=o(this,Object.getPrototypeOf(e).call(this,t,u.default.MEDIA_ATTACHING,u.default.MEDIA_DETACHING,u.default.MANIFEST_PARSED,u.default.BUFFER_RESET,u.default.BUFFER_APPENDING,u.default.BUFFER_CODECS,u.default.BUFFER_EOS,u.default.BUFFER_FLUSHING,u.default.LEVEL_UPDATED));return n._msDuration=null,n._levelDuration=null,n.onsbue=n.onSBUpdateEnd.bind(n),n.onsbe=n.onSBUpdateError.bind(n),n.pendingTracks={},n}return a(e,t),s(e,[{key:"destroy",value:function(){d.default.prototype.destroy.call(this)}},{key:"onManifestParsed",value:function(t){var e=t.audio,n=t.video,r=0;t.altAudio&&(e||n)&&(r=(e?1:0)+(n?1:0),f.logger.log(r+" sourceBuffer(s) expected")),this.sourceBufferNb=r}},{key:"onMediaAttaching",value:function(t){var e=this.media=t.media;if(e){var n=this.mediaSource=new MediaSource;this.onmso=this.onMediaSourceOpen.bind(this),this.onmse=this.onMediaSourceEnded.bind(this),this.onmsc=this.onMediaSourceClose.bind(this),n.addEventListener("sourceopen",this.onmso),n.addEventListener("sourceended",this.onmse),n.addEventListener("sourceclose",this.onmsc),e.src=URL.createObjectURL(n)}}},{key:"onMediaDetaching",value:function(){f.logger.log("media source detaching");var t=this.mediaSource;if(t){if("open"===t.readyState)try{t.endOfStream()}catch(t){f.logger.warn("onMediaDetaching:"+t.message+" while calling endOfStream")}t.removeEventListener("sourceopen",this.onmso),t.removeEventListener("sourceended",this.onmse),t.removeEventListener("sourceclose",this.onmsc),this.media&&(this.media.removeAttribute("src"),this.media.load()),this.mediaSource=null,this.media=null,this.pendingTracks={},this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0}this.onmso=this.onmse=this.onmsc=null,this.hls.trigger(u.default.MEDIA_DETACHED)}},{key:"onMediaSourceOpen",value:function(){f.logger.log("media source opened"),this.hls.trigger(u.default.MEDIA_ATTACHED,{media:this.media});var t=this.mediaSource;t&&t.removeEventListener("sourceopen",this.onmso),this.checkPendingTracks()}},{key:"checkPendingTracks",value:function(){var t=this.pendingTracks,e=Object.keys(t).length;e&&(this.sourceBufferNb<=e||0===this.sourceBufferNb)&&(this.createSourceBuffers(t),this.pendingTracks={},this.doAppending())}},{key:"onMediaSourceClose",value:function(){f.logger.log("media source closed")}},{key:"onMediaSourceEnded",value:function(){f.logger.log("media source ended")}},{key:"onSBUpdateEnd",value:function(){this._needsFlush&&this.doFlush(),this._needsEos&&this.checkEos(),this.appending=!1,this.hls.trigger(u.default.BUFFER_APPENDED,{parent:this.parent}),this._needsFlush||this.doAppending(),this.updateMediaElementDuration()}},{key:"onSBUpdateError",value:function(t){f.logger.error("sourceBuffer error:"+t),this.hls.trigger(u.default.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1})}},{key:"onBufferReset",value:function(){var t=this.sourceBuffer;for(var e in t){var n=t[e];try{this.mediaSource.removeSourceBuffer(n),n.removeEventListener("updateend",this.onsbue),n.removeEventListener("error",this.onsbe)}catch(t){}}this.sourceBuffer={},this.flushRange=[],this.segments=[],this.appended=0}},{key:"onBufferCodecs",value:function(t){if(0===Object.keys(this.sourceBuffer).length){for(var e in t)this.pendingTracks[e]=t[e];var n=this.mediaSource;n&&"open"===n.readyState&&this.checkPendingTracks()}}},{key:"createSourceBuffers",value:function(t){var e=this.sourceBuffer,n=this.mediaSource;for(var r in t)if(!e[r]){var i=t[r],o=i.levelCodec||i.codec,a=i.container+";codecs="+o;f.logger.log("creating sourceBuffer("+a+")");try{var s=e[r]=n.addSourceBuffer(a);s.addEventListener("updateend",this.onsbue),s.addEventListener("error",this.onsbe),i.buffer=s}catch(t){f.logger.error("error while trying to add sourceBuffer:"+t.message),this.hls.trigger(u.default.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,err:t,mimeType:a})}}this.hls.trigger(u.default.BUFFER_CREATED,{tracks:t})}},{key:"onBufferAppending",value:function(t){this._needsFlush||(this.segments?this.segments.push(t):this.segments=[t],this.doAppending())}},{key:"onBufferAppendFail",value:function(t){f.logger.error("sourceBuffer error:"+t.event),this.hls.trigger(u.default.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1,frag:this.fragCurrent})}},{key:"onBufferEos",value:function(t){var e=this.sourceBuffer,n=t.type;for(var r in e)n&&r!==n||e[r].ended||(e[r].ended=!0,f.logger.log(r+" sourceBuffer now EOS"));this.checkEos()}},{key:"checkEos",value:function(){var t=this.sourceBuffer,e=this.mediaSource;if(!e||"open"!==e.readyState)return void(this._needsEos=!1);for(var n in t){if(!t[n].ended)return;if(t[n].updating)return void(this._needsEos=!0)}f.logger.log("all media data available, signal endOfStream() to MediaSource and stop loading fragment"),e.endOfStream(),this._needsEos=!1}},{key:"onBufferFlushing",value:function(t){this.flushRange.push({start:t.startOffset,end:t.endOffset,type:t.type}),this.flushBufferCounter=0,this.doFlush()}},{key:"onLevelUpdated",value:function(t){var e=t.details;0!==e.fragments.length&&(this._levelDuration=e.totalduration+e.fragments[0].start,this.updateMediaElementDuration())}},{key:"updateMediaElementDuration",value:function(){if(null!==this._levelDuration){var t=this.media,e=this.mediaSource,n=this.sourceBuffer;if(t&&e&&n&&0!==t.readyState&&"open"===e.readyState){for(var r in n)if(n[r].updating)return;null===this._msDuration&&(this._msDuration=e.duration),this._levelDuration>this._msDuration&&(f.logger.log("Updating mediasource duration to "+this._levelDuration),e.duration=this._levelDuration,this._msDuration=this._levelDuration)}}}},{key:"doFlush",value:function(){for(;this.flushRange.length;){var t=this.flushRange[0];if(!this.flushBuffer(t.start,t.end,t.type))return void(this._needsFlush=!0);this.flushRange.shift(),this.flushBufferCounter=0}if(0===this.flushRange.length){this._needsFlush=!1;var e=0,n=this.sourceBuffer;for(var r in n)e+=n[r].buffered.length;this.appended=e,this.hls.trigger(u.default.BUFFER_FLUSHED)}}},{key:"doAppending",value:function(){var t=this.hls,e=this.sourceBuffer,n=this.segments;if(Object.keys(e).length){if(this.media.error)return this.segments=[],void f.logger.error("trying to append although a media error occured, flush segment and abort");if(this.appending)return;if(n&&n.length){var r=n.shift();try{var i=r.type;e[i]?(e[i].ended=!1,this.parent=r.parent,e[i].appendBuffer(r.data),this.appendError=0,this.appended++,this.appending=!0):this.onSBUpdateEnd()}catch(e){f.logger.error("error while trying to append buffer:"+e.message),n.unshift(r);var o={type:h.ErrorTypes.MEDIA_ERROR};if(22===e.code)return this.segments=[],o.details=h.ErrorDetails.BUFFER_FULL_ERROR,void t.trigger(u.default.ERROR,o);if(this.appendError?this.appendError++:this.appendError=1,o.details=h.ErrorDetails.BUFFER_APPEND_ERROR,o.frag=this.fragCurrent,this.appendError>t.config.appendErrorMaxRetry)return f.logger.log("fail "+t.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),n=[],o.fatal=!0,void t.trigger(u.default.ERROR,o);o.fatal=!1,t.trigger(u.default.ERROR,o)}}}}},{key:"flushBuffer",value:function(t,e,n){var r,i,o,a,s,l,u=this.sourceBuffer;if(Object.keys(u).length){if(f.logger.log("flushBuffer,pos/start/end: "+this.media.currentTime+"/"+t+"/"+e),this.flushBufferCounter<this.appended){for(var c in u)if(!n||c===n){if(r=u[c],r.ended=!1,r.updating)return f.logger.warn("cannot flush, sb updating in progress"),!1;for(i=0;i<r.buffered.length;i++)if(o=r.buffered.start(i),a=r.buffered.end(i),navigator.userAgent.toLowerCase().indexOf("firefox")!==-1&&e===Number.POSITIVE_INFINITY?(s=t,l=e):(s=Math.max(o,t),l=Math.min(a,e)),Math.min(l,a)-s>.5)return this.flushBufferCounter++,f.logger.log("flush "+c+" ["+s+","+l+"], of ["+o+","+a+"], pos:"+this.media.currentTime),r.remove(s,l),!1}}else f.logger.warn("abort flushing too many retries");f.logger.log("buffer flushed")}return!0}}]),e}(d.default);n.default=p},{24:24,25:25,26:26,43:43}],7:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=t(26),u=r(l),c=t(25),d=r(c),f=function(t){function e(t){return i(this,e),o(this,Object.getPrototypeOf(e).call(this,t,u.default.FPS_DROP_LEVEL_CAPPING,u.default.MEDIA_ATTACHING,u.default.MANIFEST_PARSED))}return a(e,t),s(e,[{key:"destroy",value:function(){this.hls.config.capLevelToPlayerSize&&(this.media=this.restrictedLevels=null,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(this.timer=clearInterval(this.timer)))}},{key:"onFpsDropLevelCapping",value:function(t){this.restrictedLevels||(this.restrictedLevels=[]),this.isLevelRestricted(t.droppedLevel)||this.restrictedLevels.push(t.droppedLevel)}},{key:"onMediaAttaching",value:function(t){this.media=t.media instanceof HTMLVideoElement?t.media:null}},{key:"onManifestParsed",value:function(t){this.hls.config.capLevelToPlayerSize&&(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.levels=t.levels,this.hls.firstLevel=this.getMaxLevel(t.firstLevel),clearInterval(this.timer),this.timer=setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())}},{key:"detectPlayerSize",value:function(){if(this.media){var t=this.levels?this.levels.length:0;t&&(this.hls.autoLevelCapping=this.getMaxLevel(t-1),this.hls.autoLevelCapping>this.autoLevelCapping&&this.hls.streamController.nextLevelSwitch(),this.autoLevelCapping=this.hls.autoLevelCapping)}}},{key:"getMaxLevel",value:function(t){var e=0,n=void 0,r=void 0,i=this.mediaWidth,o=this.mediaHeight,a=0,s=0;for(n=0;n<=t&&(r=this.levels[n],!this.isLevelRestricted(n))&&(e=n,a=r.width,s=r.height,!(i<=a||o<=s));n++);return e}},{key:"isLevelRestricted",value:function(t){return!(!this.restrictedLevels||this.restrictedLevels.indexOf(t)===-1)}},{key:"contentScaleFactor",get:function(){var t=1;try{t=window.devicePixelRatio}catch(t){}return t}},{key:"mediaWidth",get:function(){var t=void 0;return this.media&&(t=this.media.width||this.media.clientWidth||this.media.offsetWidth,t*=this.contentScaleFactor),t}},{key:"mediaHeight",get:function(){var t=void 0;return this.media&&(t=this.media.height||this.media.clientHeight||this.media.offsetHeight,t*=this.contentScaleFactor),t}}]),e}(d.default);n.default=f},{25:25,26:26}],8:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=t(42),s=r(a),l=function(){function t(e,n,r,o){i(this,t),this.hls=e,this.defaultEstimate_=o,this.minWeight_=.001,this.minDelayMs_=50,this.slow_=new s.default(n),this.fast_=new s.default(r)}return o(t,[{key:"sample",value:function(t,e){t=Math.max(t,this.minDelayMs_);var n=8e3*e/t,r=t/1e3;this.fast_.sample(r,n),this.slow_.sample(r,n)}},{key:"canEstimate",value:function(){var t=this.fast_;return t&&t.getTotalWeight()>=this.minWeight_}},{key:"getEstimate",value:function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_}},{key:"destroy",value:function(){}}]),t}();n.default=l},{42:42}],9:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){
+var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=t(26),u=r(l),c=t(25),d=r(c),f=t(43),h=function(t){function e(t){return i(this,e),o(this,Object.getPrototypeOf(e).call(this,t,u.default.MEDIA_ATTACHING))}return a(e,t),s(e,[{key:"destroy",value:function(){this.timer&&clearInterval(this.timer),this.isVideoPlaybackQualityAvailable=!1}},{key:"onMediaAttaching",value:function(t){this.hls.config.capLevelOnFPSDrop&&(this.video=t.media instanceof HTMLVideoElement?t.media:null,"function"==typeof this.video.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),clearInterval(this.timer),this.timer=setInterval(this.checkFPSInterval.bind(this),this.hls.config.fpsDroppedMonitoringPeriod))}},{key:"checkFPS",value:function(t,e,n){var r=performance.now();if(e){if(this.lastTime){var i=r-this.lastTime,o=n-this.lastDroppedFrames,a=e-this.lastDecodedFrames,s=1e3*o/i;if(this.hls.trigger(u.default.FPS_DROP,{currentDropped:o,currentDecoded:a,totalDroppedFrames:n}),s>0&&o>this.hls.config.fpsDroppedMonitoringThreshold*a){var l=this.hls.currentLevel;f.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+l),l>0&&(this.hls.autoLevelCapping===-1||this.hls.autoLevelCapping>=l)&&(l-=1,this.hls.trigger(u.default.FPS_DROP_LEVEL_CAPPING,{level:l,droppedLevel:this.hls.currentLevel}),this.hls.autoLevelCapping=l,this.hls.streamController.nextLevelSwitch())}}this.lastTime=r,this.lastDroppedFrames=n,this.lastDecodedFrames=e}}},{key:"checkFPSInterval",value:function(){if(this.video)if(this.isVideoPlaybackQualityAvailable){var t=this.video.getVideoPlaybackQuality();this.checkFPS(this.video,t.totalVideoFrames,t.droppedVideoFrames)}else this.checkFPS(this.video,this.video.webkitDecodedFrameCount,this.video.webkitDroppedFrameCount)}}]),e}(d.default);n.default=h},{25:25,26:26,43:43}],10:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=t(26),u=r(l),c=t(25),d=r(c),f=t(43),h=t(24),p=t(28),y=r(p),g=function(t){function e(t){i(this,e);var n=o(this,Object.getPrototypeOf(e).call(this,t,u.default.MANIFEST_LOADED,u.default.LEVEL_LOADED,u.default.ERROR));return n.ontick=n.tick.bind(n),n._manualLevel=n._autoLevelCapping=-1,n}return a(e,t),s(e,[{key:"destroy",value:function(){this.timer&&(clearTimeout(this.timer),this.timer=null),this._manualLevel=-1}},{key:"startLoad",value:function(){this.canload=!0,this.timer&&this.tick()}},{key:"stopLoad",value:function(){this.canload=!1}},{key:"onManifestLoaded",value:function(t){var e,n,r=[],i=[],o={},a=!1,s=!1,l=this.hls;if(t.levels.forEach(function(t){t.videoCodec&&(a=!0),(t.audioCodec||t.attrs&&t.attrs.AUDIO)&&(s=!0);var e=o[t.bitrate];void 0===e?(o[t.bitrate]=r.length,t.url=[t.url],t.urlId=0,r.push(t)):r[e].url.push(t.url)}),a&&s?r.forEach(function(t){t.videoCodec&&i.push(t)}):i=r,i=i.filter(function(t){var e=function(t){return MediaSource.isTypeSupported("audio/mp4;codecs="+t)},n=function(t){return MediaSource.isTypeSupported("video/mp4;codecs="+t)},r=t.audioCodec,i=t.videoCodec;return(!r||e(r))&&(!i||n(i))}),i.length){for(e=i[0].bitrate,i.sort(function(t,e){return t.bitrate-e.bitrate}),this._levels=i,n=0;n<i.length;n++)if(i[n].bitrate===e){this._firstLevel=n,f.logger.log("manifest loaded,"+i.length+" level(s) found, first bitrate:"+e);break}l.trigger(u.default.MANIFEST_PARSED,{levels:this._levels,firstLevel:this._firstLevel,stats:t.stats,audio:s,video:a,altAudio:t.audioTracks.length>0})}else l.trigger(u.default.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,details:h.ErrorDetails.MANIFEST_INCOMPATIBLE_CODECS_ERROR,fatal:!0,url:l.url,reason:"no level with compatible codecs found in manifest"})}},{key:"setLevelInternal",value:function(t){var e=this._levels;if(t>=0&&t<e.length){this.timer&&(clearTimeout(this.timer),this.timer=null),this._level!==t&&(f.logger.log("switching to level "+t),this._level=t),this.hls.trigger(u.default.LEVEL_SWITCH,{level:t});var n=e[t],r=n.details;if(!r||r.live===!0){var i=n.urlId;this.hls.trigger(u.default.LEVEL_LOADING,{url:n.url[i],level:t,id:i})}}else this.hls.trigger(u.default.ERROR,{type:h.ErrorTypes.OTHER_ERROR,details:h.ErrorDetails.LEVEL_SWITCH_ERROR,level:t,fatal:!1,reason:"invalid level idx"})}},{key:"onError",value:function(t){if(!t.fatal){var e=t.details,n=this.hls,r=void 0,i=void 0,o=!1;switch(e){case h.ErrorDetails.FRAG_LOAD_ERROR:case h.ErrorDetails.FRAG_LOAD_TIMEOUT:case h.ErrorDetails.FRAG_LOOP_LOADING_ERROR:case h.ErrorDetails.KEY_LOAD_ERROR:case h.ErrorDetails.KEY_LOAD_TIMEOUT:r=t.frag.level;break;case h.ErrorDetails.LEVEL_LOAD_ERROR:case h.ErrorDetails.LEVEL_LOAD_TIMEOUT:r=t.context.level,o=!0}if(void 0!==r)if(i=this._levels[r],i.urlId<i.url.length-1)i.urlId++,i.details=void 0,f.logger.warn("level controller,"+e+" for level "+r+": switching to redundant stream id "+i.urlId);else{var a=this._manualLevel===-1&&r;if(a)f.logger.warn("level controller,"+e+": emergency switch-down for next fragment"),n.abrController.nextAutoLevel=0;else if(i&&i.details&&i.details.live)f.logger.warn("level controller,"+e+" on live stream, discard"),o&&(this._level=void 0);else if(e===h.ErrorDetails.LEVEL_LOAD_ERROR||e===h.ErrorDetails.LEVEL_LOAD_TIMEOUT){var s=this.hls,l=s.media,c=l&&y.default.isBuffered(l,l.currentTime)&&y.default.isBuffered(l,l.currentTime+.5);if(c){var d=s.config.levelLoadingRetryDelay;f.logger.warn("level controller,"+e+", but media buffered, retry in "+d+"ms"),this.timer=setTimeout(this.ontick,d)}else f.logger.error("cannot recover "+e+" error"),this._level=void 0,this.timer&&(clearTimeout(this.timer),this.timer=null),t.fatal=!0,s.trigger(u.default.ERROR,t)}}}}},{key:"onLevelLoaded",value:function(t){if(t.level===this._level){var e=t.details;if(e.live){var n=1e3*(e.averagetargetduration?e.averagetargetduration:e.targetduration),r=this._levels[t.level],i=r.details;i&&e.endSN===i.endSN&&(n/=2,f.logger.log("same live playlist, reload twice faster")),n-=performance.now()-t.stats.trequest,n=Math.max(1e3,Math.round(n)),f.logger.log("live playlist, reload in "+n+" ms"),this.timer=setTimeout(this.ontick,n)}else this.timer=null}}},{key:"tick",value:function(){var t=this._level;if(void 0!==t&&this.canload){var e=this._levels[t],n=e.urlId;this.hls.trigger(u.default.LEVEL_LOADING,{url:e.url[n],level:t,id:n})}}},{key:"levels",get:function(){return this._levels}},{key:"level",get:function(){return this._level},set:function(t){var e=this._levels;e&&e.length>t&&(this._level===t&&void 0!==e[t].details||this.setLevelInternal(t))}},{key:"manualLevel",get:function(){return this._manualLevel},set:function(t){this._manualLevel=t,void 0===this._startLevel&&(this._startLevel=t),t!==-1&&(this.level=t)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(t){this._firstLevel=t}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var t=this.hls.config.startLevel;return void 0!==t?t:this._firstLevel}return this._startLevel},set:function(t){this._startLevel=t}},{key:"nextLoadLevel",get:function(){return this._manualLevel!==-1?this._manualLevel:this.hls.abrController.nextAutoLevel},set:function(t){this.level=t,this._manualLevel===-1&&(this.hls.abrController.nextAutoLevel=t)}}]),e}(d.default);n.default=g},{24:24,25:25,26:26,28:28,43:43}],11:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=t(39),u=r(l),c=t(28),d=r(c),f=t(20),h=r(f),p=t(26),y=r(p),g=t(25),v=r(g),m=t(29),b=r(m),_=t(45),E=r(_),T=t(24),A=t(43),k={STOPPED:"STOPPED",IDLE:"IDLE",PAUSED:"PAUSED",KEY_LOADING:"KEY_LOADING",FRAG_LOADING:"FRAG_LOADING",FRAG_LOADING_WAITING_RETRY:"FRAG_LOADING_WAITING_RETRY",WAITING_LEVEL:"WAITING_LEVEL",PARSING:"PARSING",PARSED:"PARSED",ENDED:"ENDED",ERROR:"ERROR"},w=function(t){function e(t){i(this,e);var n=o(this,Object.getPrototypeOf(e).call(this,t,y.default.MEDIA_ATTACHED,y.default.MEDIA_DETACHING,y.default.MANIFEST_LOADING,y.default.MANIFEST_PARSED,y.default.LEVEL_LOADED,y.default.KEY_LOADED,y.default.FRAG_LOADED,y.default.FRAG_LOAD_EMERGENCY_ABORTED,y.default.FRAG_PARSING_INIT_SEGMENT,y.default.FRAG_PARSING_DATA,y.default.FRAG_PARSED,y.default.ERROR,y.default.AUDIO_TRACK_SWITCH,y.default.BUFFER_CREATED,y.default.BUFFER_APPENDED,y.default.BUFFER_FLUSHED));return n.config=t.config,n.audioCodecSwap=!1,n.ticks=0,n.ontick=n.tick.bind(n),n}return a(e,t),s(e,[{key:"destroy",value:function(){this.stopLoad(),this.timer&&(clearInterval(this.timer),this.timer=null),v.default.prototype.destroy.call(this),this.state=k.STOPPED}},{key:"startLoad",value:function(t){if(this.levels){var e=this.media,n=this.lastCurrentTime,r=this.hls;if(this.stopLoad(),this.timer||(this.timer=setInterval(this.ontick,100)),this.level=-1,this.fragLoadError=0,e&&n>0?(A.logger.log("configure startPosition @"+n.toFixed(3)),this.lastPaused||(A.logger.log("resuming video"),e.play())):this.lastCurrentTime=this.startPosition?this.startPosition:t,!this.startFragRequested){var i=r.startLevel;i===-1&&(i=0,this.bitrateTest=!0),this.level=r.nextLoadLevel=i,this.loadedmetadata=!1}this.state=k.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime,this.tick()}else A.logger.warn("cannot start loading as manifest not parsed yet"),this.state=k.STOPPED}},{key:"stopLoad",value:function(){var t=this.fragCurrent;t&&(t.loader&&t.loader.abort(),this.fragCurrent=null),this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=k.STOPPED}},{key:"tick",value:function(){this.ticks++,1===this.ticks&&(this.doTick(),this.ticks>1&&setTimeout(this.tick,1),this.ticks=0)}},{key:"doTick",value:function(){switch(this.state){case k.ERROR:case k.PAUSED:break;case k.IDLE:if(!this._doTickIdle())return;break;case k.WAITING_LEVEL:var t=this.levels[this.level];t&&t.details&&(this.state=k.IDLE);break;case k.FRAG_LOADING_WAITING_RETRY:var e=performance.now(),n=this.retryDate;(!n||e>=n||this.media&&this.media.seeking)&&(A.logger.log("mediaController: retryDate reached, switch back to IDLE state"),this.state=k.IDLE);break;case k.ERROR:case k.PAUSED:case k.STOPPED:case k.FRAG_LOADING:case k.PARSING:case k.PARSED:case k.ENDED:}this._checkBuffer(),this._checkFragmentChanged()}},{key:"_doTickIdle",value:function(){var t=this.hls,e=t.config,n=this.media;if(!n&&(this.startFragRequested||!e.startFragPrefetch))return!0;var r=void 0;r=this.loadedmetadata?n.currentTime:this.nextLoadPosition;var i=t.nextLoadLevel,o=void 0;o=this.levels[i].hasOwnProperty("bitrate")?Math.max(8*e.maxBufferSize/this.levels[i].bitrate,e.maxBufferLength):e.maxBufferLength,o=Math.min(o,e.maxMaxBufferLength);var a=d.default.bufferInfo(this.mediaBuffer?this.mediaBuffer:n,r,e.maxBufferHole),s=a.len;if(s>=o)return!0;A.logger.trace("buffer length of "+s.toFixed(3)+" is below max of "+o.toFixed(3)+". checking for more payload ..."),t.nextLoadLevel=i,this.level=i;var l=this.levels[i].details;if("undefined"==typeof l||l.live&&this.levelLastLoaded!==i)return this.state=k.WAITING_LEVEL,!0;var u=this.fragPrevious;if(!l.live&&u&&u.sn===l.endSN&&(!n.seeking&&a.len||n.duration-a.end<=u.duration/2)){var c={};return this.altAudio&&(c.type="video"),this.hls.trigger(y.default.BUFFER_EOS,c),this.state=k.ENDED,!0}return this._fetchPayloadOrEos({pos:r,bufferInfo:a,levelDetails:l})}},{key:"_fetchPayloadOrEos",value:function(t){var e=t.pos,n=t.bufferInfo,r=t.levelDetails,i=this.fragPrevious,o=this.level,a=r.fragments,s=a.length;if(0===s)return!1;var l=a[0].start,u=a[s-1].start+a[s-1].duration,c=n.end,d=void 0;if(r.live){if(d=this._ensureFragmentAtLivePoint({levelDetails:r,bufferEnd:c,start:l,end:u,fragPrevious:i,fragments:a,fragLen:s}),null===d)return!1}else c<l&&(d=a[0]);return d||(d=this._findFragment({start:l,fragPrevious:i,fragLen:s,fragments:a,bufferEnd:c,end:u,levelDetails:r})),!d||this._loadFragmentOrKey({frag:d,level:o,levelDetails:r,pos:e,bufferEnd:c})}},{key:"_ensureFragmentAtLivePoint",value:function(t){var e=t.levelDetails,n=t.bufferEnd,r=t.start,i=t.end,o=t.fragPrevious,a=t.fragments,s=t.fragLen,l=this.hls.config,u=this.media,c=void 0,d=void 0!==l.liveMaxLatencyDuration?l.liveMaxLatencyDuration:l.liveMaxLatencyDurationCount*e.targetduration;if(n<Math.max(r,i-d)){var f=this.liveSyncPosition=this.computeLivePosition(r,e);A.logger.log("buffer end: "+n.toFixed(3)+" is located too far from the end of live sliding playlist, reset currentTime to : "+f.toFixed(3)),n=f,u&&u.readyState&&u.duration>f&&(u.currentTime=f)}if(e.PTSKnown&&n>i&&u&&u.readyState)return null;if(this.startFragRequested&&!e.PTSKnown){if(o){var h=o.sn+1;h>=e.startSN&&h<=e.endSN&&(c=a[h-e.startSN],A.logger.log("live playlist, switching playlist, load frag with next SN: "+c.sn))}c||(c=a[Math.min(s-1,Math.round(s/2))],A.logger.log("live playlist, switching playlist, unknown, load middle frag : "+c.sn))}return c}},{key:"_findFragment",value:function(t){var e=t.start,n=t.fragPrevious,r=t.fragLen,i=t.fragments,o=t.bufferEnd,a=t.end,s=t.levelDetails,l=this.hls.config,c=void 0,d=void 0,f=l.maxFragLookUpTolerance;if(o<a?(o>a-f&&(f=0),d=u.default.search(i,function(t){return t.start+t.duration-f<=o?1:t.start-f>o&&t.start?-1:0})):d=i[r-1],d&&(c=d,e=d.start,n&&c.level===n.level&&c.sn===n.sn))if(c.sn<s.endSN){var h=n.deltaPTS,p=c.sn-s.startSN;h&&h>l.maxBufferHole&&n.dropped&&p?(c=i[p-1],A.logger.warn("SN just loaded, with large PTS gap between audio and video, maybe frag is not starting with a keyframe ? load previous one to try to overcome this"),n.loadCounter--):(c=i[p+1],A.logger.log("SN just loaded, load next one: "+c.sn))}else c=null;return c}},{key:"_loadFragmentOrKey",value:function(t){var e=t.frag,n=t.level,r=t.levelDetails,i=t.pos,o=t.bufferEnd,a=this.hls,s=a.config;if(null==e.decryptdata.uri||null!=e.decryptdata.key){if(A.logger.log("Loading "+e.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+n+", currentTime:"+i.toFixed(3)+",bufferEnd:"+o.toFixed(3)),void 0!==this.fragLoadIdx?this.fragLoadIdx++:this.fragLoadIdx=0,e.loadCounter){e.loadCounter++;var l=s.fragLoadingLoopThreshold;if(e.loadCounter>l&&Math.abs(this.fragLoadIdx-e.loadIdx)<l)return a.trigger(y.default.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.FRAG_LOOP_LOADING_ERROR,fatal:!1,frag:e}),!1}else e.loadCounter=1;return e.loadIdx=this.fragLoadIdx,this.fragCurrent=e,this.startFragRequested=!0,e.autoLevel=a.autoLevelEnabled,e.bitrateTest=this.bitrateTest,a.trigger(y.default.FRAG_LOADING,{frag:e}),this.state=k.FRAG_LOADING,!0}A.logger.log("Loading key for "+e.sn+" of ["+r.startSN+" ,"+r.endSN+"],level "+n),this.state=k.KEY_LOADING,a.trigger(y.default.KEY_LOADING,{frag:e})}},{key:"getBufferRange",value:function(t){var e,n,r=this.bufferRange;if(r)for(e=r.length-1;e>=0;e--)if(n=r[e],t>=n.start&&t<=n.end)return n;return null}},{key:"followingBufferRange",value:function(t){return t?this.getBufferRange(t.end+.5):null}},{key:"_checkFragmentChanged",value:function(){var t,e,n=this.media;if(n&&n.readyState&&n.seeking===!1&&(e=n.currentTime,e>n.playbackRate*this.lastCurrentTime&&(this.lastCurrentTime=e),d.default.isBuffered(n,e)?t=this.getBufferRange(e):d.default.isBuffered(n,e+.1)&&(t=this.getBufferRange(e+.1)),t)){var r=t.frag;r!==this.fragPlaying&&(this.fragPlaying=r,this.hls.trigger(y.default.FRAG_CHANGED,{frag:r}))}}},{key:"immediateLevelSwitch",value:function(){if(A.logger.log("immediateLevelSwitch"),!this.immediateSwitch){this.immediateSwitch=!0;var t=this.media,e=void 0;t?(e=t.paused,t.pause()):e=!0,this.previouslyPaused=e}var n=this.fragCurrent;n&&n.loader&&n.loader.abort(),this.fragCurrent=null,this.state=k.PAUSED,this.hls.trigger(y.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY})}},{key:"immediateLevelSwitchEnd",value:function(){var t=this.media;t&&t.buffered.length&&(this.immediateSwitch=!1,d.default.isBuffered(t,t.currentTime)&&(t.currentTime-=1e-4),this.previouslyPaused||t.play())}},{key:"nextLevelSwitch",value:function(){var t=this.media;if(t&&t.readyState){var e=void 0,n=void 0,r=void 0;if(this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,n=this.getBufferRange(t.currentTime),n&&n.start>1&&(this.state=k.PAUSED,this.hls.trigger(y.default.BUFFER_FLUSHING,{startOffset:0,endOffset:n.start-1})),t.paused)e=0;else{var i=this.hls.nextLoadLevel,o=this.levels[i],a=this.fragLastKbps;e=a&&this.fragCurrent?this.fragCurrent.duration*o.bitrate/(1e3*a)+1:0}if(r=this.getBufferRange(t.currentTime+e),r&&(r=this.followingBufferRange(r))){var s=this.fragCurrent;s&&s.loader&&s.loader.abort(),this.fragCurrent=null,this.state=k.PAUSED,this.hls.trigger(y.default.BUFFER_FLUSHING,{startOffset:r.start,endOffset:Number.POSITIVE_INFINITY})}}}},{key:"onMediaAttached",value:function(t){var e=this.media=this.mediaBuffer=t.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),this.onvended=this.onMediaEnded.bind(this),e.addEventListener("seeking",this.onvseeking),e.addEventListener("seeked",this.onvseeked),e.addEventListener("ended",this.onvended);var n=this.config;this.levels&&n.autoStartLoad&&this.hls.startLoad(n.startPosition)}},{key:"onMediaDetaching",value:function(){var t=this.media;t&&t.ended&&(A.logger.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0);var e=this.levels;e&&e.forEach(function(t){t.details&&t.details.fragments.forEach(function(t){t.loadCounter=void 0})}),t&&(t.removeEventListener("seeking",this.onvseeking),t.removeEventListener("seeked",this.onvseeked),t.removeEventListener("ended",this.onvended),this.onvseeking=this.onvseeked=this.onvended=null),this.media=null,this.loadedmetadata=!1,this.stopLoad()}},{key:"onMediaSeeking",value:function(){var t=this.media,e=t?t.currentTime:void 0,n=this.config;if(A.logger.log("media seeking to "+e.toFixed(3)),this.state===k.FRAG_LOADING){var r=d.default.bufferInfo(t,e,this.config.maxBufferHole),i=this.fragCurrent;if(0===r.len&&i){var o=n.maxFragLookUpTolerance,a=i.start-o,s=i.start+i.duration+o;e<a||e>s?(i.loader&&(A.logger.log("seeking outside of buffer while fragment load in progress, cancel fragment load"),i.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.state=k.IDLE):A.logger.log("seeking outside of buffer but within currently loaded fragment range")}}else this.state===k.ENDED&&(this.state=k.IDLE);t&&(this.lastCurrentTime=e),this.state!==k.FRAG_LOADING&&void 0!==this.fragLoadIdx&&(this.fragLoadIdx+=2*n.fragLoadingLoopThreshold),this.tick()}},{key:"onMediaSeeked",value:function(){A.logger.log("media seeked to "+this.media.currentTime.toFixed(3)),this.tick()}},{key:"onMediaEnded",value:function(){A.logger.log("media ended"),this.startPosition=this.lastCurrentTime=0}},{key:"onManifestLoading",value:function(){A.logger.log("trigger BUFFER_RESET"),this.hls.trigger(y.default.BUFFER_RESET),this.bufferRange=[],this.stalled=!1,this.startPosition=this.lastCurrentTime=0}},{key:"onManifestParsed",value:function(t){var e,n=!1,r=!1;t.levels.forEach(function(t){e=t.audioCodec,e&&(e.indexOf("mp4a.40.2")!==-1&&(n=!0),e.indexOf("mp4a.40.5")!==-1&&(r=!0))}),this.audioCodecSwitch=n&&r,this.audioCodecSwitch&&A.logger.log("both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=t.levels,this.startLevelLoaded=!1,this.startFragRequested=!1;var i=this.config;i.autoStartLoad&&this.hls.startLoad(i.startPosition)}},{key:"onLevelLoaded",value:function(t){var e=t.details,n=t.level,r=this.levels[n],i=e.totalduration,o=0;if(A.logger.log("level "+n+" loaded ["+e.startSN+","+e.endSN+"],duration:"+i),this.levelLastLoaded=n,e.live){var a=r.details;a&&e.fragments.length>0?(b.default.mergeDetails(a,e),o=e.fragments[0].start,this.liveSyncPosition=this.computeLivePosition(o,a),e.PTSKnown?A.logger.log("live playlist sliding:"+o.toFixed(3)):A.logger.log("live playlist - outdated PTS, unknown sliding")):(e.PTSKnown=!1,A.logger.log("live playlist - first load, unknown sliding"))}else e.PTSKnown=!1;if(r.details=e,this.hls.trigger(y.default.LEVEL_UPDATED,{details:e,level:n}),this.startFragRequested===!1){if(this.startPosition===-1||this.lastCurrentTime===-1){var s=e.startTimeOffset;isNaN(s)?e.live?(this.startPosition=this.computeLivePosition(o,e),A.logger.log("configure startPosition to "+this.startPosition)):this.startPosition=0:(s<0&&(A.logger.log("negative start time offset "+s+", count from end of last fragment"),s=o+i+s),A.logger.log("start time offset found in playlist, adjust startPosition to "+s),this.startPosition=s)}this.nextLoadPosition=this.startPosition}this.state===k.WAITING_LEVEL&&(this.state=k.IDLE),this.tick()}},{key:"onKeyLoaded",value:function(){this.state===k.KEY_LOADING&&(this.state=k.IDLE,this.tick())}},{key:"onFragLoaded",value:function(t){var e=this.fragCurrent,n=t.frag;if(this.state===k.FRAG_LOADING&&e&&"main"===n.type&&n.level===e.level&&n.sn===e.sn){var r=t.stats,i=this.levels[e.level],o=i.details;if(A.logger.log("Loaded  "+e.sn+" of ["+o.startSN+" ,"+o.endSN+"],level "+e.level),this.bitrateTest=!1,n.bitrateTest===!0&&this.hls.nextLoadLevel)this.state=k.IDLE,this.startFragRequested=!1,r.tparsed=r.tbuffered=performance.now(),this.hls.trigger(y.default.FRAG_BUFFERED,{stats:r,frag:e,id:"main"}),this.tick();else{this.state=k.PARSING,this.stats=r;var a=o.totalduration,s=isNaN(e.startDTS)?e.start:e.startDTS,l=e.level,u=e.sn,c=this.config.defaultAudioCodec||i.audioCodec;this.audioCodecSwap&&(A.logger.log("swapping playlist audio codec"),void 0===c&&(c=this.lastAudioCodec),c&&(c=c.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5")),this.pendingAppending=0,A.logger.log("Parsing "+u+" of ["+o.startSN+" ,"+o.endSN+"],level "+l+", cc "+e.cc);var d=this.demuxer;d||(d=this.demuxer=new h.default(this.hls,"main"));var f=o.PTSKnown||!o.live;d.push(t.payload,c,i.videoCodec,s,e.cc,l,u,a,e.decryptdata,f)}}this.fragLoadError=0}},{key:"onFragParsingInitSegment",value:function(t){var e=this.fragCurrent;if(e&&"main"===t.id&&t.sn===e.sn&&t.level===e.level&&this.state===k.PARSING){var n,r,i=t.tracks;if(i.audio&&this.altAudio&&delete i.audio,r=i.audio){var o=this.levels[this.level].audioCodec,a=navigator.userAgent.toLowerCase();o&&this.audioCodecSwap&&(A.logger.log("swapping playlist audio codec"),o=o.indexOf("mp4a.40.5")!==-1?"mp4a.40.2":"mp4a.40.5"),this.audioCodecSwitch&&1!==r.metadata.channelCount&&a.indexOf("firefox")===-1&&(o="mp4a.40.5"),a.indexOf("android")!==-1&&(o="mp4a.40.2",A.logger.log("Android: force audio codec to"+o)),r.levelCodec=o,r.id=t.id}if(r=i.video,r&&(r.levelCodec=this.levels[this.level].videoCodec,r.id=t.id),t.unique){var s={codec:"",levelCodec:""};for(n in t.tracks)r=i[n],s.container=r.container,s.codec&&(s.codec+=",",s.levelCodec+=","),r.codec&&(s.codec+=r.codec),r.levelCodec&&(s.levelCodec+=r.levelCodec);i={audiovideo:s}}this.hls.trigger(y.default.BUFFER_CODECS,i);for(n in i){r=i[n],A.logger.log("main track:"+n+",container:"+r.container+",codecs[level/parsed]=["+r.levelCodec+"/"+r.codec+"]");var l=r.initSegment;l&&(this.pendingAppending++,this.hls.trigger(y.default.BUFFER_APPENDING,{type:n,data:l,parent:"main",content:"initSegment"}))}this.tick()}}},{key:"onFragParsingData",value:function(t){var e=this,n=this.fragCurrent;if(n&&"main"===t.id&&t.sn===n.sn&&t.level===n.level&&("audio"!==t.type||!this.altAudio)&&this.state===k.PARSING){var r=this.levels[this.level],i=this.fragCurrent;A.logger.log("Parsed "+t.type+",PTS:["+t.startPTS.toFixed(3)+","+t.endPTS.toFixed(3)+"],DTS:["+t.startDTS.toFixed(3)+"/"+t.endDTS.toFixed(3)+"],nb:"+t.nb+",dropped:"+(t.dropped||0));var o=b.default.updateFragPTSDTS(r.details,i.sn,t.startPTS,t.endPTS,t.startDTS,t.endDTS),a=this.hls;a.trigger(y.default.LEVEL_PTS_UPDATED,{details:r.details,level:this.level,drift:o}),"video"===t.type&&(i.dropped=t.dropped),[t.data1,t.data2].forEach(function(n){n&&(e.pendingAppending++,a.trigger(y.default.BUFFER_APPENDING,{type:t.type,data:n,parent:"main",content:"data"}))}),this.nextLoadPosition=t.endPTS,this.bufferRange.push({type:t.type,start:t.startPTS,end:t.endPTS,frag:i}),this.tick()}}},{key:"onFragParsed",value:function(t){var e=this.fragCurrent;e&&"main"===t.id&&t.sn===e.sn&&t.level===e.level&&this.state===k.PARSING&&(this.stats.tparsed=performance.now(),this.state=k.PARSED,this._checkAppendedParsed())}},{key:"onAudioTrackSwitch",value:function(t){var e=!!t.url;if(e)this.videoBuffer&&this.mediaBuffer!==this.videoBuffer&&(A.logger.log("switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=this.videoBuffer);else if(this.mediaBuffer!==this.media){A.logger.log("switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var n=this.fragCurrent;n.loader&&(A.logger.log("switching to main audio track, cancel main fragment load"),n.loader.abort()),this.fragCurrent=null,this.fragPrevious=null,this.demuxer&&(this.demuxer.destroy(),this.demuxer=null),this.state=k.IDLE}this.altAudio=e}},{key:"onBufferCreated",value:function(t){var e=t.tracks,n=void 0,r=void 0,i=!1;for(var o in e){var a=e[o];"main"===a.id?(r=o,n=a,"video"===o&&(this.videoBuffer=e[o].buffer)):i=!0}i&&n?(A.logger.log("alternate track found, use "+r+".buffered to schedule main fragment loading"),this.mediaBuffer=n.buffer):this.mediaBuffer=this.media}},{key:"onBufferAppended",value:function(t){if("main"===t.parent)switch(this.state){case k.PARSING:case k.PARSED:this.pendingAppending--,this._checkAppendedParsed()}}},{key:"_checkAppendedParsed",value:function(){if(this.state===k.PARSED&&0===this.pendingAppending){var t=this.fragCurrent,e=this.stats;if(t){this.fragPrevious=t,e.tbuffered=performance.now(),this.fragLastKbps=Math.round(8*e.total/(e.tbuffered-e.tfirst)),this.hls.trigger(y.default.FRAG_BUFFERED,{stats:e,frag:t,id:"main"});var n=this.mediaBuffer?this.mediaBuffer:this.media;A.logger.log("main buffered : "+E.default.toString(n.buffered)),this.state=k.IDLE}this.tick()}}},{key:"onError",value:function(t){var e=t.frag||this.fragCurrent;if(!e||"main"===e.type){var n=this.media,r=n&&d.default.isBuffered(n,n.currentTime)&&d.default.isBuffered(n,n.currentTime+.5);switch(t.details){case T.ErrorDetails.FRAG_LOAD_ERROR:case T.ErrorDetails.FRAG_LOAD_TIMEOUT:if(!t.fatal){var i=this.fragLoadError;i?i++:i=1;var o=this.config;if(i<=o.fragLoadingMaxRetry||r){this.fragLoadError=i,e.loadCounter=0;var a=Math.min(Math.pow(2,i-1)*o.fragLoadingRetryDelay,o.fragLoadingMaxRetryTimeout);A.logger.warn("mediaController: frag loading failed, retry in "+a+" ms"),this.retryDate=performance.now()+a,this.state=k.FRAG_LOADING_WAITING_RETRY}else A.logger.error("mediaController: "+t.details+" reaches max retry, redispatch as fatal ..."),t.fatal=!0,this.hls.trigger(y.default.ERROR,t),this.state=k.ERROR}break;case T.ErrorDetails.FRAG_LOOP_LOADING_ERROR:t.fatal||(r?(this._reduceMaxBufferLength(e.duration),this.state=k.IDLE):e.autoLevel&&0!==e.level||(t.fatal=!0,this.hls.trigger(y.default.ERROR,t),this.state=k.ERROR));break;case T.ErrorDetails.LEVEL_LOAD_ERROR:case T.ErrorDetails.LEVEL_LOAD_TIMEOUT:case T.ErrorDetails.KEY_LOAD_ERROR:case T.ErrorDetails.KEY_LOAD_TIMEOUT:this.state!==k.ERROR&&(this.state=t.fatal?k.ERROR:k.IDLE,A.logger.warn("mediaController: "+t.details+" while loading frag,switch to "+this.state+" state ..."));break;case T.ErrorDetails.BUFFER_FULL_ERROR:this.state!==k.PARSING&&this.state!==k.PARSED||(r?(this._reduceMaxBufferLength(e.duration),this.state=k.IDLE):(A.logger.warn("buffer full error also media.currentTime is not buffered, flush everything"),this.fragCurrent=null,this.state=k.PAUSED,this.hls.trigger(y.default.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY})))}}}},{key:"_reduceMaxBufferLength",value:function(t){var e=this.config;e.maxMaxBufferLength>=t&&(e.maxMaxBufferLength/=2,A.logger.warn("reduce max buffer length to "+e.maxMaxBufferLength+"s and switch to IDLE state"),this.fragLoadIdx+=2*e.fragLoadingLoopThreshold)}},{key:"_checkBuffer",value:function(){var t=this.media;if(t&&t.readyState){var e=t.currentTime,n=t.buffered;if(!this.loadedmetadata&&n.length){this.loadedmetadata=!0;var r=this.startPosition,i=d.default.isBuffered(t,r);e===r&&i||(A.logger.log("target start position:"+r),i||(r=n.start(0),A.logger.log("target start position not buffered, seek to buffered.start(0) "+r)),A.logger.log("adjust currentTime from "+e+" to "+r),t.currentTime=r)}else if(this.immediateSwitch)this.immediateLevelSwitchEnd();else{var o=d.default.bufferInfo(t,e,0),a=!(t.paused||t.ended||0===t.buffered.length),s=.5,l=e>t.playbackRate*this.lastCurrentTime,u=this.config;if(this.stalled&&l&&(this.stalled=!1,A.logger.log("playback not stuck anymore @"+e)),a&&o.len<=s&&(l?(s=0,this.seekHoleNudgeDuration=0):this.stalled?this.seekHoleNudgeDuration+=u.seekHoleNudgeDuration:(this.seekHoleNudgeDuration=0,A.logger.log("playback seems stuck @"+e),this.hls.trigger(y.default.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1}),this.stalled=!0),o.len<=s)){var c=o.nextStart,f=c-e;if(c&&f<u.maxSeekHole&&f>0){A.logger.log("adjust currentTime from "+t.currentTime+" to next buffered @ "+c+" + nudge "+this.seekHoleNudgeDuration);var h=c+this.seekHoleNudgeDuration-t.currentTime;t.currentTime=c+this.seekHoleNudgeDuration,this.hls.trigger(y.default.ERROR,{type:T.ErrorTypes.MEDIA_ERROR,details:T.ErrorDetails.BUFFER_SEEK_OVER_HOLE,fatal:!1,hole:h})}}}}}},{key:"onFragLoadEmergencyAborted",value:function(){this.state=k.IDLE,this.loadedmetadata||(this.startFragRequested=!1),this.tick()}},{key:"onBufferFlushed",value:function(){var t=this.mediaBuffer?this.mediaBuffer:this.media,e=this.bufferRange,n=[],r=void 0,i=void 0;for(i=0;i<e.length;i++)r=e[i],d.default.isBuffered(t,(r.start+r.end)/2)&&n.push(r);this.bufferRange=n,this.fragLoadIdx+=2*this.config.fragLoadingLoopThreshold,this.state=k.IDLE,this.fragPrevious=null}},{key:"swapAudioCodec",value:function(){this.audioCodecSwap=!this.audioCodecSwap}},{key:"computeLivePosition",value:function(t,e){var n=void 0!==this.config.liveSyncDuration?this.config.liveSyncDuration:this.config.liveSyncDurationCount*e.targetduration;return t+Math.max(0,e.totalduration-n)}},{key:"state",set:function(t){if(this.state!==t){var e=this.state;this._state=t,A.logger.log("engine state transition from "+e+" to "+t),this.hls.trigger(y.default.STREAM_STATE_TRANSITION,{previousState:e,nextState:t})}},get:function(){return this._state}},{key:"currentLevel",get:function(){
+var t=this.media;if(t){var e=this.getBufferRange(t.currentTime);if(e)return e.frag.level}return-1}},{key:"nextBufferRange",get:function(){var t=this.media;return t?this.followingBufferRange(this.getBufferRange(t.currentTime)):null}},{key:"nextLevel",get:function(){var t=this.nextBufferRange;return t?t.frag.level:-1}},{key:"liveSyncPosition",get:function(){return this._liveSyncPosition},set:function(t){this._liveSyncPosition=t}}]),e}(v.default);n.default=w},{20:20,24:24,25:25,26:26,28:28,29:29,39:39,43:43,45:45}],12:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=t(26),u=r(l),c=t(25),d=r(c),f=t(40),h=r(f),p=function(t){function e(t){i(this,e);var n=o(this,Object.getPrototypeOf(e).call(this,t,u.default.MEDIA_ATTACHING,u.default.MEDIA_DETACHING,u.default.FRAG_PARSING_USERDATA,u.default.MANIFEST_LOADING,u.default.FRAG_LOADED,u.default.LEVEL_SWITCH));if(n.hls=t,n.config=t.config,n.enabled=!0,n.Cues=t.config.cueHandler,n.config.enableCEA708Captions){var r=n,a={newCue:function(t,e,n){if(!r.textTrack1){var i=r.getExistingTrack("1");if(i){r.textTrack1=i,r.clearCurrentCues(r.textTrack1);var o=new window.Event("addtrack");o.track=r.textTrack1,r.media.dispatchEvent(o)}else r.textTrack1=r.createTextTrack("captions","English","en"),r.textTrack1.textTrack1=!0}r.Cues.newCue(r.textTrack1,t,e,n)}},s={newCue:function(t,e,n){if(!r.textTrack2){var i=r.getExistingTrack("2");if(i){r.textTrack2=i,r.clearCurrentCues(r.textTrack2);var o=new window.Event("addtrack");o.track=r.textTrack2,r.media.dispatchEvent(o)}else r.textTrack2=r.createTextTrack("captions","Spanish","es"),r.textTrack2.textTrack2=!0}r.Cues.newCue(r.textTrack2,t,e,n)}};n.cea608Parser=new h.default(0,a,s)}return n}return a(e,t),s(e,[{key:"clearCurrentCues",value:function(t){if(t&&t.cues)for(;t.cues.length>0;)t.removeCue(t.cues[0])}},{key:"getExistingTrack",value:function(t){var e=this.media;if(e)for(var n=0;n<e.textTracks.length;n++){var r=e.textTracks[n],i="textTrack"+t;if(r[i]===!0)return r}return null}},{key:"createTextTrack",value:function(t,e,n){if(this.media)return this.media.addTextTrack(t,e,n)}},{key:"destroy",value:function(){d.default.prototype.destroy.call(this)}},{key:"onMediaAttaching",value:function(t){this.media=t.media}},{key:"onMediaDetaching",value:function(){}},{key:"onManifestLoading",value:function(){this.lastPts=Number.NEGATIVE_INFINITY}},{key:"onLevelSwitch",value:function(){"NONE"===this.hls.currentLevel.closedCaptions?this.enabled=!1:this.enabled=!0}},{key:"onFragLoaded",value:function(t){if("main"===t.frag.type){var e=t.frag.start;e<=this.lastPts&&(this.clearCurrentCues(this.textTrack1),this.clearCurrentCues(this.textTrack2)),this.lastPts=e}}},{key:"onFragParsingUserdata",value:function(t){if(this.enabled)for(var e=0;e<t.samples.length;e++){var n=this.extractCea608Data(t.samples[e].bytes);this.cea608Parser.addData(t.samples[e].pts,n)}}},{key:"extractCea608Data",value:function(t){for(var e,n,r,i,o,a=31&t[0],s=2,l=[],u=0;u<a;u++)e=t[s++],n=127&t[s++],r=127&t[s++],i=0!==(4&e),o=3&e,0===n&&0===r||i&&0===o&&(l.push(n),l.push(r));return l}}]),e}(d.default);n.default=p},{25:25,26:26,40:40}],13:[function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=function(){function t(e){r(this,t),this._tables=[[[],[],[],[],[]],[[],[],[],[],[]]],this._precompute();var n,i,o,a,s,l=this._tables[0][4],u=this._tables[1],c=e.length,d=1;if(4!==c&&6!==c&&8!==c)throw new Error("Invalid aes key size="+c);for(a=e.slice(0),s=[],this._key=[a,s],n=c;n<4*c+28;n++)o=a[n-1],(n%c===0||8===c&&n%c===4)&&(o=l[o>>>24]<<24^l[o>>16&255]<<16^l[o>>8&255]<<8^l[255&o],n%c===0&&(o=o<<8^o>>>24^d<<24,d=d<<1^283*(d>>7))),a[n]=a[n-c]^o;for(i=0;n;i++,n--)o=a[3&i?n:n-4],n<=4||i<4?s[i]=o:s[i]=u[0][l[o>>>24]]^u[1][l[o>>16&255]]^u[2][l[o>>8&255]]^u[3][l[255&o]]}return i(t,[{key:"_precompute",value:function(){var t,e,n,r,i,o,a,s,l,u=this._tables[0],c=this._tables[1],d=u[4],f=c[4],h=[],p=[];for(t=0;t<256;t++)p[(h[t]=t<<1^283*(t>>7))^t]=t;for(e=n=0;!d[e];e^=r||1,n=p[n]||1)for(a=n^n<<1^n<<2^n<<3^n<<4,a=a>>8^255&a^99,d[e]=a,f[a]=e,o=h[i=h[r=h[e]]],l=16843009*o^65537*i^257*r^16843008*e,s=257*h[a]^16843008*a,t=0;t<4;t++)u[t][e]=s=s<<24^s>>>8,c[t][a]=l=l<<24^l>>>8;for(t=0;t<5;t++)u[t]=u[t].slice(0),c[t]=c[t].slice(0)}},{key:"decrypt",value:function(t,e,n,r,i,o){var a,s,l,u,c=this._key[1],d=t^c[0],f=r^c[1],h=n^c[2],p=e^c[3],y=c.length/4-2,g=4,v=this._tables[1],m=v[0],b=v[1],_=v[2],E=v[3],T=v[4];for(u=0;u<y;u++)a=m[d>>>24]^b[f>>16&255]^_[h>>8&255]^E[255&p]^c[g],s=m[f>>>24]^b[h>>16&255]^_[p>>8&255]^E[255&d]^c[g+1],l=m[h>>>24]^b[p>>16&255]^_[d>>8&255]^E[255&f]^c[g+2],p=m[p>>>24]^b[d>>16&255]^_[f>>8&255]^E[255&h]^c[g+3],g+=4,d=a,f=s,h=l;for(u=0;u<4;u++)i[(3&-u)+o]=T[d>>>24]<<24^T[f>>16&255]<<16^T[h>>8&255]<<8^T[255&p]^c[g++],a=d,d=f,f=h,h=p,p=a}}]),t}();n.default=o},{}],14:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=t(13),s=r(a),l=function(){function t(e,n){i(this,t),this.key=e,this.iv=n}return o(t,[{key:"ntoh",value:function(t){return t<<24|(65280&t)<<8|(16711680&t)>>8|t>>>24}},{key:"doDecrypt",value:function(t,e,n){var r,i,o,a,l,u,c,d,f,h=new Int32Array(t.buffer,t.byteOffset,t.byteLength>>2),p=new s.default(Array.prototype.slice.call(e)),y=new Uint8Array(t.byteLength),g=new Int32Array(y.buffer);for(r=~~n[0],i=~~n[1],o=~~n[2],a=~~n[3],f=0;f<h.length;f+=4)l=~~this.ntoh(h[f]),u=~~this.ntoh(h[f+1]),c=~~this.ntoh(h[f+2]),d=~~this.ntoh(h[f+3]),p.decrypt(l,u,c,d,g,f),g[f]=this.ntoh(g[f]^r),g[f+1]=this.ntoh(g[f+1]^i),g[f+2]=this.ntoh(g[f+2]^o),g[f+3]=this.ntoh(g[f+3]^a),r=l,i=u,o=c,a=d;return y}},{key:"localDecrypt",value:function(t,e,n,r){var i=this.doDecrypt(t,e,n);r.set(i,t.byteOffset)}},{key:"decrypt",value:function(t){var e=32e3,n=new Int32Array(t),r=new Uint8Array(t.byteLength),i=0,o=this.key,a=this.iv;for(this.localDecrypt(n.subarray(i,i+e),o,a,r),i=e;i<n.length;i+=e)a=new Uint32Array([this.ntoh(n[i-4]),this.ntoh(n[i-3]),this.ntoh(n[i-2]),this.ntoh(n[i-1])]),this.localDecrypt(n.subarray(i,i+e),o,a,r);return r}}]),t}();n.default=l},{13:13}],15:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=t(14),s=r(a),l=t(24),u=t(43),c=function(){function t(e){i(this,t),this.hls=e;try{var n=window?window.crypto:crypto;this.subtle=n.subtle||n.webkitSubtle,this.disableWebCrypto=!this.subtle}catch(t){this.disableWebCrypto=!0}}return o(t,[{key:"destroy",value:function(){}},{key:"decrypt",value:function(t,e,n,r){this.disableWebCrypto&&this.hls.config.enableSoftwareAES?this.decryptBySoftware(t,e,n,r):this.decryptByWebCrypto(t,e,n,r)}},{key:"decryptByWebCrypto",value:function(t,e,n,r){var i=this;u.logger.log("decrypting by WebCrypto API"),this.subtle.importKey("raw",e,{name:"AES-CBC",length:128},!1,["decrypt"]).then(function(o){i.subtle.decrypt({name:"AES-CBC",iv:n.buffer},o,t).then(r).catch(function(o){i.onWebCryptoError(o,t,e,n,r)})}).catch(function(o){i.onWebCryptoError(o,t,e,n,r)})}},{key:"decryptBySoftware",value:function(t,e,n,r){u.logger.log("decrypting by JavaScript Implementation");var i=new DataView(e.buffer),o=new Uint32Array([i.getUint32(0),i.getUint32(4),i.getUint32(8),i.getUint32(12)]);i=new DataView(n.buffer);var a=new Uint32Array([i.getUint32(0),i.getUint32(4),i.getUint32(8),i.getUint32(12)]),l=new s.default(o,a);r(l.decrypt(t).buffer)}},{key:"onWebCryptoError",value:function(t,e,n,r,i){this.hls.config.enableSoftwareAES?(u.logger.log("disabling to use WebCrypto API"),this.disableWebCrypto=!0,this.decryptBySoftware(e,n,r,i)):(u.logger.error("decrypting error : "+t.message),this.hls.trigger(Event.ERROR,{type:l.ErrorTypes.MEDIA_ERROR,details:l.ErrorDetails.FRAG_DECRYPT_ERROR,fatal:!0,reason:t.message}))}}]),t}();n.default=c},{14:14,24:24,43:43}],16:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=t(17),s=r(a),l=t(43),u=t(22),c=r(u),d=function(){function t(e,n,r,o){i(this,t),this.observer=e,this.id=n,this.remuxerClass=r,this.config=o,this.remuxer=new this.remuxerClass(e,n,o),this.insertDiscontinuity()}return o(t,[{key:"insertDiscontinuity",value:function(){this._aacTrack={container:"audio/adts",type:"audio",id:-1,sequenceNumber:0,samples:[],len:0}}},{key:"push",value:function(t,e,n,r,i,o,a,u,d){var f,h,p,y,g,v,m,b,_,E,T=new c.default(t),A=90*T.timeStamp,k=!1;for(i!==this.lastCC?(l.logger.log(this.id+" discontinuity detected"),this.lastCC=i,this.insertDiscontinuity(),this.remuxer.switchLevel(),this.remuxer.insertDiscontinuity()):o!==this.lastLevel?(l.logger.log("audio track switch detected"),this.lastLevel=o,this.remuxer.switchLevel(),this.insertDiscontinuity()):a===this.lastSN+1&&(k=!0),f=this._aacTrack,this.lastSN=a,this.lastLevel=o,v=T.length,_=t.length;v<_-1&&(255!==t[v]||240!==(240&t[v+1]));v++);for(f.audiosamplerate||(h=s.default.getAudioConfig(this.observer,t,v,e),f.config=h.config,f.audiosamplerate=h.samplerate,f.channelCount=h.channelCount,f.codec=h.codec,f.duration=u,l.logger.log("parsed codec:"+f.codec+",rate:"+h.samplerate+",nb channel:"+h.channelCount)),g=0,y=9216e4/f.audiosamplerate;v+5<_&&(m=1&t[v+1]?7:9,p=(3&t[v+3])<<11|t[v+4]<<3|(224&t[v+5])>>>5,p-=m,p>0&&v+m+p<=_);)for(b=A+g*y,E={unit:t.subarray(v+m,v+m+p),pts:b,dts:b},f.samples.push(E),f.len+=p,v+=p+m,g++;v<_-1&&(255!==t[v]||240!==(240&t[v+1]));v++);this.remuxer.remux(o,a,this._aacTrack,{samples:[]},{samples:[{pts:A,dts:A,unit:T.payload}]},{samples:[]},r,k,d)}},{key:"destroy",value:function(){}}],[{key:"probe",value:function(t){var e,n,r=new c.default(t);if(r.hasTimeStamp)for(e=r.length,n=t.length;e<n-1;e++)if(255===t[e]&&240===(240&t[e+1]))return!0;return!1}}]),t}();n.default=d},{17:17,22:22,43:43}],17:[function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=t(43),a=t(24),s=function(){function t(){r(this,t)}return i(t,null,[{key:"getAudioConfig",value:function(t,e,n,r){var i,s,l,u,c,d=navigator.userAgent.toLowerCase(),f=[96e3,88200,64e3,48e3,44100,32e3,24e3,22050,16e3,12e3,11025,8e3,7350];return i=((192&e[n+2])>>>6)+1,s=(60&e[n+2])>>>2,s>f.length-1?void t.trigger(Event.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+s}):(u=(1&e[n+2])<<2,u|=(192&e[n+3])>>>6,o.logger.log("manifest codec:"+r+",ADTS data:type:"+i+",sampleingIndex:"+s+"["+f[s]+"Hz],channelConfig:"+u),/firefox|OPR/i.test(d)?s>=6?(i=5,c=new Array(4),l=s-3):(i=2,c=new Array(2),l=s):d.indexOf("android")!==-1?(i=2,c=new Array(2),l=s):(i=5,c=new Array(4),r&&(r.indexOf("mp4a.40.29")!==-1||r.indexOf("mp4a.40.5")!==-1)||!r&&s>=6?l=s-3:((r&&r.indexOf("mp4a.40.2")!==-1&&s>=6&&1===u||!r&&1===u)&&(i=2,c=new Array(2)),l=s)),c[0]=i<<3,c[0]|=(14&s)>>1,c[1]|=(1&s)<<7,c[1]|=u<<3,5===i&&(c[1]|=(14&l)>>1,c[2]=(1&l)<<7,c[2]|=8,c[3]=0),{config:c,samplerate:f[s],channelCount:u,codec:"mp4a.40."+i})}}]),t}();n.default=s},{24:24,43:43}],18:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=t(26),s=r(a),l=t(24),u=t(16),c=r(u),d=t(23),f=r(d),h=t(36),p=r(h),y=t(37),g=r(y),v=function(){function t(e,n,r){var o=arguments.length<=3||void 0===arguments[3]?null:arguments[3];i(this,t),this.hls=e,this.id=n,this.config=this.hls.config||o,this.typeSupported=r}return o(t,[{key:"destroy",value:function(){var t=this.demuxer;t&&t.destroy()}},{key:"push",value:function(t,e,n,r,i,o,a,u,d){var h=this.demuxer;if(!h){var y=this.hls,v=this.id;if(f.default.probe(t))h=this.typeSupported.mp2t===!0?new f.default(y,v,g.default,this.config):new f.default(y,v,p.default,this.config);else{if(!c.default.probe(t))return void y.trigger(s.default.ERROR,{type:l.ErrorTypes.MEDIA_ERROR,id:v,details:l.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"});h=new c.default(y,v,p.default,this.config)}this.demuxer=h}h.push(t,e,n,r,i,o,a,u,d)}}]),t}();n.default=v},{16:16,23:23,24:24,26:26,36:36,37:37}],19:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(n,"__esModule",{value:!0});var i=t(18),o=r(i),a=t(26),s=r(a),l=t(43),u=t(1),c=r(u),d=function(t){var e=new c.default;e.trigger=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e.emit.apply(e,[t,t].concat(r))},e.off=function(t){for(var n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];e.removeListener.apply(e,[t].concat(r))};var n=function(e,n){t.postMessage({event:e,data:n})};t.addEventListener("message",function(r){var i=r.data;switch(i.cmd){case"init":var a=JSON.parse(i.config);t.demuxer=new o.default(e,i.id,i.typeSupported,a);try{(0,l.enableLogs)(a.debug)}catch(t){console.warn("demuxerWorker: unable to enable logs")}n("init",null);break;case"demux":t.demuxer.push(new Uint8Array(i.data),i.audioCodec,i.videoCodec,i.timeOffset,i.cc,i.level,i.sn,i.duration,i.accurateTimeOffset)}}),e.on(s.default.FRAG_PARSING_INIT_SEGMENT,n),e.on(s.default.FRAG_PARSED,n),e.on(s.default.ERROR,n),e.on(s.default.FRAG_PARSING_METADATA,n),e.on(s.default.FRAG_PARSING_USERDATA,n),e.on(s.default.FRAG_PARSING_DATA,function(e,n){var r=n.data1.buffer,i=n.data2.buffer;delete n.data1,delete n.data2,t.postMessage({event:e,data:n,data1:r,data2:i},[r,i])})};n.default=d},{1:1,18:18,26:26,43:43}],20:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=t(26),s=r(a),l=t(18),u=r(l),c=t(19),d=r(c),f=t(43),h=t(15),p=r(h),y=t(24),g=function(){function e(n,r){i(this,e),this.hls=n,this.id=r;var o={mp4:MediaSource.isTypeSupported("video/mp4"),mp2t:n.config.enableMP2TPassThrough&&MediaSource.isTypeSupported("video/mp2t")};if(n.config.enableWorker&&"undefined"!=typeof Worker){f.logger.log("demuxing in webworker");var a=void 0;try{var l=t(2);a=this.w=l(d.default),this.onwmsg=this.onWorkerMessage.bind(this),a.addEventListener("message",this.onwmsg),a.onerror=function(t){n.trigger(s.default.ERROR,{type:y.ErrorTypes.OTHER_ERROR,details:y.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",err:{message:t.message+" ("+t.filename+":"+t.lineno+")"}})},a.postMessage({cmd:"init",typeSupported:o,id:r,config:JSON.stringify(n.config)})}catch(t){f.logger.error("error while initializing DemuxerWorker, fallback on DemuxerInline"),a&&URL.revokeObjectURL(a.objectURL),this.demuxer=new u.default(n,r,o)}}else this.demuxer=new u.default(n,r,o);this.demuxInitialized=!0}return o(e,[{key:"destroy",value:function(){var t=this.w;if(t)t.removeEventListener("message",this.onwmsg),t.terminate(),this.w=null;else{var e=this.demuxer;e&&(e.destroy(),this.demuxer=null)}var n=this.decrypter;n&&(n.destroy(),this.decrypter=null)}},{key:"pushDecrypted",value:function(t,e,n,r,i,o,a,s,l){var u=this.w;if(u)u.postMessage({cmd:"demux",data:t,audioCodec:e,videoCodec:n,timeOffset:r,cc:i,level:o,sn:a,duration:s,accurateTimeOffset:l},[t]);else{var c=this.demuxer;c&&c.push(new Uint8Array(t),e,n,r,i,o,a,s,l)}}},{key:"push",value:function(t,e,n,r,i,o,a,s,l,u){if(t.byteLength>0&&null!=l&&null!=l.key&&"AES-128"===l.method){null==this.decrypter&&(this.decrypter=new p.default(this.hls));var c=this;this.decrypter.decrypt(t,l.key,l.iv,function(t){c.pushDecrypted(t,e,n,r,i,o,a,s,u)})}else this.pushDecrypted(t,e,n,r,i,o,a,s,u)}},{key:"onWorkerMessage",value:function(t){var e=t.data,n=this.hls;switch(e.event){case"init":URL.revokeObjectURL(this.w.objectURL);break;case s.default.FRAG_PARSING_DATA:e.data.data1=new Uint8Array(e.data1),e.data.data2=new Uint8Array(e.data2);default:n.trigger(e.event,e.data)}}}]),e}();n.default=g},{15:15,18:18,19:19,2:2,24:24,26:26,43:43}],21:[function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=t(43),a=function(){function t(e){r(this,t),this.data=e,this.bytesAvailable=this.data.byteLength,this.word=0,this.bitsAvailable=0}return i(t,[{key:"loadWord",value:function(){var t=this.data.byteLength-this.bytesAvailable,e=new Uint8Array(4),n=Math.min(4,this.bytesAvailable);if(0===n)throw new Error("no bytes available");e.set(this.data.subarray(t,t+n)),this.word=new DataView(e.buffer).getUint32(0),this.bitsAvailable=8*n,this.bytesAvailable-=n}},{key:"skipBits",value:function(t){var e;this.bitsAvailable>t?(this.word<<=t,this.bitsAvailable-=t):(t-=this.bitsAvailable,e=t>>3,t-=e>>3,this.bytesAvailable-=e,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)}},{key:"readBits",value:function(t){var e=Math.min(this.bitsAvailable,t),n=this.word>>>32-e;return t>32&&o.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0?this.word<<=e:this.bytesAvailable>0&&this.loadWord(),e=t-e,e>0&&this.bitsAvailable?n<<e|this.readBits(e):n}},{key:"skipLZ",value:function(){var t;for(t=0;t<this.bitsAvailable;++t)if(0!==(this.word&2147483648>>>t))return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()}},{key:"skipUEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"skipEG",value:function(){this.skipBits(1+this.skipLZ())}},{key:"readUEG",value:function(){var t=this.skipLZ();return this.readBits(t+1)-1}},{key:"readEG",value:function(){var t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)}},{key:"readBoolean",value:function(){return 1===this.readBits(1)}},{key:"readUByte",value:function(){return this.readBits(8)}},{key:"readUShort",value:function(){return this.readBits(16)}},{key:"readUInt",value:function(){return this.readBits(32)}},{key:"skipScalingList",value:function(t){var e,n,r=8,i=8;for(e=0;e<t;e++)0!==i&&(n=this.readEG(),i=(r+n+256)%256),r=0===i?r:i}},{key:"readSPS",value:function(){var t,e,n,r,i,o,a,s,l,u=0,c=0,d=0,f=0,h=1;if(this.readUByte(),t=this.readUByte(),e=this.readBits(5),this.skipBits(3),n=this.readUByte(),this.skipUEG(),100===t||110===t||122===t||244===t||44===t||83===t||86===t||118===t||128===t){var p=this.readUEG();if(3===p&&this.skipBits(1),this.skipUEG(),this.skipUEG(),this.skipBits(1),this.readBoolean())for(s=3!==p?8:12,l=0;l<s;l++)this.readBoolean()&&(l<6?this.skipScalingList(16):this.skipScalingList(64))}this.skipUEG();var y=this.readUEG();if(0===y)this.readUEG();else if(1===y)for(this.skipBits(1),this.skipEG(),this.skipEG(),r=this.readUEG(),l=0;l<r;l++)this.skipEG();if(this.skipUEG(),this.skipBits(1),i=this.readUEG(),o=this.readUEG(),a=this.readBits(1),0===a&&this.skipBits(1),this.skipBits(1),this.readBoolean()&&(u=this.readUEG(),c=this.readUEG(),d=this.readUEG(),f=this.readUEG()),this.readBoolean()&&this.readBoolean()){var g=void 0,v=this.readUByte();switch(v){case 1:g=[1,1];break;case 2:g=[12,11];break;case 3:g=[10,11];break;case 4:g=[16,11];break;case 5:g=[40,33];break;case 6:g=[24,11];break;case 7:g=[20,11];break;case 8:g=[32,11];break;case 9:g=[80,33];break;case 10:g=[18,11];break;case 11:g=[15,11];break;case 12:g=[64,33];break;case 13:g=[160,99];break;case 14:g=[4,3];break;case 15:g=[3,2];break;case 16:g=[2,1];break;case 255:g=[this.readUByte()<<8|this.readUByte(),this.readUByte()<<8|this.readUByte()]}g&&(h=g[0]/g[1])}return{width:Math.ceil((16*(i+1)-2*u-2*c)*h),height:(2-a)*(o+1)*16-(a?2:4)*(d+f)}}},{key:"readSliceType",value:function(){return this.readUByte(),this.readUEG(),this.readUEG()}}]),t}();n.default=a},{43:43}],22:[function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=t(43),a=function(){function t(e){r(this,t),this._hasTimeStamp=!1;for(var n,i,a,s,l,u,c,d,f=0;;)if(c=this.readUTF(e,f,3),f+=3,"ID3"===c)f+=3,n=127&e[f++],i=127&e[f++],a=127&e[f++],s=127&e[f++],l=(n<<21)+(i<<14)+(a<<7)+s,u=f+l,this._parseID3Frames(e,f,u),f=u;else{if("3DI"!==c)return f-=3,d=f,void(d&&(this.hasTimeStamp||o.logger.warn("ID3 tag found, but no timestamp"),this._length=d,this._payload=e.subarray(0,d)));f+=7,o.logger.log("3DI footer found, end: "+f)}}return i(t,[{key:"readUTF",value:function(t,e,n){var r="",i=e,o=e+n;do r+=String.fromCharCode(t[i++]);while(i<o);return r}},{key:"_parseID3Frames",value:function(t,e,n){for(var r,i,a,s,l;e+8<=n;)switch(r=this.readUTF(t,e,4),e+=4,i=t[e++]<<24+t[e++]<<16+t[e++]<<8+t[e++],s=t[e++]<<8+t[e++],a=e,r){case"PRIV":if("com.apple.streaming.transportStreamTimestamp"===this.readUTF(t,e,44)){e+=44,e+=4;var u=1&t[e++];this._hasTimeStamp=!0,l=((t[e++]<<23)+(t[e++]<<15)+(t[e++]<<7)+t[e++])/45,u&&(l+=47721858.84),l=Math.round(l),o.logger.trace("ID3 timestamp found: "+l),this._timeStamp=l}}}},{key:"hasTimeStamp",get:function(){return this._hasTimeStamp}},{key:"timeStamp",get:function(){return this._timeStamp}},{key:"length",get:function(){return this._length}},{key:"payload",get:function(){return this._payload}}]),t}();n.default=a},{43:43}],23:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=t(17),s=r(a),l=t(26),u=r(l),c=t(21),d=r(c),f=t(43),h=t(24),p=function(){function t(e,n,r,o){i(this,t),this.observer=e,this.id=n,this.remuxerClass=r,this.config=o,this.lastCC=0,this.remuxer=new this.remuxerClass(e,n,o)}return o(t,[{key:"switchLevel",value:function(){this.pmtParsed=!1,this._pmtId=-1,this._avcTrack={container:"video/mp2t",type:"video",id:-1,sequenceNumber:0,samples:[],len:0,dropped:0},this._aacTrack={container:"video/mp2t",type:"audio",id:-1,sequenceNumber:0,samples:[],len:0},this._id3Track={type:"id3",id:-1,sequenceNumber:0,samples:[],len:0},this._txtTrack={type:"text",id:-1,sequenceNumber:0,samples:[],len:0},this.aacOverFlow=null,this.aacLastPTS=null,this.avcSample=null,this.remuxer.switchLevel()}},{key:"insertDiscontinuity",value:function(){this.switchLevel(),this.remuxer.insertDiscontinuity()}},{key:"push",value:function(t,e,n,r,i,o,a,s,l){var c,d,p,y,g,v,m=t.length,b=this.remuxer.passthrough,_=!1;this.audioCodec=e,this.videoCodec=n,this._duration=s,this.contiguous=!1,this.accurateTimeOffset=l,i!==this.lastCC&&(f.logger.log("discontinuity detected"),this.insertDiscontinuity(),this.lastCC=i),o!==this.lastLevel?(f.logger.log("level switch detected"),this.switchLevel(),this.lastLevel=o):a===this.lastSN+1&&(this.contiguous=!0),this.lastSN=a;var E=this.pmtParsed,T=this._avcTrack,A=this._aacTrack,k=this._id3Track,w=T.id,S=A.id,L=k.id,R=this._pmtId,O=T.pesData,C=A.pesData,P=k.pesData,D=this._parsePAT,I=this._parsePMT,x=this._parsePES,N=this._parseAVCPES.bind(this),M=this._parseAACPES.bind(this),F=this._parseID3PES.bind(this);for(m-=m%188,c=0;c<m;c+=188)if(71===t[c]){if(d=!!(64&t[c+1]),p=((31&t[c+1])<<8)+t[c+2],y=(48&t[c+3])>>4,y>1){if(g=c+5+t[c+4],g===c+188)continue}else g=c+4;switch(p){case w:if(d){if(O&&(v=x(O))&&(N(v,!1),b&&T.codec&&(S===-1||A.codec)))return void this.remux(o,a,t,r);O={data:[],size:0}}O&&(O.data.push(t.subarray(g,c+188)),O.size+=c+188-g);break;case S:if(d){if(C&&(v=x(C))&&(M(v),b&&A.codec&&(w===-1||T.codec)))return void this.remux(o,a,t,r);C={data:[],size:0}}C&&(C.data.push(t.subarray(g,c+188)),C.size+=c+188-g);break;case L:d&&(P&&(v=x(P))&&F(v),P={data:[],size:0}),P&&(P.data.push(t.subarray(g,c+188)),P.size+=c+188-g);break;case 0:d&&(g+=t[g]+1),R=this._pmtId=D(t,g);break;case R:d&&(g+=t[g]+1);var B=I(t,g);w=T.id=B.avc,S=A.id=B.aac,L=k.id=B.id3,_&&!E&&(f.logger.log("reparse from beginning"),_=!1,c=-188),E=this.pmtParsed=!0;break;case 17:case 8191:break;default:_=!0}}else this.observer.trigger(u.default.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,id:this.id,details:h.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"TS packet did not start with 0x47"});O&&(v=x(O))?(N(v,!0),T.pesData=null):T.pesData=O,C&&(v=x(C))?(M(v),A.pesData=null):(C&&C.size&&f.logger.log("last AAC PES packet truncated,might overlap between fragments"),A.pesData=C),P&&(v=x(P))?(F(v),k.pesData=null):k.pesData=P,this.remux(o,a,null,r)}},{key:"remux",value:function(t,e,n,r){var i=this._avcTrack,o=i.samples,a=o.reduce(function(t,e){var n=e.units.units.reduce(function(t,e){return{len:t.len+e.data.length,nbNalu:t.nbNalu+1}},{len:0,nbNalu:0});return e.length=n.len,{len:t.len+n.len,nbNalu:t.nbNalu+n.nbNalu}},{len:0,nbNalu:0});i.len=a.len,i.nbNalu=a.nbNalu,this.remuxer.remux(t,e,this._aacTrack,this._avcTrack,this._id3Track,this._txtTrack,r,this.contiguous,this.accurateTimeOffset,n)}},{key:"destroy",value:function(){this.switchLevel(),this._initPTS=this._initDTS=void 0,this._duration=0}},{key:"_parsePAT",value:function(t,e){return(31&t[e+10])<<8|t[e+11]}},{key:"_parsePMT",value:function(t,e){var n,r,i,o,a={aac:-1,avc:-1,id3:-1};for(n=(15&t[e+1])<<8|t[e+2],r=e+3+n-4,i=(15&t[e+10])<<8|t[e+11],e+=12+i;e<r;){switch(o=(31&t[e+1])<<8|t[e+2],t[e]){case 15:a.aac===-1&&(a.aac=o);break;case 21:a.id3===-1&&(a.id3=o);break;case 27:a.avc===-1&&(a.avc=o);break;case 36:f.logger.warn("HEVC stream type found, not supported for now");break;default:f.logger.log("unkown stream type:"+t[e])}e+=((15&t[e+3])<<8|t[e+4])+5}return a}},{key:"_parsePES",value:function(t){var e,n,r,i,o,a,s,l,u,c=0,d=t.data;if(!t||0===t.size)return null;for(;d[0].length<19&&d.length>1;){var f=new Uint8Array(d[0].length+d[1].length);f.set(d[0]),f.set(d[1],d[0].length),d[0]=f,d.splice(1,1)}if(e=d[0],r=(e[0]<<16)+(e[1]<<8)+e[2],1===r){if(i=(e[4]<<8)+e[5],i&&i!==t.size-6)return null;for(n=e[7],192&n&&(s=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,s>4294967295&&(s-=8589934592),64&n?(l=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2,l>4294967295&&(l-=8589934592)):l=s),o=e[8],u=o+9,t.size-=u,a=new Uint8Array(t.size);d.length;){e=d.shift();var h=e.byteLength;if(u){if(u>h){u-=h;continue}e=e.subarray(u),h-=u,u=0}a.set(e,c),c+=h}return i&&(i-=o+3),{data:a,pts:s,dts:l,len:i}}return null}},{key:"pushAccesUnit",value:function(t,e){t.units.units.length&&(!this.config.forceKeyFrameOnDiscontinuity||t.key===!0||e.sps&&(e.samples.length||this.contiguous)?e.samples.push(t):e.dropped++),t.debug.length&&f.logger.log(t.pts+"/"+t.dts+":"+t.debug+","+t.units.length)}},{key:"_parseAVCPES",value:function(t,e){var n,r,i,o=this,a=this._avcTrack,s=this._parseAVCNALu(t.data),l=!1,u=this.avcSample;t.data=null,s.forEach(function(e){switch(e.type){case 1:r=!0,l&&u&&(u.debug+="NDR ");break;case 5:r=!0,u||(u=o.avcSample=o._createAVCSample(!0,t.pts,t.dts,"")),l&&(u.debug+="IDR "),u.key=!0;break;case 6:r=!0,l&&u&&(u.debug+="SEI "),n=new d.default(o.discardEPB(e.data)),n.readUByte();for(var s=0,c=0,f=!1,h=0;!f&&n.bytesAvailable>1;){s=0;do h=n.readUByte(),s+=h;while(255===h);c=0;do h=n.readUByte(),c+=h;while(255===h);if(4===s&&0!==n.bytesAvailable){f=!0;var p=n.readUByte();if(181===p){var y=n.readUShort();if(49===y){var g=n.readUInt();if(1195456820===g){var v=n.readUByte();if(3===v){var m=n.readUByte(),b=n.readUByte(),_=31&m,E=[m,b];for(i=0;i<_;i++)E.push(n.readUByte()),E.push(n.readUByte()),E.push(n.readUByte());o._insertSampleInOrder(o._txtTrack.samples,{type:3,pts:t.pts,bytes:E})}}}}}else if(c<n.bytesAvailable)for(i=0;i<c;i++)n.readUByte()}break;case 7:if(r=!0,l&&u&&(u.debug+="SPS "),!a.sps){n=new d.default(e.data);var T=n.readSPS();a.width=T.width,a.height=T.height,a.sps=[e.data],a.duration=o._duration;var A=e.data.subarray(1,4),k="avc1.";for(i=0;i<3;i++){var w=A[i].toString(16);w.length<2&&(w="0"+w),k+=w}a.codec=k}break;case 8:r=!0,l&&u&&(u.debug+="PPS "),a.pps||(a.pps=[e.data]);break;case 9:r=!1,u&&o.pushAccesUnit(u,a),u=o.avcSample=o._createAVCSample(!1,t.pts,t.dts,l?"AUD ":"");break;case 12:r=!1;break;default:r=!1,u&&(u.debug+="unknown NAL "+e.type+" ")}if(u&&r){var S=u.units;S.units.push(e)}}),e&&u&&(this.pushAccesUnit(u,a),this.avcSample=null)}},{key:"_createAVCSample",value:function(t,e,n,r){return{key:t,pts:e,dts:n,units:{units:[],length:0},debug:r}}},{key:"_insertSampleInOrder",value:function(t,e){var n=t.length;if(n>0){if(e.pts>=t[n-1].pts)t.push(e);else for(var r=n-1;r>=0;r--)if(e.pts<t[r].pts){t.splice(r,0,e);break}}else t.push(e)}
+},{key:"_getLastNalUnit",value:function(){var t=this.avcSample,e=void 0;if(!t||0===t.units.units.length){var n=this._avcTrack,r=n.samples;t=r[r.length-1]}if(t){var i=t.units.units;e=i[i.length-1]}return e}},{key:"_parseAVCNALu",value:function(t){for(var e,n,r,i,o,a=0,s=t.byteLength,l=this._avcTrack,u=l.naluState||0,c=u,d=[],f=-1;a<s;)switch(e=t[a++],u){case 0:0===e&&(u=1);break;case 1:u=0===e?2:0;break;case 2:case 3:if(0===e)u=3;else if(1===e){if(f>=0)r={data:t.subarray(f,a-u-1),type:o},d.push(r);else{var h=this._getLastNalUnit();if(h&&(c&&a<=4-c&&h.state&&(h.data=h.data.subarray(0,h.data.byteLength-c)),n=a-u-1,n>0)){var p=new Uint8Array(h.data.byteLength+n);p.set(h.data,0),p.set(t.subarray(0,n),h.data.byteLength),h.data=p}}a<s?(i=31&t[a],f=a,o=i,u=0):u=-1}else u=0;break;case-1:f=0,o=31&e,u=0}if(f>=0&&u>=0&&(r={data:t.subarray(f,s),type:o,state:u},d.push(r)),0===d.length){var y=this._getLastNalUnit();if(y){var g=new Uint8Array(y.data.byteLength+t.byteLength);g.set(y.data,0),g.set(t,y.data.byteLength),y.data=g}}return l.naluState=u,d}},{key:"discardEPB",value:function(t){for(var e,n,r=t.byteLength,i=[],o=1;o<r-2;)0===t[o]&&0===t[o+1]&&3===t[o+2]?(i.push(o+2),o+=2):o++;if(0===i.length)return t;e=r-i.length,n=new Uint8Array(e);var a=0;for(o=0;o<e;a++,o++)a===i[0]&&(a++,i.shift()),n[o]=t[a];return n}},{key:"_parseAACPES",value:function(t){var e,n,r,i,o,a,l,c,d,p=this._aacTrack,y=t.data,g=t.pts,v=0,m=this.aacOverFlow,b=this.aacLastPTS;if(m){var _=new Uint8Array(m.byteLength+y.byteLength);_.set(m,0),_.set(y,m.byteLength),y=_}for(o=v,c=y.length;o<c-1&&(255!==y[o]||240!==(240&y[o+1]));o++);if(o){var E,T;if(o<c-1?(E="AAC PES did not start with ADTS header,offset:"+o,T=!1):(E="no ADTS header found in AAC PES",T=!0),f.logger.warn("parsing error:"+E),this.observer.trigger(u.default.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,id:this.id,details:h.ErrorDetails.FRAG_PARSING_ERROR,fatal:T,reason:E}),T)return}if(p.audiosamplerate||(e=s.default.getAudioConfig(this.observer,y,o,this.audioCodec),p.config=e.config,p.audiosamplerate=e.samplerate,p.channelCount=e.channelCount,p.codec=e.codec,p.duration=this._duration,f.logger.log("parsed codec:"+p.codec+",rate:"+e.samplerate+",nb channel:"+e.channelCount)),i=0,r=9216e4/p.audiosamplerate,m&&b){var A=b+r;Math.abs(A-g)>1&&(f.logger.log("AAC: align PTS for overlapping frames by "+Math.round((A-g)/90)),g=A)}for(;o+5<c&&(a=1&y[o+1]?7:9,n=(3&y[o+3])<<11|y[o+4]<<3|(224&y[o+5])>>>5,n-=a,n>0&&o+a+n<=c);)for(l=g+i*r,d={unit:y.subarray(o+a,o+a+n),pts:l,dts:l},p.samples.push(d),p.len+=n,o+=n+a,i++;o<c-1&&(255!==y[o]||240!==(240&y[o+1]));o++);m=o<c?y.subarray(o,c):null,this.aacOverFlow=m,this.aacLastPTS=l}},{key:"_parseID3PES",value:function(t){this._id3Track.samples.push(t)}}],[{key:"probe",value:function(t){return t.length>=564&&71===t[0]&&71===t[188]&&71===t[376]}}]),t}();n.default=p},{17:17,21:21,24:24,26:26,43:43}],24:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0});n.ErrorTypes={NETWORK_ERROR:"networkError",MEDIA_ERROR:"mediaError",OTHER_ERROR:"otherError"},n.ErrorDetails={MANIFEST_LOAD_ERROR:"manifestLoadError",MANIFEST_LOAD_TIMEOUT:"manifestLoadTimeOut",MANIFEST_PARSING_ERROR:"manifestParsingError",MANIFEST_INCOMPATIBLE_CODECS_ERROR:"manifestIncompatibleCodecsError",LEVEL_LOAD_ERROR:"levelLoadError",LEVEL_LOAD_TIMEOUT:"levelLoadTimeOut",LEVEL_SWITCH_ERROR:"levelSwitchError",AUDIO_TRACK_LOAD_ERROR:"audioTrackLoadError",AUDIO_TRACK_LOAD_TIMEOUT:"audioTrackLoadTimeOut",FRAG_LOAD_ERROR:"fragLoadError",FRAG_LOOP_LOADING_ERROR:"fragLoopLoadingError",FRAG_LOAD_TIMEOUT:"fragLoadTimeOut",FRAG_DECRYPT_ERROR:"fragDecryptError",FRAG_PARSING_ERROR:"fragParsingError",KEY_LOAD_ERROR:"keyLoadError",KEY_LOAD_TIMEOUT:"keyLoadTimeOut",BUFFER_ADD_CODEC_ERROR:"bufferAddCodecError",BUFFER_APPEND_ERROR:"bufferAppendError",BUFFER_APPENDING_ERROR:"bufferAppendingError",BUFFER_STALLED_ERROR:"bufferStalledError",BUFFER_FULL_ERROR:"bufferFullError",BUFFER_SEEK_OVER_HOLE:"bufferSeekOverHole",INTERNAL_EXCEPTION:"internalException"}},{}],25:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},a=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),s=t(43),l=t(24),u=t(26),c=r(u),d=function(){function t(e){i(this,t),this.hls=e,this.onEvent=this.onEvent.bind(this);for(var n=arguments.length,r=Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];this.handledEvents=r,this.useGenericHandler=!0,this.registerListeners()}return a(t,[{key:"destroy",value:function(){this.unregisterListeners()}},{key:"isEventHandler",value:function(){return"object"===o(this.handledEvents)&&this.handledEvents.length&&"function"==typeof this.onEvent}},{key:"registerListeners",value:function(){this.isEventHandler()&&this.handledEvents.forEach(function(t){if("hlsEventGeneric"===t)throw new Error("Forbidden event name: "+t);this.hls.on(t,this.onEvent)}.bind(this))}},{key:"unregisterListeners",value:function(){this.isEventHandler()&&this.handledEvents.forEach(function(t){this.hls.off(t,this.onEvent)}.bind(this))}},{key:"onEvent",value:function(t,e){this.onEventGeneric(t,e)}},{key:"onEventGeneric",value:function(t,e){var n=function(t,e){var n="on"+t.replace("hls","");if("function"!=typeof this[n])throw new Error("Event "+t+" has no generic handler in this "+this.constructor.name+" class (tried "+n+")");return this[n].bind(this,e)};try{n.call(this,t,e).call()}catch(e){s.logger.error("internal error happened while processing "+t+":"+e.message),this.hls.trigger(c.default.ERROR,{type:l.ErrorTypes.OTHER_ERROR,details:l.ErrorDetails.INTERNAL_EXCEPTION,fatal:!1,event:t,err:e})}}}]),t}();n.default=d},{24:24,26:26,43:43}],26:[function(t,e,n){"use strict";e.exports={MEDIA_ATTACHING:"hlsMediaAttaching",MEDIA_ATTACHED:"hlsMediaAttached",MEDIA_DETACHING:"hlsMediaDetaching",MEDIA_DETACHED:"hlsMediaDetached",BUFFER_RESET:"hlsBufferReset",BUFFER_CODECS:"hlsBufferCodecs",BUFFER_CREATED:"hlsBufferCreated",BUFFER_APPENDING:"hlsBufferAppending",BUFFER_APPENDED:"hlsBufferAppended",BUFFER_EOS:"hlsBufferEos",BUFFER_FLUSHING:"hlsBufferFlushing",BUFFER_FLUSHED:"hlsBufferFlushed",MANIFEST_LOADING:"hlsManifestLoading",MANIFEST_LOADED:"hlsManifestLoaded",MANIFEST_PARSED:"hlsManifestParsed",LEVEL_LOADING:"hlsLevelLoading",LEVEL_LOADED:"hlsLevelLoaded",LEVEL_UPDATED:"hlsLevelUpdated",LEVEL_PTS_UPDATED:"hlsLevelPtsUpdated",LEVEL_SWITCH:"hlsLevelSwitch",AUDIO_TRACKS_UPDATED:"hlsAudioTracksUpdated",AUDIO_TRACK_SWITCH:"hlsAudioTrackSwitch",AUDIO_TRACK_LOADING:"hlsAudioTrackLoading",AUDIO_TRACK_LOADED:"hlsAudioTrackLoaded",FRAG_LOADING:"hlsFragLoading",FRAG_LOAD_PROGRESS:"hlsFragLoadProgress",FRAG_LOAD_EMERGENCY_ABORTED:"hlsFragLoadEmergencyAborted",FRAG_LOADED:"hlsFragLoaded",FRAG_PARSING_INIT_SEGMENT:"hlsFragParsingInitSegment",FRAG_PARSING_USERDATA:"hlsFragParsingUserdata",FRAG_PARSING_METADATA:"hlsFragParsingMetadata",FRAG_PARSING_DATA:"hlsFragParsingData",FRAG_PARSED:"hlsFragParsed",FRAG_BUFFERED:"hlsFragBuffered",FRAG_CHANGED:"hlsFragChanged",FPS_DROP:"hlsFpsDrop",FPS_DROP_LEVEL_CAPPING:"hlsFpsDropLevelCapping",ERROR:"hlsError",DESTROYING:"hlsDestroying",KEY_LOADING:"hlsKeyLoading",KEY_LOADED:"hlsKeyLoaded",STREAM_STATE_TRANSITION:"hlsStreamStateTransition"}},{}],27:[function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=function(){function t(){r(this,t)}return i(t,null,[{key:"getSilentFrame",value:function(t){return 1===t?new Uint8Array([0,200,0,128,35,128]):2===t?new Uint8Array([33,0,73,144,2,25,0,35,128]):3===t?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]):4===t?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]):5===t?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]):6===t?new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224]):null}}]),t}();n.default=o},{}],28:[function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=function(){function t(){r(this,t)}return i(t,null,[{key:"isBuffered",value:function(t,e){if(t)for(var n=t.buffered,r=0;r<n.length;r++)if(e>=n.start(r)&&e<=n.end(r))return!0;return!1}},{key:"bufferInfo",value:function(t,e,n){if(t){var r,i=t.buffered,o=[];for(r=0;r<i.length;r++)o.push({start:i.start(r),end:i.end(r)});return this.bufferedInfo(o,e,n)}return{len:0,start:0,end:0,nextStart:void 0}}},{key:"bufferedInfo",value:function(t,e,n){var r,i,o,a,s,l=[];for(t.sort(function(t,e){var n=t.start-e.start;return n?n:e.end-t.end}),s=0;s<t.length;s++){var u=l.length;if(u){var c=l[u-1].end;t[s].start-c<n?t[s].end>c&&(l[u-1].end=t[s].end):l.push(t[s])}else l.push(t[s])}for(s=0,r=0,i=o=e;s<l.length;s++){var d=l[s].start,f=l[s].end;if(e+n>=d&&e<f)i=d,o=f,r=o-e;else if(e+n<d){a=d;break}}return{len:r,start:i,end:o,nextStart:a}}}]),t}();n.default=o},{}],29:[function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=t(43),a=function(){function t(){r(this,t)}return i(t,null,[{key:"mergeDetails",value:function(e,n){var r,i=Math.max(e.startSN,n.startSN)-n.startSN,a=Math.min(e.endSN,n.endSN)-n.startSN,s=n.startSN-e.startSN,l=e.fragments,u=n.fragments,c=0;if(a<i)return void(n.PTSKnown=!1);for(var d=i;d<=a;d++){var f=l[s+d],h=u[d];h&&f&&(c=f.cc-h.cc,isNaN(f.startPTS)||(h.start=h.startPTS=f.startPTS,h.endPTS=f.endPTS,h.duration=f.duration,r=h))}if(c)for(o.logger.log("discontinuity sliding from playlist, take drift into account"),d=0;d<u.length;d++)u[d].cc+=c;if(r)t.updateFragPTSDTS(n,r.sn,r.startPTS,r.endPTS,r.startDTS,r.endDTS);else if(s>=0&&s<l.length){var p=l[s].start;for(d=0;d<u.length;d++)u[d].start+=p}n.PTSKnown=e.PTSKnown}},{key:"updateFragPTSDTS",value:function(e,n,r,i,o,a){var s,l,u,c;if(n<e.startSN||n>e.endSN)return 0;if(s=n-e.startSN,l=e.fragments,u=l[s],!isNaN(u.startPTS)){var d=Math.abs(u.startPTS-r);isNaN(u.deltaPTS)?u.deltaPTS=d:u.deltaPTS=Math.max(d,u.deltaPTS),r=Math.min(r,u.startPTS),i=Math.max(i,u.endPTS),o=Math.min(o,u.startDTS),a=Math.max(a,u.endDTS)}var f=r-u.start;for(u.start=u.startPTS=r,u.endPTS=i,u.startDTS=o,u.endDTS=a,u.duration=i-r,c=s;c>0;c--)t.updatePTS(l,c,c-1);for(c=s;c<l.length-1;c++)t.updatePTS(l,c,c+1);return e.PTSKnown=!0,f}},{key:"updatePTS",value:function(t,e,n){var r=t[e],i=t[n],a=i.startPTS;isNaN(a)?n>e?i.start=r.start+r.duration:i.start=r.start-i.duration:n>e?(r.duration=a-r.start,r.duration<0&&o.logger.warn("negative duration computed for frag "+r.sn+",level "+r.level+", there should be some duration drift between playlist and fragment!")):(i.duration=r.start-a,i.duration<0&&o.logger.warn("negative duration computed for frag "+i.sn+",level "+i.level+", there should be some duration drift between playlist and fragment!"))}}]),t}();n.default=a},{43:43}],30:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=t(26),s=r(a),l=t(24),u=t(34),c=r(u),d=t(32),f=r(d),h=t(3),p=r(h),y=t(6),g=r(y),v=t(7),m=r(v),b=t(4),_=r(b),E=t(11),T=r(E),A=t(10),k=r(A),w=t(12),S=r(w),L=t(9),R=r(L),O=t(5),C=r(O),P=t(43),D=t(47),I=r(D),x=t(1),N=r(x),M=t(33),F=r(M),B=t(41),U=r(B),j=function(){function t(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];i(this,t);var n=t.DefaultConfig;if((e.liveSyncDurationCount||e.liveMaxLatencyDurationCount)&&(e.liveSyncDuration||e.liveMaxLatencyDuration))throw new Error("Illegal hls.js config: don't mix up liveSyncDurationCount/liveMaxLatencyDurationCount and liveSyncDuration/liveMaxLatencyDuration");for(var r in n)r in e||(e[r]=n[r]);if(void 0!==e.liveMaxLatencyDurationCount&&e.liveMaxLatencyDurationCount<=e.liveSyncDurationCount)throw new Error('Illegal hls.js config: "liveMaxLatencyDurationCount" must be gt "liveSyncDurationCount"');if(void 0!==e.liveMaxLatencyDuration&&(e.liveMaxLatencyDuration<=e.liveSyncDuration||void 0===e.liveSyncDuration))throw new Error('Illegal hls.js config: "liveMaxLatencyDuration" must be gt "liveSyncDuration"');(0,P.enableLogs)(e.debug),this.config=e;var o=this.observer=new N.default;o.trigger=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];o.emit.apply(o,[t,t].concat(n))},o.off=function(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];o.removeListener.apply(o,[t].concat(n))},this.on=o.on.bind(o),this.off=o.off.bind(o),this.trigger=o.trigger.bind(o),this.playlistLoader=new c.default(this),this.fragmentLoader=new f.default(this),this.levelController=new k.default(this),this.abrController=new e.abrController(this),this.bufferController=new e.bufferController(this),this.capLevelController=new e.capLevelController(this),this.fpsController=new e.fpsController(this),this.streamController=new e.streamController(this),this.audioStreamController=new e.audioStreamController(this),this.timelineController=new e.timelineController(this),this.audioTrackController=new C.default(this),this.keyLoader=new F.default(this)}return o(t,null,[{key:"isSupported",value:function(){return window.MediaSource&&"function"==typeof window.MediaSource.isTypeSupported&&window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')}},{key:"version",get:function(){return"0.6.7"}},{key:"Events",get:function(){return s.default}},{key:"ErrorTypes",get:function(){return l.ErrorTypes}},{key:"ErrorDetails",get:function(){return l.ErrorDetails}},{key:"DefaultConfig",get:function(){return t.defaultConfig||(t.defaultConfig={autoStartLoad:!0,startPosition:-1,defaultAudioCodec:void 0,debug:!1,capLevelOnFPSDrop:!1,capLevelToPlayerSize:!1,maxBufferLength:30,maxBufferSize:6e7,maxBufferHole:.5,maxSeekHole:2,seekHoleNudgeDuration:.01,stalledInBufferedNudgeThreshold:10,maxFragLookUpTolerance:.2,liveSyncDurationCount:3,liveMaxLatencyDurationCount:1/0,liveSyncDuration:void 0,liveMaxLatencyDuration:void 0,maxMaxBufferLength:600,enableWorker:!0,enableSoftwareAES:!0,manifestLoadingTimeOut:1e4,manifestLoadingMaxRetry:1,manifestLoadingRetryDelay:1e3,manifestLoadingMaxRetryTimeout:64e3,startLevel:void 0,levelLoadingTimeOut:1e4,levelLoadingMaxRetry:4,levelLoadingRetryDelay:1e3,levelLoadingMaxRetryTimeout:64e3,fragLoadingTimeOut:2e4,fragLoadingMaxRetry:6,fragLoadingRetryDelay:1e3,fragLoadingMaxRetryTimeout:64e3,fragLoadingLoopThreshold:3,startFragPrefetch:!1,fpsDroppedMonitoringPeriod:5e3,fpsDroppedMonitoringThreshold:.2,appendErrorMaxRetry:3,loader:I.default,fLoader:void 0,pLoader:void 0,xhrSetup:void 0,fetchSetup:void 0,abrController:p.default,bufferController:g.default,capLevelController:m.default,fpsController:R.default,streamController:T.default,audioStreamController:_.default,timelineController:S.default,cueHandler:U.default,enableCEA708Captions:!0,enableMP2TPassThrough:!1,stretchShortVideoTrack:!1,forceKeyFrameOnDiscontinuity:!0,abrEwmaFastLive:5,abrEwmaSlowLive:9,abrEwmaFastVoD:3,abrEwmaSlowVoD:9,abrEwmaDefaultEstimate:5e5,abrBandWidthFactor:.8,abrBandWidthUpFactor:.7,maxStarvationDelay:4,maxLoadingDelay:4,minAutoBitrate:0}),t.defaultConfig},set:function(e){t.defaultConfig=e}}]),o(t,[{key:"destroy",value:function(){P.logger.log("destroy"),this.trigger(s.default.DESTROYING),this.detachMedia(),this.playlistLoader.destroy(),this.fragmentLoader.destroy(),this.levelController.destroy(),this.abrController.destroy(),this.bufferController.destroy(),this.capLevelController.destroy(),this.fpsController.destroy(),this.streamController.destroy(),this.audioStreamController.destroy(),this.timelineController.destroy(),this.audioTrackController.destroy(),this.keyLoader.destroy(),this.url=null,this.observer.removeAllListeners()}},{key:"attachMedia",value:function(t){P.logger.log("attachMedia"),this.media=t,this.trigger(s.default.MEDIA_ATTACHING,{media:t})}},{key:"detachMedia",value:function(){P.logger.log("detachMedia"),this.trigger(s.default.MEDIA_DETACHING),this.media=null}},{key:"loadSource",value:function(t){P.logger.log("loadSource:"+t),this.url=t,this.trigger(s.default.MANIFEST_LOADING,{url:t})}},{key:"startLoad",value:function(){var t=arguments.length<=0||void 0===arguments[0]?-1:arguments[0];P.logger.log("startLoad"),this.levelController.startLoad(),this.streamController.startLoad(t),this.audioStreamController.startLoad(t)}},{key:"stopLoad",value:function(){P.logger.log("stopLoad"),this.levelController.stopLoad(),this.streamController.stopLoad(),this.audioStreamController.stopLoad()}},{key:"swapAudioCodec",value:function(){P.logger.log("swapAudioCodec"),this.streamController.swapAudioCodec()}},{key:"recoverMediaError",value:function(){P.logger.log("recoverMediaError");var t=this.media;this.detachMedia(),this.attachMedia(t)}},{key:"levels",get:function(){return this.levelController.levels}},{key:"currentLevel",get:function(){return this.streamController.currentLevel},set:function(t){P.logger.log("set currentLevel:"+t),this.loadLevel=t,this.streamController.immediateLevelSwitch()}},{key:"nextLevel",get:function(){return this.streamController.nextLevel},set:function(t){P.logger.log("set nextLevel:"+t),this.levelController.manualLevel=t,this.streamController.nextLevelSwitch()}},{key:"loadLevel",get:function(){return this.levelController.level},set:function(t){P.logger.log("set loadLevel:"+t),this.levelController.manualLevel=t}},{key:"nextLoadLevel",get:function(){return this.levelController.nextLoadLevel},set:function(t){this.levelController.nextLoadLevel=t}},{key:"firstLevel",get:function(){return this.levelController.firstLevel},set:function(t){P.logger.log("set firstLevel:"+t),this.levelController.firstLevel=t}},{key:"startLevel",get:function(){return this.levelController.startLevel},set:function(t){P.logger.log("set startLevel:"+t),this.levelController.startLevel=t}},{key:"autoLevelCapping",get:function(){return this.abrController.autoLevelCapping},set:function(t){P.logger.log("set autoLevelCapping:"+t),this.abrController.autoLevelCapping=t}},{key:"autoLevelEnabled",get:function(){return this.levelController.manualLevel===-1}},{key:"manualLevel",get:function(){return this.levelController.manualLevel}},{key:"audioTracks",get:function(){return this.audioTrackController.audioTracks}},{key:"audioTrack",get:function(){return this.audioTrackController.audioTrack},set:function(t){this.audioTrackController.audioTrack=t}},{key:"liveSyncPosition",get:function(){return this.streamController.liveSyncPosition}}]),t}();n.default=j},{1:1,10:10,11:11,12:12,24:24,26:26,3:3,32:32,33:33,34:34,4:4,41:41,43:43,47:47,5:5,6:6,7:7,9:9}],31:[function(t,e,n){"use strict";e.exports=t(30).default},{30:30}],32:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=t(26),u=r(l),c=t(25),d=r(c),f=t(24),h=t(43),p=function(t){function e(t){i(this,e);var n=o(this,Object.getPrototypeOf(e).call(this,t,u.default.FRAG_LOADING));return n.loaders={},n}return a(e,t),s(e,[{key:"destroy",value:function(){var t=this.loaders;for(var e in t){var n=t[e];n&&n.destroy()}this.loaders={},d.default.prototype.destroy.call(this)}},{key:"onFragLoading",value:function(t){var e=t.frag,n=e.type,r=this.loaders[n],i=this.hls.config;e.loaded=0,r&&(h.logger.warn("abort previous fragment loader for type:"+n),r.abort()),r=this.loaders[n]=e.loader="undefined"!=typeof i.fLoader?new i.fLoader(i):new i.loader(i);var o=void 0,a=void 0,s=void 0;o={url:e.url,frag:e,responseType:"arraybuffer",progressData:!1};var l=e.byteRangeStartOffset,u=e.byteRangeEndOffset;isNaN(l)||isNaN(u)||(o.rangeStart=l,o.rangeEnd=u),a={timeout:i.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:i.fragLoadingMaxRetryTimeout},s={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this),onProgress:this.loadprogress.bind(this)},r.load(o,a,s)}},{key:"loadsuccess",value:function(t,e,n){var r=t.data,i=n.frag;i.loader=void 0,this.loaders[i.type]=void 0,this.hls.trigger(u.default.FRAG_LOADED,{payload:r,frag:i,stats:e})}},{key:"loaderror",value:function(t,e){var n=e.loader;n&&n.abort(),this.loaders[e.type]=void 0,this.hls.trigger(u.default.ERROR,{type:f.ErrorTypes.NETWORK_ERROR,details:f.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:e.frag,response:t})}},{key:"loadtimeout",value:function(t,e){var n=e.loader;n&&n.abort(),this.loaders[e.type]=void 0,this.hls.trigger(u.default.ERROR,{type:f.ErrorTypes.NETWORK_ERROR,details:f.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:e.frag})}},{key:"loadprogress",value:function(t,e,n){var r=e.frag;r.loaded=t.loaded,this.hls.trigger(u.default.FRAG_LOAD_PROGRESS,{frag:r,stats:t})}}]),e}(d.default);n.default=p},{24:24,25:25,26:26,43:43}],33:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=t(26),u=r(l),c=t(25),d=r(c),f=t(24),h=t(43),p=function(t){function e(t){i(this,e);var n=o(this,Object.getPrototypeOf(e).call(this,t,u.default.KEY_LOADING));return n.loaders={},n.decryptkey=null,n.decrypturl=null,n}return a(e,t),s(e,[{key:"destroy",value:function(){for(var t in this.loaders){var e=this.loaders[t];e&&e.destroy()}this.loaders={},d.default.prototype.destroy.call(this)}},{key:"onKeyLoading",value:function(t){var e=t.frag,n=e.type,r=this.loaders[n],i=e.decryptdata,o=i.uri;if(o!==this.decrypturl||null===this.decryptkey){var a=this.hls.config;r&&(h.logger.warn("abort previous fragment loader for type:"+n),r.abort()),e.loader=this.loaders[n]=new a.loader(a),this.decrypturl=o,this.decryptkey=null;var s=void 0,l=void 0,c=void 0;s={url:o,frag:e,responseType:"arraybuffer"},l={timeout:a.fragLoadingTimeOut,maxRetry:a.fragLoadingMaxRetry,retryDelay:a.fragLoadingRetryDelay,maxRetryDelay:a.fragLoadingMaxRetryTimeout},c={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)},e.loader.load(s,l,c)}else this.decryptkey&&(i.key=this.decryptkey,this.hls.trigger(u.default.KEY_LOADED,{frag:e}))}},{key:"loadsuccess",value:function(t,e,n){var r=n.frag;this.decryptkey=r.decryptdata.key=new Uint8Array(t.data),r.loader=void 0,this.loaders[n.type]=void 0,this.hls.trigger(u.default.KEY_LOADED,{frag:r})}},{key:"loaderror",value:function(t,e){var n=e.frag,r=n.loader;r&&r.abort(),this.loaders[e.type]=void 0,this.hls.trigger(u.default.ERROR,{type:f.ErrorTypes.NETWORK_ERROR,details:f.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:n,response:t})}},{key:"loadtimeout",value:function(t,e){var n=e.frag,r=n.loader;r&&r.abort(),this.loaders[e.type]=void 0,this.hls.trigger(u.default.ERROR,{type:f.ErrorTypes.NETWORK_ERROR,details:f.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:n})}}]),e}(d.default);n.default=p},{24:24,25:25,26:26,43:43}],34:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!e||"object"!=typeof e&&"function"!=typeof e?t:e}function a(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(Object.setPrototypeOf?Object.setPrototypeOf(t,e):t.__proto__=e)}Object.defineProperty(n,"__esModule",{value:!0});var s=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),l=t(26),u=r(l),c=t(25),d=r(c),f=t(24),h=t(46),p=r(h),y=t(38),g=r(y),v=t(43),m=function(t){function e(t){i(this,e);var n=o(this,Object.getPrototypeOf(e).call(this,t,u.default.MANIFEST_LOADING,u.default.LEVEL_LOADING,u.default.AUDIO_TRACK_LOADING));return n.loaders={},n}return a(e,t),s(e,[{key:"destroy",value:function(){for(var t in this.loaders){var e=this.loaders[t];e&&e.destroy()}this.loaders={},d.default.prototype.destroy.call(this)}},{key:"onManifestLoading",value:function(t){this.load(t.url,{type:"manifest"})}},{key:"onLevelLoading",value:function(t){this.load(t.url,{type:"level",level:t.level,id:t.id})}},{key:"onAudioTrackLoading",value:function(t){this.load(t.url,{type:"audioTrack",id:t.id})}},{key:"load",value:function(t,e){var n=this.loaders[e.type];if(n){var r=n.context;if(r&&r.url===t)return void v.logger.trace("playlist request ongoing");v.logger.warn("abort previous loader for type:"+e.type),n.abort()}var i=this.hls.config,o=void 0,a=void 0,s=void 0,l=void 0;"manifest"===e.type?(o=i.manifestLoadingMaxRetry,a=i.manifestLoadingTimeOut,s=i.manifestLoadingRetryDelay,l=i.manifestLoadingMaxRetryTimeOut):(o=i.levelLoadingMaxRetry,a=i.levelLoadingTimeOut,s=i.levelLoadingRetryDelay,l=i.levelLoadingMaxRetryTimeOut,v.logger.log("loading playlist for level "+e.level)),n=this.loaders[e.type]=e.loader="undefined"!=typeof i.pLoader?new i.pLoader(i):new i.loader(i),e.url=t,e.responseType="";var u=void 0,c=void 0;u={timeout:a,maxRetry:o,retryDelay:s,maxRetryDelay:l},c={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)},n.load(e,u,c)}},{key:"resolve",value:function(t,e){return p.default.buildAbsoluteURL(e,t)}},{key:"parseMasterPlaylist",value:function(t,e){for(var n=[],r=void 0,i=/#EXT-X-STREAM-INF:([^\n\r]*)[\r\n]+([^\r\n]+)/g;null!=(r=i.exec(t));){var o={},a=o.attrs=new g.default(r[1]);o.url=this.resolve(r[2],e);var s=a.decimalResolution("RESOLUTION");s&&(o.width=s.width,o.height=s.height),o.bitrate=a.decimalInteger("AVERAGE-BANDWIDTH")||a.decimalInteger("BANDWIDTH"),o.name=a.NAME;var l=a.CODECS;if(l){l=l.split(",");for(var u=0;u<l.length;u++){var c=l[u];c.indexOf("avc1")!==-1?o.videoCodec=this.avc1toavcoti(c):o.audioCodec=c}}n.push(o)}return n}},{key:"parseMasterPlaylistMedia",value:function(t,e,n){for(var r=void 0,i=[],o=/#EXT-X-MEDIA:(.*)/g;null!=(r=o.exec(t));){var a={},s=new g.default(r[1]);s.TYPE===n&&(a.groupId=s["GROUP-ID"],a.name=s.NAME,a.type=n,a.default="YES"===s.DEFAULT,a.autoselect="YES"===s.AUTOSELECT,a.forced="YES"===s.FORCED,s.URI&&(a.url=this.resolve(s.URI,e)),a.lang=s.LANGUAGE,a.name||(a.name=a.lang),i.push(a))}return i}},{key:"createInitializationVector",value:function(t){for(var e=new Uint8Array(16),n=12;n<16;n++)e[n]=t>>8*(15-n)&255;return e}},{key:"fragmentDecryptdataFromLevelkey",value:function(t,e){var n=t;return t&&t.method&&t.uri&&!t.iv&&(n=this.cloneObj(t),n.iv=this.createInitializationVector(e)),n}},{key:"avc1toavcoti",value:function(t){var e,n=t.split(".");return n.length>2?(e=n.shift()+".",e+=parseInt(n.shift()).toString(16),e+=("000"+parseInt(n.shift()).toString(16)).substr(-4)):e=t,e}},{key:"cloneObj",value:function(t){return JSON.parse(JSON.stringify(t))}},{key:"parseLevelPlaylist",value:function(t,e,n,r){var i,o,a,s=0,l=0,u={type:null,version:null,url:e,fragments:[],live:!0,startSN:0},c={method:null,key:null,iv:null,uri:null},d=0,f=null,h=null,p=null,y=null,m=null,b=null,_=[];for(a=/(?:(?:#(EXTM3U))|(?:#EXT-X-(PLAYLIST-TYPE):(.+))|(?:#EXT-X-(MEDIA-SEQUENCE):(\d+))|(?:#EXT-X-(TARGETDURATION):(\d+))|(?:#EXT-X-(KEY):(.+))|(?:#EXT-X-(START):(.+))|(?:#EXT(INF):(\d+(?:\.\d+)?)(?:,(.*))?)|(?:(?!#)()(\S.+))|(?:#EXT-X-(BYTERANGE):(\d+(?:@\d+(?:\.\d+)?)?)|(?:#EXT-X-(ENDLIST))|(?:#EXT-X-(DIS)CONTINUITY))|(?:#EXT-X-(PROGRAM-DATE-TIME):(.+))|(?:#EXT-X-(VERSION):(\d+))|(?:(#)(.*):(.*))|(?:(#)(.*)))(?:.*)\r?\n?/g;null!==(o=a.exec(t));)switch(o.shift(),o=o.filter(function(t){return void 0!==t}),o[0]){case"PLAYLIST-TYPE":u.type=o[1].toUpperCase();break;case"MEDIA-SEQUENCE":s=u.startSN=parseInt(o[1]);break;case"TARGETDURATION":u.targetduration=parseFloat(o[1]);break;case"VERSION":u.version=parseInt(o[1]);break;case"EXTM3U":break;case"ENDLIST":u.live=!1;break;case"DIS":d++,_.push(o);break;case"BYTERANGE":var E=o[1].split("@");b=1===E.length?m:parseInt(E[1]),m=parseInt(E[0])+b;break;case"INF":p=parseFloat(o[1]),y=o[2]?o[2]:null,_.push(o);break;case"":if(!isNaN(p)){var T=s++;i=this.fragmentDecryptdataFromLevelkey(c,T);var A=o[1]?this.resolve(o[1],e):null;h={url:A,type:r,duration:p,title:y,start:l,sn:T,level:n,cc:d,decryptdata:i,programDateTime:f,tagList:_},null!==b&&(h.byteRangeStartOffset=b,h.byteRangeEndOffset=m),u.fragments.push(h),l+=p,p=null,y=null,b=null,f=null,_=[]}break;case"KEY":var k=o[1],w=new g.default(k),S=w.enumeratedString("METHOD"),L=w.URI,R=w.hexadecimalInteger("IV");S&&(c={method:null,key:null,iv:null,uri:null},L&&"AES-128"===S&&(c.method=S,c.uri=this.resolve(L,e),c.key=null,c.iv=R));break;case"START":var O=o[1],C=new g.default(O),P=C.decimalFloatingPoint("TIME-OFFSET");isNaN(P)||(u.startTimeOffset=P);
+break;case"PROGRAM-DATE-TIME":f=new Date(Date.parse(o[1])),_.push(o);break;case"#":o.shift(),_.push(o);break;default:v.logger.warn("line parsed but not handled: "+o)}return h&&!h.url&&(u.fragments.pop(),l-=h.duration),u.totalduration=l,u.averagetargetduration=l/u.fragments.length,u.endSN=s-1,u}},{key:"loadsuccess",value:function(t,e,n){var r=t.data,i=t.url,o=n.type,a=n.id,s=n.level,l=this.hls;if(this.loaders[o]=void 0,void 0!==i&&0!==i.indexOf("data:")||(i=n.url),e.tload=performance.now(),0===r.indexOf("#EXTM3U"))if(r.indexOf("#EXTINF:")>0){var c="audioTrack"!==o,d=this.parseLevelPlaylist(r,i,(c?s:a)||0,c?"main":"audio");"manifest"===o&&l.trigger(u.default.MANIFEST_LOADED,{levels:[{url:i,details:d}],audioTracks:[],url:i,stats:e}),e.tparsed=performance.now(),c?l.trigger(u.default.LEVEL_LOADED,{details:d,level:s||0,id:a||0,stats:e}):l.trigger(u.default.AUDIO_TRACK_LOADED,{details:d,id:a,stats:e})}else{var h=this.parseMasterPlaylist(r,i);if(h.length){var p=this.parseMasterPlaylistMedia(r,i,"AUDIO");if(p.length){var y=!1;p.forEach(function(t){t.url||(y=!0)}),y===!1&&h[0].audioCodec&&!h[0].attrs.AUDIO&&(v.logger.log("audio codec signaled in quality level, but no embedded audio track signaled, create one"),p.unshift({type:"main",name:"main"}))}l.trigger(u.default.MANIFEST_LOADED,{levels:h,audioTracks:p,url:i,stats:e})}else l.trigger(u.default.ERROR,{type:f.ErrorTypes.NETWORK_ERROR,details:f.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:i,reason:"no level found in manifest"})}else l.trigger(u.default.ERROR,{type:f.ErrorTypes.NETWORK_ERROR,details:f.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:!0,url:i,reason:"no EXTM3U delimiter"})}},{key:"loaderror",value:function(t,e){var n,r,i=e.loader;switch(e.type){case"manifest":n=f.ErrorDetails.MANIFEST_LOAD_ERROR,r=!0;break;case"level":n=f.ErrorDetails.LEVEL_LOAD_ERROR,r=!1;break;case"audioTrack":n=f.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,r=!1}i&&(i.abort(),this.loaders[e.type]=void 0),this.hls.trigger(u.default.ERROR,{type:f.ErrorTypes.NETWORK_ERROR,details:n,fatal:r,url:i.url,loader:i,response:t,context:e})}},{key:"loadtimeout",value:function(t,e){var n,r,i=e.loader;switch(e.type){case"manifest":n=f.ErrorDetails.MANIFEST_LOAD_TIMEOUT,r=!0;break;case"level":n=f.ErrorDetails.LEVEL_LOAD_TIMEOUT,r=!1;break;case"audioTrack":n=f.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT,r=!1}i&&(i.abort(),this.loaders[e.type]=void 0),this.hls.trigger(u.default.ERROR,{type:f.ErrorTypes.NETWORK_ERROR,details:n,fatal:r,url:i.url,loader:i,context:e})}}]),e}(d.default);n.default=m},{24:24,25:25,26:26,38:38,43:43,46:46}],35:[function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=function(){function t(){r(this,t)}return i(t,null,[{key:"init",value:function(){t.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],mvex:[],mvhd:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]};var e;for(e in t.types)t.types.hasOwnProperty(e)&&(t.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);var n=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),r=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);t.HDLR_TYPES={video:n,audio:r};var i=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),o=new Uint8Array([0,0,0,0,0,0,0,0]);t.STTS=t.STSC=t.STCO=o,t.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),t.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),t.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),t.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var a=new Uint8Array([105,115,111,109]),s=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);t.FTYP=t.box(t.types.ftyp,a,l,a,s),t.DINF=t.box(t.types.dinf,t.box(t.types.dref,i))}},{key:"box",value:function(t){for(var e,n=Array.prototype.slice.call(arguments,1),r=8,i=n.length,o=i;i--;)r+=n[i].byteLength;for(e=new Uint8Array(r),e[0]=r>>24&255,e[1]=r>>16&255,e[2]=r>>8&255,e[3]=255&r,e.set(t,4),i=0,r=8;i<o;i++)e.set(n[i],r),r+=n[i].byteLength;return e}},{key:"hdlr",value:function(e){return t.box(t.types.hdlr,t.HDLR_TYPES[e])}},{key:"mdat",value:function(e){return t.box(t.types.mdat,e)}},{key:"mdhd",value:function(e,n){return n*=e,t.box(t.types.mdhd,new Uint8Array([0,0,0,0,0,0,0,2,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,n>>24,n>>16&255,n>>8&255,255&n,85,196,0,0]))}},{key:"mdia",value:function(e){return t.box(t.types.mdia,t.mdhd(e.timescale,e.duration),t.hdlr(e.type),t.minf(e))}},{key:"mfhd",value:function(e){return t.box(t.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))}},{key:"minf",value:function(e){return"audio"===e.type?t.box(t.types.minf,t.box(t.types.smhd,t.SMHD),t.DINF,t.stbl(e)):t.box(t.types.minf,t.box(t.types.vmhd,t.VMHD),t.DINF,t.stbl(e))}},{key:"moof",value:function(e,n,r){return t.box(t.types.moof,t.mfhd(e),t.traf(r,n))}},{key:"moov",value:function(e){for(var n=e.length,r=[];n--;)r[n]=t.trak(e[n]);return t.box.apply(null,[t.types.moov,t.mvhd(e[0].timescale,e[0].duration)].concat(r).concat(t.mvex(e)))}},{key:"mvex",value:function(e){for(var n=e.length,r=[];n--;)r[n]=t.trex(e[n]);return t.box.apply(null,[t.types.mvex].concat(r))}},{key:"mvhd",value:function(e,n){n*=e;var r=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,2,e>>24&255,e>>16&255,e>>8&255,255&e,n>>24&255,n>>16&255,n>>8&255,255&n,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return t.box(t.types.mvhd,r)}},{key:"sdtp",value:function(e){var n,r,i=e.samples||[],o=new Uint8Array(4+i.length);for(r=0;r<i.length;r++)n=i[r].flags,o[r+4]=n.dependsOn<<4|n.isDependedOn<<2|n.hasRedundancy;return t.box(t.types.sdtp,o)}},{key:"stbl",value:function(e){return t.box(t.types.stbl,t.stsd(e),t.box(t.types.stts,t.STTS),t.box(t.types.stsc,t.STSC),t.box(t.types.stsz,t.STSZ),t.box(t.types.stco,t.STCO))}},{key:"avc1",value:function(e){var n,r,i,o=[],a=[];for(n=0;n<e.sps.length;n++)r=e.sps[n],i=r.byteLength,o.push(i>>>8&255),o.push(255&i),o=o.concat(Array.prototype.slice.call(r));for(n=0;n<e.pps.length;n++)r=e.pps[n],i=r.byteLength,a.push(i>>>8&255),a.push(255&i),a=a.concat(Array.prototype.slice.call(r));var s=t.box(t.types.avcC,new Uint8Array([1,o[3],o[4],o[5],255,224|e.sps.length].concat(o).concat([e.pps.length]).concat(a))),l=e.width,u=e.height;return t.box(t.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,255&l,u>>8&255,255&u,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),s,t.box(t.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])))}},{key:"esds",value:function(t){var e=t.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t.config).concat([6,1,2]))}},{key:"mp4a",value:function(e){var n=e.audiosamplerate;return t.box(t.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,n>>8&255,255&n,0,0]),t.box(t.types.esds,t.esds(e)))}},{key:"stsd",value:function(e){return"audio"===e.type?t.box(t.types.stsd,t.STSD,t.mp4a(e)):t.box(t.types.stsd,t.STSD,t.avc1(e))}},{key:"tkhd",value:function(e){var n=e.id,r=e.duration*e.timescale,i=e.width,o=e.height;return t.box(t.types.tkhd,new Uint8Array([0,0,0,7,0,0,0,0,0,0,0,0,n>>24&255,n>>16&255,n>>8&255,255&n,0,0,0,0,r>>24,r>>16&255,r>>8&255,255&r,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,i>>8&255,255&i,0,0,o>>8&255,255&o,0,0]))}},{key:"traf",value:function(e,n){var r=t.sdtp(e),i=e.id;return t.box(t.types.traf,t.box(t.types.tfhd,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i])),t.box(t.types.tfdt,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n])),t.trun(e,r.length+16+16+8+16+8+8),r)}},{key:"trak",value:function(e){return e.duration=e.duration||4294967295,t.box(t.types.trak,t.tkhd(e),t.mdia(e))}},{key:"trex",value:function(e){var n=e.id;return t.box(t.types.trex,new Uint8Array([0,0,0,0,n>>24,n>>16&255,n>>8&255,255&n,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))}},{key:"trun",value:function(e,n){var r,i,o,a,s,l,u=e.samples||[],c=u.length,d=12+16*c,f=new Uint8Array(d);for(n+=8+d,f.set([0,0,15,1,c>>>24&255,c>>>16&255,c>>>8&255,255&c,n>>>24&255,n>>>16&255,n>>>8&255,255&n],0),r=0;r<c;r++)i=u[r],o=i.duration,a=i.size,s=i.flags,l=i.cts,f.set([o>>>24&255,o>>>16&255,o>>>8&255,255&o,a>>>24&255,a>>>16&255,a>>>8&255,255&a,s.isLeading<<2|s.dependsOn,s.isDependedOn<<6|s.hasRedundancy<<4|s.paddingValue<<1|s.isNonSync,61440&s.degradPrio,15&s.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*r);return t.box(t.types.trun,f)}},{key:"initSegment",value:function(e){t.types||t.init();var n,r=t.moov(e);return n=new Uint8Array(t.FTYP.byteLength+r.byteLength),n.set(t.FTYP),n.set(r,t.FTYP.byteLength),n}}]),t}();n.default=o},{}],36:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=t(27),s=r(a),l=t(26),u=r(l),c=t(43),d=t(35),f=r(d),h=t(24);t(44);var p=function(){function t(e,n,r){i(this,t),this.observer=e,this.id=n,this.config=r,this.ISGenerated=!1,this.PES2MP4SCALEFACTOR=4,this.PES_TIMESCALE=9e4,this.MP4_TIMESCALE=this.PES_TIMESCALE/this.PES2MP4SCALEFACTOR}return o(t,[{key:"destroy",value:function(){}},{key:"insertDiscontinuity",value:function(){this._initPTS=this._initDTS=void 0}},{key:"switchLevel",value:function(){this.ISGenerated=!1}},{key:"remux",value:function(t,e,n,r,i,o,a,s,l){if(this.level=t,this.sn=e,this.ISGenerated||this.generateIS(n,r,a),this.ISGenerated)if(n.samples.length){var c=this.remuxAudio(n,a,s,l);if(r.samples.length){var d=void 0;c&&(d=c.endPTS-c.startPTS),this.remuxVideo(r,a,s,d)}}else{var f=void 0;r.samples.length&&(f=this.remuxVideo(r,a,s)),f&&n.codec&&this.remuxEmptyAudio(n,a,s,f)}i.samples.length&&this.remuxID3(i,a),o.samples.length&&this.remuxText(o,a),this.observer.trigger(u.default.FRAG_PARSED,{id:this.id,level:this.level,sn:this.sn})}},{key:"generateIS",value:function(t,e,n){var r,i,o=this.observer,a=t.samples,s=e.samples,l=this.PES_TIMESCALE,d={},p={id:this.id,level:this.level,sn:this.sn,tracks:d,unique:!1},y=void 0===this._initPTS;y&&(r=i=1/0),t.config&&a.length&&(t.timescale=t.audiosamplerate,t.timescale*t.duration>Math.pow(2,32)&&!function(){var e=function t(e,n){return n?t(n,e%n):e};t.timescale=t.audiosamplerate/e(t.audiosamplerate,1024)}(),c.logger.log("audio mp4 timescale :"+t.timescale),d.audio={container:"audio/mp4",codec:t.codec,initSegment:f.default.initSegment([t]),metadata:{channelCount:t.channelCount}},y&&(r=i=a[0].pts-l*n)),e.sps&&e.pps&&s.length&&(e.timescale=this.MP4_TIMESCALE,d.video={container:"video/mp4",codec:e.codec,initSegment:f.default.initSegment([e]),metadata:{width:e.width,height:e.height}},y&&(r=Math.min(r,s[0].pts-l*n),i=Math.min(i,s[0].dts-l*n))),Object.keys(d).length?(o.trigger(u.default.FRAG_PARSING_INIT_SEGMENT,p),this.ISGenerated=!0,y&&(this._initPTS=r,this._initDTS=i)):o.trigger(u.default.ERROR,{type:h.ErrorTypes.MEDIA_ERROR,id:this.id,details:h.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"no audio/video samples found"})}},{key:"remuxVideo",value:function(t,e,n,r){var i,o,a,s,l,d,h,p,y=8,g=this.PES_TIMESCALE,v=this.PES2MP4SCALEFACTOR,m=t.samples,b=[],_=m.reduce(function(t,e){return Math.max(Math.min(t,e.pts-e.dts),-18e3)},0);if(_<0){c.logger.warn("PTS < DTS detected in video samples, shifting DTS by "+Math.round(_/90)+" ms to overcome this issue");for(var E=0;E<m.length;E++)m[E].dts+=_}var T=void 0;T=n?this.nextAvcDts:e*g;var A=m[0];l=Math.max(this._PTSNormalize(A.dts-this._initDTS,T),0),s=Math.max(this._PTSNormalize(A.pts-this._initDTS,T),0);var k=Math.round((l-T)/90);n&&k&&(k>1?c.logger.log("AVC:"+k+" ms hole between fragments detected,filling it"):k<-1&&c.logger.log("AVC:"+-k+" ms overlapping between fragments detected"),l=T,m[0].dts=l+this._initDTS,s=Math.max(s-k,T),m[0].pts=s+this._initDTS,c.logger.log("Video/PTS/DTS adjusted: "+Math.round(s/90)+"/"+Math.round(l/90)+",delta:"+k+" ms")),d=l,A=m[m.length-1],p=Math.max(this._PTSNormalize(A.dts-this._initDTS,T),0),h=Math.max(this._PTSNormalize(A.pts-this._initDTS,T),0),h=Math.max(h,p);var w=navigator.vendor,S=navigator.userAgent,L=w&&w.indexOf("Apple")>-1&&S&&!S.match("CriOS");L&&(i=Math.round((p-l)/(v*(m.length-1))));for(var R=0;R<m.length;R++){var O=m[R];L?O.dts=l+R*v*i:(O.dts=Math.max(this._PTSNormalize(O.dts-this._initDTS,T),l),O.dts=Math.round(O.dts/v)*v),O.pts=Math.max(this._PTSNormalize(O.pts-this._initDTS,T),O.dts),O.pts=Math.round(O.pts/v)*v}o=new Uint8Array(t.len+4*t.nbNalu+8);var C=new DataView(o.buffer);C.setUint32(0,o.byteLength),o.set(f.default.types.mdat,4);for(var P=0;P<m.length;P++){for(var D=m[P],I=0,x=void 0;D.units.units.length;){var N=D.units.units.shift();C.setUint32(y,N.data.byteLength),y+=4,o.set(N.data,y),y+=N.data.byteLength,I+=4+N.data.byteLength}if(L)x=Math.max(0,i*Math.round((D.pts-D.dts)/(v*i)));else{if(P<m.length-1)i=m[P+1].dts-D.dts;else{var M=this.config,F=D.dts-m[P>0?P-1:P].dts;if(M.stretchShortVideoTrack){var B=M.maxBufferHole,U=M.maxSeekHole,j=Math.floor(Math.min(B,U)*g),G=(r?s+r*g:this.nextAacPts)-D.pts;G>j?(i=G-F,i<0&&(i=F),c.logger.log("It is approximately "+G/90+" ms to the next segment; using duration "+i/90+" ms for the last video frame.")):i=F}else i=F}i/=v,x=Math.round((D.pts-D.dts)/v)}b.push({size:I,duration:i,cts:x,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:D.key?2:1,isNonSync:D.key?0:1}})}this.nextAvcDts=p+i*v;var Y=t.dropped;if(t.len=0,t.nbNalu=0,t.dropped=0,b.length&&navigator.userAgent.toLowerCase().indexOf("chrome")>-1){var V=b[0].flags;V.dependsOn=2,V.isNonSync=0}t.samples=b,a=f.default.moof(t.sequenceNumber++,l/v,t),t.samples=[];var K={id:this.id,level:this.level,sn:this.sn,data1:a,data2:o,startPTS:s/g,endPTS:(h+v*i)/g,startDTS:l/g,endDTS:this.nextAvcDts/g,type:"video",nb:b.length,dropped:Y};return this.observer.trigger(u.default.FRAG_PARSING_DATA,K),K}},{key:"remuxAudio",value:function(t,e,n,r){var i,o,a,l,d,h,p,y,g,v,m,b,_,E,T,A=this.PES_TIMESCALE,k=t.timescale,w=A/k,S=1024*t.timescale/t.audiosamplerate,L=8,R=[],O=[];t.samples.sort(function(t,e){return t.pts-e.pts}),O=t.samples,n|=O.length&&this.nextAacPts&&Math.abs(e-this.nextAacPts/A)<.1;var C=n?this.nextAacPts:e*A,P=S*w,D=C;if(r)for(var I=0;I<O.length;){var x=O[I],N=this._PTSNormalize(x.pts-this._initDTS,C),M=N-D;if(M<=-P)c.logger.warn("Dropping 1 audio frame @ "+Math.round(D/90)/1e3+"s due to "+Math.round(Math.abs(M/90))+" ms overlap."),O.splice(I,1),t.len-=x.unit.length;else if(M>=P){var F=Math.round(M/P);c.logger.warn("Injecting "+F+" audio frame @ "+Math.round(D/90)/1e3+"s due to "+Math.round(M/90)+" ms gap.");for(var B=0;B<F;B++)T=D+this._initDTS,T=Math.max(T,this._initDTS),E=s.default.getSilentFrame(t.channelCount),E||(c.logger.log("Unable to get silent frame for given audio codec; duplicating last frame instead."),E=x.unit.slice(0)),O.splice(I,0,{unit:E,pts:T,dts:T}),t.len+=E.length,D+=P,I+=1;x.pts=x.dts=D+this._initDTS,D+=P,I+=1}else Math.abs(M)>.1*P,D+=P,0===I?x.pts=x.dts=this._initDTS+C:x.pts=x.dts=O[I-1].pts+P,I+=1}for(;O.length;){if(o=O.shift(),l=o.unit,v=o.pts-this._initDTS,m=o.dts-this._initDTS,void 0!==g)b=this._PTSNormalize(v,g),_=this._PTSNormalize(m,g),a.duration=Math.round((_-g)/w);else{b=this._PTSNormalize(v,C),_=this._PTSNormalize(m,C);var U=Math.round(1e3*(b-C)/A),j=0;if(n&&U){if(U>0)j=Math.round((b-C)/P),c.logger.log(U+" ms hole between AAC samples detected,filling it"),j>0&&(E=s.default.getSilentFrame(t.channelCount),E||(E=l.slice(0)),t.len+=j*E.length);else if(U<-12){c.logger.log(-U+" ms overlapping between AAC samples detected, drop frame"),t.len-=l.byteLength;continue}b=_=C}if(p=Math.max(0,b),y=Math.max(0,_),!(t.len>0))return;d=new Uint8Array(t.len+8),i=new DataView(d.buffer),i.setUint32(0,d.byteLength),d.set(f.default.types.mdat,4);for(var G=0;G<j;G++)T=b-(j-G)*P,E=s.default.getSilentFrame(t.channelCount),E||(c.logger.log("Unable to get silent frame for given audio codec; duplicating this frame instead."),E=l.slice(0)),d.set(E,L),L+=E.byteLength,a={size:E.byteLength,cts:0,duration:1024,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},R.push(a)}d.set(l,L),L+=l.byteLength,a={size:l.byteLength,cts:0,duration:0,flags:{isLeading:0,isDependedOn:0,hasRedundancy:0,degradPrio:0,dependsOn:1}},R.push(a),g=_}var Y=0,V=R.length;if(V>=2&&(Y=R[V-2].duration,a.duration=Y),V){this.nextAacPts=b+w*Y,t.len=0,t.samples=R,h=f.default.moof(t.sequenceNumber++,y/w,t),t.samples=[];var K={id:this.id,level:this.level,sn:this.sn,data1:h,data2:d,startPTS:p/A,endPTS:this.nextAacPts/A,startDTS:y/A,endDTS:(_+w*Y)/A,type:"audio",nb:V};return this.observer.trigger(u.default.FRAG_PARSING_DATA,K),K}return null}},{key:"remuxEmptyAudio",value:function(t,e,n,r){var i=this.PES_TIMESCALE,o=t.timescale?t.timescale:t.audiosamplerate,a=i/o,l=r.startDTS*i+this._initDTS,u=r.endDTS*i+this._initDTS,d=1024,f=a*d,h=Math.ceil((u-l)/f),p=s.default.getSilentFrame(t.channelCount);if(!p)return void c.logger.trace("Unable to remuxEmptyAudio since we were unable to get a silent frame for given audio codec!");for(var y=[],g=0;g<h;g++){var v=l+g*f;y.push({unit:p.slice(0),pts:v,dts:v}),t.len+=p.length}t.samples=y,this.remuxAudio(t,e,n)}},{key:"remuxID3",value:function(t,e){var n,r=t.samples.length;if(r){for(var i=0;i<r;i++)n=t.samples[i],n.pts=(n.pts-this._initPTS)/this.PES_TIMESCALE,n.dts=(n.dts-this._initDTS)/this.PES_TIMESCALE;this.observer.trigger(u.default.FRAG_PARSING_METADATA,{id:this.id,level:this.level,sn:this.sn,samples:t.samples})}t.samples=[],e=e}},{key:"remuxText",value:function(t,e){t.samples.sort(function(t,e){return t.pts-e.pts});var n,r=t.samples.length;if(r){for(var i=0;i<r;i++)n=t.samples[i],n.pts=(n.pts-this._initPTS)/this.PES_TIMESCALE;this.observer.trigger(u.default.FRAG_PARSING_USERDATA,{id:this.id,level:this.level,sn:this.sn,samples:t.samples})}t.samples=[],e=e}},{key:"_PTSNormalize",value:function(t,e){var n;if(void 0===e)return t;for(n=e<t?-8589934592:8589934592;Math.abs(t-e)>4294967296;)t+=n;return t}},{key:"passthrough",get:function(){return!1}}]),t}();n.default=p},{24:24,26:26,27:27,35:35,43:43,44:44}],37:[function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{default:t}}function i(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var o=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),a=t(26),s=r(a),l=function(){function t(e,n){i(this,t),this.observer=e,this.id=n,this.ISGenerated=!1}return o(t,[{key:"destroy",value:function(){}},{key:"insertDiscontinuity",value:function(){}},{key:"switchLevel",value:function(){this.ISGenerated=!1}},{key:"remux",value:function(t,e,n,r,i,o){var a=this.observer;if(!this.ISGenerated){var l={},u={id:this.id,tracks:l,unique:!0},c=e,d=c.codec;d&&(u.tracks.video={container:c.container,codec:d,metadata:{width:c.width,height:c.height}}),c=t,d=c.codec,d&&(u.tracks.audio={container:c.container,codec:d,metadata:{channelCount:c.channelCount}}),this.ISGenerated=!0,a.trigger(s.default.FRAG_PARSING_INIT_SEGMENT,u)}a.trigger(s.default.FRAG_PARSING_DATA,{id:this.id,data1:o,startPTS:i,startDTS:i,type:"audiovideo",nb:1,dropped:0})}},{key:"passthrough",get:function(){return!0}}]),t}();n.default=l},{26:26}],38:[function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=function(){function t(e){r(this,t),"string"==typeof e&&(e=t.parseAttrList(e));for(var n in e)e.hasOwnProperty(n)&&(this[n]=e[n])}return i(t,[{key:"decimalInteger",value:function(t){var e=parseInt(this[t],10);return e>Number.MAX_SAFE_INTEGER?1/0:e}},{key:"hexadecimalInteger",value:function(t){if(this[t]){var e=(this[t]||"0x").slice(2);e=(1&e.length?"0":"")+e;for(var n=new Uint8Array(e.length/2),r=0;r<e.length/2;r++)n[r]=parseInt(e.slice(2*r,2*r+2),16);return n}return null}},{key:"hexadecimalIntegerAsNumber",value:function(t){var e=parseInt(this[t],16);return e>Number.MAX_SAFE_INTEGER?1/0:e}},{key:"decimalFloatingPoint",value:function(t){return parseFloat(this[t])}},{key:"enumeratedString",value:function(t){return this[t]}},{key:"decimalResolution",value:function(t){var e=/^(\d+)x(\d+)$/.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}}}],[{key:"parseAttrList",value:function(t){for(var e,n=/\s*(.+?)\s*=((?:\".*?\")|.*?)(?:,|$)/g,r={};null!==(e=n.exec(t));){var i=e[2],o='"';0===i.indexOf(o)&&i.lastIndexOf(o)===i.length-1&&(i=i.slice(1,-1)),r[e[1]]=i}return r}}]),t}();n.default=o},{}],39:[function(t,e,n){"use strict";var r={search:function(t,e){for(var n=0,r=t.length-1,i=null,o=null;n<=r;){i=(n+r)/2|0,o=t[i];var a=e(o);if(a>0)n=i+1;else{if(!(a<0))return o;r=i-1}}return null}};e.exports=r},{}],40:[function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o={42:225,92:233,94:237,95:243,96:250,123:231,124:247,125:209,126:241,127:9608,128:174,129:176,130:189,131:191,132:8482,133:162,134:163,135:9834,136:224,137:32,138:232,139:226,140:234,141:238,142:244,143:251,144:193,145:201,146:211,147:218,148:220,149:252,150:8216,151:161,152:42,153:8217,154:9473,155:169,156:8480,157:8226,158:8220,159:8221,160:192,161:194,162:199,163:200,164:202,165:203,166:235,167:206,168:207,169:239,170:212,171:217,172:249,173:219,174:171,175:187,176:195,177:227,178:205,179:204,180:236,181:210,182:242,183:213,184:245,185:123,186:125,187:92,188:94,189:95,190:124,191:8764,192:196,193:228,194:214,195:246,196:223,197:165,198:164,199:9475,200:197,201:229,202:216,203:248,204:9487,205:9491,206:9495,207:9499},a=function(t){var e=t;return o.hasOwnProperty(t)&&(e=o[t]),String.fromCharCode(e)},s=15,l=32,u={17:1,18:3,21:5,22:7,23:9,16:11,19:12,20:14},c={17:2,18:4,21:6,22:8,23:10,19:13,20:15},d={25:1,26:3,29:5,30:7,31:9,24:11,27:12,28:14},f={25:2,26:4,29:6,30:8,31:10,27:13,28:15},h=["white","green","blue","cyan","red","yellow","magenta","black","transparent"],p={verboseFilter:{DATA:3,DEBUG:3,INFO:2,WARNING:2,TEXT:1,ERROR:0},time:null,verboseLevel:0,setTime:function(t){this.time=t},log:function(t,e){var n=this.verboseFilter[t];this.verboseLevel>=n&&console.log(this.time+" ["+t+"] "+e)}},y=function(t){for(var e=[],n=0;n<t.length;n++)e.push(t[n].toString(16));return e},g=function(){function t(e,n,i,o,a){r(this,t),this.foreground=e||"white",this.underline=n||!1,this.italics=i||!1,this.background=o||"black",this.flash=a||!1}return i(t,[{key:"reset",value:function(){this.foreground="white",this.underline=!1,this.italics=!1,this.background="black",this.flash=!1}},{key:"setStyles",value:function(t){for(var e=["foreground","underline","italics","background","flash"],n=0;n<e.length;n++){var r=e[n];t.hasOwnProperty(r)&&(this[r]=t[r])}}},{key:"isDefault",value:function(){return"white"===this.foreground&&!this.underline&&!this.italics&&"black"===this.background&&!this.flash}},{key:"equals",value:function(t){return this.foreground===t.foreground&&this.underline===t.underline&&this.italics===t.italics&&this.background===t.background&&this.flash===t.flash}},{key:"copy",value:function(t){this.foreground=t.foreground,this.underline=t.underline,this.italics=t.italics,this.background=t.background,this.flash=t.flash}},{key:"toString",value:function(){return"color="+this.foreground+", underline="+this.underline+", italics="+this.italics+", background="+this.background+", flash="+this.flash}}]),t}(),v=function(){function t(e,n,i,o,a,s){r(this,t),this.uchar=e||" ",this.penState=new g(n,i,o,a,s)}return i(t,[{key:"reset",value:function(){this.uchar=" ",this.penState.reset()}},{key:"setChar",value:function(t,e){this.uchar=t,this.penState.copy(e)}},{key:"setPenState",value:function(t){this.penState.copy(t)}},{key:"equals",value:function(t){return this.uchar===t.uchar&&this.penState.equals(t.penState)}},{key:"copy",value:function(t){this.uchar=t.uchar,this.penState.copy(t.penState)}},{key:"isEmpty",value:function(){return" "===this.uchar&&this.penState.isDefault()}}]),t}(),m=function(){function t(){r(this,t),this.chars=[];for(var e=0;e<l;e++)this.chars.push(new v);this.pos=0,this.currPenState=new g}return i(t,[{key:"equals",value:function(t){for(var e=!0,n=0;n<l;n++)if(!this.chars[n].equals(t.chars[n])){e=!1;break}return e}},{key:"copy",value:function(t){for(var e=0;e<l;e++)this.chars[e].copy(t.chars[e])}},{key:"isEmpty",value:function(){for(var t=!0,e=0;e<l;e++)if(!this.chars[e].isEmpty()){t=!1;break}return t}},{key:"setCursor",value:function(t){this.pos!==t&&(this.pos=t),this.pos<0?(p.log("ERROR","Negative cursor position "+this.pos),this.pos=0):this.pos>l&&(p.log("ERROR","Too large cursor position "+this.pos),this.pos=l)}},{key:"moveCursor",value:function(t){var e=this.pos+t;if(t>1)for(var n=this.pos+1;n<e+1;n++)this.chars[n].setPenState(this.currPenState);this.setCursor(e)}},{key:"backSpace",value:function(){this.moveCursor(-1),this.chars[this.pos].setChar(" ",this.currPenState)}},{key:"insertChar",value:function(t){t>=144&&this.backSpace();var e=a(t);return this.pos>=l?void p.log("ERROR","Cannot insert "+t.toString(16)+" ("+e+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(e,this.currPenState),void this.moveCursor(1))}},{key:"clearFromPos",value:function(t){var e;for(e=t;e<l;e++)this.chars[e].reset()}},{key:"clear",value:function(){this.clearFromPos(0),this.pos=0,this.currPenState.reset()}},{key:"clearToEndOfRow",value:function(){this.clearFromPos(this.pos)}},{key:"getTextString",value:function(){for(var t=[],e=!0,n=0;n<l;n++){var r=this.chars[n].uchar;" "!==r&&(e=!1),t.push(r)}return e?"":t.join("")}},{key:"setPenStyles",value:function(t){this.currPenState.setStyles(t);var e=this.chars[this.pos];e.setPenState(this.currPenState)}}]),t}(),b=function(){function t(){r(this,t),this.rows=[];for(var e=0;e<s;e++)this.rows.push(new m);this.currRow=s-1,this.nrRollUpRows=null,this.reset()}return i(t,[{key:"reset",value:function(){for(var t=0;t<s;t++)this.rows[t].clear();this.currRow=s-1}},{key:"equals",value:function(t){for(var e=!0,n=0;n<s;n++)if(!this.rows[n].equals(t.rows[n])){e=!1;break}return e}},{key:"copy",value:function(t){for(var e=0;e<s;e++)this.rows[e].copy(t.rows[e])}},{key:"isEmpty",value:function(){for(var t=!0,e=0;e<s;e++)if(!this.rows[e].isEmpty()){t=!1;break}return t}},{key:"backSpace",value:function(){var t=this.rows[this.currRow];t.backSpace()}},{key:"clearToEndOfRow",value:function(){var t=this.rows[this.currRow];t.clearToEndOfRow()}},{key:"insertChar",value:function(t){var e=this.rows[this.currRow];e.insertChar(t)}},{key:"setPen",value:function(t){var e=this.rows[this.currRow];e.setPenStyles(t)}},{key:"moveCursor",value:function(t){var e=this.rows[this.currRow];e.moveCursor(t)}},{key:"setCursor",value:function(t){p.log("INFO","setCursor: "+t);var e=this.rows[this.currRow];e.setCursor(t)}},{key:"setPAC",value:function(t){p.log("INFO","pacData = "+JSON.stringify(t));var e=t.row-1;this.nrRollUpRows&&e<this.nrRollUpRows-1&&(e=this.nrRollUpRows-1),this.currRow=e;var n=this.rows[this.currRow];if(null!==t.indent){var r=t.indent,i=Math.max(r-1,0);n.setCursor(t.indent),t.color=n.chars[i].penState.foreground}var o={foreground:t.color,underline:t.underline,italics:t.italics,background:"black",flash:!1};this.setPen(o)}},{key:"setBkgData",value:function(t){p.log("INFO","bkgData = "+JSON.stringify(t)),this.backSpace(),this.setPen(t),this.insertChar(32)}},{key:"setRollUpRows",value:function(t){this.nrRollUpRows=t}},{key:"rollUp",value:function(){if(null===this.nrRollUpRows)return void p.log("DEBUG","roll_up but nrRollUpRows not set yet");p.log("TEXT",this.getDisplayText());var t=this.currRow+1-this.nrRollUpRows,e=this.rows.splice(t,1)[0];e.clear(),this.rows.splice(this.currRow,0,e),p.log("INFO","Rolling up")}},{key:"getDisplayText",value:function(t){t=t||!1;for(var e=[],n="",r=-1,i=0;i<s;i++){var o=this.rows[i].getTextString();o&&(r=i+1,t?e.push("Row "+r+": '"+o+"'"):e.push(o.trim()))}return e.length>0&&(n=t?"["+e.join(" | ")+"]":e.join("\n")),n}},{key:"getTextAndFormat",value:function(){return this.rows}}]),t}(),_=function(){function t(e,n){r(this,t),this.chNr=e,this.outputFilter=n,this.mode=null,this.verbose=0,this.displayedMemory=new b,this.nonDisplayedMemory=new b,this.lastOutputScreen=new b,this.currRollUpRow=this.displayedMemory.rows[s-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null}return i(t,[{key:"reset",value:function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.currRollUpRow=this.displayedMemory.rows[s-1],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.lastCueEndTime=null}},{key:"getHandler",value:function(){return this.outputFilter}},{key:"setHandler",value:function(t){this.outputFilter=t}},{key:"setPAC",value:function(t){this.writeScreen.setPAC(t)}},{key:"setBkgData",value:function(t){this.writeScreen.setBkgData(t)}},{key:"setMode",value:function(t){t!==this.mode&&(this.mode=t,p.log("INFO","MODE="+t),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=t)}},{key:"insertChars",value:function(t){for(var e=0;e<t.length;e++)this.writeScreen.insertChar(t[e]);var n=this.writeScreen===this.displayedMemory?"DISP":"NON_DISP";p.log("INFO",n+": "+this.writeScreen.getDisplayText(!0)),"MODE_PAINT-ON"!==this.mode&&"MODE_ROLL-UP"!==this.mode||(p.log("TEXT","DISPLAYED: "+this.displayedMemory.getDisplayText(!0)),this.outputDataUpdate())}},{key:"ccRCL",value:function(){p.log("INFO","RCL - Resume Caption Loading"),this.setMode("MODE_POP-ON")}},{key:"ccBS",value:function(){p.log("INFO","BS - BackSpace"),"MODE_TEXT"!==this.mode&&(this.writeScreen.backSpace(),this.writeScreen===this.displayedMemory&&this.outputDataUpdate())}},{key:"ccAOF",value:function(){}},{key:"ccAON",value:function(){}},{key:"ccDER",value:function(){p.log("INFO","DER- Delete to End of Row"),this.writeScreen.clearToEndOfRow(),this.outputDataUpdate()}},{key:"ccRU",value:function(t){p.log("INFO","RU("+t+") - Roll Up"),this.writeScreen=this.displayedMemory,this.setMode("MODE_ROLL-UP"),this.writeScreen.setRollUpRows(t)}},{key:"ccFON",value:function(){
+p.log("INFO","FON - Flash On"),this.writeScreen.setPen({flash:!0})}},{key:"ccRDC",value:function(){p.log("INFO","RDC - Resume Direct Captioning"),this.setMode("MODE_PAINT-ON")}},{key:"ccTR",value:function(){p.log("INFO","TR"),this.setMode("MODE_TEXT")}},{key:"ccRTD",value:function(){p.log("INFO","RTD"),this.setMode("MODE_TEXT")}},{key:"ccEDM",value:function(){p.log("INFO","EDM - Erase Displayed Memory"),this.displayedMemory.reset(),this.outputDataUpdate()}},{key:"ccCR",value:function(){p.log("CR - Carriage Return"),this.writeScreen.rollUp(),this.outputDataUpdate()}},{key:"ccENM",value:function(){p.log("INFO","ENM - Erase Non-displayed Memory"),this.nonDisplayedMemory.reset()}},{key:"ccEOC",value:function(){if(p.log("INFO","EOC - End Of Caption"),"MODE_POP-ON"===this.mode){var t=this.displayedMemory;this.displayedMemory=this.nonDisplayedMemory,this.nonDisplayedMemory=t,this.writeScreen=this.nonDisplayedMemory,p.log("TEXT","DISP: "+this.displayedMemory.getDisplayText())}this.outputDataUpdate()}},{key:"ccTO",value:function(t){p.log("INFO","TO("+t+") - Tab Offset"),this.writeScreen.moveCursor(t)}},{key:"ccMIDROW",value:function(t){var e={flash:!1};if(e.underline=t%2===1,e.italics=t>=46,e.italics)e.foreground="white";else{var n=Math.floor(t/2)-16,r=["white","green","blue","cyan","red","yellow","magenta"];e.foreground=r[n]}p.log("INFO","MIDROW: "+JSON.stringify(e)),this.writeScreen.setPen(e)}},{key:"outputDataUpdate",value:function(){var t=p.time;null!==t&&this.outputFilter&&(this.outputFilter.updateData&&this.outputFilter.updateData(t,this.displayedMemory),null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.lastOutputScreen),this.cueStartTime=this.displayedMemory.isEmpty()?null:t):this.cueStartTime=t,this.lastOutputScreen.copy(this.displayedMemory))}},{key:"cueSplitAtTime",value:function(t){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.displayedMemory),this.cueStartTime=t))}}]),t}(),E=function(){function t(e,n,i){r(this,t),this.field=e||1,this.outputs=[n,i],this.channels=[new _(1,n),new _(2,i)],this.currChNr=-1,this.lastCmdA=null,this.lastCmdB=null,this.bufferedData=[],this.startTime=null,this.lastTime=null,this.dataCounters={padding:0,char:0,cmd:0,other:0}}return i(t,[{key:"getHandler",value:function(t){return this.channels[t].getHandler()}},{key:"setHandler",value:function(t,e){this.channels[t].setHandler(e)}},{key:"addData",value:function(t,e){var n,r,i,o=!1;this.lastTime=t,p.setTime(t);for(var a=0;a<e.length;a+=2)if(r=127&e[a],i=127&e[a+1],0!==r||0!==i){if(p.log("DATA","["+y([e[a],e[a+1]])+"] -> ("+y([r,i])+")"),n=this.parseCmd(r,i),n||(n=this.parseMidrow(r,i)),n||(n=this.parsePAC(r,i)),n||(n=this.parseBackgroundAttributes(r,i)),!n&&(o=this.parseChars(r,i)))if(this.currChNr&&this.currChNr>=0){var s=this.channels[this.currChNr-1];s.insertChars(o)}else p.log("WARNING","No channel found yet. TEXT-MODE?");n?this.dataCounters.cmd+=2:o?this.dataCounters.char+=2:(this.dataCounters.other+=2,p.log("WARNING","Couldn't parse cleaned data "+y([r,i])+" orig: "+y([e[a],e[a+1]])))}else this.dataCounters.padding+=2}},{key:"parseCmd",value:function(t,e){var n=null,r=(20===t||28===t)&&32<=e&&e<=47,i=(23===t||31===t)&&33<=e&&e<=35;if(!r&&!i)return!1;if(t===this.lastCmdA&&e===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,p.log("DEBUG","Repeated command ("+y([t,e])+") is dropped"),!0;n=20===t||23===t?1:2;var o=this.channels[n-1];return 20===t||28===t?32===e?o.ccRCL():33===e?o.ccBS():34===e?o.ccAOF():35===e?o.ccAON():36===e?o.ccDER():37===e?o.ccRU(2):38===e?o.ccRU(3):39===e?o.ccRU(4):40===e?o.ccFON():41===e?o.ccRDC():42===e?o.ccTR():43===e?o.ccRTD():44===e?o.ccEDM():45===e?o.ccCR():46===e?o.ccENM():47===e&&o.ccEOC():o.ccTO(e-32),this.lastCmdA=t,this.lastCmdB=e,this.currChNr=n,!0}},{key:"parseMidrow",value:function(t,e){var n=null;if((17===t||25===t)&&32<=e&&e<=47){if(n=17===t?1:2,n!==this.currChNr)return p.log("ERROR","Mismatch channel in midrow parsing"),!1;var r=this.channels[n-1];return r.ccMIDROW(e),p.log("DEBUG","MIDROW ("+y([t,e])+")"),!0}return!1}},{key:"parsePAC",value:function(t,e){var n=null,r=null,i=(17<=t&&t<=23||25<=t&&t<=31)&&64<=e&&e<=127,o=(16===t||24===t)&&64<=e&&e<=95;if(!i&&!o)return!1;if(t===this.lastCmdA&&e===this.lastCmdB)return this.lastCmdA=null,this.lastCmdB=null,!0;n=t<=23?1:2,r=64<=e&&e<=95?1===n?u[t]:d[t]:1===n?c[t]:f[t];var a=this.interpretPAC(r,e),s=this.channels[n-1];return s.setPAC(a),this.lastCmdA=t,this.lastCmdB=e,this.currChNr=n,!0}},{key:"interpretPAC",value:function(t,e){var n=e,r={color:null,italics:!1,indent:null,underline:!1,row:t};return n=e>95?e-96:e-64,r.underline=1===(1&n),n<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(n/2)]:n<=15?(r.italics=!0,r.color="white"):r.indent=4*Math.floor((n-16)/2),r}},{key:"parseChars",value:function(t,e){var n=null,r=null,i=null;if(t>=25?(n=2,i=t-8):(n=1,i=t),17<=i&&i<=19){var o=e;o=17===i?e+80:18===i?e+112:e+144,p.log("INFO","Special char '"+a(o)+"' in channel "+n),r=[o]}else 32<=t&&t<=127&&(r=0===e?[t]:[t,e]);if(r){var s=y(r);p.log("DEBUG","Char codes =  "+s.join(",")),this.lastCmdA=null,this.lastCmdB=null}return r}},{key:"parseBackgroundAttributes",value:function(t,e){var n,r,i,o,a=(16===t||24===t)&&32<=e&&e<=47,s=(23===t||31===t)&&45<=e&&e<=47;return!(!a&&!s)&&(n={},16===t||24===t?(r=Math.floor((e-32)/2),n.background=h[r],e%2===1&&(n.background=n.background+"_semi")):45===e?n.background="transparent":(n.foreground="black",47===e&&(n.underline=!0)),i=t<24?1:2,o=this.channels[i-1],o.setBkgData(n),this.lastCmdA=null,this.lastCmdB=null,!0)}},{key:"reset",value:function(){for(var t=0;t<this.channels.length;t++)this.channels[t]&&this.channels[t].reset();this.lastCmdA=null,this.lastCmdB=null}},{key:"cueSplitAtTime",value:function(t){for(var e=0;e<this.channels.length;e++)this.channels[e]&&this.channels[e].cueSplitAtTime(t)}}]),t}();n.default=E},{}],41:[function(t,e,n){"use strict";var r={newCue:function(t,e,n,r){for(var i,o,a,s,l,u=window.VTTCue||window.TextTrackCue,c=0;c<r.rows.length;c++)if(i=r.rows[c],a=!0,s=0,l="",!i.isEmpty()){for(var d=0;d<i.chars.length;d++)i.chars[d].uchar.match(/\s/)&&a?s++:(l+=i.chars[d].uchar,a=!1);o=new u(e,n,l.trim()),s>=16?s--:s++,navigator.userAgent.match(/Firefox\//)?o.line=c+1:o.line=c>7?c-2:c+1,o.align="left",o.position=100*(s/32)+(navigator.userAgent.match(/Firefox\//)?50:0),t.addCue(o)}}};e.exports=r},{}],42:[function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=function(){function t(e){r(this,t),this.alpha_=e?Math.exp(Math.log(.5)/e):0,this.estimate_=0,this.totalWeight_=0}return i(t,[{key:"sample",value:function(t,e){var n=Math.pow(this.alpha_,t);this.estimate_=e*(1-n)+n*this.estimate_,this.totalWeight_+=t}},{key:"getTotalWeight",value:function(){return this.totalWeight_}},{key:"getEstimate",value:function(){if(this.alpha_){var t=1-Math.pow(this.alpha_,this.totalWeight_);return this.estimate_/t}return this.estimate_}}]),t}();n.default=o},{}],43:[function(t,e,n){"use strict";function r(){}function i(t,e){return e="["+t+"] > "+e}function o(t){var e=self.console[t];return e?function(){for(var n=arguments.length,r=Array(n),o=0;o<n;o++)r[o]=arguments[o];r[0]&&(r[0]=i(t,r[0])),e.apply(self.console,r)}:r}function a(t){for(var e=arguments.length,n=Array(e>1?e-1:0),r=1;r<e;r++)n[r-1]=arguments[r];n.forEach(function(e){u[e]=t[e]?t[e].bind(t):o(e)})}Object.defineProperty(n,"__esModule",{value:!0});var s="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol?"symbol":typeof t},l={trace:r,debug:r,log:r,warn:r,info:r,error:r},u=l;n.enableLogs=function(t){if(t===!0||"object"===("undefined"==typeof t?"undefined":s(t))){a(t,"debug","log","info","warn","error");try{u.log()}catch(t){u=l}}else u=l},n.logger=u},{}],44:[function(t,e,n){"use strict";"undefined"==typeof ArrayBuffer||ArrayBuffer.prototype.slice||(ArrayBuffer.prototype.slice=function(t,e){var n=new Uint8Array(this);void 0===e&&(e=n.length);for(var r=new ArrayBuffer(e-t),i=new Uint8Array(r),o=0;o<i.length;o++)i[o]=n[o+t];return r})},{}],45:[function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=function(){function t(){r(this,t)}return i(t,null,[{key:"toString",value:function(t){for(var e="",n=t.length,r=0;r<n;r++)e+="["+t.start(r).toFixed(3)+","+t.end(r).toFixed(3)+"]";return e}}]),t}();n.default=o},{}],46:[function(t,e,n){"use strict";var r={buildAbsoluteURL:function(t,e){if(e=e.trim(),/^[a-z]+:/i.test(e))return e;var n=null,i=null,o=/^([^#]*)(.*)$/.exec(e);o&&(i=o[2],e=o[1]);var a=/^([^\?]*)(.*)$/.exec(e);a&&(n=a[2],e=a[1]);var s=/^([^#]*)(.*)$/.exec(t);s&&(t=s[1]);var l=/^([^\?]*)(.*)$/.exec(t);l&&(t=l[1]);var u=/^(([a-z]+:)?\/\/[a-z0-9\.\-_~]+(:[0-9]+)?)?(\/.*)$/i.exec(t);if(!u)throw new Error("Error trying to parse base URL.");var c=u[2]||"",d=u[1]||"",f=u[4],h=null;return h=/^\/\//.test(e)?c+"//"+r.buildAbsolutePath("",e.substring(2)):/^\//.test(e)?d+"/"+r.buildAbsolutePath("",e.substring(1)):r.buildAbsolutePath(d+f,e),n&&(h+=n),i&&(h+=i),h},buildAbsolutePath:function(t,e){for(var n,r,i=e,o="",a=t.replace(/[^\/]*$/,i.replace(/(\/|^)(?:\.?\/+)+/g,"$1")),s=0;r=a.indexOf("/../",s),r>-1;s=r+n)n=/^\/(?:\.\.\/)*/.exec(a.slice(r))[0].length,o=(o+a.substring(s,r)).replace(new RegExp("(?:\\/+[^\\/]*){0,"+(n-1)/3+"}$"),"/");return o+a.substr(s)}};e.exports=r},{}],47:[function(t,e,n){"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(n,"__esModule",{value:!0});var i=function(){function t(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}return function(e,n,r){return n&&t(e.prototype,n),r&&t(e,r),e}}(),o=t(43),a=function(){function t(e){r(this,t),e&&e.xhrSetup&&(this.xhrSetup=e.xhrSetup)}return i(t,[{key:"destroy",value:function(){this.abort(),this.loader=null}},{key:"abort",value:function(){var t=this.loader;t&&4!==t.readyState&&(this.stats.aborted=!0,t.abort()),window.clearTimeout(this.requestTimeout),this.requestTimeout=null,window.clearTimeout(this.retryTimeout),this.retryTimeout=null}},{key:"load",value:function(t,e,n){this.context=t,this.config=e,this.callbacks=n,this.stats={trequest:performance.now(),retry:0},this.retryDelay=e.retryDelay,this.loadInternal()}},{key:"loadInternal",value:function(){var t,e=this.context;t="undefined"!=typeof XDomainRequest?this.loader=new XDomainRequest:this.loader=new XMLHttpRequest,t.onreadystatechange=this.readystatechange.bind(this),t.onprogress=this.loadprogress.bind(this),t.open("GET",e.url,!0),e.rangeEnd&&t.setRequestHeader("Range","bytes="+e.rangeStart+"-"+(e.rangeEnd-1)),t.responseType=e.responseType;var n=this.stats;n.tfirst=0,n.loaded=0,this.xhrSetup&&this.xhrSetup(t,e.url),this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),this.config.timeout),t.send()}},{key:"readystatechange",value:function(t){var e=t.currentTarget,n=e.readyState,r=this.stats,i=this.context,a=this.config;if(!r.aborted&&(window.clearTimeout(this.requestTimeout),n>=2&&(0===r.tfirst&&(r.tfirst=Math.max(performance.now(),r.trequest),this.requestTimeout=window.setTimeout(this.loadtimeout.bind(this),a.timeout-(r.tfirst-r.trequest))),4===n))){var s=e.status;if(s>=200&&s<300){r.tload=Math.max(r.tfirst,performance.now());var l=void 0,u=void 0;"arraybuffer"===i.responseType?(l=e.response,u=l.byteLength):(l=e.responseText,u=l.length),r.loaded=r.total=u;var c={url:e.responseURL,data:l};this.callbacks.onSuccess(c,r,i)}else r.retry>=a.maxRetry||s>=400&&s<499?(o.logger.error(s+" while loading "+i.url),this.callbacks.onError({code:s,text:e.statusText},i)):(o.logger.warn(s+" while loading "+i.url+", retrying in "+this.retryDelay+"..."),this.destroy(),this.retryTimeout=window.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,a.maxRetryDelay),r.retry++)}}},{key:"loadtimeout",value:function(){o.logger.warn("timeout while loading "+this.context.url),this.callbacks.onTimeout(this.stats,this.context)}},{key:"loadprogress",value:function(t){var e=this.stats;e.loaded=t.loaded,t.lengthComputable&&(e.total=t.total);var n=this.callbacks.onProgress;n&&n(e,this.context,null)}}]),t}();n.default=a},{43:43}]},{},[31])(31)})},function(t,e){t.exports='<div class="media-control-background" data-background></div>\n<div class="media-control-layer" data-controls>\n  <%  var renderBar = function(name) { %>\n      <div class="bar-container" data-<%= name %>>\n        <div class="bar-background" data-<%= name %>>\n          <div class="bar-fill-1" data-<%= name %>></div>\n          <div class="bar-fill-2" data-<%= name %>></div>\n          <div class="bar-hover" data-<%= name %>></div>\n        </div>\n        <div class="bar-scrubber" data-<%= name %>>\n          <div class="bar-scrubber-icon" data-<%= name %>></div>\n        </div>\n      </div>\n  <%  }; %>\n  <%  var renderSegmentedBar = function(name, segments) {\n      segments = segments || 10; %>\n    <div class="bar-container" data-<%= name %>>\n    <% for (var i = 0; i < segments; i++) { %>\n      <div class="segmented-bar-element" data-<%= name %>></div>\n    <% } %>\n    </div>\n  <% }; %>\n  <% var renderDrawer = function(name, renderContent) { %>\n      <div class="drawer-container" data-<%= name %>>\n        <div class="drawer-icon-container" data-<%= name %>>\n          <div class="drawer-icon media-control-icon" data-<%= name %>></div>\n          <span class="drawer-text" data-<%= name %>></span>\n        </div>\n        <% renderContent(name); %>\n      </div>\n  <% }; %>\n  <% var renderIndicator = function(name) { %>\n      <div class="media-control-indicator" data-<%= name %>></div>\n  <% }; %>\n  <% var renderButton = function(name) { %>\n      <button type="button" class="media-control-button media-control-icon" data-<%= name %>></button>\n  <% }; %>\n  <%  var templates = {\n        bar: renderBar,\n        segmentedBar: renderSegmentedBar,\n      };\n      var render = function(settingsList) {\n        settingsList.forEach(function(setting) {\n          if(setting === "seekbar") {\n            renderBar(setting);\n          } else if (setting === "volume") {\n            renderDrawer(setting, settings.volumeBarTemplate ? templates[settings.volumeBarTemplate] : function(name) { return renderSegmentedBar(name); });\n          } else if (setting === "duration" || setting === "position") {\n            renderIndicator(setting);\n          } else {\n            renderButton(setting);\n          }\n        });\n      }; %>\n  <% if (settings.default && settings.default.length) { %>\n  <div class="media-control-center-panel" data-media-control>\n    <% render(settings.default); %>\n  </div>\n  <% } %>\n  <% if (settings.left && settings.left.length) { %>\n  <div class="media-control-left-panel" data-media-control>\n    <% render(settings.left); %>\n  </div>\n  <% } %>\n  <% if (settings.right && settings.right.length) { %>\n  <div class="media-control-right-panel" data-media-control>\n    <% render(settings.right); %>\n  </div>\n  <% } %>\n</div>\n'},function(t,e){t.exports='<param name="movie" value="<%= swfPath %>?inline=1">\n<param name="quality" value="autohigh">\n<param name="swliveconnect" value="true">\n<param name="allowScriptAccess" value="always">\n<param name="bgcolor" value="#000000">\n<param name="allowFullScreen" value="false">\n<param name="wmode" value="<%= wmode %>">\n<param name="tabindex" value="1">\n<param name="FlashVars" value="playbackId=<%= playbackId %>&callback=<%= callbackName %>">\n<embed\n  name="<%= cid %>"\n  type="application/x-shockwave-flash"\n  disabled="disabled"\n  tabindex="-1"\n  enablecontextmenu="false"\n  allowScriptAccess="always"\n  quality="autohigh"\n  pluginspage="http://www.macromedia.com/go/getflashplayer"\n  wmode="<%= wmode %>"\n  swliveconnect="true"\n  allowfullscreen="false"\n  bgcolor="#000000"\n  FlashVars="playbackId=<%= playbackId %>&callback=<%= callbackName %>"\n  src="<%= swfPath %>"\n  width="100%"\n  height="100%">\n</embed>\n'},function(t,e){t.exports="<canvas data-no-op-canvas></canvas>\n<p data-no-op-msg><%=message%><p>\n"},function(t,e){t.exports='<div class="live-info"><%= live %></div>\n<button type="button" class="live-button"><%= backToLive %></button>\n'},function(t,e){t.exports='<div class="play-wrapper" data-poster></div>\n'},function(t,e){t.exports="<span data-seek-time></span>\n<span data-duration></span>\n"},function(t,e){t.exports="<div data-bounce1></div><div data-bounce2></div><div data-bounce3></div>\n"},function(t,e){t.exports="<div data-watermark data-watermark-<%=position %>>\n<% if(typeof imageLink !== 'undefined') { %>\n<a target=_blank href=\"<%= imageLink %>\">\n<% } %>\n<img src=\"<%= imageUrl %>\">\n<% if(typeof imageLink !== 'undefined') { %>\n</a>\n<% } %>\n</div>\n"},function(t,e,n){(function(t,n){function r(t,e){for(var n=-1,r=t?t.length:0;++n<r;)if(e(t[n],n,t))return!0;return!1}function i(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function o(t){return function(e){return t(e)}}function a(t,e){return null==t?void 0:t[e]}function s(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function l(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function u(t,e){return function(n){return t(e(n))}}function c(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function d(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function f(){this.__data__=Te?Te(null):{}}function h(t){return this.has(t)&&delete this.__data__[t]}function p(t){var e=this.__data__;if(Te){var n=e[t];return n===ht?void 0:n}return ue.call(e,t)?e[t]:void 0}function y(t){var e=this.__data__;return Te?void 0!==e[t]:ue.call(e,t)}function g(t,e){var n=this.__data__;return n[t]=Te&&void 0===e?ht:e,this}function v(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function m(){this.__data__=[]}function b(t){var e=this.__data__,n=U(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():ye.call(e,n,1),!0}function _(t){var e=this.__data__,n=U(e,t);return n<0?void 0:e[n][1]}function E(t){return U(this.__data__,t)>-1}function T(t,e){var n=this.__data__,r=U(n,t);return r<0?n.push([t,e]):n[r][1]=e,this}function A(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function k(){this.__data__={hash:new d,map:new(me||v),string:new d}}function w(t){return q(this,t).delete(t)}function S(t){return q(this,t).get(t)}function L(t){return q(this,t).has(t)}function R(t,e){return q(this,t).set(t,e),this}function O(t){var e=-1,n=t?t.length:0;for(this.__data__=new A;++e<n;)this.add(t[e])}function C(t){return this.__data__.set(t,ht),this}function P(t){return this.__data__.has(t)}function D(t){this.__data__=new v(t)}function I(){this.__data__=new v}function x(t){return this.__data__.delete(t)}function N(t){return this.__data__.get(t)}function M(t){return this.__data__.has(t)}function F(t,e){var n=this.__data__;if(n instanceof v){var r=n.__data__;if(!me||r.length<ft-1)return r.push([t,e]),this;n=this.__data__=new A(r)}return n.set(t,e),this}function B(t,e){var n=Pe(t)||rt(t)?i(t.length,String):[],r=n.length,o=!!r;for(var a in t)!e&&!ue.call(t,a)||o&&("length"==a||Z(a,r))||n.push(a);return n}function U(t,e){for(var n=t.length;n--;)if(nt(t[n][0],e))return n;return-1}function j(t){return ce.call(t)}function G(t,e,n,r,i){return t===e||(null==t||null==e||!ut(t)&&!ct(e)?t!==t&&e!==e:Y(t,e,G,n,r,i))}function Y(t,e,n,r,i,o){var a=Pe(t),l=Pe(e),u=mt,c=mt;a||(u=Ce(t),u=u==vt?St:u),l||(c=Ce(e),c=c==vt?St:c);var d=u==St&&!s(t),f=c==St&&!s(e),h=u==c;if(h&&!d)return o||(o=new D),a||De(t)?H(t,e,n,r,i,o):z(t,e,u,n,r,i,o);if(!(i&yt)){var p=d&&ue.call(t,"__wrapped__"),y=f&&ue.call(e,"__wrapped__");if(p||y){var g=p?t.value():t,v=y?e.value():e;return o||(o=new D),n(g,v,r,i,o)}}return!!h&&(o||(o=new D),W(t,e,n,r,i,o))}function V(t){if(!ut(t)||Q(t))return!1;var e=st(t)||s(t)?de:$t;return e.test(et(t))}function K(t){return ct(t)&&lt(t.length)&&!!zt[ce.call(t)]}function $(t){if(!tt(t))return ge(t);var e=[];for(var n in Object(t))ue.call(t,n)&&"constructor"!=n&&e.push(n);return e}function H(t,e,n,i,o,a){var s=o&yt,l=t.length,u=e.length;if(l!=u&&!(s&&u>l))return!1;var c=a.get(t);if(c&&a.get(e))return c==e;var d=-1,f=!0,h=o&pt?new O:void 0;for(a.set(t,e),a.set(e,t);++d<l;){var p=t[d],y=e[d];if(i)var g=s?i(y,p,d,e,t,a):i(p,y,d,t,e,a);if(void 0!==g){if(g)continue;f=!1;break}if(h){if(!r(e,function(t,e){if(!h.has(e)&&(p===t||n(p,t,i,o,a)))return h.add(e)})){f=!1;break}}else if(p!==y&&!n(p,y,i,o,a)){f=!1;break}}return a.delete(t),a.delete(e),f}function z(t,e,n,r,i,o,a){switch(n){case xt:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case It:return!(t.byteLength!=e.byteLength||!r(new he(t),new he(e)));case bt:case _t:case wt:return nt(+t,+e);case Et:return t.name==e.name&&t.message==e.message;case Rt:case Ct:return t==e+"";case kt:var s=l;case Ot:var u=o&yt;if(s||(s=c),t.size!=e.size&&!u)return!1;var d=a.get(t);if(d)return d==e;o|=pt,a.set(t,e);var f=H(s(t),s(e),r,i,o,a);return a.delete(t),f;case Pt:if(Oe)return Oe.call(t)==Oe.call(e)}return!1}function W(t,e,n,r,i,o){var a=i&yt,s=dt(t),l=s.length,u=dt(e),c=u.length;if(l!=c&&!a)return!1;for(var d=l;d--;){var f=s[d];if(!(a?f in e:ue.call(e,f)))return!1}var h=o.get(t);if(h&&o.get(e))return h==e;var p=!0;o.set(t,e),o.set(e,t);for(var y=a;++d<l;){f=s[d];var g=t[f],v=e[f];if(r)var m=a?r(v,g,f,e,t,o):r(g,v,f,t,e,o);if(!(void 0===m?g===v||n(g,v,r,i,o):m)){p=!1;break}y||(y="constructor"==f)}if(p&&!y){var b=t.constructor,_=e.constructor;b!=_&&"constructor"in t&&"constructor"in e&&!("function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _)&&(p=!1)}return o.delete(t),o.delete(e),p}function q(t,e){var n=t.__data__;return J(e)?n["string"==typeof e?"string":"hash"]:n.map}function X(t,e){var n=a(t,e);return V(n)?n:void 0}function Z(t,e){return e=null==e?gt:e,!!e&&("number"==typeof t||Ht.test(t))&&t>-1&&t%1==0&&t<e}function J(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function Q(t){return!!se&&se in t}function tt(t){var e=t&&t.constructor,n="function"==typeof e&&e.prototype||oe;return t===n}function et(t){if(null!=t){try{return le.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function nt(t,e){return t===e||t!==t&&e!==e}function rt(t){return ot(t)&&ue.call(t,"callee")&&(!pe.call(t,"callee")||ce.call(t)==vt)}function it(t){return null!=t&&lt(t.length)&&!st(t)}function ot(t){return ct(t)&&it(t)}function at(t,e){return G(t,e)}function st(t){var e=ut(t)?ce.call(t):"";return e==Tt||e==At}function lt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=gt}function ut(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function ct(t){return!!t&&"object"==typeof t}function dt(t){return it(t)?B(t):$(t)}var ft=200,ht="__lodash_hash_undefined__",pt=1,yt=2,gt=9007199254740991,vt="[object Arguments]",mt="[object Array]",bt="[object Boolean]",_t="[object Date]",Et="[object Error]",Tt="[object Function]",At="[object GeneratorFunction]",kt="[object Map]",wt="[object Number]",St="[object Object]",Lt="[object Promise]",Rt="[object RegExp]",Ot="[object Set]",Ct="[object String]",Pt="[object Symbol]",Dt="[object WeakMap]",It="[object ArrayBuffer]",xt="[object DataView]",Nt="[object Float32Array]",Mt="[object Float64Array]",Ft="[object Int8Array]",Bt="[object Int16Array]",Ut="[object Int32Array]",jt="[object Uint8Array]",Gt="[object Uint8ClampedArray]",Yt="[object Uint16Array]",Vt="[object Uint32Array]",Kt=/[\\^$.*+?()[\]{}|]/g,$t=/^\[object .+?Constructor\]$/,Ht=/^(?:0|[1-9]\d*)$/,zt={};zt[Nt]=zt[Mt]=zt[Ft]=zt[Bt]=zt[Ut]=zt[jt]=zt[Gt]=zt[Yt]=zt[Vt]=!0,zt[vt]=zt[mt]=zt[It]=zt[bt]=zt[xt]=zt[_t]=zt[Et]=zt[Tt]=zt[kt]=zt[wt]=zt[St]=zt[Rt]=zt[Ot]=zt[Ct]=zt[Dt]=!1;var Wt="object"==typeof t&&t&&t.Object===Object&&t,qt="object"==typeof self&&self&&self.Object===Object&&self,Xt=Wt||qt||Function("return this")(),Zt="object"==typeof e&&e&&!e.nodeType&&e,Jt=Zt&&"object"==typeof n&&n&&!n.nodeType&&n,Qt=Jt&&Jt.exports===Zt,te=Qt&&Wt.process,ee=function(){try{return te&&te.binding("util")}catch(t){}}(),ne=ee&&ee.isTypedArray,re=Array.prototype,ie=Function.prototype,oe=Object.prototype,ae=Xt["__core-js_shared__"],se=function(){var t=/[^.]+$/.exec(ae&&ae.keys&&ae.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),le=ie.toString,ue=oe.hasOwnProperty,ce=oe.toString,de=RegExp("^"+le.call(ue).replace(Kt,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),fe=Xt.Symbol,he=Xt.Uint8Array,pe=oe.propertyIsEnumerable,ye=re.splice,ge=u(Object.keys,Object),ve=X(Xt,"DataView"),me=X(Xt,"Map"),be=X(Xt,"Promise"),_e=X(Xt,"Set"),Ee=X(Xt,"WeakMap"),Te=X(Object,"create"),Ae=et(ve),ke=et(me),we=et(be),Se=et(_e),Le=et(Ee),Re=fe?fe.prototype:void 0,Oe=Re?Re.valueOf:void 0;d.prototype.clear=f,d.prototype.delete=h,d.prototype.get=p,d.prototype.has=y,d.prototype.set=g,v.prototype.clear=m,v.prototype.delete=b,v.prototype.get=_,v.prototype.has=E,v.prototype.set=T,A.prototype.clear=k,A.prototype.delete=w,A.prototype.get=S,A.prototype.has=L,A.prototype.set=R,O.prototype.add=O.prototype.push=C,O.prototype.has=P,D.prototype.clear=I,D.prototype.delete=x,D.prototype.get=N,D.prototype.has=M,D.prototype.set=F;var Ce=j;(ve&&Ce(new ve(new ArrayBuffer(1)))!=xt||me&&Ce(new me)!=kt||be&&Ce(be.resolve())!=Lt||_e&&Ce(new _e)!=Ot||Ee&&Ce(new Ee)!=Dt)&&(Ce=function(t){var e=ce.call(t),n=e==St?t.constructor:void 0,r=n?et(n):void 0;if(r)switch(r){case Ae:return xt;case ke:return kt;case we:return Lt;case Se:return Ot;case Le:return Dt}return e});var Pe=Array.isArray,De=ne?o(ne):K;n.exports=at}).call(e,function(){return this}(),n(23)(t))},function(t,e){function n(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function r(t,e){return function(n){return t(e(n))}}function i(t){return!!t&&"object"==typeof t}function o(t){if(!i(t)||f.call(t)!=a||n(t))return!1;var e=h(t);if(null===e)return!0;var r=c.call(e,"constructor")&&e.constructor;return"function"==typeof r&&r instanceof r&&u.call(r)==d}var a="[object Object]",s=Function.prototype,l=Object.prototype,u=s.toString,c=l.hasOwnProperty,d=u.call(Object),f=l.toString,h=r(Object.getPrototypeOf,Object);t.exports=o},function(t,e){function n(t,e){var n;if("function"!=typeof e)throw new TypeError(c);return t=l(t),function(){return--t>0&&(n=e.apply(this,arguments)),t<=1&&(e=void 0),n}}function r(t){return n(2,t)}function i(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function o(t){return!!t&&"object"==typeof t}function a(t){return"symbol"==typeof t||o(t)&&E.call(t)==p}function s(t){if(!t)return 0===t?t:0;if(t=u(t),t===d||t===-d){var e=t<0?-1:1;return e*f}return t===t?t:0}function l(t){var e=s(t),n=e%1;return e===e?n?e-n:e:0}function u(t){if("number"==typeof t)return t;if(a(t))return h;if(i(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=i(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=t.replace(y,"");var n=v.test(t);return n||m.test(t)?b(t.slice(2),n?2:8):g.test(t)?h:+t}var c="Expected a function",d=1/0,f=1.7976931348623157e308,h=NaN,p="[object Symbol]",y=/^\s+|\s+$/g,g=/^[-+]0x[0-9a-f]+$/i,v=/^0b[01]+$/i,m=/^0o[0-7]+$/i,b=parseInt,_=Object.prototype,E=_.toString;t.exports=r},function(t,e){(function(e){function n(t,e){return null==t?void 0:t[e]}function r(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function i(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function o(){this.__data__=yt?yt(null):{}}function a(t){return this.has(t)&&delete this.__data__[t]}function s(t){var e=this.__data__;if(yt){var n=e[t];return n===Y?void 0:n}return ut.call(e,t)?e[t]:void 0}function l(t){var e=this.__data__;return yt?void 0!==e[t]:ut.call(e,t)}function u(t,e){var n=this.__data__;return n[t]=yt&&void 0===e?Y:e,this}function c(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function d(){this.__data__=[]}function f(t){var e=this.__data__,n=T(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():ht.call(e,n,1),!0}function h(t){var e=this.__data__,n=T(e,t);return n<0?void 0:e[n][1]}function p(t){return T(this.__data__,t)>-1}function y(t,e){var n=this.__data__,r=T(n,t);return r<0?n.push([t,e]):n[r][1]=e,this}function g(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function v(){this.__data__={hash:new i,map:new(pt||c),string:new i}}function m(t){return S(this,t).delete(t)}function b(t){return S(this,t).get(t)}function _(t){return S(this,t).has(t)}function E(t,e){return S(this,t).set(t,e),this}function T(t,e){for(var n=t.length;n--;)if(x(t[n][0],e))return n;return-1}function A(t){if(!M(t)||C(t))return!1;var e=N(t)||r(t)?dt:Q;return e.test(D(t))}function k(t){if("string"==typeof t)return t;if(B(t))return vt?vt.call(t):"";var e=t+"";return"0"==e&&1/t==-V?"-0":e}function w(t){return bt(t)?t:mt(t)}function S(t,e){var n=t.__data__;return O(e)?n["string"==typeof e?"string":"hash"]:n.map}function L(t,e){var r=n(t,e);return A(r)?r:void 0}function R(t,e){if(bt(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!B(t))||(W.test(t)||!z.test(t)||null!=e&&t in Object(e))}function O(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function C(t){return!!st&&st in t}function P(t){if("string"==typeof t||B(t))return t;var e=t+"";return"0"==e&&1/t==-V?"-0":e}function D(t){if(null!=t){try{return lt.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function I(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError(G);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a),a};return n.cache=new(I.Cache||g),n}function x(t,e){return t===e||t!==t&&e!==e}function N(t){var e=M(t)?ct.call(t):"";return e==K||e==$}function M(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function F(t){return!!t&&"object"==typeof t}function B(t){return"symbol"==typeof t||F(t)&&ct.call(t)==H}function U(t){return null==t?"":k(t)}function j(t,e,n){e=R(e,t)?[e]:w(e);var r=-1,i=e.length;for(i||(t=void 0,i=1);++r<i;){var o=null==t?void 0:t[P(e[r])];void 0===o&&(r=i,o=n),t=N(o)?o.call(t):o}return t}var G="Expected a function",Y="__lodash_hash_undefined__",V=1/0,K="[object Function]",$="[object GeneratorFunction]",H="[object Symbol]",z=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,W=/^\w*$/,q=/^\./,X=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Z=/[\\^$.*+?()[\]{}|]/g,J=/\\(\\)?/g,Q=/^\[object .+?Constructor\]$/,tt="object"==typeof e&&e&&e.Object===Object&&e,et="object"==typeof self&&self&&self.Object===Object&&self,nt=tt||et||Function("return this")(),rt=Array.prototype,it=Function.prototype,ot=Object.prototype,at=nt["__core-js_shared__"],st=function(){var t=/[^.]+$/.exec(at&&at.keys&&at.keys.IE_PROTO||"");
+return t?"Symbol(src)_1."+t:""}(),lt=it.toString,ut=ot.hasOwnProperty,ct=ot.toString,dt=RegExp("^"+lt.call(ut).replace(Z,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ft=nt.Symbol,ht=rt.splice,pt=L(nt,"Map"),yt=L(Object,"create"),gt=ft?ft.prototype:void 0,vt=gt?gt.toString:void 0;i.prototype.clear=o,i.prototype.delete=a,i.prototype.get=s,i.prototype.has=l,i.prototype.set=u,c.prototype.clear=d,c.prototype.delete=f,c.prototype.get=h,c.prototype.has=p,c.prototype.set=y,g.prototype.clear=v,g.prototype.delete=m,g.prototype.get=b,g.prototype.has=_,g.prototype.set=E;var mt=I(function(t){t=U(t);var e=[];return q.test(t)&&e.push(""),t.replace(X,function(t,n,r,i){e.push(r?i.replace(J,"$1"):n||t)}),e});I.Cache=g;var bt=Array.isArray;t.exports=j}).call(e,function(){return this}())},function(t,e,n){(function(t,n){function r(t,e){var n=t?t.length:0;return!!n&&s(t,e,0)>-1}function i(t,e,n){for(var r=-1,i=t?t.length:0;++r<i;)if(n(e,t[r]))return!0;return!1}function o(t,e){for(var n=-1,r=t?t.length:0;++n<r;)if(e(t[n],n,t))return!0;return!1}function a(t,e,n,r){for(var i=t.length,o=n+(r?1:-1);r?o--:++o<i;)if(e(t[o],o,t))return o;return-1}function s(t,e,n){if(e!==e)return a(t,l,n);for(var r=n-1,i=t.length;++r<i;)if(t[r]===e)return r;return-1}function l(t){return t!==t}function u(t){return function(e){return null==e?void 0:e[t]}}function c(t,e){for(var n=-1,r=Array(t);++n<t;)r[n]=e(n);return r}function d(t){return function(e){return t(e)}}function f(t,e){return t.has(e)}function h(t,e){return null==t?void 0:t[e]}function p(t){var e=!1;if(null!=t&&"function"!=typeof t.toString)try{e=!!(t+"")}catch(t){}return e}function y(t){var e=-1,n=Array(t.size);return t.forEach(function(t,r){n[++e]=[r,t]}),n}function g(t,e){return function(n){return t(e(n))}}function v(t){var e=-1,n=Array(t.size);return t.forEach(function(t){n[++e]=t}),n}function m(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function b(){this.__data__=sn?sn(null):{}}function _(t){return this.has(t)&&delete this.__data__[t]}function E(t){var e=this.__data__;if(sn){var n=e[t];return n===$t?void 0:n}return ze.call(e,t)?e[t]:void 0}function T(t){var e=this.__data__;return sn?void 0!==e[t]:ze.call(e,t)}function A(t,e){var n=this.__data__;return n[t]=sn&&void 0===e?$t:e,this}function k(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function w(){this.__data__=[]}function S(t){var e=this.__data__,n=H(e,t);if(n<0)return!1;var r=e.length-1;return n==r?e.pop():Qe.call(e,n,1),!0}function L(t){var e=this.__data__,n=H(e,t);return n<0?void 0:e[n][1]}function R(t){return H(this.__data__,t)>-1}function O(t,e){var n=this.__data__,r=H(n,t);return r<0?n.push([t,e]):n[r][1]=e,this}function C(t){var e=-1,n=t?t.length:0;for(this.clear();++e<n;){var r=t[e];this.set(r[0],r[1])}}function P(){this.__data__={hash:new m,map:new(nn||k),string:new m}}function D(t){return ft(this,t).delete(t)}function I(t){return ft(this,t).get(t)}function x(t){return ft(this,t).has(t)}function N(t,e){return ft(this,t).set(t,e),this}function M(t){var e=-1,n=t?t.length:0;for(this.__data__=new C;++e<n;)this.add(t[e])}function F(t){return this.__data__.set(t,$t),this}function B(t){return this.__data__.has(t)}function U(t){this.__data__=new k(t)}function j(){this.__data__=new k}function G(t){return this.__data__.delete(t)}function Y(t){return this.__data__.get(t)}function V(t){return this.__data__.has(t)}function K(t,e){var n=this.__data__;if(n instanceof k){var r=n.__data__;if(!nn||r.length<Vt-1)return r.push([t,e]),this;n=this.__data__=new C(r)}return n.set(t,e),this}function $(t,e){var n=bn(t)||Rt(t)?c(t.length,String):[],r=n.length,i=!!r;for(var o in t)!e&&!ze.call(t,o)||i&&("length"==o||gt(o,r))||n.push(o);return n}function H(t,e){for(var n=t.length;n--;)if(Lt(t[n][0],e))return n;return-1}function z(t,e){e=vt(e,t)?[e]:lt(e);for(var n=0,r=e.length;null!=t&&n<r;)t=t[At(e[n++])];return n&&n==r?t:void 0}function W(t){return We.call(t)}function q(t,e){return null!=t&&e in Object(t)}function X(t,e,n,r,i){return t===e||(null==t||null==e||!It(t)&&!xt(e)?t!==t&&e!==e:Z(t,e,X,n,r,i))}function Z(t,e,n,r,i,o){var a=bn(t),s=bn(e),l=Zt,u=Zt;a||(l=vn(t),l=l==Xt?oe:l),s||(u=vn(e),u=u==Xt?oe:u);var c=l==oe&&!p(t),d=u==oe&&!p(e),f=l==u;if(f&&!c)return o||(o=new U),a||_n(t)?ut(t,e,n,r,i,o):ct(t,e,l,n,r,i,o);if(!(i&zt)){var h=c&&ze.call(t,"__wrapped__"),y=d&&ze.call(e,"__wrapped__");if(h||y){var g=h?t.value():t,v=y?e.value():e;return o||(o=new U),n(g,v,r,i,o)}}return!!f&&(o||(o=new U),dt(t,e,n,r,i,o))}function J(t,e,n,r){var i=n.length,o=i,a=!r;if(null==t)return!o;for(t=Object(t);i--;){var s=n[i];if(a&&s[2]?s[1]!==t[s[0]]:!(s[0]in t))return!1}for(;++i<o;){s=n[i];var l=s[0],u=t[l],c=s[1];if(a&&s[2]){if(void 0===u&&!(l in t))return!1}else{var d=new U;if(r)var f=r(u,c,l,t,e,d);if(!(void 0===f?X(c,u,r,Ht|zt,d):f))return!1}}return!0}function Q(t){if(!It(t)||bt(t))return!1;var e=Pt(t)||p(t)?qe:Oe;return e.test(kt(t))}function tt(t){return xt(t)&&Dt(t.length)&&!!Pe[We.call(t)]}function et(t){return"function"==typeof t?t:null==t?jt:"object"==typeof t?bn(t)?it(t[0],t[1]):rt(t):Yt(t)}function nt(t){if(!_t(t))return tn(t);var e=[];for(var n in Object(t))ze.call(t,n)&&"constructor"!=n&&e.push(n);return e}function rt(t){var e=ht(t);return 1==e.length&&e[0][2]?Tt(e[0][0],e[0][1]):function(n){return n===t||J(n,t,e)}}function it(t,e){return vt(t)&&Et(e)?Tt(At(t),e):function(n){var r=Ft(n,t);return void 0===r&&r===e?Bt(n,t):X(e,r,void 0,Ht|zt)}}function ot(t){return function(e){return z(e,t)}}function at(t){if("string"==typeof t)return t;if(Nt(t))return yn?yn.call(t):"";var e=t+"";return"0"==e&&1/t==-Wt?"-0":e}function st(t,e,n){var o=-1,a=r,s=t.length,l=!0,u=[],c=u;if(n)l=!1,a=i;else if(s>=Vt){var d=e?null:gn(t);if(d)return v(d);l=!1,a=f,c=new M}else c=e?[]:u;t:for(;++o<s;){var h=t[o],p=e?e(h):h;if(h=n||0!==h?h:0,l&&p===p){for(var y=c.length;y--;)if(c[y]===p)continue t;e&&c.push(p),u.push(h)}else a(c,p,n)||(c!==u&&c.push(p),u.push(h))}return u}function lt(t){return bn(t)?t:mn(t)}function ut(t,e,n,r,i,a){var s=i&zt,l=t.length,u=e.length;if(l!=u&&!(s&&u>l))return!1;var c=a.get(t);if(c&&a.get(e))return c==e;var d=-1,f=!0,h=i&Ht?new M:void 0;for(a.set(t,e),a.set(e,t);++d<l;){var p=t[d],y=e[d];if(r)var g=s?r(y,p,d,e,t,a):r(p,y,d,t,e,a);if(void 0!==g){if(g)continue;f=!1;break}if(h){if(!o(e,function(t,e){if(!h.has(e)&&(p===t||n(p,t,r,i,a)))return h.add(e)})){f=!1;break}}else if(p!==y&&!n(p,y,r,i,a)){f=!1;break}}return a.delete(t),a.delete(e),f}function ct(t,e,n,r,i,o,a){switch(n){case he:if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case fe:return!(t.byteLength!=e.byteLength||!r(new Ze(t),new Ze(e)));case Jt:case Qt:case ie:return Lt(+t,+e);case te:return t.name==e.name&&t.message==e.message;case se:case ue:return t==e+"";case re:var s=y;case le:var l=o&zt;if(s||(s=v),t.size!=e.size&&!l)return!1;var u=a.get(t);if(u)return u==e;o|=Ht,a.set(t,e);var c=ut(s(t),s(e),r,i,o,a);return a.delete(t),c;case ce:if(pn)return pn.call(t)==pn.call(e)}return!1}function dt(t,e,n,r,i,o){var a=i&zt,s=Ut(t),l=s.length,u=Ut(e),c=u.length;if(l!=c&&!a)return!1;for(var d=l;d--;){var f=s[d];if(!(a?f in e:ze.call(e,f)))return!1}var h=o.get(t);if(h&&o.get(e))return h==e;var p=!0;o.set(t,e),o.set(e,t);for(var y=a;++d<l;){f=s[d];var g=t[f],v=e[f];if(r)var m=a?r(v,g,f,e,t,o):r(g,v,f,t,e,o);if(!(void 0===m?g===v||n(g,v,r,i,o):m)){p=!1;break}y||(y="constructor"==f)}if(p&&!y){var b=t.constructor,_=e.constructor;b!=_&&"constructor"in t&&"constructor"in e&&!("function"==typeof b&&b instanceof b&&"function"==typeof _&&_ instanceof _)&&(p=!1)}return o.delete(t),o.delete(e),p}function ft(t,e){var n=t.__data__;return mt(e)?n["string"==typeof e?"string":"hash"]:n.map}function ht(t){for(var e=Ut(t),n=e.length;n--;){var r=e[n],i=t[r];e[n]=[r,i,Et(i)]}return e}function pt(t,e){var n=h(t,e);return Q(n)?n:void 0}function yt(t,e,n){e=vt(e,t)?[e]:lt(e);for(var r,i=-1,o=e.length;++i<o;){var a=At(e[i]);if(!(r=null!=t&&n(t,a)))break;t=t[a]}if(r)return r;var o=t?t.length:0;return!!o&&Dt(o)&&gt(a,o)&&(bn(t)||Rt(t))}function gt(t,e){return e=null==e?qt:e,!!e&&("number"==typeof t||Ce.test(t))&&t>-1&&t%1==0&&t<e}function vt(t,e){if(bn(t))return!1;var n=typeof t;return!("number"!=n&&"symbol"!=n&&"boolean"!=n&&null!=t&&!Nt(t))||(ke.test(t)||!Ae.test(t)||null!=e&&t in Object(e))}function mt(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t}function bt(t){return!!$e&&$e in t}function _t(t){var e=t&&t.constructor,n="function"==typeof e&&e.prototype||Ve;return t===n}function Et(t){return t===t&&!It(t)}function Tt(t,e){return function(n){return null!=n&&(n[t]===e&&(void 0!==e||t in Object(n)))}}function At(t){if("string"==typeof t||Nt(t))return t;var e=t+"";return"0"==e&&1/t==-Wt?"-0":e}function kt(t){if(null!=t){try{return He.call(t)}catch(t){}try{return t+""}catch(t){}}return""}function wt(t,e){return t&&t.length?st(t,et(e,2)):[]}function St(t,e){if("function"!=typeof t||e&&"function"!=typeof e)throw new TypeError(Kt);var n=function(){var r=arguments,i=e?e.apply(this,r):r[0],o=n.cache;if(o.has(i))return o.get(i);var a=t.apply(this,r);return n.cache=o.set(i,a),a};return n.cache=new(St.Cache||C),n}function Lt(t,e){return t===e||t!==t&&e!==e}function Rt(t){return Ct(t)&&ze.call(t,"callee")&&(!Je.call(t,"callee")||We.call(t)==Xt)}function Ot(t){return null!=t&&Dt(t.length)&&!Pt(t)}function Ct(t){return xt(t)&&Ot(t)}function Pt(t){var e=It(t)?We.call(t):"";return e==ee||e==ne}function Dt(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=qt}function It(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function xt(t){return!!t&&"object"==typeof t}function Nt(t){return"symbol"==typeof t||xt(t)&&We.call(t)==ce}function Mt(t){return null==t?"":at(t)}function Ft(t,e,n){var r=null==t?void 0:z(t,e);return void 0===r?n:r}function Bt(t,e){return null!=t&&yt(t,e,q)}function Ut(t){return Ot(t)?$(t):nt(t)}function jt(t){return t}function Gt(){}function Yt(t){return vt(t)?u(At(t)):ot(t)}var Vt=200,Kt="Expected a function",$t="__lodash_hash_undefined__",Ht=1,zt=2,Wt=1/0,qt=9007199254740991,Xt="[object Arguments]",Zt="[object Array]",Jt="[object Boolean]",Qt="[object Date]",te="[object Error]",ee="[object Function]",ne="[object GeneratorFunction]",re="[object Map]",ie="[object Number]",oe="[object Object]",ae="[object Promise]",se="[object RegExp]",le="[object Set]",ue="[object String]",ce="[object Symbol]",de="[object WeakMap]",fe="[object ArrayBuffer]",he="[object DataView]",pe="[object Float32Array]",ye="[object Float64Array]",ge="[object Int8Array]",ve="[object Int16Array]",me="[object Int32Array]",be="[object Uint8Array]",_e="[object Uint8ClampedArray]",Ee="[object Uint16Array]",Te="[object Uint32Array]",Ae=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,ke=/^\w*$/,we=/^\./,Se=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Le=/[\\^$.*+?()[\]{}|]/g,Re=/\\(\\)?/g,Oe=/^\[object .+?Constructor\]$/,Ce=/^(?:0|[1-9]\d*)$/,Pe={};Pe[pe]=Pe[ye]=Pe[ge]=Pe[ve]=Pe[me]=Pe[be]=Pe[_e]=Pe[Ee]=Pe[Te]=!0,Pe[Xt]=Pe[Zt]=Pe[fe]=Pe[Jt]=Pe[he]=Pe[Qt]=Pe[te]=Pe[ee]=Pe[re]=Pe[ie]=Pe[oe]=Pe[se]=Pe[le]=Pe[ue]=Pe[de]=!1;var De="object"==typeof t&&t&&t.Object===Object&&t,Ie="object"==typeof self&&self&&self.Object===Object&&self,xe=De||Ie||Function("return this")(),Ne="object"==typeof e&&e&&!e.nodeType&&e,Me=Ne&&"object"==typeof n&&n&&!n.nodeType&&n,Fe=Me&&Me.exports===Ne,Be=Fe&&De.process,Ue=function(){try{return Be&&Be.binding("util")}catch(t){}}(),je=Ue&&Ue.isTypedArray,Ge=Array.prototype,Ye=Function.prototype,Ve=Object.prototype,Ke=xe["__core-js_shared__"],$e=function(){var t=/[^.]+$/.exec(Ke&&Ke.keys&&Ke.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),He=Ye.toString,ze=Ve.hasOwnProperty,We=Ve.toString,qe=RegExp("^"+He.call(ze).replace(Le,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Xe=xe.Symbol,Ze=xe.Uint8Array,Je=Ve.propertyIsEnumerable,Qe=Ge.splice,tn=g(Object.keys,Object),en=pt(xe,"DataView"),nn=pt(xe,"Map"),rn=pt(xe,"Promise"),on=pt(xe,"Set"),an=pt(xe,"WeakMap"),sn=pt(Object,"create"),ln=kt(en),un=kt(nn),cn=kt(rn),dn=kt(on),fn=kt(an),hn=Xe?Xe.prototype:void 0,pn=hn?hn.valueOf:void 0,yn=hn?hn.toString:void 0;m.prototype.clear=b,m.prototype.delete=_,m.prototype.get=E,m.prototype.has=T,m.prototype.set=A,k.prototype.clear=w,k.prototype.delete=S,k.prototype.get=L,k.prototype.has=R,k.prototype.set=O,C.prototype.clear=P,C.prototype.delete=D,C.prototype.get=I,C.prototype.has=x,C.prototype.set=N,M.prototype.add=M.prototype.push=F,M.prototype.has=B,U.prototype.clear=j,U.prototype.delete=G,U.prototype.get=Y,U.prototype.has=V,U.prototype.set=K;var gn=on&&1/v(new on([,-0]))[1]==Wt?function(t){return new on(t)}:Gt,vn=W;(en&&vn(new en(new ArrayBuffer(1)))!=he||nn&&vn(new nn)!=re||rn&&vn(rn.resolve())!=ae||on&&vn(new on)!=le||an&&vn(new an)!=de)&&(vn=function(t){var e=We.call(t),n=e==oe?t.constructor:void 0,r=n?kt(n):void 0;if(r)switch(r){case ln:return he;case un:return re;case cn:return ae;case dn:return le;case fn:return de}return e});var mn=St(function(t){t=Mt(t);var e=[];return we.test(t)&&e.push(""),t.replace(Se,function(t,n,r,i){e.push(r?i.replace(Re,"$1"):n||t)}),e});St.Cache=C;var bn=Array.isArray,_n=je?d(je):tt;n.exports=wt}).call(e,function(){return this}(),n(23)(t))},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" fill="#010101" d="M1.712 1.24h12.6v13.52h-12.6z"></path></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" fill="#010101" d="M11.5 11h-.002v1.502L7.798 10H4.5V6h3.297l3.7-2.502V4.5h.003V11zM11 4.49L7.953 6.5H5v3h2.953L11 11.51V4.49z"></path></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" fill="#010101" d="M9.75 11.51L6.7 9.5H3.75v-3H6.7L9.75 4.49v.664l.497.498V3.498L6.547 6H3.248v4h3.296l3.7 2.502v-2.154l-.497.5v.662zm3-5.165L12.404 6l-1.655 1.653L9.093 6l-.346.345L10.402 8 8.747 9.654l.346.347 1.655-1.653L12.403 10l.348-.346L11.097 8l1.655-1.655z"></path></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#010101" d="M7.156 8L4 11.156V8.5H3V13h4.5v-1H4.844L8 8.844 7.156 8zM8.5 3v1h2.657L8 7.157 8.846 8 12 4.844V7.5h1V3H8.5z"></path></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#010101" d="M13.5 3.344l-.844-.844L9.5 5.656V3h-1v4.5H13v-1h-2.656L13.5 3.344zM3 9.5h2.656L2.5 12.656l.844.844L6.5 10.344V13h1V8.5H3v1z"></path></svg>'},function(t,e){t.exports='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill="#010101" d="M5.375 7.062H2.637V4.26H.502v7.488h2.135V8.9h2.738v2.848h2.133V4.26H5.375v2.802zm5.97-2.81h-2.84v7.496h2.798c2.65 0 4.195-1.607 4.195-3.77v-.022c0-2.162-1.523-3.704-4.154-3.704zm2.06 3.758c0 1.21-.81 1.896-2.03 1.896h-.83V6.093h.83c1.22 0 2.03.696 2.03 1.896v.02z"></path></svg>'},function(t,e,n){t.exports=n.p+"38861cba61c66739c1452c3a71e39852.ttf"},function(t,e,n){t.exports=n.p+"4b76590b32dab62bc95c1b7951efae78.swf"},function(t,e,n){t.exports=n.p+"809981e5b09d5336c45d72d0869ada2a.swf"}])});
+//# sourceMappingURL=clappr.min.js.map
\ No newline at end of file
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/mjpeg.js b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/mjpeg.js
new file mode 100644
index 0000000..696e976
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/mjpeg.js
@@ -0,0 +1,123 @@
+// namespace MJPEG { ...
+var MJPEG = (function(module) {
+  "use strict";
+
+  // class Stream { ...
+  module.Stream = function(args) {
+    var self = this;
+    var autoStart = args.autoStart || false;
+
+    self.url = args.url;
+    self.refreshRate = args.refreshRate || 500;
+    self.onStart = args.onStart || null;
+    self.onFrame = args.onFrame || null;
+    self.onStop = args.onStop || null;
+    self.callbacks = {};
+    self.running = false;
+    self.frameTimer = 0;
+
+    self.img = new Image();
+    if (autoStart) {
+      self.img.onload = self.start;
+    }
+    self.img.src = self.url;
+
+    function setRunning(running) {
+      self.running = running;
+      if (self.running) {
+        self.img.src = self.url;
+        self.frameTimer = setInterval(function() {
+          if (self.onFrame) {
+            self.onFrame(self.img);
+          }
+        }, self.refreshRate);
+        if (self.onStart) {
+          self.onStart();
+        }
+      } else {
+        self.img.src = "#";
+        clearInterval(self.frameTimer);
+        if (self.onStop) {
+          self.onStop();
+        }
+      }
+    }
+
+    self.start = function() { setRunning(true); }
+    self.stop = function() { setRunning(false); }
+  };
+
+  // class Player { ...
+  module.Player = function(canvas, url, options) {
+
+    var self = this;
+    if (typeof canvas === "string" || canvas instanceof String) {
+      canvas = document.getElementById(canvas);
+    }
+    var context = canvas.getContext("2d");
+
+    if (! options) {
+      options = {};
+    }
+    options.url = url;
+    options.onFrame = updateFrame;
+    options.onStart = function() { console.log("started"); }
+    options.onStop = function() { console.log("stopped"); }
+
+    self.stream = new module.Stream(options);
+
+    canvas.addEventListener("click", function() {
+      if (self.stream.running) { self.stop(); }
+      else { self.start(); }
+    }, false);
+
+    function scaleRect(srcSize, dstSize) {
+      var ratio = Math.min(dstSize.width / srcSize.width,
+                           dstSize.height / srcSize.height);
+      var newRect = {
+        x: 0, y: 0,
+        width: srcSize.width * ratio,
+        height: srcSize.height * ratio
+      };
+      newRect.x = (dstSize.width/2) - (newRect.width/2);
+      newRect.y = (dstSize.height/2) - (newRect.height/2);
+      return newRect;
+    }
+
+    function updateFrame(img) {
+        var srcRect = {
+          x: 0, y: 0,
+          width: img.naturalWidth,
+          height: img.naturalHeight
+        };
+        var dstRect = scaleRect(srcRect, {
+          width: canvas.width,
+          height: canvas.height
+        });
+      try {
+        context.drawImage(img,
+          srcRect.x,
+          srcRect.y,
+          srcRect.width,
+          srcRect.height,
+          dstRect.x,
+          dstRect.y,
+          dstRect.width,
+          dstRect.height
+        );
+        console.log(".");
+      } catch (e) {
+        // if we can't draw, don't bother updating anymore
+        self.stop();
+        console.log("!");
+        throw e;
+      }
+    }
+
+    self.start = function() { self.stream.start(); }
+    self.stop = function() { self.stream.stop(); }
+  };
+
+  return module;
+
+})(MJPEG || {});
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/xml2json.min.js b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/xml2json.min.js
new file mode 100644
index 0000000..e8f9d0a
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/js/xml2json.min.js
@@ -0,0 +1 @@
+(function(a,b){if(typeof define==="function"&&define.amd){define([],b);}else{if(typeof exports==="object"){module.exports=b();}else{a.X2JS=b();}}}(this,function(){return function(z){var t="1.2.0";z=z||{};i();u();function i(){if(z.escapeMode===undefined){z.escapeMode=true;}z.attributePrefix=z.attributePrefix||"_";z.arrayAccessForm=z.arrayAccessForm||"none";z.emptyNodeForm=z.emptyNodeForm||"text";if(z.enableToStringFunc===undefined){z.enableToStringFunc=true;}z.arrayAccessFormPaths=z.arrayAccessFormPaths||[];if(z.skipEmptyTextNodesForObj===undefined){z.skipEmptyTextNodesForObj=true;}if(z.stripWhitespaces===undefined){z.stripWhitespaces=true;}z.datetimeAccessFormPaths=z.datetimeAccessFormPaths||[];if(z.useDoubleQuotes===undefined){z.useDoubleQuotes=false;}z.xmlElementsFilter=z.xmlElementsFilter||[];z.jsonPropertiesFilter=z.jsonPropertiesFilter||[];if(z.keepCData===undefined){z.keepCData=false;}}var h={ELEMENT_NODE:1,TEXT_NODE:3,CDATA_SECTION_NODE:4,COMMENT_NODE:8,DOCUMENT_NODE:9};function u(){}function x(B){var C=B.localName;if(C==null){C=B.baseName;}if(C==null||C==""){C=B.nodeName;}return C;}function r(B){return B.prefix;}function s(B){if(typeof(B)=="string"){return B.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;");}else{return B;}}function k(B){return B.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&quot;/g,'"').replace(/&apos;/g,"'").replace(/&amp;/g,"&");}function w(C,F,D,E){var B=0;for(;B<C.length;B++){var G=C[B];if(typeof G==="string"){if(G==E){break;}}else{if(G instanceof RegExp){if(G.test(E)){break;}}else{if(typeof G==="function"){if(G(F,D,E)){break;}}}}}return B!=C.length;}function n(D,B,C){switch(z.arrayAccessForm){case"property":if(!(D[B] instanceof Array)){D[B+"_asArray"]=[D[B]];}else{D[B+"_asArray"]=D[B];}break;}if(!(D[B] instanceof Array)&&z.arrayAccessFormPaths.length>0){if(w(z.arrayAccessFormPaths,D,B,C)){D[B]=[D[B]];}}}function a(G){var E=G.split(/[-T:+Z]/g);var F=new Date(E[0],E[1]-1,E[2]);var D=E[5].split(".");F.setHours(E[3],E[4],D[0]);if(D.length>1){F.setMilliseconds(D[1]);}if(E[6]&&E[7]){var C=E[6]*60+Number(E[7]);var B=/\d\d-\d\d:\d\d$/.test(G)?"-":"+";C=0+(B=="-"?-1*C:C);F.setMinutes(F.getMinutes()-C-F.getTimezoneOffset());}else{if(G.indexOf("Z",G.length-1)!==-1){F=new Date(Date.UTC(F.getFullYear(),F.getMonth(),F.getDate(),F.getHours(),F.getMinutes(),F.getSeconds(),F.getMilliseconds()));}}return F;}function q(D,B,C){if(z.datetimeAccessFormPaths.length>0){var E=C.split(".#")[0];if(w(z.datetimeAccessFormPaths,D,B,E)){return a(D);}else{return D;}}else{return D;}}function b(E,C,B,D){if(C==h.ELEMENT_NODE&&z.xmlElementsFilter.length>0){return w(z.xmlElementsFilter,E,B,D);}else{return true;}}function A(D,J){if(D.nodeType==h.DOCUMENT_NODE){var K=new Object;var B=D.childNodes;for(var L=0;L<B.length;L++){var C=B.item(L);if(C.nodeType==h.ELEMENT_NODE){var I=x(C);K[I]=A(C,I);}}return K;}else{if(D.nodeType==h.ELEMENT_NODE){var K=new Object;K.__cnt=0;var B=D.childNodes;for(var L=0;L<B.length;L++){var C=B.item(L);var I=x(C);if(C.nodeType!=h.COMMENT_NODE){var H=J+"."+I;if(b(K,C.nodeType,I,H)){K.__cnt++;if(K[I]==null){K[I]=A(C,H);n(K,I,H);}else{if(K[I]!=null){if(!(K[I] instanceof Array)){K[I]=[K[I]];n(K,I,H);}}(K[I])[K[I].length]=A(C,H);}}}}for(var E=0;E<D.attributes.length;E++){var F=D.attributes.item(E);K.__cnt++;K[z.attributePrefix+F.name]=F.value;}var G=r(D);if(G!=null&&G!=""){K.__cnt++;K.__prefix=G;}if(K["#text"]!=null){K.__text=K["#text"];if(K.__text instanceof Array){K.__text=K.__text.join("\n");}if(z.stripWhitespaces){K.__text=K.__text.trim();}delete K["#text"];if(z.arrayAccessForm=="property"){delete K["#text_asArray"];}K.__text=q(K.__text,I,J+"."+I);}if(K["#cdata-section"]!=null){K.__cdata=K["#cdata-section"];delete K["#cdata-section"];if(z.arrayAccessForm=="property"){delete K["#cdata-section_asArray"];}}if(K.__cnt==0&&z.emptyNodeForm=="text"){K="";}else{if(K.__cnt==1&&K.__text!=null){K=K.__text;}else{if(K.__cnt==1&&K.__cdata!=null&&!z.keepCData){K=K.__cdata;}else{if(K.__cnt>1&&K.__text!=null&&z.skipEmptyTextNodesForObj){if((z.stripWhitespaces&&K.__text=="")||(K.__text.trim()=="")){delete K.__text;}}}}}delete K.__cnt;if(z.enableToStringFunc&&(K.__text!=null||K.__cdata!=null)){K.toString=function(){return(this.__text!=null?this.__text:"")+(this.__cdata!=null?this.__cdata:"");};}return K;}else{if(D.nodeType==h.TEXT_NODE||D.nodeType==h.CDATA_SECTION_NODE){return D.nodeValue;}}}}function o(I,F,H,C){var E="<"+((I!=null&&I.__prefix!=null)?(I.__prefix+":"):"")+F;if(H!=null){for(var G=0;G<H.length;G++){var D=H[G];var B=I[D];if(z.escapeMode){B=s(B);}E+=" "+D.substr(z.attributePrefix.length)+"=";if(z.useDoubleQuotes){E+='"'+B+'"';}else{E+="'"+B+"'";}}}if(!C){E+=">";}else{E+="/>";}return E;}function j(C,B){return"</"+(C.__prefix!=null?(C.__prefix+":"):"")+B+">";}function v(C,B){return C.indexOf(B,C.length-B.length)!==-1;}function y(C,B){if((z.arrayAccessForm=="property"&&v(B.toString(),("_asArray")))||B.toString().indexOf(z.attributePrefix)==0||B.toString().indexOf("__")==0||(C[B] instanceof Function)){return true;}else{return false;}}function m(D){var C=0;if(D instanceof Object){for(var B in D){if(y(D,B)){continue;}C++;}}return C;}function l(D,B,C){return z.jsonPropertiesFilter.length==0||C==""||w(z.jsonPropertiesFilter,D,B,C);}function c(D){var C=[];if(D instanceof Object){for(var B in D){if(B.toString().indexOf("__")==-1&&B.toString().indexOf(z.attributePrefix)==0){C.push(B);}}}return C;}function g(C){var B="";if(C.__cdata!=null){B+="<![CDATA["+C.__cdata+"]]>";}if(C.__text!=null){if(z.escapeMode){B+=s(C.__text);}else{B+=C.__text;}}return B;}function d(C){var B="";if(C instanceof Object){B+=g(C);}else{if(C!=null){if(z.escapeMode){B+=s(C);}else{B+=C;}}}return B;}function p(C,B){if(C===""){return B;}else{return C+"."+B;}}function f(D,G,F,E){var B="";if(D.length==0){B+=o(D,G,F,true);}else{for(var C=0;C<D.length;C++){B+=o(D[C],G,c(D[C]),false);B+=e(D[C],p(E,G));B+=j(D[C],G);}}return B;}function e(I,H){var B="";var F=m(I);if(F>0){for(var E in I){if(y(I,E)||(H!=""&&!l(I,E,p(H,E)))){continue;}var D=I[E];var G=c(D);if(D==null||D==undefined){B+=o(D,E,G,true);}else{if(D instanceof Object){if(D instanceof Array){B+=f(D,E,G,H);}else{if(D instanceof Date){B+=o(D,E,G,false);B+=D.toISOString();B+=j(D,E);}else{var C=m(D);if(C>0||D.__text!=null||D.__cdata!=null){B+=o(D,E,G,false);B+=e(D,p(H,E));B+=j(D,E);}else{B+=o(D,E,G,true);}}}}else{B+=o(D,E,G,false);B+=d(D);B+=j(D,E);}}}}B+=d(I);return B;}this.parseXmlString=function(D){var F=window.ActiveXObject||"ActiveXObject" in window;if(D===undefined){return null;}var E;if(window.DOMParser){var G=new window.DOMParser();var B=null;if(!F){try{B=G.parseFromString("INVALID","text/xml").getElementsByTagName("parsererror")[0].namespaceURI;}catch(C){B=null;}}try{E=G.parseFromString(D,"text/xml");if(B!=null&&E.getElementsByTagNameNS(B,"parsererror").length>0){E=null;}}catch(C){E=null;}}else{if(D.indexOf("<?")==0){D=D.substr(D.indexOf("?>")+2);}E=new ActiveXObject("Microsoft.XMLDOM");E.async="false";E.loadXML(D);}return E;};this.asArray=function(B){if(B===undefined||B==null){return[];}else{if(B instanceof Array){return B;}else{return[B];}}};this.toXmlDateTime=function(B){if(B instanceof Date){return B.toISOString();}else{if(typeof(B)==="number"){return new Date(B).toISOString();}else{return null;}}};this.asDateTime=function(B){if(typeof(B)=="string"){return a(B);}else{return B;}};this.xml2json=function(B){return A(B);};this.xml_str2json=function(B){var C=this.parseXmlString(B);if(C!=null){return this.xml2json(C);}else{return null;}};this.json2xml_str=function(B){return e(B,"");};this.json2xml=function(C){var B=this.json2xml_str(C);return this.parseXmlString(B);};this.getVersion=function(){return t;};};}));
\ No newline at end of file
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/login.html b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/login.html
new file mode 100644
index 0000000..68e2bdd
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/login.html
@@ -0,0 +1,62 @@
+<!doctype html>
+<html>
+<head>
+<meta charset="utf-8">
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<title>Smart Home | login</title>
+<link rel="stylesheet" href="css/style.css">
+<link rel="icon" type="image/png" href="../webapps/images/favicon.ico" />
+<script>
+	var params = {};
+if (location.search) {
+    var parts = location.search.substring(1).split('&');
+
+    for (var i = 0; i < parts.length; i++) {
+        var nv = parts[i].split('=');
+        if (!nv[0]) continue;
+        params[nv[0]] = nv[1] || true;
+    }
+}
+
+var message = params.message;
+	function loginCenter(){
+		var bodyHeight = (document.getElementById('page-wrap').clientHeight - 273)/2;
+		console.log(bodyHeight)
+		  document.getElementById("loginArea").style.top = bodyHeight +"px";
+		  
+		if(message)document.getElementById("error").style.display ="inline";
+	}
+	
+	function updateFormAction(form) {
+		form.action = form.action + "?sessionId=" + Date.now();
+	}
+
+</script>
+</head>
+
+<body onLoad="loginCenter()" onResize="loginCenter()"> 
+<!-- login screen -->
+<div class="page-wrap" id="page-wrap">
+<div class="login-strip clearfix" id="loginArea">
+    	<div class="loginBox">
+    	<form method="POST" action="../security/login" id="loginForm" name="loginForm" onsubmit="updateFormAction(this)">
+        	<figure>
+            	<img src="images/logo.png">
+                <figcaption>Monitoring Application </figcaption>
+            </figure>
+            <div id="error" style="color:red;display:none;">Invalid user name or password.</div>
+            <label>
+	            user name
+                <input type="text" name="name">
+            </label>
+            <label>
+	            password
+                <input type="password" name="password">
+            </label>
+            <input type="submit" value="login">
+            <form/>
+        </div>
+    </div>
+    </div>
+</body>
+</html>
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/monitor.html b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/monitor.html
new file mode 100644
index 0000000..1bb15c3
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/monitor.html
@@ -0,0 +1,99 @@
+<!doctype html>
+<html ng-app="app">
+	<head>
+		<meta charset="utf-8">
+		<meta name="viewport" content="width=device-width, initial-scale=1">
+		<title>Smart Home | main page</title>
+		
+		<link rel="icon" type="image/png" href="../webapps/images/favicon.ico" />
+		<link rel="stylesheet" href="../webapps/css/style.css">
+		<link rel="stylesheet" href="../webapps/css/angular-ui-switch.css">
+		<link rel="stylesheet" href="../webapps/css/bootstrap-3.0.1.min.css">
+		
+		<script src="../webapps/js/angular.min.js"></script>
+		<script src="../webapps/js/angular-ui-switch.js"></script>
+		<!-- <script src="../webapps/js/angular-load.js"></script> -->
+		<script src="../webapps/js/xml2json.min.js"></script>
+		<!-- <script src="../webapps/js/1_hls.min.js"></script> -->
+		<script src="https://cdn.jsdelivr.net/clappr/latest/clappr.min.js"></script>
+		<script src="../webapps/js/mjpeg.js"></script>
+		<script src="../webapps/js/app.js"></script>
+		<script>
+			function listHeight(){
+				var bodyHeight = document.getElementById('page-wrap').clientHeight - 180;
+				  document.getElementById("list").style.minHeight = bodyHeight +"px";
+			}
+		</script>
+	</head>
+
+	<body onLoad="listHeight()" onResize="listHeight()" data-ng-controller="MainController">
+		<div class="page-wrap" id="page-wrap">
+			<script src="{{camera}}"></script>
+			<!-- main page -->
+			<header class="top_bar">
+				<div class="container">
+					<figure>
+						<a href="#"><img src="../webapps/images/logo.png" alt=""></a>
+						<figcaption>Home Monitoring Application</figcaption>
+					</figure>
+					<div class="user">
+						<span>hello, </span> 
+							<label>{{name}}</label> 
+							<a href="../security/logout" class="logout">Logout</a>
+					</div>
+				</div>
+			</header>
+			<div class="container" >
+				<div id="videoPart" class="left_side">
+					<h3>Video from monitoring camera</h3>
+					<div class="btn-group-horizontal" role="group"
+						aria-label="coffee strength">
+						<label ng-repeat="cam in cams" class="btn btn-default classButton"
+							ng-class="cam.btnClass" ng-click="loadWebcam(cam)">
+							{{cam.deviceName}} 
+						</label>
+					</div>
+					<div>
+						<canvas id="player" width="480" height="360"
+							style="background: #000;" ng-hide="hideMjpegVideo">
+	      				</canvas>
+					</div>
+					<!-- <img width="320" height="240" ng-src="{{camera}}" ng-hide="hideMjpegVideo"/> -->
+					<div id="clappr" ng-hide="hideHlsVideo"></div>
+					<!-- 				<video id="video" ng-hide="hideHlsVideo"></video>		 -->
+					<!-- <button ng-click="test()">stop MJPEG</button> -->
+				</div>
+				<div class="right_side" id="list">
+					<h3>Device</h3>
+					<form>
+						<ul>
+							<li ng-repeat='device in getDevicesAsArray() | filter: deviceFilter' 
+									ng-class="{'backgroundRed' : device.isUpdated}">
+								<div>{{device.name}}</div>
+								<table width="100%">
+									<tr>
+										<td ng-repeat="module in getModulesFromDevice(device) | filter: moduleFilter">
+											<img ng-src="../webapps/{{module.img}}" />
+											{{module.value}}
+										</td>
+										<td class="tdSmall" 
+												ng-repeat="module in getModulesFromDevice(device) | filter: switchFilter">
+											<div ng-hide="module.hideSpinning" class="spinner"></div>
+										</td>
+										<td class="tdSmall"
+												ng-repeat="module in getModulesFromDevice(device) | filter: switchFilter">
+											<switch class="adjustSwitch" name="moduleSwitch_{{module.id}}" id="moduleSwitch_{{module.id}}"
+												 ng-model="module.state"
+												ng-change="changeState(device,module)"></switch>
+										</td>
+									</tr>
+								</table>
+							</li>
+						</ul>
+					</form>
+				</div>
+			</div>
+		</div>
+		<footer class="site-footer"> &copy; 2017 </footer>
+	</body>
+</html>
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/1445441961_logout.png b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/1445441961_logout.png
new file mode 100644
index 0000000..0c2ecfd
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/1445441961_logout.png
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/1445442166_on-off.png b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/1445442166_on-off.png
new file mode 100644
index 0000000..1847bc4
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/1445442166_on-off.png
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/Helvetica.zip b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/Helvetica.zip
new file mode 100644
index 0000000..2585eb5
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/Helvetica.zip
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/HelveticaNeueLTStd Lt.otf b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/HelveticaNeueLTStd Lt.otf
new file mode 100644
index 0000000..1b27e9f
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/HelveticaNeueLTStd Lt.otf
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master.zip b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master.zip
new file mode 100644
index 0000000..b447139
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master.zip
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/.gitignore b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/.gitignore
new file mode 100644
index 0000000..76a84fa
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/.gitignore
@@ -0,0 +1,3 @@
+node_modules
+bower_components
+.DS_Store
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/Makefile b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/Makefile
new file mode 100644
index 0000000..0765292
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/Makefile
@@ -0,0 +1,23 @@
+NPM=./node_modules/.bin
+
+all:
+
+compile: js css
+
+publish: npm bower
+
+js:
+	@echo "Minifying javascript ..."
+	@$(NPM)/uglifyjs angular-ui-switch.js --compress --mangle --comments > angular-ui-switch.min.js
+
+css:
+	@echo "Minifying css ..."
+	@$(NPM)/minify angular-ui-switch.css > angular-ui-switch.min.css
+
+npm:
+	@echo "Publishing as npm ..."
+	npm publish
+
+bower:
+	@echo "Publishing as bower ..."
+	bower register angular-ui-switch git@github.com:xpepermint/angular-ui-switch.git
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/README.md b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/README.md
new file mode 100644
index 0000000..c7400e3
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/README.md
@@ -0,0 +1,88 @@
+# [angular](https://angularjs.org/)-ui-switch
+
+This is a simple iOS 7 style switch directive for AngularJS. You can use this module as you would use the default HTML checkbox input element. This is a super lightweight module and you can completely change the design using just CSS.
+
+Supported by all modern browsers: Chrome, Firefox, Opera, Safari, IE8+
+
+![YoomJS](https://raw.githubusercontent.com/xpepermint/angular-ui-switch/master/logo.png)
+
+Inspired by [switchery](https://github.com/abpetkov/switchery) - in angular way.
+
+## Installation
+
+Download the package from `github`. The package is also available over `npm install angular-ui-switch` or `bower install angular-ui-switch`.
+
+Include `javascript` and `css` files into your page.
+
+```html
+<!DOCTYPE html>
+<html lang="en" ng-app="app">
+<head>
+  ...
+  <link rel="stylesheet" href="/ui-switch.min.css"/>
+</head>
+<body>
+  ...
+  <script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-rc.3/angular.min.js"></script>
+  <script src="/ui-switch.min.js"></script>
+</body>
+</html>
+```
+
+Declare a dependency on the module.
+
+```js
+angular.module('myModule', ['uiSwitch']);
+```
+
+Insert the switch in your html template.
+
+```html
+<form>
+  <switch id="enabled" name="enabled" ng-model="enabled" class="green"></switch>
+  <br>{{ enabled }}
+</form>
+```
+
+Add optional on/off text
+```html
+<form>
+  <switch id="enabled" name="enabled" ng-model="enabled" on="On" off="Off" class="green"></switch>
+  <br>{{ enabled }}
+</form>
+```
+
+Disabled state
+```html
+<form>
+  <switch id="enabled" name="enabled" ng-model="enabled" disabled="true" class="green"></switch>
+  <br>{{ enabled }}
+</form>
+```
+
+## Design
+
+You can completely change the design. All the magic is hidden inside two CSS classes.
+
+```css
+.switch {
+  /* frame */
+}
+.switch small {
+  /* button */
+}
+.switch.checked {
+  /* frame when enabled */
+}
+.switch.checked small {
+  /* button when enabled */
+}
+```
+
+## Publishing
+
+1. Update version in `package.json` and `bower.json`.
+
+2. Run `make compile` to minify files.
+
+3. Run `make publish` to publish.
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/angular-ui-switch.css b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/angular-ui-switch.css
new file mode 100644
index 0000000..d5bcdf2
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/angular-ui-switch.css
@@ -0,0 +1,82 @@
+.switch {
+  background: #fff;
+  border: 1px solid #dfdfdf;
+  position: relative;
+  display: inline-block;
+  box-sizing: content-box;
+  overflow: visible;
+  width: 52px;
+  height: 30px;
+  padding: 0px;
+  margin: 0px;
+  border-radius: 20px;
+  cursor: pointer;
+  box-shadow: rgb(223, 223, 223) 0px 0px 0px 0px inset;
+  transition: 0.3s ease-out all;
+  -webkit-transition: 0.3s ease-out all;
+  top: -1px;
+}
+/*adding a wide width for larger switch text*/
+.switch.wide {
+  width:80px;
+}
+.switch small {
+  background: #fff;
+  border-radius: 100%;
+  box-shadow: 0 1px 3px rgba(0,0,0,0.4);
+  width: 30px;
+  height: 30px;
+  position: absolute;
+  top: 0px;
+  left: 0px;
+  transition: 0.3s ease-out all;
+  -webkit-transition: 0.3s ease-out all;
+}
+.switch.checked {
+  background: rgb(100, 189, 99);
+  border-color: rgb(100, 189, 99);
+}
+.switch.checked small {
+  left: 22px;
+}
+/*wider switch text moves small further to the right*/
+.switch.wide.checked small {
+  left:52px;
+}
+/*styles for switch-text*/
+.switch .switch-text {
+  font-family:Arial, Helvetica, sans-serif;
+  font-size:13px;
+}
+
+.switch .off {
+  display:block;
+  position: absolute;
+  right: 10%;
+  top: 25%;
+  z-index: 0;
+  color:#A9A9A9;
+}
+
+.switch .on {
+  display:none;
+   z-index: 0;
+  color:#fff;
+  position: absolute;
+  top: 25%;
+  left: 9%;
+}
+
+.switch.checked .off {
+  display:none;
+}
+
+.switch.checked .on {
+  display:block;
+
+}
+
+.switch.disabled {
+  opacity: .50;
+  cursor: not-allowed;
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/angular-ui-switch.js b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/angular-ui-switch.js
new file mode 100644
index 0000000..9a6b591
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/angular-ui-switch.js
@@ -0,0 +1,28 @@
+angular.module('uiSwitch', [])
+
+.directive('switch', function(){
+  return {
+    restrict: 'AE'
+  , replace: true
+  , transclude: true
+  , template: function(element, attrs) {
+      var html = '';
+      html += '<span';
+      html +=   ' class="switch' + (attrs.class ? ' ' + attrs.class : '') + '"';
+      html +=   attrs.ngModel ? ' ng-click="' + attrs.disabled + ' ? ' + attrs.ngModel + ' : ' + attrs.ngModel + '=!' + attrs.ngModel + (attrs.ngChange ? '; ' + attrs.ngChange + '()"' : '"') : '';
+      html +=   ' ng-class="{ checked:' + attrs.ngModel + ', disabled:' + attrs.disabled + ' }"';
+      html +=   '>';
+      html +=   '<small></small>';
+      html +=   '<input type="checkbox"';
+      html +=     attrs.id ? ' id="' + attrs.id + '"' : '';
+      html +=     attrs.name ? ' name="' + attrs.name + '"' : '';
+      html +=     attrs.ngModel ? ' ng-model="' + attrs.ngModel + '"' : '';
+      html +=     ' style="display:none" />';
+      html +=     '<span class="switch-text">'; /*adding new container for switch text*/
+      html +=     attrs.on ? '<span class="on">'+attrs.on+'</span>' : ''; /*switch text on value set by user in directive html markup*/
+      html +=     attrs.off ? '<span class="off">'+attrs.off + '</span>' : ' ';  /*switch text off value set by user in directive html markup*/
+      html += '</span>';
+      return html;
+    }
+  }
+});
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/angular-ui-switch.min.css b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/angular-ui-switch.min.css
new file mode 100644
index 0000000..a52d377
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/angular-ui-switch.min.css
@@ -0,0 +1 @@
+.switch{background:#fff;border:1px solid #dfdfdf;position:relative;display:inline-block;box-sizing:content-box;overflow:visible;width:52px;height:30px;padding:0;margin:0;border-radius:20px;cursor:pointer;box-shadow:#dfdfdf 0 0 0 0 inset;transition:.3s ease-out all;-webkit-transition:.3s ease-out all;top:-1px}.switch.wide{width:80px}.switch small{background:#fff;border-radius:100%;box-shadow:0 1px 3px rgba(0,0,0,.4);width:30px;height:30px;position:absolute;top:0;left:0;transition:.3s ease-out all;-webkit-transition:.3s ease-out all}.switch.checked{background:#64bd63;border-color:#64bd63}.switch.checked small{left:22px}.switch.wide.checked small{left:52px}.switch .switch-text{font-family:Arial,Helvetica,sans-serif;font-size:13px}.switch .off{display:block;position:absolute;right:10%;top:25%;z-index:0;color:#A9A9A9}.switch .on{display:none;z-index:0;color:#fff;position:absolute;top:25%;left:9%}.switch.checked .off{display:none}.switch.checked .on{display:block}.switch.disabled{opacity:.5;cursor:not-allowed}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/angular-ui-switch.min.js b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/angular-ui-switch.min.js
new file mode 100644
index 0000000..6f6da0f
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/angular-ui-switch.min.js
@@ -0,0 +1 @@
+angular.module("uiSwitch",[]).directive("switch",function(){return{restrict:"AE",replace:!0,transclude:!0,template:function(n,e){var s="";return s+="<span",s+=' class="switch'+(e.class?" "+e.class:"")+'"',s+=e.ngModel?' ng-click="'+e.disabled+" ? "+e.ngModel+" : "+e.ngModel+"=!"+e.ngModel+(e.ngChange?"; "+e.ngChange+'()"':'"'):"",s+=' ng-class="{ checked:'+e.ngModel+", disabled:"+e.disabled+' }"',s+=">",s+="<small></small>",s+='<input type="checkbox"',s+=e.id?' id="'+e.id+'"':"",s+=e.name?' name="'+e.name+'"':"",s+=e.ngModel?' ng-model="'+e.ngModel+'"':"",s+=' style="display:none" />',s+='<span class="switch-text">',s+=e.on?'<span class="on">'+e.on+"</span>":"",s+=e.off?'<span class="off">'+e.off+"</span>":" ",s+="</span>"}}});
\ No newline at end of file
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/app.js b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/app.js
new file mode 100644
index 0000000..3c424cf
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/app.js
@@ -0,0 +1,14 @@
+angular.module('app', ['uiSwitch'])
+
+.controller('MyController', function($scope) {
+  $scope.enabled = true; 
+  $scope.test = true;
+  $scope.onOff = true;
+  $scope.yesNo = true;
+  $scope.disabled = true;
+
+
+  $scope.changeCallback = function() {
+    console.log('This is the state of my model ' + $scope.enabled);
+  };
+});
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/bower.json b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/bower.json
new file mode 100644
index 0000000..de0fe16
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/bower.json
@@ -0,0 +1,30 @@
+{
+  "name": "angular-ui-switch",
+  "version": "0.1.1",
+  "main": ["angular-ui-switch.js", "angular-ui-switch.css"],
+  "authors": [
+    "xpeper <xpepermint@gmail.com>"
+  ],
+  "description": "iOS 7 style switch directive for AngularJS",
+  "keywords": [
+    "angular",
+    "angularjs",
+    "ui",
+    "directive",
+    "switch",
+    "on",
+    "off",
+    "button",
+    "checkbox",
+    "form"
+  ],
+  "license": "MIT",
+  "homepage": "https://github.com/xpepermint/angular-ui-switch",
+  "ignore": [
+    "**/.*",
+    "node_modules",
+    "bower_components",
+    "test",
+    "tests"
+  ]
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/example/app.js b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/example/app.js
new file mode 100644
index 0000000..3c424cf
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/example/app.js
@@ -0,0 +1,14 @@
+angular.module('app', ['uiSwitch'])
+
+.controller('MyController', function($scope) {
+  $scope.enabled = true; 
+  $scope.test = true;
+  $scope.onOff = true;
+  $scope.yesNo = true;
+  $scope.disabled = true;
+
+
+  $scope.changeCallback = function() {
+    console.log('This is the state of my model ' + $scope.enabled);
+  };
+});
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/example/index.html b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/example/index.html
new file mode 100644
index 0000000..a890209
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/example/index.html
@@ -0,0 +1,53 @@
+<!DOCTYPE html>
+<html lang="en" ng-app="app">
+<head>
+  <meta charset="utf-8">
+  <meta http-equiv="X-UA-Compatible" content="IE=edge">
+  <meta name="viewport" content="width=device-width, initial-scale=1">
+  <link rel="stylesheet" href="../angular-ui-switch.css"/>
+    <script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.0-rc.3/angular.min.js"></script>
+    <script src="../angular-ui-switch.js"></script>
+    <script src="app.js"></script>
+</head>
+<body>
+
+  <form data-ng-controller="MyController">
+    <switch name="enabled" ng-model="enabled" ng-change="changeCallback"></switch>
+    <switch name="enabled" ng-model="test" ng-change="changeCallback"></switch>
+    <p>
+        <button ng-click="enabled=!enabled">Toggle</button>
+    </p>
+    <p>
+        Enabled: {{ enabled }}
+    </p>
+     <!--Examples of using switch text on/off values.  These values can be anything.  First example shows basic on/off-->
+
+    <switch name="onOff" ng-model="onOff" on="on" off="off"></switch>
+     <p>
+        <button ng-click="onOff=!onOff">Toggle</button>
+    </p>
+    <p>
+        Enabled: {{ onOff }}
+    </p>
+
+    <!--Examples of using the nonsense words lorem/ipsum in the on/off values.  Because these are wider, added an option "wide" class to allow for more room-->
+    <switch name="yesNo" ng-model="yesNo" on="lorem" off="ipsum" class="wide"></switch>
+     <p>
+        <button ng-click="onOff=!onOff">Toggle</button>
+    </p>
+    <p>
+        Enabled: {{ yesNo }}
+    </p>
+
+    <!--Examples of using switch disabled states. -->
+    <switch name="disabled" ng-model="disabled" disabled="true"></switch>
+    <p>
+        <button ng-click="disabled=!disabled">Toggle</button>
+    </p>
+    <p>
+        Enabled: {{ disabled }}
+    </p>
+  </form>
+
+</body>
+</html>
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/logo.png b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/logo.png
new file mode 100644
index 0000000..f99d04f
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/logo.png
Binary files differ
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/package.json b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/package.json
new file mode 100644
index 0000000..a590c91
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/org.eclipse.om2m.sdt.home.monitoring/src/main/resources/webapps/resources/angular-ui-switch-master/package.json
@@ -0,0 +1,35 @@
+{
+  "name": "angular-ui-switch",
+  "version": "0.1.1",
+  "description": "iOS 7 style switch directive for AngularJS",
+  "main": "angular-ui-switch.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git://github.com/xpepermint/angular-ui-switch.git"
+  },
+  "keywords": [
+    "angular",
+    "angularjs",
+    "ui",
+    "directive",
+    "switch",
+    "on",
+    "off",
+    "button",
+    "checkbox",
+    "form"
+  ],
+  "author": "xpeper <xpepermint@gmail.com>",
+  "license": "MIT",
+  "bugs": {
+    "url": "https://github.com/xpepermint/angular-ui-switch/issues"
+  },
+  "homepage": "https://github.com/xpepermint/angular-ui-switch",
+  "devDependencies": {
+    "minify": "^1.0.4",
+    "uglify-js": "^2.4.15"
+  }
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/pom.xml b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/pom.xml
new file mode 100644
index 0000000..6038e27
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.applications/pom.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Copyright (c) 2014, 2016 Orange. All rights reserved. This program and 
+	the accompanying materials are made available under the terms of the Eclipse 
+	Public License v1.0 which accompanies this distribution, and is available 
+	at http://www.eclipse.org/legal/epl-v10.html -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+	<modelVersion>4.0.0</modelVersion>
+
+	<artifactId>org.eclipse.om2m.sdt.home.applications</artifactId>
+	<packaging>pom</packaging>
+	<version>1.0.0-SNAPSHOT</version>
+	<description>SDT Applications for oneM2M, Home domain</description>
+
+	<parent>
+		<groupId>org.eclipse.om2m</groupId>
+		<artifactId>org.eclipse.om2m.sdt</artifactId>
+		<version>1.0.0-SNAPSHOT</version>
+	</parent>
+
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-release-plugin</artifactId>
+				<version>2.5.3</version>
+			</plugin>
+		</plugins>
+	</build>
+
+	<modules>
+		<module>org.eclipse.om2m.sdt.home.monitoring</module>
+	</modules>
+
+</project>
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.cloud/src/main/java/org/eclipse/om2m/sdt/home/cloud/Activator.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.cloud/src/main/java/org/eclipse/om2m/sdt/home/cloud/Activator.java
index 1d261e9..e4be964 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.cloud/src/main/java/org/eclipse/om2m/sdt/home/cloud/Activator.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.cloud/src/main/java/org/eclipse/om2m/sdt/home/cloud/Activator.java
@@ -24,6 +24,7 @@
 import org.osgi.service.log.LogService;
 import org.osgi.util.tracker.ServiceTracker;
 
+@SuppressWarnings({"rawtypes", "unchecked"})
 public class Activator implements BundleActivator {
 
 	static private final String PROTOCOL = "Cloud";
@@ -97,7 +98,7 @@
 		try {
 			newDevices.addAll(ResourceDiscovery.readDeviceURIs());
 		} catch (Throwable e) {
-			logger.error("Error reading remote devices: " + e.getMessage(), e);
+			logger.error("Error reading remote devices: " + e.getMessage());
 		}
 		logger.info("newDevices[size:" + newDevices.size() + "]");
 		
@@ -124,16 +125,16 @@
 	private void install(String uri) {
 		try {
 			GenericDevice device = ResourceDiscovery.readDevice(uri);
-			logger.info("Install device " + device);
 			device.setProtocol(PROTOCOL + "." + device.getProtocol());
 			String name = device.getDeviceName();
-			if (Utilities.isEmpty(name))
+			if (isEmpty(name))
 				name = device.getDeviceAliasName();
-			if (Utilities.isEmpty(name))
+			if (isEmpty(name))
 				name = device.getName();
 			device.setDeviceAliasName("Cloud device " + name);
 			registrations.put(device.getId(), Utils.register(device, context));
 			devices.put(uri, device);
+			logger.info("Installed device " + device);
 		} catch (Throwable e) {
 			logger.error("Error installing remote device: " + uri, e);
 		}
@@ -171,4 +172,8 @@
 		context = null;
 	}
 
+	private static boolean isEmpty(final String str) {
+		return (str == null) || str.trim().equals("");
+	}
+
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.cloud/src/main/java/org/eclipse/om2m/sdt/home/cloud/ResourceDiscovery.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.cloud/src/main/java/org/eclipse/om2m/sdt/home/cloud/ResourceDiscovery.java
index 209433a..78f7241 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.cloud/src/main/java/org/eclipse/om2m/sdt/home/cloud/ResourceDiscovery.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.cloud/src/main/java/org/eclipse/om2m/sdt/home/cloud/ResourceDiscovery.java
@@ -21,11 +21,12 @@
 import org.eclipse.om2m.commons.constants.ResourceType;
 import org.eclipse.om2m.commons.constants.ResponseStatusCode;
 import org.eclipse.om2m.commons.constants.ResultContent;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
 import org.eclipse.om2m.commons.resource.ChildResourceRef;
 import org.eclipse.om2m.commons.resource.CustomAttribute;
 import org.eclipse.om2m.commons.resource.FilterCriteria;
 import org.eclipse.om2m.commons.resource.FlexContainer;
-import org.eclipse.om2m.commons.resource.FlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
 import org.eclipse.om2m.commons.resource.RequestPrimitive;
 import org.eclipse.om2m.commons.resource.ResponsePrimitive;
 import org.eclipse.om2m.commons.resource.URIList;
@@ -34,6 +35,7 @@
 import org.eclipse.om2m.sdt.Arg;
 import org.eclipse.om2m.sdt.DataPoint;
 import org.eclipse.om2m.sdt.Domain;
+import org.eclipse.om2m.sdt.Identifiers;
 import org.eclipse.om2m.sdt.Module;
 import org.eclipse.om2m.sdt.Property;
 import org.eclipse.om2m.sdt.args.Command;
@@ -43,6 +45,7 @@
 import org.eclipse.om2m.sdt.datapoints.ByteDataPoint;
 import org.eclipse.om2m.sdt.datapoints.DateDataPoint;
 import org.eclipse.om2m.sdt.datapoints.DateTimeDataPoint;
+import org.eclipse.om2m.sdt.datapoints.EnumDataPoint;
 import org.eclipse.om2m.sdt.datapoints.FloatDataPoint;
 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;
 import org.eclipse.om2m.sdt.datapoints.StringDataPoint;
@@ -52,14 +55,8 @@
 import org.eclipse.om2m.sdt.home.devices.Camera;
 import org.eclipse.om2m.sdt.home.devices.GenericDevice;
 import org.eclipse.om2m.sdt.home.modules.AlarmSpeaker;
-import org.eclipse.om2m.sdt.home.types.AlertColourCode;
-import org.eclipse.om2m.sdt.home.types.DoorState;
-import org.eclipse.om2m.sdt.home.types.FoamStrength;
-import org.eclipse.om2m.sdt.home.types.LevelType;
-import org.eclipse.om2m.sdt.home.types.LockState;
-import org.eclipse.om2m.sdt.home.types.SupportedMode;
-import org.eclipse.om2m.sdt.home.types.TasteStrength;
-import org.eclipse.om2m.sdt.home.types.Tone;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
+import org.eclipse.om2m.sdt.home.types.PropertyType;
 import org.eclipse.om2m.sdt.types.DataType;
 import org.eclipse.om2m.sdt.types.SimpleType;
 
@@ -121,20 +118,11 @@
 			throw new Exception("Could not read devices list: " + response);
 		}
 		return ((URIList) response.getContent()).getListOfUri();
-//		for (String uri : ((URIList) response.getContent()).getListOfUri()) {
-//			try {
-//				GenericDevice device = readDevice(uri);
-//				ret.put(device.getId(), device);
-//			} catch (Exception e) {
-//				Activator.logger.error("Error reading device " + uri, e);
-//			}
-//		}
-//		return ret;
 	}
 
 	static public GenericDevice readDevice(String uri) throws Exception {
 		Activator.logger.info("Get device " + uri);
-		FlexContainer deviceFlexContainer = (FlexContainer) retrieveFlexContainer(uri,
+		AbstractFlexContainer deviceFlexContainer = (AbstractFlexContainer) retrieveFlexContainer(uri,
 				ResultContent.ORIGINAL_RES);
 		if (deviceFlexContainer == null) {
 			throw new Exception("Could not read device " + uri);
@@ -147,7 +135,8 @@
 				labels.put(label.substring(0, idx), label.substring(idx+1));
 		}
 		String deviceId = labels.get("id");
-		CustomAttribute serialAttr = deviceFlexContainer.getCustomAttribute("propDeviceSerialNum");
+		CustomAttribute serialAttr = 
+				deviceFlexContainer.getCustomAttribute(PropertyType.deviceSerialNum.getShortName());
 		String serial = null;
 		if (serialAttr == null) {
 			Activator.logger.info("No serial number property. Take id instead.");
@@ -172,12 +161,19 @@
 			Activator.logger.info("Created SDT device " + device);
 		}
 		for (CustomAttribute attr : deviceFlexContainer.getCustomAttributes()) {
-			device.setProperty(attr.getCustomAttributeName(),
-					attr.getCustomAttributeValue(),
-					attr.getCustomAttributeType());
+			Activator.logger.info("dev CustomAttribute: " + attr);
+			PropertyType propType = PropertyType.fromShortName(attr.getCustomAttributeName());
+			if (propType != null) {
+				Property prop = new Property(propType, attr.getCustomAttributeValue());
+//				device.addProperty(prop);
+				device.addProperty(propType, attr.getCustomAttributeValue());
+			} else {
+				Activator.logger.warning("Unknown custom attribute: " 
+						+ attr.getCustomAttributeName());
+			}
 		}
 		// Search children resources: modules
-		FlexContainerAnnc ctr = (FlexContainerAnnc)retrieveFlexContainer(uri, ResultContent.ATTRIBUTES_AND_CHILD_REF);
+		AbstractFlexContainerAnnc ctr = (AbstractFlexContainerAnnc)retrieveFlexContainer(uri, ResultContent.ATTRIBUTES_AND_CHILD_REF);
 		for (ChildResourceRef ref : ctr.getChildResource()) {
 			if (ref.getType().equals(BigInteger.valueOf(ResourceType.FLEXCONTAINER_ANNC))) {
 				Module module = readModule(ref.getValue());
@@ -195,7 +191,7 @@
 
 	private static Module readModule(String uri) throws Exception {
 		Activator.logger.info("Get module " + uri);
-		FlexContainer moduleFlexContainer = (FlexContainer) retrieveFlexContainer(uri,
+		AbstractFlexContainer moduleFlexContainer = (AbstractFlexContainer) retrieveFlexContainer(uri,
 				ResultContent.ORIGINAL_RES);
 		if (moduleFlexContainer == null) {
 			throw new Exception("Could not read module " + uri);
@@ -208,19 +204,23 @@
 				labels.put(label.substring(0, idx), label.substring(idx+1));
 		}
 		List<Property> props = new ArrayList<Property>();
+		List<CustomAttribute> dpAttrs = new ArrayList<CustomAttribute>();
 		for (CustomAttribute attr : moduleFlexContainer.getCustomAttributes()) {
-			if (attr.getCustomAttributeName().startsWith("prop")) {
-				Property prop = new Property(attr.getCustomAttributeName(), 
-						attr.getCustomAttributeValue());
-				prop.setType(SimpleType.getSimpleType(attr.getCustomAttributeType()));
+			Activator.logger.info("mod CustomAttribute(1): " + attr);
+			PropertyType propType = PropertyType.fromShortName(attr.getCustomAttributeName());
+			if (propType != null) {
+				Property prop = new Property(propType, attr.getCustomAttributeValue());
 				props.add(prop);
+			} else {
+				dpAttrs.add(attr);
 			}
 		}
+		Activator.logger.info("props: " + props);
 		String modName = labels.get("name");
 		Module module = (Module) Activator.DOMAIN.getModule(modName);
 		if (module != null) {
 			for (Property prop : props) {
-				module.setProperty(prop.getName(), prop.getValue());
+				module.addProperty(prop);
 			}
 			Activator.logger.info("Full retrieved SDT module " + module);//.prettyPrint());
 			return module;
@@ -232,36 +232,37 @@
 				+ Character.toUpperCase(cntDef.charAt(idx)) 
 				+ cntDef.substring(idx + 1);
 		List<DataPoint> dps = new ArrayList<DataPoint>();
-		for (CustomAttribute attr : moduleFlexContainer.getCustomAttributes()) {
-			String type = attr.getCustomAttributeType();
-			if (! attr.getCustomAttributeName().startsWith("prop")) {
-				switch (type) {
-				case "xs:integer": dps.add(getIntegerDataPoint(attr, uri)); break;
-				case "xs:boolean": dps.add(getBooleanDataPoint(attr, uri)); break;
-				case "xs:string": dps.add(getStringDataPoint(attr, uri)); break;
-				case "xs:byte": dps.add(getByteDataPoint(attr, uri)); break;
-				case "xs:float": dps.add(getFloatDataPoint(attr, uri)); break;
-				case "xs:datetime": dps.add(getDateTimeDataPoint(attr, uri)); break;
-				case "xs:time": dps.add(getTimeDataPoint(attr, uri)); break;
-				case "xs:date": dps.add(getDateDataPoint(attr, uri)); break;
-				case "xs:enum": dps.add(getArrayDataPoint(attr, uri)); break;
-				case "hd:alertColourCode": dps.add(getAlertColourCode(attr, uri)); break;
-				case "hd:doorState": dps.add(getDoorState(attr, uri)); break;
-				case "hd:foamStrength": dps.add(getFoamStrength(attr, uri)); break;
-				case "hd:level": dps.add(getLevel(attr, uri)); break;
-				case "hd:lockState": dps.add(getLockState(attr, uri)); break;
-				case "hd:supportedMode": dps.add(getSupportedMode(attr, uri)); break;
-				case "hd:tasteStrength": dps.add(getTasteStrength(attr, uri)); break;
-				case "hd:tone": dps.add(getTone(attr, uri)); break;
-
-				default:
-					break;
+		for (CustomAttribute attr : dpAttrs) {
+			Activator.logger.info("mod CustomAttribute(2): " + attr);
+			DatapointType datapointType = DatapointType.fromShortName(attr.getCustomAttributeName());
+			if (datapointType == null) {
+				Activator.logger.warning("Unknown custom attribute, neither property nor datapoint: " 
+						+ attr.getCustomAttributeName());
+				continue;
+			}
+			String type = datapointType.getDataType().getTypeChoice().getOneM2MType();
+			switch (type) {
+			case "xs:integer": dps.add(getIntegerDataPoint(attr, uri)); break;
+			case "xs:boolean": dps.add(getBooleanDataPoint(attr, uri)); break;
+			case "xs:string": dps.add(getStringDataPoint(attr, uri)); break;
+			case "xs:byte": dps.add(getByteDataPoint(attr, uri)); break;
+			case "xs:float": dps.add(getFloatDataPoint(attr, uri)); break;
+			case "xs:datetime": dps.add(getDateTimeDataPoint(attr, uri)); break;
+			case "xs:time": dps.add(getTimeDataPoint(attr, uri)); break;
+			case "xs:date": dps.add(getDateDataPoint(attr, uri)); break;
+			case "xs:enum": dps.add(getArrayDataPoint(attr, uri)); break;
+			default:
+				if (type.startsWith("hd:")) {
+					type = type.substring(3);
+					dps.add(getEnumDataPoint(type, attr, uri));
 				}
-			} 
+				break;
+			}
 		}
+		Activator.logger.info("datapoints: " + dps);
 		Map<String, DataPoint> dpsMap = new HashMap<String, DataPoint>();
 		for (DataPoint dp : dps) {
-			dpsMap.put(dp.getName(), dp);
+			dpsMap.put(dp.getShortDefinitionType(), dp);
 		}
 		Class<?> clazz = Class.forName(className);
 		if (modName.startsWith(cntDef + "__")) {
@@ -275,7 +276,7 @@
 		}
 		Activator.logger.info("Full new SDT module " + module);//.prettyPrint());
 		// Search children resources: modules
-		FlexContainerAnnc ctr = (FlexContainerAnnc)retrieveFlexContainer(uri, ResultContent.ATTRIBUTES_AND_CHILD_REF);
+		AbstractFlexContainerAnnc ctr = (AbstractFlexContainerAnnc)retrieveFlexContainer(uri, ResultContent.ATTRIBUTES_AND_CHILD_REF);
 		Activator.logger.info("Children " + ctr.getChildResource());
 		for (ChildResourceRef ref : ctr.getChildResource()) {
 			if (ref.getType().equals(BigInteger.valueOf(ResourceType.FLEXCONTAINER_ANNC))) {
@@ -297,7 +298,7 @@
 	
 	private static Action readAction(final String uri, final Module module) throws Exception {
 		Activator.logger.info("Get action " + uri);
-		FlexContainer actionFlexContainer = (FlexContainer) retrieveFlexContainer(uri,
+		final AbstractFlexContainer actionFlexContainer = (AbstractFlexContainer) retrieveFlexContainer(uri,
 				ResultContent.ORIGINAL_RES);
 		if (actionFlexContainer == null) {
 			throw new Exception("Could not read action " + uri);
@@ -311,22 +312,26 @@
 		}
 		List<Arg> args = new ArrayList<Arg>();
 		final List<CustomAttribute> attributes = actionFlexContainer.getCustomAttributes();
-		for (final CustomAttribute attr : attributes) {
-			String type = attr.getCustomAttributeType();
-			Arg arg = new ValuedArg<Object>(attr.getCustomAttributeName(), 
-					new DataType(type, SimpleType.getSimpleType(type))) {
-				public void setValue(Object value) {
-					try {
-						SDTUtil.setValue(attr, value);
-						updateAttribute(uri, attr);
-					} catch (Exception e) {
-						Activator.logger.warning("Could not set arg", e);
-					}
-				}
-			};
-			args.add(arg);
-		}
-		String cntDef = actionFlexContainer.getContainerDefinition();
+		// 2017 07 17 - Grégory BONNARDEL
+		// I commented the next piece of code because we don't have information
+		// about argument type 
+		// as we have only no-arg action, this is not a problem
+//		for (final CustomAttribute attr : attributes) {
+//			String type = attr.getCustomAttributeType();
+//			Arg arg = new ValuedArg<Object>(attr.getCustomAttributeName(), 
+//					new DataType(type, SimpleType.getSimpleType(type))) {
+//				public void setValue(Object value) {
+//					try {
+//						SDTUtil.setValue(attr, value);
+//						updateAttribute(uri, attr);
+//					} catch (Exception e) {
+//						Activator.logger.warning("Could not set arg", e);
+//					}
+//				}
+//			};
+//			args.add(arg);
+//		}
+		final String cntDef = actionFlexContainer.getContainerDefinition();
 		String actionName = labels.get("name");
 		if (actionName == null)
 			actionName = cntDef.substring(cntDef.lastIndexOf('.') + 1);
@@ -335,7 +340,22 @@
 			Activator.logger.info("Full retrieved SDT action " + action);
 			return action;
 		}
-		action = new Command(actionName, cntDef, args) {
+		action = new Command(actionName, args,
+				new Identifiers() {
+					@Override
+					public String getShortName() {
+						return actionFlexContainer.getShortName();
+					}
+					@Override
+					public String getLongName() {
+						return actionFlexContainer.getLongName();
+					}
+					@Override
+					public String getDefinition() {
+						return cntDef;
+					}
+				}) {
+//				actionFlexContainer.getLongName(), actionFlexContainer.getShortName()) {
 			@Override
 			protected Object doInvoke() throws ActionException {
 				Activator.logger.info("invoke SDT action");
@@ -353,14 +373,11 @@
 
 	private static IntegerDataPoint getIntegerDataPoint(final CustomAttribute attr,
 			final String uri) {
-		return new IntegerDataPoint(attr.getCustomAttributeName()) {
-//			public Integer getValue() throws DataPointException, AccessException {
-//				return doGetValue();
-//			}
+		return new IntegerDataPoint(DatapointType.fromShortName(attr.getCustomAttributeName())) {
 			@Override
 			public void doSetValue(Integer val) throws DataPointException {
 				try {
-					SDTUtil.setValue(attr, val);
+					SDTUtil.setValue(attr, "xs:integer", val);
 					updateAttribute(uri, attr);
 				} catch (Exception e) {
 					throw new DataPointException(e);
@@ -369,7 +386,7 @@
 			@Override
 			public Integer doGetValue() throws DataPointException {
 				try {
-					return (Integer) retrieveAttribute(uri, attr.getCustomAttributeName());
+					return (Integer) retrieveAttribute(uri, attr.getCustomAttributeName(), "xs:integer");
 				} catch (Exception e) {
 					throw new DataPointException(e);
 				}
@@ -379,14 +396,11 @@
 	
 	private static BooleanDataPoint getBooleanDataPoint(final CustomAttribute attr,
 			final String uri) {
-		BooleanDataPoint ret = new BooleanDataPoint(attr.getCustomAttributeName()) {
-//			public Boolean getValue() throws DataPointException, AccessException {
-//				return doGetValue();
-//			}
+		BooleanDataPoint ret = new BooleanDataPoint(DatapointType.fromShortName(attr.getCustomAttributeName())) {
 			@Override
 			public void doSetValue(Boolean val) throws DataPointException {
 				try {
-					SDTUtil.setValue(attr, val);
+					SDTUtil.setValue(attr, "xs:boolean", val);
 					updateAttribute(uri, attr);
 				} catch (Exception e) {
 					throw new DataPointException(e);
@@ -395,7 +409,7 @@
 			@Override
 			public Boolean doGetValue() throws DataPointException {
 				try {
-					return (Boolean) retrieveAttribute(uri, attr.getCustomAttributeName());
+					return (Boolean) retrieveAttribute(uri, attr.getCustomAttributeName(), "xs:boolean");
 				} catch (Exception e) {
 					throw new DataPointException(e);
 				}
@@ -406,14 +420,11 @@
 	
 	private static StringDataPoint getStringDataPoint(final CustomAttribute attr,
 			final String uri) {
-		return new StringDataPoint(attr.getCustomAttributeName()) {
-//			public String getValue() throws DataPointException, AccessException {
-//				return doGetValue();
-//			}
+		return new StringDataPoint(DatapointType.fromShortName(attr.getCustomAttributeName())) {
 			@Override
 			public void doSetValue(String val) throws DataPointException {
 				try {
-					SDTUtil.setValue(attr, val);
+					SDTUtil.setValue(attr, "xs:string", val);
 					updateAttribute(uri, attr);
 				} catch (Exception e) {
 					throw new DataPointException(e);
@@ -422,7 +433,7 @@
 			@Override
 			public String doGetValue() throws DataPointException {
 				try {
-					return (String) retrieveAttribute(uri, attr.getCustomAttributeName());
+					return (String) retrieveAttribute(uri, attr.getCustomAttributeName(), "xs:string");
 				} catch (Exception e) {
 					throw new DataPointException(e);
 				}
@@ -432,11 +443,11 @@
 	
 	private static ByteDataPoint getByteDataPoint(final CustomAttribute attr,
 			final String uri) {
-		return new ByteDataPoint(attr.getCustomAttributeName()) {
+		return new ByteDataPoint(DatapointType.fromShortName(attr.getCustomAttributeName())) {
 			@Override
 			public void doSetValue(Byte val) throws DataPointException {
 				try {
-					SDTUtil.setValue(attr, val);
+					SDTUtil.setValue(attr, "xs:byte", val);
 					updateAttribute(uri, attr);
 				} catch (Exception e) {
 					throw new DataPointException(e);
@@ -445,7 +456,7 @@
 			@Override
 			public Byte doGetValue() throws DataPointException {
 				try {
-					return (Byte) retrieveAttribute(uri, attr.getCustomAttributeName());
+					return (Byte) retrieveAttribute(uri, attr.getCustomAttributeName(), "xs:byte");
 				} catch (Exception e) {
 					throw new DataPointException(e);
 				}
@@ -455,11 +466,11 @@
 	
 	private static FloatDataPoint getFloatDataPoint(final CustomAttribute attr,
 			final String uri) {
-		return new FloatDataPoint(attr.getCustomAttributeName()) {
+		return new FloatDataPoint(DatapointType.fromShortName(attr.getCustomAttributeName())) {
 			@Override
 			public void doSetValue(Float val) throws DataPointException {
 				try {
-					SDTUtil.setValue(attr, val);
+					SDTUtil.setValue(attr, "xs:float", val);
 					updateAttribute(uri, attr);
 				} catch (Exception e) {
 					throw new DataPointException(e);
@@ -468,7 +479,7 @@
 			@Override
 			public Float doGetValue() throws DataPointException {
 				try {
-					return (Float) retrieveAttribute(uri, attr.getCustomAttributeName());
+					return (Float) retrieveAttribute(uri, attr.getCustomAttributeName(), "xs:float");
 				} catch (Exception e) {
 					throw new DataPointException(e);
 				}
@@ -478,11 +489,11 @@
 	
 	private static DateTimeDataPoint getDateTimeDataPoint(final CustomAttribute attr,
 			final String uri) {
-		return new DateTimeDataPoint(attr.getCustomAttributeName()) {
+		return new DateTimeDataPoint(DatapointType.fromShortName(attr.getCustomAttributeName())) {
 			@Override
 			public void doSetValue(Date val) throws DataPointException {
 				try {
-					SDTUtil.setValue(attr, val);
+					SDTUtil.setValue(attr, "xs:datetime", val);
 					updateAttribute(uri, attr);
 				} catch (Exception e) {
 					throw new DataPointException(e);
@@ -491,7 +502,7 @@
 			@Override
 			public Date doGetValue() throws DataPointException {
 				try {
-					return (Date) retrieveAttribute(uri, attr.getCustomAttributeName());
+					return (Date) retrieveAttribute(uri, attr.getCustomAttributeName(), "xs:datetime");
 				} catch (Exception e) {
 					throw new DataPointException(e);
 				}
@@ -501,11 +512,11 @@
 	
 	private static DateDataPoint getDateDataPoint(final CustomAttribute attr,
 			final String uri) {
-		return new DateDataPoint(attr.getCustomAttributeName()) {
+		return new DateDataPoint(DatapointType.fromShortName(attr.getCustomAttributeName())) {
 			@Override
 			public void doSetValue(Date val) throws DataPointException {
 				try {
-					SDTUtil.setValue(attr, val);
+					SDTUtil.setValue(attr, "xs:date", val);
 					updateAttribute(uri, attr);
 				} catch (Exception e) {
 					throw new DataPointException(e);
@@ -514,7 +525,7 @@
 			@Override
 			public Date doGetValue() throws DataPointException {
 				try {
-					return (Date) retrieveAttribute(uri, attr.getCustomAttributeName());
+					return (Date) retrieveAttribute(uri, attr.getCustomAttributeName(), "xs:date");
 				} catch (Exception e) {
 					throw new DataPointException(e);
 				}
@@ -524,11 +535,11 @@
 	
 	private static TimeDataPoint getTimeDataPoint(final CustomAttribute attr,
 			final String uri) {
-		return new TimeDataPoint(attr.getCustomAttributeName()) {
+		return new TimeDataPoint(DatapointType.fromShortName(attr.getCustomAttributeName())) {
 			@Override
 			public void doSetValue(Date val) throws DataPointException {
 				try {
-					SDTUtil.setValue(attr, val);
+					SDTUtil.setValue(attr, "xs:time", val);
 					updateAttribute(uri, attr);
 				} catch (Exception e) {
 					throw new DataPointException(e);
@@ -537,7 +548,7 @@
 			@Override
 			public Date doGetValue() throws DataPointException {
 				try {
-					return (Date) retrieveAttribute(uri, attr.getCustomAttributeName());
+					return (Date) retrieveAttribute(uri, attr.getCustomAttributeName(), "xs:time");
 				} catch (Exception e) {
 					throw new DataPointException(e);
 				}
@@ -547,11 +558,11 @@
 	
 	private static ArrayDataPoint<String> getArrayDataPoint(final CustomAttribute attr,
 			final String uri) {
-		return new ArrayDataPoint<String>(attr.getCustomAttributeName()) {
+		return new ArrayDataPoint<String>(DatapointType.fromShortName(attr.getCustomAttributeName())) {
 			@Override
 			public void doSetValue(List<String> val) throws DataPointException {
 				try {
-					SDTUtil.setValue(attr, val);
+					SDTUtil.setValue(attr, "xs:array", val);
 					updateAttribute(uri, attr);
 				} catch (Exception e) {
 					throw new DataPointException(e);
@@ -561,7 +572,7 @@
 			@Override
 			public List<String> doGetValue() throws DataPointException {
 				try {
-					return (List<String>) retrieveAttribute(uri, attr.getCustomAttributeName());
+					return (List<String>) retrieveAttribute(uri, attr.getCustomAttributeName(), "xs:array");
 				} catch (Exception e) {
 					throw new DataPointException(e);
 				}
@@ -569,184 +580,39 @@
 		};
 	}
 	
-	private static AlertColourCode getAlertColourCode(final CustomAttribute attr,
+	@SuppressWarnings("unchecked")
+	private static EnumDataPoint<Integer> getEnumDataPoint(String type, final CustomAttribute attr,
 			final String uri) {
-		return new AlertColourCode(attr.getCustomAttributeName()) {
-			@Override
-			public void doSetValue(Integer val) throws DataPointException {
-				try {
-					SDTUtil.setValue(attr, val);
-					updateAttribute(uri, attr);
-				} catch (Exception e) {
-					throw new DataPointException(e);
-				}
-			}
-			@Override
-			public Integer doGetValue() throws DataPointException {
-				try {
-					return (Integer) retrieveAttribute(uri, attr.getCustomAttributeName());
-				} catch (Exception e) {
-					throw new DataPointException(e);
-				}
-			}
-		};
-	}
-	
-	private static DoorState getDoorState(final CustomAttribute attr,
-			final String uri) {
-		return new DoorState(attr.getCustomAttributeName()) {
-			@Override
-			public void doSetValue(Integer val) throws DataPointException {
-				try {
-					SDTUtil.setValue(attr, val);
-					updateAttribute(uri, attr);
-				} catch (Exception e) {
-					throw new DataPointException(e);
-				}
-			}
-			@Override
-			public Integer doGetValue() throws DataPointException {
-				try {
-					return (Integer) retrieveAttribute(uri, attr.getCustomAttributeName());
-				} catch (Exception e) {
-					throw new DataPointException(e);
-				}
-			}
-		};
-	}
-	
-	private static LevelType getLevel(final CustomAttribute attr, final String uri) {
-		return new LevelType(attr.getCustomAttributeName()) {
-			@Override
-			public void doSetValue(Integer val) throws DataPointException {
-				try {
-					SDTUtil.setValue(attr, val);
-					updateAttribute(uri, attr);
-				} catch (Exception e) {
-					throw new DataPointException(e);
-				}
-			}
-			@Override
-			public Integer doGetValue() throws DataPointException {
-				try {
-					return (Integer) retrieveAttribute(uri, attr.getCustomAttributeName());
-				} catch (Exception e) {
-					throw new DataPointException(e);
-				}
-			}
-		};
-	}
-	
-	private static LockState getLockState(final CustomAttribute attr,
-			final String uri) {
-		return new LockState(attr.getCustomAttributeName()) {
-			@Override
-			public void doSetValue(Integer val) throws DataPointException {
-				try {
-					SDTUtil.setValue(attr, val);
-					updateAttribute(uri, attr);
-				} catch (Exception e) {
-					throw new DataPointException(e);
-				}
-			}
-			@Override
-			public Integer doGetValue() throws DataPointException {
-				try {
-					return (Integer) retrieveAttribute(uri, attr.getCustomAttributeName());
-				} catch (Exception e) {
-					throw new DataPointException(e);
-				}
-			}
-		};
-	}
-	
-	private static SupportedMode getSupportedMode(final CustomAttribute attr,
-			final String uri) {
-		return new SupportedMode(attr.getCustomAttributeName()) {
-			@Override
-			public void doSetValue(Integer val) throws DataPointException {
-				try {
-					SDTUtil.setValue(attr, val);
-					updateAttribute(uri, attr);
-				} catch (Exception e) {
-					throw new DataPointException(e);
-				}
-			}
-			@Override
-			public Integer doGetValue() throws DataPointException {
-				try {
-					return (Integer) retrieveAttribute(uri, attr.getCustomAttributeName());
-				} catch (Exception e) {
-					throw new DataPointException(e);
-				}
-			}
-		};
-	}
-	
-	private static Tone getTone(final CustomAttribute attr, final String uri) {
-		return new Tone(attr.getCustomAttributeName()) {
-			@Override
-			public void doSetValue(Integer val) throws DataPointException {
-				try {
-					SDTUtil.setValue(attr, val);
-					updateAttribute(uri, attr);
-				} catch (Exception e) {
-					throw new DataPointException(e);
-				}
-			}
-			@Override
-			public Integer doGetValue() throws DataPointException {
-				try {
-					return (Integer) retrieveAttribute(uri, attr.getCustomAttributeName());
-				} catch (Exception e) {
-					throw new DataPointException(e);
-				}
-			}
-		};
-	}
-	
-	private static FoamStrength getFoamStrength(final CustomAttribute attr, final String uri) {
-		return new FoamStrength(attr.getCustomAttributeName()) {
-			@Override
-			public void doSetValue(Integer val) throws DataPointException {
-				try {
-					SDTUtil.setValue(attr, val);
-					updateAttribute(uri, attr);
-				} catch (Exception e) {
-					throw new DataPointException(e);
-				}
-			}
-			@Override
-			public Integer doGetValue() throws DataPointException {
-				try {
-					return (Integer) retrieveAttribute(uri, attr.getCustomAttributeName());
-				} catch (Exception e) {
-					throw new DataPointException(e);
-				}
-			}
-		};
-	}
-	
-	private static TasteStrength getTasteStrength(final CustomAttribute attr, final String uri) {
-		return new TasteStrength(attr.getCustomAttributeName()) {
-			@Override
-			public void doSetValue(Integer val) throws DataPointException {
-				try {
-					SDTUtil.setValue(attr, val);
-					updateAttribute(uri, attr);
-				} catch (Exception e) {
-					throw new DataPointException(e);
-				}
-			}
-			@Override
-			public Integer doGetValue() throws DataPointException {
-				try {
-					return (Integer) retrieveAttribute(uri, attr.getCustomAttributeName());
-				} catch (Exception e) {
-					throw new DataPointException(e);
-				}
-			}
-		};
+		try {
+			String className = DatapointType.class.getPackage().getName() + "." 
+				+ type.substring(0, 1).toUpperCase() + type.substring(1);
+			Class<?> clazz = Class.forName(className);
+			return (EnumDataPoint<Integer>) 
+				clazz.getConstructor(Identifiers.class, EnumDataPoint.class)
+					.newInstance(DatapointType.fromShortName(attr.getCustomAttributeName()), 
+						new EnumDataPoint<Integer>(null) {
+							@Override
+							public void doSetValue(Integer val) throws DataPointException {
+								try {
+									SDTUtil.setValue(attr, "xs:enum", val);
+									updateAttribute(uri, attr);
+								} catch (Exception e) {
+									throw new DataPointException(e);
+								}
+							}
+							@Override
+							public Integer doGetValue() throws DataPointException {
+								try {
+									return (Integer) retrieveAttribute(uri, attr.getCustomAttributeName(), "xs:integer");
+								} catch (Exception e) {
+									throw new DataPointException(e);
+								}
+							}
+						});
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return null;
 	}
 
 	private static Object retrieveFlexContainer(String uri, BigInteger resultContent) {
@@ -755,6 +621,8 @@
 		request.setReturnContentType(MimeMediaType.OBJ);
 		request.setRequestContentType(MimeMediaType.OBJ);
 		request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
+		request.setFilterCriteria(new FilterCriteria());
+		request.getFilterCriteria().setLevel(BigInteger.ONE);
 //		request.setFrom(name + ":" + pwd);
 		request.setTargetId(uri);
 		request.setResultContent(resultContent);
@@ -766,7 +634,7 @@
 				? response.getContent() : null;
 	}
 
-	private static Object retrieveAttribute(String uri, String attr) throws Exception {
+	private static Object retrieveAttribute(String uri, String attr, String type) throws Exception {
 		RequestPrimitive request = new RequestPrimitive();
 		request.setOperation(Operation.RETRIEVE);
 		request.setReturnContentType(MimeMediaType.OBJ);
@@ -774,13 +642,12 @@
 		request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
 		request.setTargetId(uri);
 		request.setResultContent(ResultContent.ORIGINAL_RES);
-		Activator.logger.info("read " + attr + " -> " + request.toString(), ResourceDiscovery.class);
 
 		ResponsePrimitive response = cseService.doRequest(request);
-//		Activator.logger.info(response.toString(), ResourceDiscovery.class);
+		Activator.logger.info("read " + attr + " -> " + response.getResponseStatusCode());
 		if (! ResponseStatusCode.OK.equals(response.getResponseStatusCode()))
 			throw new Exception("Error reading cloud data: " + response.getResponseStatusCode());
-		return SDTUtil.getValue(((FlexContainer) response.getContent()).getCustomAttribute(attr));
+		return SDTUtil.getValue(((AbstractFlexContainer) response.getContent()).getCustomAttribute(attr), type);
 	}
 
 	public static void updateAttribute(final String uri, 
@@ -796,11 +663,9 @@
 		request.setOperation(Operation.UPDATE);
 		request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
 		request.setTargetId(uri);
-		Activator.logger.info("write " + customAttribute.getCustomAttributeName() 
-				+ " -> " + request.toString(), ResourceDiscovery.class);
 
 		ResponsePrimitive response = cseService.doRequest(request);
-		Activator.logger.info(response.toString(), ResourceDiscovery.class);
+		Activator.logger.info("write " + customAttribute + " -> " + response.getResponseStatusCode());
 		if (! ResponseStatusCode.UPDATED.equals(response.getResponseStatusCode()))
 			throw new Exception("Error writing cloud data: " + response.getResponseStatusCode());
 	}
@@ -818,14 +683,12 @@
 		request.setOperation(Operation.UPDATE);
 		request.setFrom(Constants.ADMIN_REQUESTING_ENTITY);
 		request.setTargetId(uri);
-		Activator.logger.info("write " + customAttributes 
-				+ " -> " + request.toString(), ResourceDiscovery.class);
 
 		ResponsePrimitive response = cseService.doRequest(request);
-		Activator.logger.info(response.toString(), ResourceDiscovery.class);
+		Activator.logger.info("invoke " + customAttributes + " -> " + response.getResponseStatusCode());
 		if (! ResponseStatusCode.UPDATED.equals(response.getResponseStatusCode()))
 			throw new Exception("Error invoking cloud action: " + response.getResponseStatusCode());
-		CustomAttribute ret = ((FlexContainer) response.getContent()).getCustomAttribute("output");
+		CustomAttribute ret = ((AbstractFlexContainer) response.getContent()).getCustomAttribute("output");
 		return (ret == null) ? null : ret.getCustomAttributeValue();
 	}
 
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.cloud/src/main/java/org/eclipse/om2m/sdt/home/cloud/SDTUtil.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.cloud/src/main/java/org/eclipse/om2m/sdt/home/cloud/SDTUtil.java
index 6ff25c7..9f01748 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.cloud/src/main/java/org/eclipse/om2m/sdt/home/cloud/SDTUtil.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.cloud/src/main/java/org/eclipse/om2m/sdt/home/cloud/SDTUtil.java
@@ -21,9 +21,9 @@
 	static final private DateFormat dateFormat = DateFormat.getDateInstance();
 	static final private DateFormat timeFormat = DateFormat.getTimeInstance();
 
-	public static Object getValue(CustomAttribute attr) throws Exception {
+	public static Object getValue(CustomAttribute attr, String type) throws Exception {
 		return (attr == null) ? null
-			: getValue(attr.getCustomAttributeValue(), attr.getCustomAttributeType());
+			: getValue(attr.getCustomAttributeValue(), type);
 	}
 	
 	public static Object getValue(String value, String type) throws Exception {
@@ -31,16 +31,7 @@
 			return null;
 		switch (type) {
 		case "xs:string": return value;
-		case "xs:integer": 
-		case "hd:alertColourCode":
-		case "hd:doorState":
-		case "hd:level":
-		case "hd:lockState":
-		case "hd:supportedMode":
-		case "hd:tone":
-		case "hd:foamStrength":
-		case "hd:tasteStrength":
-			return Integer.parseInt(value);
+		case "xs:integer": return Integer.parseInt(value);
 		case "xs:float": return Float.parseFloat(value);
 		case "xs:boolean": return Boolean.parseBoolean(value);
 		case "xs:datetime": return dateTimeFormat.parse(value);
@@ -62,28 +53,22 @@
 		case "xs:uri": return new URI(value);
 		case "xs:blob": return value;
 		default:
-			return null;
+			return type.startsWith("hd:") ? Integer.parseInt(value) : null;
 		}
 	}
 	
-	public static void setValue(CustomAttribute attr, Object val) throws Exception {
+	public static void setValue(CustomAttribute attr, String type, Object val) throws Exception {
 		if (val == null) {
 			attr.setCustomAttributeValue(null);
 			return;
 		}
-		switch (attr.getCustomAttributeType()) {
-		case "xs:string": attr.setCustomAttributeValue((String)val); return;
+		switch (type) {
+		case "xs:string":
 		case "xs:integer": 
 		case "xs:float":
 		case "xs:boolean":
 		case "xs:byte":
 		case "xs:uri":
-		case "hd:alertColourCode":
-		case "hd:doorState":
-		case "hd:liquidLevel":
-		case "hd:lockState":
-		case "hd:supportedMode":
-		case "hd:tone": 
 			attr.setCustomAttributeValue(val.toString()); return;
 		case "xs:datetime": attr.setCustomAttributeValue(dateTimeFormat.format((Date)val)); return;
 		case "xs:time": attr.setCustomAttributeValue(timeFormat.format((Date)val)); return;
@@ -97,19 +82,12 @@
 				ret += s.toString();
 			}
 			attr.setCustomAttributeValue(ret); return;
-		case "xs:blob": ;// TODO serialize byte array
+		case "xs:blob": return;// TODO serialize byte array
 		default:
+			if (type.startsWith("hd:")) 
+				attr.setCustomAttributeValue(val.toString());
 			return;
 		}
 	}
 
-//	public static void main(String[] args) {
-//		try {
-//			System.out.println(getValue("[mode1, mode2, mode3]", "xs:enum"));
-//			System.out.println(getValue(" [mode1, mode2 , mode3] ", "xs:enum"));
-//			System.out.println(getValue("  [ mode1,, mode2,  ,   mode3 ]  ", "xs:enum"));
-//		} catch (Exception e) {
-//			e.printStackTrace();
-//		}
-//	}
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.cloud/src/main/java/org/eclipse/om2m/sdt/home/cloud/Utilities.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.cloud/src/main/java/org/eclipse/om2m/sdt/home/cloud/Utilities.java
deleted file mode 100644
index 4fdcac4..0000000
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.cloud/src/main/java/org/eclipse/om2m/sdt/home/cloud/Utilities.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2016 Orange.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.om2m.sdt.home.cloud;
-
-import java.io.BufferedInputStream;
-import java.io.BufferedOutputStream;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.io.Reader;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-public class Utilities {
-
-	/**
-	 * Instantiates a new string utilities.
-	 */
-	private Utilities() {
-	}
-
-	/**
-	 * Checks the case-dependent equality of 2 objects (either both null or same
-	 * strings).
-	 * 
-	 * @param s1
-	 *            the first object
-	 * @param s2
-	 *            the second object
-	 * @return true, if successful
-	 */
-	public static boolean equals(final Object s1, final Object s2) {
-		return (s1 == null) ? (s2 == null) : s1.equals(s2);
-	}
-
-	/**
-	 * Checks if a string is null or empty.
-	 * 
-	 * @param str
-	 *            the string
-	 * @return true, if is null or empty
-	 */
-	public static boolean isEmpty(final String str) {
-		return (str == null) || str.trim().equals("");
-	}
-
-	public static boolean isEmpty(final Object obj) {
-		return (obj == null) || obj.toString().trim().equals("");
-	}
-
-	/**
-	 */
-	public static boolean isEmpty(final Collection coll) {
-		return (coll == null) || coll.isEmpty();
-	}
-
-	/**
-	 */
-	public static boolean isEmpty(final Object[] coll) {
-		return (coll == null) || (coll.length == 0);
-	}
-
-	/**
-	 * Checks if a string is a non empty string.
-	 * 
-	 * @param str
-	 *            the string
-	 * @return true, if is not empty
-	 */
-	public static boolean isNotEmpty(final String str) {
-		return (str != null) && !str.trim().equals("");
-	}
-
-	/**
-	 * @param in
-	 * @return
-	 * @throws IOException
-	 */
-	public static String readLine(final InputStream in) throws IOException {
-		return readLine(new InputStreamReader(in, "UTF-8"));
-	}
-	
-	public static String readLine(final InputStream in, final boolean skipComments) throws IOException {
-		return readLine(new InputStreamReader(in, "UTF-8"), skipComments);
-	}
-
-	public static String readLine(final Reader in) throws IOException {
-		return readLine(in, false);
-	}
-	
-	public static String readLine(final Reader in, final boolean skipComments) throws IOException {
-		BufferedReader br = null;
-		try {
-			br = new BufferedReader(in);
-			StringBuffer result = new StringBuffer();
-			String line;
-			while ((line = br.readLine()) != null) {
-				if (! (skipComments && (line.startsWith("#") || line.trim().startsWith("//"))))
-					result.append(line);
-			}
-			return result.toString();
-		} finally {
-			try {
-				br.close();
-			} catch (Exception ignored) {
-			}
-		}
-	}
-
-	public static void copyToFile(final InputStream in, final File out)
-		throws IOException {
-		try {
-			OutputStream fos = new FileOutputStream(out);
-			try {
-				copyInOut(in, fos);
-			} finally {
-				try { fos.close(); }
-				catch(Exception igored) {}
-			}
-		} finally {
-			try { in.close(); }
-			catch(Exception igored) {}
-		}
-	}
-
-	/**
-	 * Copies an input stream into an output stream.
-	 * 
-	 * @param in
-	 *            the input stream
-	 * @param out
-	 *            the output stream
-	 * @throws IOException
-	 *             Signals that an I/O exception has occurred.
-	 */
-	public static void copyInOut(final InputStream in, final OutputStream out)
-			throws IOException {
-		BufferedInputStream bis = new BufferedInputStream(in);
-		BufferedOutputStream bos = new BufferedOutputStream(out);
-		byte[] c = new byte[512];
-		int number = 0;
-		while ((number = bis.read(c)) != -1) {
-			bos.write(c, 0, number);
-		}
-		bos.flush();
-	}
-
-	public static List readLines(final Reader in, final boolean skipComments) throws IOException {
-		BufferedReader br = null;
-		List ret = new ArrayList();
-		try {
-			br = new BufferedReader(in);
-			String line;
-			while ((line = br.readLine()) != null) {
-				line = line.trim();
-				if (! (skipComments && (line.equals("") || line.startsWith("#") || line.startsWith("//"))))
-					ret.add(line);
-			}
-			return ret;
-		} finally {
-			try {
-				br.close();
-			} catch (Exception ignored) {
-			}
-		}
-	}
-
-}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.driver/META-INF/MANIFEST.MF b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.driver/META-INF/MANIFEST.MF
index 35bf195..8c38189 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.driver/META-INF/MANIFEST.MF
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.driver/META-INF/MANIFEST.MF
@@ -6,6 +6,7 @@
 Bundle-RequiredExecutionEnvironment: JavaSE-1.7
 Bundle-ClassPath: .
 Import-Package: org.eclipse.om2m.sdt,
+ org.eclipse.om2m.sdt.exceptions,
  org.eclipse.om2m.sdt.home.devices,
  org.eclipse.om2m.sdt.home.modules,
  org.osgi.framework,
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.driver/src/main/java/org/eclipse/om2m/sdt/home/driver/Logger.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.driver/src/main/java/org/eclipse/om2m/sdt/home/driver/Logger.java
index 322dfe7..7af041f 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.driver/src/main/java/org/eclipse/om2m/sdt/home/driver/Logger.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.driver/src/main/java/org/eclipse/om2m/sdt/home/driver/Logger.java
@@ -38,7 +38,7 @@
 		print(LogService.LOG_DEBUG, null, message);
 	}
 
-	public final void debug(final String message, final Class clazz) {
+	public final void debug(final String message, final Class<?> clazz) {
 		print(LogService.LOG_DEBUG, clazz, message);
 	}
 
@@ -46,7 +46,7 @@
 		print(LogService.LOG_INFO, null, message);
 	}
 
-	public final void info(final String message, final Class clazz) {
+	public final void info(final String message, final Class<?> clazz) {
 		print(LogService.LOG_INFO, clazz, message);
 	}
 
@@ -58,11 +58,11 @@
 		print(LogService.LOG_WARNING, null, message, e);
 	}
 
-	public final void warning(final String message, final Class clazz) {
+	public final void warning(final String message, final Class<?> clazz) {
 		print(LogService.LOG_WARNING, clazz, message);
 	}
 
-	public final void warning(final String message, final Class clazz, final Throwable e) {
+	public final void warning(final String message, final Class<?> clazz, final Throwable e) {
 		print(LogService.LOG_WARNING, clazz, message, e);
 	}
 
@@ -74,15 +74,15 @@
 		print(LogService.LOG_ERROR, null, message, e);
 	}
 
-	public final void error(final String message, final Class clazz) {
+	public final void error(final String message, final Class<?> clazz) {
 		print(LogService.LOG_ERROR, clazz, message);
 	}
 
-	public final void error(final String message, final Class clazz, final Throwable e) {
+	public final void error(final String message, final Class<?> clazz, final Throwable e) {
 		print(LogService.LOG_ERROR, clazz, message, e);
 	}
 
-	private final void print(final int level, final Class clazz, final String message) {
+	private final void print(final int level, final Class<?> clazz, final String message) {
 		String msg = PREFIX + protocol + ((clazz == null) ? "] " : "." + clazz.getSimpleName() + "] ") + message;
 		if (logService != null)
 			logService.log(level, msg);
@@ -90,7 +90,7 @@
 			System.out.println(LEVELS[level-1] + msg);
 	}
 
-	private final void print(final int level, final Class clazz, final String message, final Throwable e) {
+	private final void print(final int level, final Class<?> clazz, final String message, final Throwable e) {
 		String msg = PREFIX + protocol + ((clazz == null) ? "] " : "." + clazz.getSimpleName() + "] ") + message;
 		if (logService != null)
 			logService.log(level, msg, e);
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.driver/src/main/java/org/eclipse/om2m/sdt/home/driver/PersistedDevice.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.driver/src/main/java/org/eclipse/om2m/sdt/home/driver/PersistedDevice.java
index a4d76d3..a836554 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.driver/src/main/java/org/eclipse/om2m/sdt/home/driver/PersistedDevice.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.driver/src/main/java/org/eclipse/om2m/sdt/home/driver/PersistedDevice.java
@@ -16,18 +16,20 @@
 import org.osgi.service.cm.ConfigurationException;
 import org.osgi.service.cm.ManagedService;
 
+@SuppressWarnings({ "rawtypes", "unchecked" })
 public class PersistedDevice implements ManagedService {
 
 	private GenericDevice device;
-	private ServiceRegistration registration;
+	private ServiceRegistration<?> registration;
 	private Logger logger;
 	
 	PersistedDevice(GenericDevice device) {
 		this.device = device;
-		logger = new Logger(device.getProtocol());
+		String protocol = device.getProtocol();
+		logger = new Logger((protocol == null) ? "Driver" : protocol);
 	}
 	
-	void setRegistration(ServiceRegistration registration) {
+	void setRegistration(ServiceRegistration<?> registration) {
 		this.registration = registration;
 	}
 
@@ -42,12 +44,12 @@
 		}
 	}
 	
-	public boolean updateDevice(Dictionary props) {
+	public boolean updateDevice(Dictionary<?,?> props) {
 		boolean modified = false;
 		for (Enumeration keys = props.keys(); keys.hasMoreElements(); ) {
 			String key = (String)keys.nextElement();
 			String val = (String)props.get(key);
-			Property old = device.getProperty(key);
+			Property old = device.getProperty(key, false);
 			if (old == null) {
 				// Not a valid property: ignore (cannot add dynamically new properties)
 				logger.info("Unknown property (not SDT): " + key + "/" + val);
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.driver/src/main/java/org/eclipse/om2m/sdt/home/driver/Utils.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.driver/src/main/java/org/eclipse/om2m/sdt/home/driver/Utils.java
index 6543fed..e97403a 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.driver/src/main/java/org/eclipse/om2m/sdt/home/driver/Utils.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.driver/src/main/java/org/eclipse/om2m/sdt/home/driver/Utils.java
@@ -7,7 +7,6 @@
  *******************************************************************************/
 package org.eclipse.om2m.sdt.home.driver;
 
-import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Dictionary;
@@ -21,13 +20,13 @@
 import org.eclipse.om2m.sdt.home.devices.GenericDevice;
 import org.eclipse.om2m.sdt.home.modules.GenericSensor;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.cm.Configuration;
 import org.osgi.service.cm.ConfigurationAdmin;
 import org.osgi.service.cm.ManagedService;
 
+@SuppressWarnings({ "rawtypes", "unchecked" })
 public class Utils {
 
 	static public final String SERVICE_PID = org.osgi.framework.Constants.SERVICE_PID;
@@ -53,6 +52,9 @@
 	static public List<ServiceRegistration> register(GenericDevice device, 
 			BundleContext context) {
 		String protocol = device.getProtocol();
+		if (protocol == null) {
+			protocol = "Unknown";
+		}
 		Logger log = new Logger(protocol);
 		List<ServiceRegistration> regs = new ArrayList<ServiceRegistration>();
 		regs.add(context.registerService(getSDTNames(device),
@@ -76,7 +78,7 @@
 						if (prop.getValue() != null)
 							props.put(prop.getName(), prop.getValue());
 					}
-					props.put(Constants.SERVICE_PID, device.getPid());
+					props.put(SERVICE_PID, "P_" + device.getPid());
 					log.info("persist: " + props);
 					pDev.setRegistration(context.registerService(ManagedService.class.getName(),
 							pDev, props));
@@ -90,6 +92,8 @@
 	}
 	
 	static public void setProperties(ServiceReference ref, GenericDevice device) {
+		String name = null;
+		String manuf = null;
 		for (String prop : ref.getPropertyKeys()) {
 			if (prop.equalsIgnoreCase(Utils.SERVICE_PID)
 					|| prop.equalsIgnoreCase(Utils.SERVICE_ID)
@@ -104,17 +108,15 @@
 			if (prop.equals(Utils.DEVICE_DESCRIPTION))
 				device.setDeviceAliasName(val.toString());
 			else if (prop.equals(Utils.DEVICE_MANUFACTURER))
-				device.setDeviceManufacturer(val.toString());
+				manuf = val.toString();
 			else if (prop.equals(Utils.DEVICE_PRODUCT_CLASS))
 				device.setDeviceModelName(val.toString());
 			else if (prop.equals(Utils.DEVICE_FRIENDLY_NAME))
-				device.setDeviceName(val.toString());
-			else device.setProperty(prop, val.toString());
+				name = val.toString();
+//			else device.setProperty(prop, Utils.DEVICE_FRIENDLY_NAME, val.toString());
 		}
-		if (device.getDeviceManufacturer() == null)
-			device.setDeviceManufacturer("Unknown");
-		if (device.getDeviceName() == null)
-			device.setDeviceModelName(device.getSerialNumber());
+		device.setDeviceManufacturer((manuf != null) ? manuf : "Unknown");
+		device.setDeviceName((name != null) ? name : device.getSerialNumber());
 	}
 	
 	static public final boolean equals(final String s1, final String s2) {
@@ -153,6 +155,14 @@
 		if (elt instanceof Device) {
 			props.put(SDT_ID, elt.getName());
 			props.put(SERVICE_PID, ((Device)elt).getPid());
+			String desc = null;
+			try {
+				desc = ((GenericDevice)elt).getDeviceModelName();
+				if (desc == null) desc = ((GenericDevice)elt).getDeviceAliasName();
+				if (desc == null) desc = ((GenericDevice)elt).getDeviceName();
+			} catch(Exception ignored) {}
+			if (desc == null) desc = ((GenericDevice)elt).getSerialNumber();
+			props.put(DEVICE_DESCRIPTION, desc);
 			sdtProps = ((Device)elt).getProperties();
 		} else if (elt instanceof Module) {
 			props.put(SERVICE_PID, ((Module)elt).getPid());
@@ -176,15 +186,13 @@
 		return cfgAdmin;
 	}
 	
-	static private final Configuration getConfiguration(BundleContext bc , String pid) throws IOException {
-		Configuration config = null;
-		
-		ConfigurationAdmin configAdmin = getConfigurationAdmin(bc);
-		if (configAdmin != null) {
-			config = configAdmin.getConfiguration(pid);
-		}
-		
-		return config;
-	}
+//	static private final Configuration getConfiguration(BundleContext bc , String pid) throws IOException {
+//		Configuration config = null;
+//		ConfigurationAdmin configAdmin = getConfigurationAdmin(bc);
+//		if (configAdmin != null) {
+//			config = configAdmin.getConfiguration(pid);
+//		}
+//		return config;
+//	}
 
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/Activator.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/Activator.java
index 35af075..cdbeb3b 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/Activator.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/Activator.java
@@ -30,6 +30,7 @@
 import org.osgi.service.log.LogService;
 import org.osgi.util.tracker.ServiceTracker;
 
+@SuppressWarnings({ "unchecked", "rawtypes" })
 public class Activator implements BundleActivator, EventHandler {
 	
 	static private final String PROTOCOL = "EnOcean";
@@ -99,7 +100,7 @@
 
 	private void initDevicesTracker() {
 		enOceanDeviceTracker = new ServiceTracker(context, EnOceanDevice.class.getName(), null) {
-            public void removedService(ServiceReference ref, Object service) {
+			public void removedService(ServiceReference ref, Object service) {
             	EnOceanDevice device = (EnOceanDevice) service;
         		logger.info("Removed EnOcean device " + device);
         		EnOceanSDTDevice dev = sdtDevices.remove(device.getChipId());
@@ -148,7 +149,7 @@
 		}
 	}
 
-	private EnOceanSDTDevice createSDTDevice(ServiceReference ref) {
+	private EnOceanSDTDevice createSDTDevice(ServiceReference<?> ref) {
 		logger.info("Added EnOcean ref " + ref);
 		for (String key : ref.getPropertyKeys()) {
 			Object prop = ref.getProperty(key);
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/EOFloodDetector.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/EOFloodDetector.java
index 0189467..f1ba143 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/EOFloodDetector.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/EOFloodDetector.java
@@ -19,15 +19,18 @@
 import org.eclipse.om2m.sdt.home.modules.AbstractAlarmSensor;
 import org.eclipse.om2m.sdt.home.modules.FaultDetection;
 import org.eclipse.om2m.sdt.home.modules.WaterSensor;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.enocean.EnOceanDevice;
 import org.osgi.service.enocean.EnOceanMessage;
 
+@SuppressWarnings("rawtypes")
 public class EOFloodDetector extends FloodDetector implements EnOceanSDTDevice {
 
 	private final EnOceanDevice eoDevice;
 	private Domain domain;
+	
 	private List<ServiceRegistration> registrations;
 	private BundleContext context;
 
@@ -91,7 +94,7 @@
 	}
 
 	private void addWaterSensor() {
-		alarm = new BooleanDataPoint("alarm") {
+		alarm = new BooleanDataPoint(DatapointType.alarm) {
 			@Override
 			public Boolean doGetValue() throws DataPointException {
 				return floodDetected;
@@ -108,7 +111,7 @@
 
 	private void addFaultDetection() {
 		faultDetection = new FaultDetection("FaultDetection_" + eoDevice.getChipId(), domain,
-				new BooleanDataPoint("status") {
+				new BooleanDataPoint(DatapointType.status) {
 			@Override
 			public Boolean doGetValue() throws DataPointException {
 				return false;
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/EOLight.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/EOLight.java
index 5a1a6f3..e0ff486 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/EOLight.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/EOLight.java
@@ -24,11 +24,13 @@
 import org.eclipse.om2m.sdt.home.modules.ColourSaturation;
 import org.eclipse.om2m.sdt.home.modules.FaultDetection;
 import org.eclipse.om2m.sdt.home.modules.RunMode;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.enocean.EnOceanDevice;
 import org.osgi.service.enocean.EnOceanMessage;
 
+@SuppressWarnings("rawtypes")
 public class EOLight extends Light implements EnOceanSDTDevice {
 
 	private EnOceanDevice eoDevice;
@@ -54,6 +56,7 @@
 			Activator.logger.warning("Error addFaultDetection", e);
 		}
 		try {
+//			addRunState();
 			addRunMode();
 		} catch (Exception e) {
 			Activator.logger.warning("Error addRunMode", e);
@@ -90,7 +93,7 @@
 	private void addBinarySwitch() {
 		BinarySwitch binarySwitch = new BinarySwitch("BinarySwitch_" + eoDevice.getChipId(), 
 			domain,
-			new BooleanDataPoint("powerState") {
+			new BooleanDataPoint(DatapointType.powerState) {
 				@Override
 				public Boolean doGetValue() throws DataPointException {
 					return false;
@@ -107,7 +110,7 @@
 	private void addFaultDetection() {
 		FaultDetection faultDetection = new FaultDetection("FaultDetection_" + eoDevice.getChipId(), 
 			domain,
-			new BooleanDataPoint("status") {
+			new BooleanDataPoint(DatapointType.status) {
 				@Override
 				public Boolean doGetValue() throws DataPointException {
 					return false;
@@ -116,9 +119,46 @@
 		addModule(faultDetection);
 	}
 
+//	private void addRunState() {
+//		RunState runState = new RunState("RunState_" + eoDevice.getChipId(), domain, 
+//			new JobStates(new EnumDataPoint<Integer>(null) {
+//				@Override
+//				public void doSetValue(Integer val) throws DataPointException {
+//					throw new DataPointException("Not implemented");
+//				}
+//				@Override
+//				public Integer doGetValue() throws DataPointException {
+//					return null;
+//				}
+//			}), 
+//			new ArrayDataPoint<Integer>(DatapointType.jobStates) {
+//				@Override
+//				public List<Integer> doGetValue() throws DataPointException {
+//					return null;
+//				}
+//			},
+//			new MachineState(new EnumDataPoint<Integer>(null) {
+//				@Override
+//				public void doSetValue(Integer val) throws DataPointException {
+//					throw new DataPointException("Not implemented");
+//				}
+//				@Override
+//				public Integer doGetValue() throws DataPointException {
+//					return null;
+//				}
+//			}), 
+//			new ArrayDataPoint<Integer>(DatapointType.machineStates) {
+//				@Override
+//				public List<Integer> doGetValue() throws DataPointException {
+//					return null;
+//				}
+//			});
+//		addModule(runState);
+//	}
+
 	private void addRunMode() {
 		RunMode runMode = new RunMode("RunMode_" + eoDevice.getChipId(), domain, 
-			new ArrayDataPoint<String>("operationMode") {
+			new ArrayDataPoint<String>(DatapointType.operationMode) {
 				@Override
 				public void doSetValue(List<String> values) throws DataPointException {
 					throw new DataPointException("Not implemented");
@@ -128,7 +168,7 @@
 					return null;
 				}
 			}, 
-			new ArrayDataPoint<String>("supportedModes") {
+			new ArrayDataPoint<String>(DatapointType.supportedModes) {
 				@Override
 				public void doSetValue(List<String> value) throws DataPointException {
 					throw new DataPointException("Not implemented");
@@ -143,7 +183,7 @@
 
 	private void addColour() {
 		Colour colour = new Colour("colour_" + eoDevice.getChipId(), domain, 
-			new IntegerDataPoint("red") {
+			new IntegerDataPoint(DatapointType.red) {
 				@Override
 				public void doSetValue(Integer value) throws DataPointException {
 				}
@@ -152,7 +192,7 @@
 					return null;
 				}
 			}, 
-			new IntegerDataPoint("green") {
+			new IntegerDataPoint(DatapointType.green) {
 				@Override
 				public void doSetValue(Integer value) throws DataPointException {
 				}
@@ -161,7 +201,7 @@
 					return null;
 				}
 			}, 
-			new IntegerDataPoint("blue") {
+			new IntegerDataPoint(DatapointType.blue) {
 				@Override
 				public void doSetValue(Integer value) throws DataPointException {
 				}
@@ -176,7 +216,7 @@
 	private void addColourSaturation() {
 		ColourSaturation colourSaturation = new ColourSaturation("colourSaturation_" + eoDevice.getChipId(), 
 			domain,
-			new IntegerDataPoint("colourSaturation") {
+			new IntegerDataPoint(DatapointType.colourSat) {
 				@Override
 				public void doSetValue(Integer value) throws DataPointException {
 				}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/EOLightBlindControl.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/EOLightBlindControl.java
index 8e005a2..4ed6965 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/EOLightBlindControl.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/EOLightBlindControl.java
@@ -19,11 +19,13 @@
 import org.eclipse.om2m.sdt.home.modules.FaultDetection;
 import org.eclipse.om2m.sdt.home.modules.PushButton;
 import org.eclipse.om2m.sdt.home.modules.SmokeSensor;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.enocean.EnOceanDevice;
 import org.osgi.service.enocean.EnOceanMessage;
 
+@SuppressWarnings("rawtypes")
 public class EOLightBlindControl extends SwitchButton implements EnOceanSDTDevice {
 	
 	private final EnOceanDevice eoDevice;
@@ -116,7 +118,7 @@
 	}
 	
 	private void addPushButton() {
-		pushed = new BooleanDataPoint("pushed") {
+		pushed = new BooleanDataPoint(DatapointType.pushed) {
 			@Override
 			public void doSetValue(Boolean v) throws DataPointException {
 				val = v;
@@ -132,7 +134,7 @@
 
 	private void addFaultDetection() {
 		faultDetection = new FaultDetection("FaultDetection_" + eoDevice.getChipId(), domain, 
-				new BooleanDataPoint("status") {
+				new BooleanDataPoint(DatapointType.status) {
 			@Override
 			public Boolean doGetValue() throws DataPointException {
 				return false;
@@ -142,7 +144,7 @@
 	}
 	
 	private void addSmokeSensor() {
-		status = new BooleanDataPoint("alarm") {
+		status = new BooleanDataPoint(DatapointType.alarm) {
 			@Override
 			public Boolean doGetValue() throws DataPointException {
 				Activator.logger.info("alarm: " + val);
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/EOSmokeDetector.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/EOSmokeDetector.java
index f8569db..fbe82b3 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/EOSmokeDetector.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/EOSmokeDetector.java
@@ -19,11 +19,13 @@
 import org.eclipse.om2m.sdt.home.enocean.Activator.EnOceanSDTDevice;
 import org.eclipse.om2m.sdt.home.modules.FaultDetection;
 import org.eclipse.om2m.sdt.home.modules.SmokeSensor;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.enocean.EnOceanDevice;
 import org.osgi.service.enocean.EnOceanMessage;
 
+@SuppressWarnings("rawtypes")
 public class EOSmokeDetector extends SmokeDetector implements EnOceanSDTDevice {
 	
 	static private final String[] NU1_MODES = new String[] {
@@ -118,7 +120,7 @@
 
 	private void addFaultDetection() {
 		faultDetection = new FaultDetection("FaultDetection_" + eoDevice.getChipId(), domain, 
-				new BooleanDataPoint("status") {
+				new BooleanDataPoint(DatapointType.status) {
 			@Override
 			public Boolean doGetValue() throws DataPointException {
 				return false;
@@ -128,7 +130,7 @@
 	}
 	
 	private void addSmokeSensor() {
-		status = new BooleanDataPoint("alarm") {
+		status = new BooleanDataPoint(DatapointType.alarm) {
 			@Override
 			public Boolean doGetValue() throws DataPointException {
 				Activator.logger.info("alarm: " + val);
@@ -138,7 +140,7 @@
 		smokeSensor = new SmokeSensor("SmokeSensor_" + eoDevice.getChipId(), domain, status);
 		addModule(smokeSensor);
 		
-		smokeSensor.setDetectedTime(new IntegerDataPoint("detectedTime") {
+		smokeSensor.setDetectedTime(new IntegerDataPoint(DatapointType.detectedTime) {
 			@Override
 			protected Integer doGetValue() throws DataPointException {
 				return detectedTime;
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/EOWaterValve.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/EOWaterValve.java
index ad29b93..3c1cf3b 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/EOWaterValve.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.enocean/src/main/java/org/eclipse/om2m/sdt/home/enocean/EOWaterValve.java
@@ -12,13 +12,14 @@
 import org.eclipse.om2m.sdt.Domain;
 import org.eclipse.om2m.sdt.Event;
 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
+import org.eclipse.om2m.sdt.datapoints.EnumDataPoint;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
 import org.eclipse.om2m.sdt.home.devices.WaterValve;
 import org.eclipse.om2m.sdt.home.driver.Utils;
 import org.eclipse.om2m.sdt.home.enocean.Activator.EnOceanSDTDevice;
 import org.eclipse.om2m.sdt.home.modules.FaultDetection;
-import org.eclipse.om2m.sdt.home.modules.Level;
-import org.eclipse.om2m.sdt.home.types.LevelType;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
+import org.eclipse.om2m.sdt.home.types.LiquidLevel;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.enocean.EnOceanDevice;
@@ -26,6 +27,7 @@
 import org.osgi.service.enocean.EnOceanMessage;
 import org.osgi.service.enocean.EnOceanRPC;
 
+@SuppressWarnings("rawtypes")
 public class EOWaterValve extends WaterValve implements EnOceanSDTDevice {
 
 	protected EnOceanDevice eoDevice;
@@ -35,10 +37,10 @@
 	private BundleContext context;
 
 	private FaultDetection faultDetection;
-	private Level waterLevel;
+	private org.eclipse.om2m.sdt.home.modules.LiquidLevel waterLevel;
 	
-	private LevelType liquidLevelDP;
-	private Integer liquidLevel = LevelType.maximum;
+	private LiquidLevel liquidLevelDP;
+	private Integer liquidLevel = LiquidLevel.maximum;
 
 	public EOWaterValve(EnOceanDevice device, Domain domain,
 			String serial, BundleContext context) {
@@ -95,10 +97,10 @@
 		String msg;
 		if (feedback == 1) {
 			msg = "Closed";
-			liquidLevel = LevelType.zero;
+			liquidLevel = LiquidLevel.zero;
 		} else if (feedback == 2) {
 			msg = "Opened";
-			liquidLevel = LevelType.maximum;
+			liquidLevel = LiquidLevel.maximum;
 		} else {
 			msg = "Not defined";
 			liquidLevel = null;
@@ -112,7 +114,7 @@
 	}
 
 	private void addWaterLevel() {
-		liquidLevelDP = new LevelType("liquidLevel") {
+		liquidLevelDP = new LiquidLevel(new EnumDataPoint<Integer>(null) {
 			@Override
 			public void doSetValue(Integer value) throws DataPointException {
 				try {
@@ -129,16 +131,16 @@
 					throw new DataPointException("Unknown");
 				return liquidLevel;
 			}
-		};
-		waterLevel = new Level("Level_" + eoDevice.getChipId(), domain, null, liquidLevelDP);
+		});
+		waterLevel = new org.eclipse.om2m.sdt.home.modules.LiquidLevel("Level_" + eoDevice.getChipId(), domain, liquidLevelDP);
 		
-		Activator.logger.info("add Level module: " + waterLevel);
+		Activator.logger.info("add LiquidLevel module: " + waterLevel);
 		addModule(waterLevel);
 	}
 
 	private void addFaultDetection() {
 		faultDetection = new FaultDetection("FaultDetection_" + eoDevice.getChipId(), domain, 
-				new BooleanDataPoint("status") {
+				new BooleanDataPoint(DatapointType.status) {
 			@Override
 			public Boolean doGetValue() throws DataPointException {
 				return false;
@@ -150,10 +152,10 @@
 	private void turn(int value) throws DataPointException {
 		final String command;
 		switch (value) {
-		case LevelType.zero:
+		case LiquidLevel.zero:
 			command = "HARDCODED_TURN_OFF";
 			break;
-		case LevelType.maximum:
+		case LiquidLevel.maximum:
 			command = "HARDCODED_APPAIR_TURN_ON";
 			break;
 		default:
@@ -189,7 +191,7 @@
 		};
 
 		Activator.logger.info("Water pump available, " 
-				+ ((value == LevelType.zero) ? "close it!" : "Open it!"),
+				+ ((value == LiquidLevel.zero) ? "close it!" : "Open it!"),
 			EOWaterValve.class);
 		eoDevice.invoke(appairRPC, handlerTurnRPC);
 		Activator.logger.info("OK!", EOWaterValve.class);
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/META-INF/MANIFEST.MF b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/META-INF/MANIFEST.MF
index 8efc884..32dfc29 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/META-INF/MANIFEST.MF
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/META-INF/MANIFEST.MF
@@ -14,6 +14,7 @@
  org.eclipse.om2m.sdt.home.devices,
  org.eclipse.om2m.sdt.home.driver,
  org.eclipse.om2m.sdt.home.modules,
+ org.eclipse.om2m.sdt.home.types,
  org.osgi.framework,
  org.osgi.service.cm,
  org.osgi.service.log
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/LIFXDevice.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/LIFXDevice.java
index c8a7fec..102b076 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/LIFXDevice.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/LIFXDevice.java
@@ -21,7 +21,7 @@
 	private double brightness;

 	

 	/** kelvin: from 2500 to 9000 */ 

-	private long kelvin;

+	private double kelvin;

 	

 	/** power: 0=off, 65535=on */ 

 	private int power;

@@ -175,13 +175,13 @@
 	 * @return kelvin value from 2500 to 9000

 	 * @throws Exception

 	 */

-	public long getKelvin(){

+	public double getKelvin(){

 		return kelvin;

 	}

 	

-	public abstract long getKelvinRemotely() throws Exception;

+	public abstract double getKelvinRemotely() throws Exception;

 	

-	public long getKelvin(boolean cache) throws Exception {

+	public double getKelvin(boolean cache) throws Exception {

 		if (cache) {

 			return getKelvin();

 		} else {

@@ -193,7 +193,7 @@
 	 * 

 	 * @param kelvin value from 2500 to 9000

 	 */

-	public void setKelvin(long kelvin) {

+	public void setKelvin(double kelvin) {

 		this.kelvin = kelvin;

 		updateLastDataFromDevice();

 	}

@@ -238,7 +238,7 @@
 	}

 	

 	

-	public abstract void setLightState(int newPower, double newHue, double newSaturation, long newKelvin, double newBrightness, int duration) throws Exception;

+	public abstract void setLightState(int newPower, double newHue, double newSaturation, double newKelvin, double newBrightness, int duration) throws Exception;

 

 	public String getLabel()  throws Exception {

 		return label;

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/Activator.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/Activator.java
index db7d08b..ba680e3 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/Activator.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/Activator.java
@@ -37,6 +37,7 @@
 import org.osgi.service.cm.ManagedService;

 import org.osgi.service.log.LogService;

 

+@SuppressWarnings({"rawtypes", "unchecked"})

 public class Activator implements BundleActivator, ManagedService, LIFXDiscoveredDeviceListener {

 

 	private static final String MODE = "mode";

@@ -77,8 +78,8 @@
 

 		Dictionary properties = new Hashtable<>();

 		properties.put(Constants.SERVICE_PID, "lifx.basedriver");

-		managedServiceServiceRegistration = bundleContext.registerService(ManagedService.class.getName(), this,

-				properties);

+		managedServiceServiceRegistration = 

+			bundleContext.registerService(ManagedService.class.getName(), this, properties);

 

 		currentMode = NO_MODE;

 	}

@@ -87,7 +88,6 @@
 		try {

 			managedServiceServiceRegistration.unregister();

 			managedServiceServiceRegistration = null;

-

 			stopMode();

 		} catch (Exception e) {

 			e.printStackTrace();

@@ -95,13 +95,11 @@
 	}

 

 	@Override

-	public void updated(Dictionary properties) throws ConfigurationException {

+	public synchronized void updated(Dictionary properties) throws ConfigurationException {

 		try {

 			if (properties != null) {

-

 				// retrieve mode

 				String mode = (String) properties.get(MODE);

-

 				if (mode != null) {

 					if (CLOUD_MODE_NAME.equals(mode)) {

 						// cloud mode

@@ -112,23 +110,18 @@
 					} else {

 						System.out.println("invalid LIFX Basedriver mode -> nothing to do");

 					}

-

 				}

-

 			}

 		} catch (Exception e) {

 			e.printStackTrace();

 		}

-

 	}

 

 	private void handleLanMode(Dictionary properties) {

 		String networkInterfaceName = (String) properties.get(NETWORK_INTERFACE_NAME);

 		if (networkInterfaceName != null) {

-

 			NetworkInterface ni;

 			InetAddress localInetAddress = null;

-

 			try {

 				ni = NetworkInterface.getByInetAddress(InetAddress.getByName(networkInterfaceName));

 				if (ni != null) {

@@ -145,21 +138,17 @@
 				System.out.println("localInetAddress=" + localInetAddress);

 			} catch (SocketException e) {

 			} catch (UnknownHostException e1) {

-				// TODO Auto-generated catch block

 				e1.printStackTrace();

 			}

 			if (localInetAddress != null) {

 				// valid configuration

 				stopMode();

-

 				currentMode = LAN_MODE;

 				address = localInetAddress;

-

 				try {

 					startMode();

 				} catch (UnknownHostException e) {

 				}

-

 			}

 		}

 	}

@@ -181,11 +170,9 @@
 			try {

 				startMode();

 			} catch (UnknownHostException e) {

-				// TODO Auto-generated catch block

 				e.printStackTrace();

 			}

 		}

-

 	}

 

 	@Override

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/Logger.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/Logger.java
index 655740a..bbcb391 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/Logger.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/Logger.java
@@ -23,9 +23,27 @@
 		logService = pLogService;

 	}

 	

-	public void info(Class clazz, String msg) {

+	public void info(Class<?> clazz, String msg) {

 		if (logService != null) {

 			logService.log(LogService.LOG_INFO, "[" + clazz.getName() + "] " + msg);

+		} else {

+			System.out.println("INFO [" + clazz.getName() + "] " + msg);

+		}

+	}

+	

+	public void warning(Class<?> clazz, String msg) {

+		if (logService != null) {

+			logService.log(LogService.LOG_WARNING, "[" + clazz.getName() + "] " + msg);

+		} else {

+			System.out.println("WARNING [" + clazz.getName() + "] " + msg);

+		}

+	}

+	

+	public void error(Class<?> clazz, String msg) {

+		if (logService != null) {

+			logService.log(LogService.LOG_ERROR, "[" + clazz.getName() + "] " + msg);

+		} else {

+			System.out.println("ERROR [" + clazz.getName() + "] " + msg);

 		}

 	}

 	

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/cloud/DiscoveryCloud.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/cloud/DiscoveryCloud.java
index 501c91c..8cb2a90 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/cloud/DiscoveryCloud.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/cloud/DiscoveryCloud.java
@@ -23,10 +23,10 @@
 import java.util.TimerTask;

 

 import org.eclipse.om2m.sdt.home.lifx.impl.Discovery;

+import org.eclipse.om2m.sdt.home.lifx.impl.Logger;

 import org.json.simple.JSONArray;

 import org.json.simple.JSONObject;

 import org.json.simple.parser.JSONParser;

-import org.json.simple.parser.ParseException;

 

 public class DiscoveryCloud extends Discovery {

 

@@ -50,23 +50,19 @@
 	public DiscoveryCloud(final String pAuthenticationToken) {

 		authenticationToken = pAuthenticationToken;

 		timerTask = new TimerTask() {

-

 			@Override

 			public void run() {

 				retrieveLIFXDevices();

-

 			}

 		};

 	}

 

+	@SuppressWarnings("rawtypes")

 	public void retrieveLIFXDevices() {

 		JSONArray jsonArray = retrieveLIFXDevice(null, authenticationToken);

-

 		if (jsonArray != null) {

-

 			for (Iterator it = jsonArray.iterator(); it.hasNext();) {

 				JSONObject jsonLifxDevice = (JSONObject) it.next();

-

 				LIFXDeviceCloud lifxDeviceCloud = LIFXDeviceCloud.fromJson(jsonLifxDevice, this.authenticationToken);

 				addOrRemoveLIFXDevice(lifxDeviceCloud);

 			}

@@ -102,24 +98,11 @@
 				String finalLine = "";

 				while ((line = br.readLine()) != null) {

 					finalLine += line;

-

 				}

-				JSONParser parser = new JSONParser();

-				JSONArray jsonObject = (JSONArray) parser.parse(finalLine);

-

-				return jsonObject;

-

+				return (JSONArray) new JSONParser().parse(finalLine);

 			}

-

-		} catch (MalformedURLException e) {

-			// TODO Auto-generated catch block

-			e.printStackTrace();

-		} catch (IOException e) {

-			// TODO Auto-generated catch block

-			e.printStackTrace();

-		} catch (ParseException e) {

-			// TODO Auto-generated catch block

-			e.printStackTrace();

+		} catch (Exception e) {

+			Logger.getInstance().warning(DiscoveryCloud.class, e.toString());

 		}

 		return null;

 	}

@@ -156,17 +139,18 @@
 

 	@Override

 	public void startDiscoveryTask() {

+		Logger.getInstance().info(DiscoveryCloud.class, "Start discovery");

 		timer = new Timer();

 		timer.schedule(timerTask, 0, 30000);

 	}

 

 	@Override

 	public void stopDiscoveryTask() {

+		Logger.getInstance().info(DiscoveryCloud.class, "Stop discovery");

 		if (timer != null) {

 			timer.cancel();

 			timer = null;

 		}

-		

 	}

 

 	public static void updateLightState(LIFXDeviceCloud lifxDevice) {

@@ -177,7 +161,7 @@
 	}

 

 	public static void setLightPower(LIFXDeviceCloud lifxDevice, String power, Double hue, Double saturation,

-			Long kelvin, Double brightness, Double duration) throws MalformedURLException, IOException {

+			Double kelvin, Double brightness, Double duration) throws MalformedURLException, IOException {

 		HttpURLConnection httpUrlConnection = null;

 		httpUrlConnection = (HttpURLConnection) new URL(LIGHT_URL + lifxDevice.getId() + "/state").openConnection();

 		httpUrlConnection.setRequestMethod("PUT");

@@ -213,7 +197,6 @@
 		}

 		data += "}";

 		

-

 		httpUrlConnection.setDoOutput(true);

 		httpUrlConnection.setDoInput(true);

 

@@ -230,7 +213,6 @@
 		synchronized (devices) {

 			toBeReturned.addAll(devices.values());

 		}

-

 		return toBeReturned;

 	}

 

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/cloud/LIFXDeviceCloud.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/cloud/LIFXDeviceCloud.java
index 5ded793..e797947 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/cloud/LIFXDeviceCloud.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/cloud/LIFXDeviceCloud.java
@@ -47,7 +47,7 @@
 	 * 

 	 */

 	public LIFXDeviceCloud(final String id, final String uuid, final String label, final boolean connected,

-			String power, final double hue, final double saturation, final long kelvin, final double brightness,

+			String power, final double hue, final double saturation, final double kelvin, final double brightness,

 			final String authenticationToken) {

 		super(id);

 		this.uuid = uuid;

@@ -126,7 +126,7 @@
 	}

 

 	@Override

-	public long getKelvinRemotely() throws Exception {

+	public double getKelvinRemotely() throws Exception {

 		DiscoveryCloud.updateLightState(this);

 		return super.getKelvin();

 	}

@@ -144,7 +144,7 @@
 	}

 

 	@Override

-	public void setLightState(int newPower, double newHue, double newSaturation, long newKelvin, double newBrightness,

+	public void setLightState(int newPower, double newHue, double newSaturation, double newKelvin, double newBrightness,

 			int duration) throws Exception {

 		DiscoveryCloud.setLightPower(this, (newPower == 0 ? "off" : "on"), newHue / 65535d * 360d,

 				newSaturation / 65535d, newKelvin, newBrightness / 65535d, (double) duration);

@@ -163,10 +163,10 @@
 		String power = (String) json.get(POWER);

 		Boolean connected = (Boolean) json.get(CONNECTED);

 		JSONObject colorJsonObject = (JSONObject) json.get(COLOR);

-		double hue = (double) colorJsonObject.get(HUE);

-		double saturation = (double) colorJsonObject.get(SATURATION);

-		long kelvin = (long) colorJsonObject.get(KELVIN);

-		double brightness = (double) json.get(BRIGHTNESS);

+		double hue = getDoubleValue(colorJsonObject.get(HUE));

+		double saturation = getDoubleValue(colorJsonObject.get(SATURATION));

+		double kelvin = getDoubleValue(colorJsonObject.get(KELVIN));

+		double brightness = getDoubleValue(json.get(BRIGHTNESS));

 

 		// convert cloud value to lan value

 		// hue (0 to 360) -> (0 to 65535)

@@ -187,11 +187,11 @@
 		String power = (String) json.get(POWER);

 		Boolean connected = (Boolean) json.get(CONNECTED);

 		JSONObject colorJsonObject = (JSONObject) json.get(COLOR);

-		double hue = (double) colorJsonObject.get(HUE);

-		double saturation = (double) colorJsonObject.get(SATURATION);

-		long kelvin = (long) colorJsonObject.get(KELVIN);

-		double brightness = (double) json.get(BRIGHTNESS);

-

+		double hue = getDoubleValue(colorJsonObject.get(HUE));

+		double saturation = getDoubleValue(colorJsonObject.get(SATURATION));

+		double kelvin = getDoubleValue(colorJsonObject.get(KELVIN));

+		double brightness = getDoubleValue(json.get(BRIGHTNESS));

+		

 		// convert cloud value to lan value

 		// hue (0 to 360) -> (0 to 65535)

 		hue = hue / 360d * 65535d;

@@ -208,4 +208,15 @@
 		super.setKelvin(kelvin);

 		super.setBrightness(brightness);

 	}

+	

+	private static double getDoubleValue(Object object) {

+		double value = 0;

+		try {

+			value = (double) object;

+		} catch (Exception e) {

+			value = (long) object;

+		}

+		

+		return value;

+	}

 }

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/lan/LIFXDeviceLan.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/lan/LIFXDeviceLan.java
index 8ae85b2..639287d 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/lan/LIFXDeviceLan.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/lan/LIFXDeviceLan.java
@@ -86,7 +86,7 @@
 		return super.getBrightness();

 	}

 	

-	public long getKelvinRemotely() throws Exception {

+	public double getKelvinRemotely() throws Exception {

 		executeGetLightMessage();

 		return super.getKelvin();

 	}

@@ -101,7 +101,7 @@
 	}

 	

 	@Override

-	public void setLightState(int newPower, double newHue, double newSaturation, long newKelvin, double newBrightness, int duration)

+	public void setLightState(int newPower, double newHue, double newSaturation, double newKelvin, double newBrightness, int duration)

 			throws Exception {

 		executeSetPowerMessage(newPower, duration);

 		executeSetColorMessage((int)newHue, (int)newSaturation, (int)newBrightness, (int) newKelvin, duration);

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/lan/Server.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/lan/Server.java
index 91593f1..9438f46 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/lan/Server.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/impl/lan/Server.java
@@ -8,6 +8,7 @@
 package org.eclipse.om2m.sdt.home.lifx.impl.lan;

 

 import java.io.IOException;

+import java.net.SocketTimeoutException;

 import java.net.DatagramPacket;

 import java.net.DatagramSocket;

 import java.net.InetAddress;

@@ -57,10 +58,12 @@
 	

 	public void init(InetAddress pLocalInetAddress) {

 		try {

+			toBeStopped = false;

 			localInetAddress = pLocalInetAddress;

 			datagramSocket = new DatagramSocket(56700, localInetAddress);

 			datagramSocket.setReuseAddress(true);

-			

+			datagramSocket.setSoTimeout(1000); // 1 s timeout on the datagram socket

+

 		} catch (Exception e) {

 			e.printStackTrace();

 

@@ -75,7 +78,7 @@
 	}

 

 	public void stopServer() {

-		if (toBeStopped != false) {

+		if (toBeStopped == false) {

 			toBeStopped = true;

 			datagramSocket.disconnect();

 			datagramSocket.close();

@@ -84,6 +87,7 @@
 				serverThread.join();

 			} catch (InterruptedException e) {

 			}

+			Logger.getInstance().info(Server.class, "DatagramSocket closed");

 		}

 		

 		

@@ -102,12 +106,13 @@
 				Thread t = new Thread(rph);

 				t.start();

 				

+			} catch (SocketTimeoutException e) {

+				// ignore

 			} catch (Exception e) {

 				e.printStackTrace();

 			}

-				

-		}

 

+		}

 	}

 

 	protected void notify(LIFXGlobalFrame globalFrame) {

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/sdt/LIFXSDTDevice.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/sdt/LIFXSDTDevice.java
index 466ca07..24f3841 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/sdt/LIFXSDTDevice.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.lifx/src/main/java/org/eclipse/om2m/sdt/home/lifx/sdt/LIFXSDTDevice.java
@@ -15,6 +15,7 @@
 import org.eclipse.om2m.sdt.home.lifx.LIFXDevice;

 import org.eclipse.om2m.sdt.home.modules.BinarySwitch;

 import org.eclipse.om2m.sdt.home.modules.Colour;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

 

 public class LIFXSDTDevice extends Light {

 	

@@ -36,120 +37,94 @@
 		setProtocol("LIFX");

 		

 		// binary switch module

-		BinarySwitch binarySwitch = new BinarySwitch(getSerialNumber() + "_BinarySwitch", domain, new BooleanDataPoint("powerState") {

-			

-			@Override

-			protected Boolean doGetValue() throws DataPointException {

-				int lifxPower;

-				try {

-					lifxPower = lifxDevice.getPower(false);

-				} catch (Exception e) {

-					throw new DataPointException("Error when retrieving power state:" + e.getMessage());

-				}

-				// at this point, we are sure 

-				if (lifxPower == 0) {

-					// off

-					return false;

-				} else {

-					// on

-					return true;

+		BinarySwitch binarySwitch = new BinarySwitch(getSerialNumber() + "_BinarySwitch", domain,

+			new BooleanDataPoint(DatapointType.powerState) {

+				@Override

+				protected Boolean doGetValue() throws DataPointException {

+					try {

+						return lifxDevice.getPower(false) != 0;

+					} catch (Exception e) {

+						throw new DataPointException("Error when retrieving power state:" + e.getMessage());

+					}

 				}

 				

-			}

-			

-			@Override

-			protected void doSetValue(Boolean value) throws DataPointException {

-				try {

-					lifxDevice.setPower((value ? 65535 : 0), 0);

-				} catch (Exception e) {

-					throw new DataPointException("Error when setting power state:" + e.getMessage());

+				@Override

+				protected void doSetValue(Boolean value) throws DataPointException {

+					try {

+						lifxDevice.setPower((value ? 65535 : 0), 0);

+					} catch (Exception e) {

+						throw new DataPointException("Error when setting power state:" + e.getMessage());

+					}

 				}

-			}

-		});

+			});

 		addModule(binarySwitch);

 		

-		Colour colourModule = new Colour(getSerialNumber() + "_Colour", domain, new IntegerDataPoint("red") {

-			

-			@Override

-			protected Integer doGetValue() throws DataPointException {

-				int color;

-				try {

-					color = getColor(0);

-				} catch (Exception e) {

-					throw new DataPointException(e.getMessage());

+		Colour colourModule = new Colour(getSerialNumber() + "_Colour", domain, 

+			new IntegerDataPoint(DatapointType.red) {

+				@Override

+				protected Integer doGetValue() throws DataPointException {

+					try {

+						return getColor(0);

+					} catch (Exception e) {

+						throw new DataPointException(e.getMessage());

+					}

 				}

-				return color;

-			}

-			

-			@Override

-			protected void doSetValue(Integer value) throws DataPointException {

-				try {

-					setColor(0, value);

-				} catch (Exception e) {

-					throw new DataPointException(e.getMessage());

+				@Override

+				protected void doSetValue(Integer value) throws DataPointException {

+					try {

+						setColor(0, value);

+					} catch (Exception e) {

+						throw new DataPointException(e.getMessage());

+					}

 				}

-			}

-		},  new IntegerDataPoint("green") {

-			

-			@Override

-			protected Integer doGetValue() throws DataPointException {

-				int color;

-				try {

-					color = getColor(1);

-				} catch (Exception e) {

-					throw new DataPointException(e.getMessage());

+			},  

+			new IntegerDataPoint(DatapointType.green) {

+				@Override

+				protected Integer doGetValue() throws DataPointException {

+					try {

+						return getColor(1);

+					} catch (Exception e) {

+						throw new DataPointException(e.getMessage());

+					}

 				}

-				return color;

-			}

-			

-			@Override

-			protected void doSetValue(Integer value) throws DataPointException {

-				try {

-					setColor(1, value);

-				} catch (Exception e) {

-					throw new DataPointException(e.getMessage());

+				@Override

+				protected void doSetValue(Integer value) throws DataPointException {

+					try {

+						setColor(1, value);

+					} catch (Exception e) {

+						throw new DataPointException(e.getMessage());

+					}

 				}

-			}

-			

-		},  new IntegerDataPoint("blue") {

-			

-			@Override

-			protected Integer doGetValue() throws DataPointException {

-				int color;

-				try {

-					color = getColor(2);

-				} catch (Exception e) {

-					throw new DataPointException(e.getMessage());

+			},  

+			new IntegerDataPoint(DatapointType.blue) {

+				@Override

+				protected Integer doGetValue() throws DataPointException {

+					try {

+						return getColor(2);

+					} catch (Exception e) {

+						throw new DataPointException(e.getMessage());

+					}

 				}

-				return color;

-			}

-			

-			@Override

-			protected void doSetValue(Integer value) throws DataPointException {

-				try {

-					setColor(2, value);

-				} catch (Exception e) {

-					throw new DataPointException(e.getMessage());

+				@Override

+				protected void doSetValue(Integer value) throws DataPointException {

+					try {

+						setColor(2, value);

+					} catch (Exception e) {

+						throw new DataPointException(e.getMessage());

+					}

 				}

-			}

-		});

-		

+			});

 		addModule(colourModule);

-		

-		

 	}

 

-

 	private static String computeLifxDeviceId(LIFXDevice pLIFXDevice) {

 		return pLIFXDevice.getId().replaceAll(":", "_");

 	}

 

-

 	private static String computeLifxDeviceSerial(LIFXDevice pLIFXDevice) {

 		return pLIFXDevice.getId().replaceAll(":", "_");

 	}

 

-	

 	private void setColor(int colorIndex, int colorValue) throws Exception {

 		// get current state

 		int h = Math.round((float)(lifxDevice.getHue() / 65565d * 360d));

@@ -315,9 +290,4 @@
 		return out;

 	}

 	

-	

-

-	

-	

-

 }

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/Activator.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/Activator.java
index 3366efd..c89322d 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/Activator.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/Activator.java
@@ -30,6 +30,8 @@
 public class Activator implements BundleActivator {

 

 	static private final String PROTOCOL = "Mocked";

+	static private final String MANUFACTURER = "MockedManufacturer";

+	static private final String ALIAS = "Simulated device for ";

 	

 	static private BundleContext context;

 	static public Logger logger;

@@ -37,7 +39,7 @@
 	private List<GenericDevice> devices;

 	private Domain domain = new Domain("home");

 	private boolean running;

-	private int counter = 1;

+	private int counter = (int)(Math.random() * 100);

 

 	@Override

 	public void start(BundleContext ctxt) throws Exception {

@@ -52,13 +54,20 @@
 			running = true;

 			devices = new ArrayList<GenericDevice>();

 			

-			devices.add(new MockedSmartElectricMeter(getName(), getSerial(), domain));

-			devices.add(new MockedWaterValve(getName(), getSerial(), domain));

-			devices.add(new MockedSmokeDetector(getName(), getSerial(), domain));

-			devices.add(new MockedWarningDevice(getName(), getSerial(), domain));

-			devices.add(new MockedFloodDetector(getName(), getSerial(), domain));

-			devices.add(new MockedDoor(getName(), getSerial(), domain));

-			devices.add(new MockedCamera(getName(), getSerial(), domain));

+//			devices.add(new MockedWaterValve(getId(), getSerial(), domain));

+//			devices.add(new MockedSmokeDetector(getId(), getSerial(), domain));

+//			devices.add(new MockedWarningDevice(getId(), getSerial(), domain));

+//			devices.add(new MockedFloodDetector(getId(), getSerial(), domain));

+//			devices.add(new MockedSmartElectricMeter(getId(), getSerial(), domain));

+			devices.add(new MockedLight(getId(), getSerial(), domain));

+			devices.add(new MockedDoor(getId(), getSerial(), domain, true));

+			devices.add(new MockedDoor(getId(), getSerial(), domain, false));

+			devices.add(new MockedCamera(getId(), getSerial(), domain));

+			devices.add(new MockedWeatherStation(getId(), getSerial(), domain));

+//			devices.add(new MockedThermometer(getId(), getSerial(), domain));

+//			devices.add(new MockedThermostat(getId(), getSerial(), domain));

+//			devices.add(new MockedDoor(getId(), getSerial(), domain));

+//			devices.add(new MockedCamera(getId(), getSerial(), domain));

 			

 			for (GenericDevice dev : devices) {

 				install(dev);

@@ -68,7 +77,7 @@
 				@Override

 				public void run() {

 					while (running) {

-						GenericDevice light = new MockedLight(getName(), getSerial(), domain);

+						GenericDevice light = new MockedLight(getId(), getSerial(), domain);

 						devices.add(light);

 						logger.info("\n*************************************************");

 						logger.info("start new light " + light);

@@ -81,7 +90,7 @@
 						}

 					}

 				}

-			}).start();

+			});//.start();

 

 		} catch (Exception e) {

 			e.printStackTrace();

@@ -89,13 +98,11 @@
 	}

 

 	private void install(GenericDevice dev) {

-		String name = dev.getClass().getSimpleName();

-		if (dev instanceof MockedLight)

-			name += " " + (counter-1);

+		String name = dev.getClass().getSimpleName() + " " + dev.getName();

 		dev.setDeviceName(name);

-		dev.setDeviceAliasName("Simulated device for " + name);

+		dev.setDeviceAliasName(ALIAS + name);

 		dev.setProtocol(PROTOCOL);

-		dev.setDeviceManufacturer("MockedManufacturer");

+		dev.setDeviceManufacturer(MANUFACTURER);

 		logger.info("register " + dev);

 		((MockedDevice)dev).registerDevice();

 	}

@@ -117,11 +124,12 @@
 	 * @param bundleContext

 	 * @return true if successful registration

 	 */

+	@SuppressWarnings("rawtypes")

 	public static List<ServiceRegistration> register(GenericDevice device) {

 		return Utils.register(device, context);

 	}

 	

-	private final String getName() {

+	private final String getId() {

 		return "mocked_" + counter;

 	}

 	

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedCamera.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedCamera.java
index bf61a8b..2ac8635 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedCamera.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedCamera.java
@@ -16,8 +16,10 @@
 import org.eclipse.om2m.sdt.home.devices.Camera;
 import org.eclipse.om2m.sdt.home.mocked.modules.MockedStreaming;
 import org.eclipse.om2m.sdt.home.modules.PersonSensor;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.osgi.framework.ServiceRegistration;
 
+@SuppressWarnings("rawtypes")
 public class MockedCamera extends Camera implements MockedDevice {
 
 	private List<ServiceRegistration> serviceRegistrations;
@@ -26,10 +28,10 @@
 		super(id, serial, domain);
 
 		// Module FaultDetection
-		addModule(new MockedStreaming("mockedStreaming-" + id, domain));
+		addModule(new MockedStreaming("streaming_" + id, domain));
 
 		addModule(new PersonSensor("personSensor_" + id, domain, 
-			new ArrayDataPoint<String>("detectedPersons") {
+			new ArrayDataPoint<String>(DatapointType.detectedPersons) {
 				@Override
 				public List<String> doGetValue() throws DataPointException {
 					return Arrays.asList("admin", "Phil");
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedDoor.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedDoor.java
index ec07b7b..9e88dc7 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedDoor.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedDoor.java
@@ -10,27 +10,29 @@
 import java.util.List;
 
 import org.eclipse.om2m.sdt.Domain;
+import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
 import org.eclipse.om2m.sdt.home.devices.Door;
+import org.eclipse.om2m.sdt.home.mocked.modules.MockedBattery;
 import org.eclipse.om2m.sdt.home.mocked.modules.MockedDoorStatus;
-import org.eclipse.om2m.sdt.home.mocked.modules.MockedFaultDetection;
 import org.eclipse.om2m.sdt.home.mocked.modules.MockedLock;
 import org.osgi.framework.ServiceRegistration;
 
+@SuppressWarnings("rawtypes")
 public class MockedDoor extends Door implements MockedDevice {
 
 	private List<ServiceRegistration> serviceRegistrations;
 
-	public MockedDoor(String id, String serial, Domain domain) {
+	public MockedDoor(String id, String serial, Domain domain, boolean openOnly) {
 		super(id, serial, domain);
 
-		// Module FaultDetection
-		addModule(new MockedFaultDetection("faultDetection_" + id, domain));
+		// Module Battery
+		addModule(new MockedBattery("battery_" + id, domain));
 
 		// Module DoorStatus
 		addModule(new MockedDoorStatus("doorStatus_" + id, domain));
 
-		// Module Lock
-		addModule(new MockedLock("lock_" + id, domain));
+		// Module Door
+		addModule(new MockedLock("lock_" + id, domain, openOnly));
 		
 		setLocation("Porte d\'entree");
 	}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedFloodDetector.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedFloodDetector.java
index db25d40..fad5b8e 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedFloodDetector.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedFloodDetector.java
@@ -16,8 +16,10 @@
 import org.eclipse.om2m.sdt.home.devices.FloodDetector;
 import org.eclipse.om2m.sdt.home.mocked.modules.MockedFaultDetection;
 import org.eclipse.om2m.sdt.home.modules.WaterSensor;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.osgi.framework.ServiceRegistration;
 
+@SuppressWarnings("rawtypes")
 public class MockedFloodDetector extends FloodDetector implements MockedDevice {
 
 	private List<ServiceRegistration> serviceRegistrations;
@@ -30,7 +32,7 @@
 		super(id, serial, domain);
 		
 		waterSensor = new WaterSensor("waterSensor_" + id, domain, 
-			new BooleanDataPoint("alarm") {
+			new BooleanDataPoint(DatapointType.alarm) {
 				@Override
 				public Boolean doGetValue() throws DataPointException {
 					return waterAlarm;
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedLight.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedLight.java
index c14accf..2f981d0 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedLight.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedLight.java
@@ -7,7 +7,6 @@
  *******************************************************************************/

 package org.eclipse.om2m.sdt.home.mocked.devices;

 

-import java.util.Arrays;

 import java.util.List;

 

 import org.eclipse.om2m.sdt.Domain;

@@ -19,8 +18,10 @@
 import org.eclipse.om2m.sdt.home.mocked.modules.MockedFaultDetection;

 import org.eclipse.om2m.sdt.home.mocked.modules.MockedRunMode;

 import org.eclipse.om2m.sdt.home.modules.ColourSaturation;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

 import org.osgi.framework.ServiceRegistration;

 

+@SuppressWarnings("rawtypes")

 public class MockedLight extends Light implements MockedDevice {

 

 	private List<ServiceRegistration> serviceRegistrations;

@@ -34,14 +35,15 @@
 		// Module BinarySwitch

 		addModule(new MockedBinarySwitch("binarySwitch_" + id, domain));

 

-		// Module RunMode

+		// Module RunState

+//		addModule(new MockedRunState("runMode_" + id, domain));

 		addModule(new MockedRunMode("runMode_" + id, domain));

 

-		// Module Colour

+		// Module Color

 		addModule(new MockedColour("colour_" + id, domain));

 

 		addModule(new ColourSaturation("colourSaturation_" + id, domain, 

-			new IntegerDataPoint("colourSaturation") {

+			new IntegerDataPoint(DatapointType.colourSat) {

 				private Integer v = new Integer((int)(Math.random() * 100));

 				@Override

 				public void doSetValue(Integer value) throws DataPointException {

@@ -59,12 +61,6 @@
 		if (! ((serviceRegistrations == null) || serviceRegistrations.isEmpty())) {

 			return;

 		}

-		try {

-			getRunMode().setSupportedModes(Arrays.asList("mode1", "mode2", "mode3"));

-			getRunMode().setOperationMode(Arrays.asList("mode1", "mode3"));

-		} catch (Exception e) {

-			Activator.logger.warning("", e);

-		}

 		serviceRegistrations = Activator.register(this);

 	}

 

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedSmartElectricMeter.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedSmartElectricMeter.java
index 567315b..f756e45 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedSmartElectricMeter.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedSmartElectricMeter.java
@@ -7,7 +7,6 @@
  *******************************************************************************/

 package org.eclipse.om2m.sdt.home.mocked.devices;

 

-import java.util.Arrays;

 import java.util.List;

 

 import org.eclipse.om2m.sdt.DataPoint;

@@ -23,6 +22,7 @@
 import org.eclipse.om2m.sdt.home.mocked.modules.MockedFaultDetection;

 import org.eclipse.om2m.sdt.home.mocked.modules.MockedRunMode;

 import org.eclipse.om2m.sdt.home.modules.EnergyConsumption;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

 import org.osgi.framework.ServiceRegistration;

 

 public class MockedSmartElectricMeter extends SmartElectricMeter implements MockedDevice {

@@ -40,7 +40,7 @@
 

 		// EnergyConsumption

 		energyConsumption = new MockedEnergyConsumption("energyConsumption_" + id, domain, 

-			new FloatDataPoint("power") {

+			new FloatDataPoint(DatapointType.power) {

 				@Override

 				public Float doGetValue() throws DataPointException {

 					return power;

@@ -55,8 +55,9 @@
 		addModule(new MockedClock("clock_" + id, domain));

 		

 		// runMode

+//		addModule(new MockedRunState("runState_" + id, domain));

 		addModule(new MockedRunMode("runMode_" + id, domain));

-		

+

 		// energyGeneration

 		addModule(new MockedEnergyGeneration("energyGeneration_" + id, domain));

 	}

@@ -68,12 +69,6 @@
 			return;

 		}

 		serviceRegistrations = Activator.register(this);

-		try {

-			getRunMode().setSupportedModes(Arrays.asList("mode1", "mode2", "mode3", "mode4"));

-			getRunMode().setOperationMode(Arrays.asList("mode2", "mode3"));

-		} catch (Exception e) {

-			Activator.logger.warning("", e);

-		}

 

 		new Thread(new Runnable() {

 			@Override

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedSmokeDetector.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedSmokeDetector.java
index a4ffebd..1d4c97a 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedSmokeDetector.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedSmokeDetector.java
@@ -17,8 +17,10 @@
 import org.eclipse.om2m.sdt.home.devices.SmokeDetector;
 import org.eclipse.om2m.sdt.home.mocked.modules.MockedFaultDetection;
 import org.eclipse.om2m.sdt.home.modules.SmokeSensor;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.osgi.framework.ServiceRegistration;
 
+@SuppressWarnings("rawtypes")
 public class MockedSmokeDetector extends SmokeDetector implements MockedDevice {
 
 	private List<ServiceRegistration> serviceRegistrations;
@@ -31,14 +33,14 @@
 		super(id, serial, domain);
 		
 		smokeSensor = new SmokeSensor("smokeSensor_" + id, domain, 
-			new BooleanDataPoint("alarm") {
+			new BooleanDataPoint(DatapointType.alarm) {
 				@Override
 				public Boolean doGetValue() throws DataPointException {
 					return smokeAlarm;
 				}
 			});
 		
-		smokeSensor.setDetectedTime(new IntegerDataPoint("detectedTime") {
+		smokeSensor.setDetectedTime(new IntegerDataPoint(DatapointType.detectedTime) {
 			@Override
 			protected Integer doGetValue() throws DataPointException {
 				return detectedTime;
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedThermometer.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedThermometer.java
new file mode 100644
index 0000000..52faa9e
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedThermometer.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.home.mocked.devices;
+
+import java.util.List;
+
+import org.eclipse.om2m.sdt.Domain;
+import org.eclipse.om2m.sdt.Event;
+import org.eclipse.om2m.sdt.datapoints.FloatDataPoint;
+import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.devices.TemperatureDetector;
+import org.eclipse.om2m.sdt.home.mocked.modules.MockedTemperature;
+import org.eclipse.om2m.sdt.home.modules.Temperature;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
+import org.osgi.framework.ServiceRegistration;
+
+@SuppressWarnings("rawtypes")
+public class MockedThermometer extends TemperatureDetector implements MockedDevice {
+	
+	static private final int MIN = 15;
+	static private final int MAX = 35;
+
+	private List<ServiceRegistration> serviceRegistrations;
+	private float temp;
+	private Temperature temperature;
+	private boolean running;
+	private int delta;
+
+	public MockedThermometer(String id, String serial, Domain domain) {
+		super(id, serial, domain);
+		
+		temperature = new MockedTemperature("temperature_" + id, domain, 
+			new FloatDataPoint(DatapointType.currentTemperature) {
+				@Override
+				public Float doGetValue() throws DataPointException {
+					return temp;
+				}
+			});
+		addModule(temperature);
+	}
+
+	public void registerDevice() {
+		running = true;
+		if (! ((serviceRegistrations == null) || serviceRegistrations.isEmpty())) {
+			// already registered
+			return;
+		}
+		serviceRegistrations = Activator.register(this);
+	}
+
+	public void unregisterDevice() {
+		running = false;
+		if (serviceRegistrations == null)
+			return;
+		for (ServiceRegistration reg : serviceRegistrations) {
+			reg.unregister();
+		}
+		serviceRegistrations.clear();
+	}
+	
+	private class ThermoThread extends Thread {
+		public void run() {
+			while (running) {
+				try {
+					sleep(20000);
+					float oldT = temp;
+					temp += delta;
+					if ((temp <= MIN) || (temp >= MAX)) {
+						delta = -delta;
+					}
+//					informListeners(oldT);
+					Event evt = new Event("ALARM");
+					evt.addDataPoint(temperature.getDataPoint("currentTemperature"));
+					evt.setValue(temp);
+					temperature.addEvent(evt);
+//					sleep(2000);
+//					sendEvent();
+				} catch (InterruptedException e) {
+					running = false;
+				}
+			}
+		}
+	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedThermostat.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedThermostat.java
new file mode 100644
index 0000000..88a6e83
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedThermostat.java
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.home.mocked.devices;
+
+import java.util.List;
+
+import org.eclipse.om2m.sdt.Domain;
+import org.eclipse.om2m.sdt.datapoints.FloatDataPoint;
+import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.devices.Thermostat;
+import org.eclipse.om2m.sdt.home.mocked.modules.MockedTemperature;
+import org.eclipse.om2m.sdt.home.modules.Temperature;
+import org.eclipse.om2m.sdt.home.modules.Timer;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
+import org.osgi.framework.ServiceRegistration;
+
+@SuppressWarnings("rawtypes")
+public class MockedThermostat extends Thermostat implements MockedDevice {
+
+	private List<ServiceRegistration> serviceRegistrations;
+	private float currentTemp;
+	private float targetTemp;
+	private Temperature temperature;
+	private boolean running;
+
+	public MockedThermostat(String id, String serial, Domain domain) {
+		super(id, serial, domain);
+		
+		temperature = new MockedTemperature("temperature_" + id, domain, 
+				new FloatDataPoint(DatapointType.currentTemperature) {
+				@Override
+				public Float doGetValue() throws DataPointException {
+					return currentTemp;
+				}
+			});
+		
+		temperature.setTargetTemperature(new FloatDataPoint(DatapointType.targetTemperature) {
+			@Override
+			protected Float doGetValue() throws DataPointException {
+				return targetTemp;
+			}
+			@Override
+			protected void doSetValue(Float temp) throws DataPointException {
+				targetTemp = temp;
+			}
+		});
+		addModule(temperature);
+		
+		Timer timer = new Timer("timer_" + id, domain);
+//		timer.setActivated(new BooleanDataPoint(DatapointType.activated) {
+//			@Override
+//			protected Boolean doGetValue() throws DataPointException {
+//				return running;
+//			}
+//			@Override
+//			protected void doSetValue(Boolean b) throws DataPointException {
+//				running = b;
+//			}
+//		});
+		addModule(timer);
+	}
+
+	public void registerDevice() {
+		running = true;
+		if (! ((serviceRegistrations == null) || serviceRegistrations.isEmpty())) {
+			// already registered
+			return;
+		}
+		serviceRegistrations = Activator.register(this);
+	}
+
+	public void unregisterDevice() {
+		running = false;
+		if (serviceRegistrations == null)
+			return;
+		for (ServiceRegistration reg : serviceRegistrations) {
+			reg.unregister();
+		}
+		serviceRegistrations.clear();
+	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedWarningDevice.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedWarningDevice.java
index 2dcb385..5a2bb51 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedWarningDevice.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedWarningDevice.java
@@ -15,6 +15,7 @@
 import org.eclipse.om2m.sdt.home.mocked.modules.MockedFaultDetection;

 import org.osgi.framework.ServiceRegistration;

 

+@SuppressWarnings("rawtypes")

 public class MockedWarningDevice extends WarningDevice implements MockedDevice {

 

 	private List<ServiceRegistration> serviceRegistrations;

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedWaterValve.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedWaterValve.java
index eb76ed0..01877f1 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedWaterValve.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedWaterValve.java
@@ -10,13 +10,15 @@
 import java.util.List;
 
 import org.eclipse.om2m.sdt.Domain;
+import org.eclipse.om2m.sdt.datapoints.EnumDataPoint;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
 import org.eclipse.om2m.sdt.home.devices.WaterValve;
 import org.eclipse.om2m.sdt.home.mocked.modules.MockedFaultDetection;
-import org.eclipse.om2m.sdt.home.modules.Level;
-import org.eclipse.om2m.sdt.home.types.LevelType;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
+import org.eclipse.om2m.sdt.home.types.LiquidLevel;
 import org.osgi.framework.ServiceRegistration;
 
+@SuppressWarnings("rawtypes")
 public class MockedWaterValve extends WaterValve implements MockedDevice {
 
 	private List<ServiceRegistration> serviceRegistrations;
@@ -25,9 +27,9 @@
 		super(id, serial, domain);
 
 		// Datapoints
-		addModule(new Level("waterLevel_" + id, domain, 
-			new LevelType("quantity") {
-				private Integer openLevel = LevelType.zero;
+		addModule(new org.eclipse.om2m.sdt.home.modules.LiquidLevel("waterLevel_" + id, domain, 
+			new LiquidLevel(new EnumDataPoint<Integer>(DatapointType.liquidLevel) {
+				private Integer openLevel = LiquidLevel.zero;
 				@Override
 				public void doSetValue(Integer value) throws DataPointException {
 					openLevel = value;
@@ -37,16 +39,9 @@
 				public Integer doGetValue() throws DataPointException {
 					return openLevel;
 				}
-			},
-			new LevelType("status") {
-				private Integer openLevel = LevelType.zero;
-				@Override
-				public Integer doGetValue() throws DataPointException {
-					return openLevel;
-				}
-			}));
+			})));
 		
-		addModule(new MockedFaultDetection("faultDetection_" + id, domain));
+//		addModule(new MockedFaultDetection("faultDetection_" + id, domain));
 	}
 
 	public void registerDevice() {
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedWeatherStation.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedWeatherStation.java
new file mode 100644
index 0000000..72d8911
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/devices/MockedWeatherStation.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.home.mocked.devices;
+
+import java.util.List;
+
+import org.eclipse.om2m.sdt.Domain;
+import org.eclipse.om2m.sdt.Event;
+import org.eclipse.om2m.sdt.datapoints.FloatDataPoint;
+import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;
+import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.devices.WeatherStation;
+import org.eclipse.om2m.sdt.home.mocked.modules.MockedTemperature;
+import org.eclipse.om2m.sdt.home.modules.Noise;
+import org.eclipse.om2m.sdt.home.modules.RelativeHumidity;
+import org.eclipse.om2m.sdt.home.modules.Temperature;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
+import org.osgi.framework.ServiceRegistration;
+
+@SuppressWarnings("rawtypes")
+public class MockedWeatherStation extends WeatherStation implements MockedDevice {
+	
+	static private final int MIN = 15;
+	static private final int MAX = 35;
+
+	private List<ServiceRegistration> serviceRegistrations;
+	private float temp;
+	private float humidity;
+	private Temperature temperature;
+	private RelativeHumidity relativeHumidity;
+	private boolean running=true;
+	private int delta = 1;
+
+	public MockedWeatherStation(String id, String serial, Domain domain) {
+		super(id, serial, domain);
+		
+		temperature = new MockedTemperature("temperature_" + id, domain, 
+			new FloatDataPoint(DatapointType.currentTemperature) {
+				@Override
+				public Float doGetValue() throws DataPointException {
+					return temp;
+				}
+			});
+		addModule(temperature);
+		
+		relativeHumidity = new RelativeHumidity("humidity_" + id, domain, 
+			new FloatDataPoint(DatapointType.relativeHumidity) {
+				@Override
+				public Float doGetValue() throws DataPointException {
+					return humidity;
+				}
+			});
+		addModule(relativeHumidity);
+		
+		addModule(new Noise("noise_" + id, domain, 
+			new IntegerDataPoint(DatapointType.noise) {
+				@Override
+				protected Integer doGetValue() throws DataPointException {
+					return 37;
+				}
+			}));
+		
+		new MyThread().start();
+	}
+
+	public void registerDevice() {
+		running = true;
+		if (! ((serviceRegistrations == null) || serviceRegistrations.isEmpty())) {
+			// already registered
+			return;
+		}
+		serviceRegistrations = Activator.register(this);
+	}
+
+	public void unregisterDevice() {
+		running = false;
+		if (serviceRegistrations == null)
+			return;
+		for (ServiceRegistration reg : serviceRegistrations) {
+			reg.unregister();
+		}
+		serviceRegistrations.clear();
+	}
+	
+	private class MyThread extends Thread {
+		public void run() {
+			while (running) {
+				try {
+					sleep(20000);
+					temp += delta;
+					if ((temp <= MIN) || (temp >= MAX)) {
+						delta = -delta;
+					}
+					humidity = (float) (Math.random() * 100);
+					Event evt = new Event("ALARM");
+					evt.addDataPoint(temperature.getDataPointByShortName(
+							DatapointType.currentTemperature.getShortName()));
+					evt.setValue(temp);
+					temperature.addEvent(evt);
+//					sendEvent();
+				} catch (InterruptedException e) {
+					running = false;
+				}
+			}
+		}
+	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedAlarmSpeaker.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedAlarmSpeaker.java
index f1fc392..01f81dc 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedAlarmSpeaker.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedAlarmSpeaker.java
@@ -9,16 +9,18 @@
 

 import org.eclipse.om2m.sdt.Domain;

 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;

+import org.eclipse.om2m.sdt.datapoints.EnumDataPoint;

 import org.eclipse.om2m.sdt.exceptions.DataPointException;

 import org.eclipse.om2m.sdt.home.mocked.devices.Activator;

 import org.eclipse.om2m.sdt.home.modules.AlarmSpeaker;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

 import org.eclipse.om2m.sdt.home.types.Tone;

 

 public class MockedAlarmSpeaker extends AlarmSpeaker {

 	

 	public MockedAlarmSpeaker(String name, Domain domain) {

 		super(name, domain,

-			new BooleanDataPoint("alarmStatus") {

+			new BooleanDataPoint(DatapointType.alarmStatus) {

 				private boolean alarmStatus = false;

 				@Override

 				public void doSetValue(Boolean value) throws DataPointException {

@@ -32,7 +34,7 @@
 			}

 		);

 

-		setTone(new Tone("tone") {

+		setTone(new Tone(new EnumDataPoint<Integer>(null) {

 			private Integer tone = Tone.Silent;

 			@Override

 			public void doSetValue(Integer value) throws DataPointException {

@@ -43,7 +45,7 @@
 			public Integer doGetValue() throws DataPointException {

 				return tone;

 			}

-		});

+		}));

 	}

 

 }

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedBattery.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedBattery.java
new file mode 100644
index 0000000..cc25122
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedBattery.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.home.mocked.modules;
+
+import org.eclipse.om2m.sdt.Domain;
+import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
+import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;
+import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.modules.Battery;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
+
+public class MockedBattery extends Battery {
+	
+	static private final int CAPACITY = 37;
+
+	public MockedBattery(String name, Domain domain) {
+		super(name, domain, new IntegerDataPoint(DatapointType.level) {
+			@Override
+			protected Integer doGetValue() throws DataPointException {
+				return (int)(Math.random() * CAPACITY);
+			}
+		});
+		
+		setCapacity(new IntegerDataPoint(DatapointType.capacity) {
+			@Override
+			protected Integer doGetValue() throws DataPointException {
+				return CAPACITY;
+			}
+		});
+		
+		setCharging(new BooleanDataPoint(DatapointType.charging) {
+			@Override
+			protected Boolean doGetValue() throws DataPointException {
+				return true;
+			}
+		});
+		
+		setDischarging(new BooleanDataPoint(DatapointType.discharging) {
+			@Override
+			protected Boolean doGetValue() throws DataPointException {
+				return false;
+			}
+		});
+	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedBinarySwitch.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedBinarySwitch.java
index 6243f16..679b68d 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedBinarySwitch.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedBinarySwitch.java
@@ -15,12 +15,13 @@
 import org.eclipse.om2m.sdt.home.actions.Toggle;

 import org.eclipse.om2m.sdt.home.mocked.devices.Activator;

 import org.eclipse.om2m.sdt.home.modules.BinarySwitch;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

 

 public class MockedBinarySwitch extends BinarySwitch {

 

 	public MockedBinarySwitch(String name, Domain domain) {

 		super(name, domain,

-			new BooleanDataPoint("powerState") {

+			new BooleanDataPoint(DatapointType.powerState) {

 				private Boolean powerState = Boolean.TRUE;

 				@Override

 				public void doSetValue(Boolean value) throws DataPointException {

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedClock.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedClock.java
index 5d077a5..a2d084d 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedClock.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedClock.java
@@ -14,12 +14,13 @@
 import org.eclipse.om2m.sdt.datapoints.TimeDataPoint;

 import org.eclipse.om2m.sdt.exceptions.DataPointException;

 import org.eclipse.om2m.sdt.home.modules.Clock;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

 

 public class MockedClock extends Clock {

 

 	public MockedClock(String name, Domain domain) {

 		super(name, domain,

-			new TimeDataPoint("currentTime") {

+			new TimeDataPoint(DatapointType.currentTime) {

 				private Date d = new Date();

 				@Override

 				public void doSetValue(Date value) throws DataPointException {

@@ -30,7 +31,7 @@
 					return d;

 				}

 			}, 

-			new DateDataPoint("currentDate") {

+			new DateDataPoint(DatapointType.currentDate) {

 				private Date d = new Date();

 				@Override

 				public void doSetValue(Date value) throws DataPointException {

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedColour.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedColour.java
index 471fa68..c14377e 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedColour.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedColour.java
@@ -7,49 +7,90 @@
  *******************************************************************************/

 package org.eclipse.om2m.sdt.home.mocked.modules;

 

+import java.util.HashMap;

+import java.util.List;

+import java.util.Map;

+

 import org.eclipse.om2m.sdt.Domain;

 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;

+import org.eclipse.om2m.sdt.exceptions.AccessException;

 import org.eclipse.om2m.sdt.exceptions.DataPointException;

+import org.eclipse.om2m.sdt.home.mocked.devices.Activator;

 import org.eclipse.om2m.sdt.home.modules.Colour;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

 

 public class MockedColour extends Colour {

+	

+	static private int red, green, blue;

 

 	public MockedColour(String name, Domain domain) {

 		super(name, domain,

-			new IntegerDataPoint("red") {

-				private Integer v = new Integer((int)(Math.random() * 255));

+			new IntegerDataPoint(DatapointType.red) {

 				@Override

 				public void doSetValue(Integer value) throws DataPointException {

-					v = value;

+					Activator.logger.info("set single red " + value);

+					red = value;

 				}

 				@Override

 				public Integer doGetValue() throws DataPointException {

+					int v = (red == 0) ? (int)(Math.random() * 255) : red;

+					Activator.logger.info("get single red " + v);

 					return v;

 				}

 			}, 

-			new IntegerDataPoint("green") {

-				private Integer v = new Integer((int)(Math.random() * 255));

+			new IntegerDataPoint(DatapointType.green) {

 				@Override

 				public void doSetValue(Integer value) throws DataPointException {

-					v = value;

+					green = value;

 				}

 				@Override

 				public Integer doGetValue() throws DataPointException {

-					return v;

+					return (green == 0) ? (int)(Math.random() * 255) : green;

 				}

 			}, 

-			new IntegerDataPoint("blue") {

-				private Integer v = new Integer((int)(Math.random() * 255));

+			new IntegerDataPoint(DatapointType.blue) {

 				@Override

 				public void doSetValue(Integer value) throws DataPointException {

-					v = value;

+					blue = value;

 				}

 				@Override

 				public Integer doGetValue() throws DataPointException {

-					return v;

+					return (blue == 0) ? (int)(Math.random() * 255) : blue;

 				}

 			}

 		);

+		setDatapointHandler(new DatapointHandler() {

+			@Override

+			public void setValues(Map<String, Object> values)

+					throws DataPointException, AccessException {

+				Activator.logger.info("set values " + values);

+				for (Map.Entry<String, Object> entry : values.entrySet()) {

+					switch (entry.getKey()) {

+					case "red": red = (int)entry.getValue(); break;

+					case "green": green = (int)entry.getValue(); break;

+					case "blue": blue = (int)entry.getValue(); break;

+					default:

+						break;

+					}

+				}

+			}

+			@Override

+			public Map<String, Object> getValues(List<String> names)

+					throws DataPointException, AccessException {

+				Map<String, Object> ret = new HashMap<String, Object>();

+				for (String name : names) {

+					switch (name) {

+					case "red": ret.put(name, red); break;

+					case "green": ret.put(name, green); break;

+					case "blue": ret.put(name, blue); break;

+					default:

+						break;

+					}

+				}

+				Activator.logger.info("get values " + names + " -> " + ret);

+				return ret;

+			}

+		});

 	}

 

 }

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedDoorStatus.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedDoorStatus.java
index b272463..b9b7c92 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedDoorStatus.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedDoorStatus.java
@@ -8,6 +8,7 @@
 package org.eclipse.om2m.sdt.home.mocked.modules;
 
 import org.eclipse.om2m.sdt.Domain;
+import org.eclipse.om2m.sdt.datapoints.EnumDataPoint;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
 import org.eclipse.om2m.sdt.home.modules.DoorStatus;
 import org.eclipse.om2m.sdt.home.types.DoorState;
@@ -16,14 +17,14 @@
 	
 	public MockedDoorStatus(String name, Domain domain) {
 		super(name, domain,
-			new DoorState("doorState") {
+			new DoorState(new EnumDataPoint<Integer>(null) {
 				private int state = DoorState.Closed;
 				@Override
 				public Integer doGetValue() throws DataPointException {
 					return state;
 				}
 			}
-		);
+		));
 	}
 
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedEnergyConsumption.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedEnergyConsumption.java
index 3f1c6a1..075afcd 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedEnergyConsumption.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedEnergyConsumption.java
@@ -12,6 +12,7 @@
 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;

 import org.eclipse.om2m.sdt.exceptions.DataPointException;

 import org.eclipse.om2m.sdt.home.modules.EnergyConsumption;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

 

 public class MockedEnergyConsumption extends EnergyConsumption {

 

@@ -19,7 +20,7 @@
 		super(name, domain, value);

 		

 		// absolute energy consumption data

-		setAbsoluteEnergyConsumption(new FloatDataPoint("absoluteEnergyConsumption") {

+		setAbsoluteEnergyConsumption(new FloatDataPoint(DatapointType.absoluteEnergyConsumption) {

 			@Override

 			public Float doGetValue() throws DataPointException {

 				return new Float(Math.random() * 1000);

@@ -27,7 +28,7 @@
 		});

 		

 		// rounding energy consumption data

-		setRoundingEnergyConsumption(new IntegerDataPoint("roundingEnergyConsumption") {

+		setRoundingEnergyConsumption(new IntegerDataPoint(DatapointType.roundingEnergyConsumption) {

 			@Override

 			public Integer doGetValue() throws DataPointException {

 				return new Integer((int)(Math.random() * 1000));

@@ -35,7 +36,7 @@
 		});

 		

 		// significant figures

-		setSignificantDigits(new IntegerDataPoint("significantDigits") {

+		setSignificantDigits(new IntegerDataPoint(DatapointType.significantDigits) {

 			private Integer dataPointValue = 1;

 			@Override

 			public void doSetValue(Integer value) throws DataPointException {

@@ -48,7 +49,7 @@
 		});

 		

 		// multiplying factors

-		setMultiplyingFactors(new IntegerDataPoint("multiplyingFactors") {

+		setMultiplyingFactors(new IntegerDataPoint(DatapointType.multiplyingFactors) {

 			private Integer dataPointValue = 2;

 			@Override

 			public void doSetValue(Integer value) throws DataPointException {

@@ -61,7 +62,7 @@
 		});

 		

 		// voltage

-		setVoltage(new FloatDataPoint("voltage") {

+		setVoltage(new FloatDataPoint(DatapointType.voltage) {

 			private Float dataPointValue = (float) 220;

 			@Override

 			public Float doGetValue() throws DataPointException {

@@ -70,7 +71,7 @@
 		});

 		

 		// current

-		setCurrent(new FloatDataPoint("current") {

+		setCurrent(new FloatDataPoint(DatapointType.current) {

 			private Float dataPointValue = (float) 0;

 			@Override

 			public Float doGetValue() throws DataPointException {

@@ -79,7 +80,7 @@
 		});

 		

 		// frequency

-		setFrequency(new FloatDataPoint("frequency") {

+		setFrequency(new FloatDataPoint(DatapointType.frequency) {

 			private Float dataPointValue = (float) 50;

 			@Override

 			public Float doGetValue() throws DataPointException {

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedEnergyGeneration.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedEnergyGeneration.java
index 5125f31..1514460 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedEnergyGeneration.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedEnergyGeneration.java
@@ -12,27 +12,28 @@
 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;

 import org.eclipse.om2m.sdt.exceptions.DataPointException;

 import org.eclipse.om2m.sdt.home.modules.EnergyGeneration;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

 

 public class MockedEnergyGeneration extends EnergyGeneration {

 

 	public MockedEnergyGeneration(String name, Domain domain) {

 		super(name, domain);

 

-		addDataPoint(new FloatDataPoint("powerGenerationData") {

+		setPowerGenerationData(new FloatDataPoint(DatapointType.powerGenerationData) {

 			@Override

 			public Float doGetValue() throws DataPointException {

 				return new Float(Math.random() * 1000);

 			}

 		});

 		

-		addDataPoint(new IntegerDataPoint("roundingEnergyGeneration") {

+		setRoundingEnergyGeneration(new IntegerDataPoint(DatapointType.roundingEnergyGeneration) {

 			@Override

 			public Integer doGetValue() throws DataPointException {

 				return new Integer((int)(Math.random() * 1000));

 			}

 		});

 		

-		addDataPoint(new IntegerDataPoint("significantDigits") {

+		setSignificantDigits(new IntegerDataPoint(DatapointType.significantDigits) {

 			private Integer significantDigits = new Integer(1);

 			@Override

 			public void doSetValue(Integer value) throws DataPointException {

@@ -44,7 +45,7 @@
 			}

 		});

 		

-		addDataPoint(new IntegerDataPoint("multiplyingFactors") {

+		setMultiplyingFactors(new IntegerDataPoint(DatapointType.multiplyingFactors) {

 			Integer multiplyingFactors = new Integer(2);

 			@Override

 			public void doSetValue(Integer value) throws DataPointException {

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedFaultDetection.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedFaultDetection.java
index 0e16517..1bce141 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedFaultDetection.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedFaultDetection.java
@@ -11,12 +11,13 @@
 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;

 import org.eclipse.om2m.sdt.exceptions.DataPointException;

 import org.eclipse.om2m.sdt.home.modules.FaultDetection;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

 

 public class MockedFaultDetection extends FaultDetection {

 

 	public MockedFaultDetection(String name, Domain domain) {

 		super(name, domain, 

-			new BooleanDataPoint("status") {

+			new BooleanDataPoint(DatapointType.status) {

 				@Override

 				public Boolean doGetValue() throws DataPointException {

 					return (Math.random() * 100) == 1;

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedLock.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedLock.java
index 5899eed..7a2b420 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedLock.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedLock.java
@@ -8,26 +8,28 @@
 package org.eclipse.om2m.sdt.home.mocked.modules;
 
 import org.eclipse.om2m.sdt.Domain;
+import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
 import org.eclipse.om2m.sdt.home.modules.Lock;
-import org.eclipse.om2m.sdt.home.types.LockState;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 
 public class MockedLock extends Lock {
 	
-	public MockedLock(String name, Domain domain) {
+	public MockedLock(String name, Domain domain, boolean openOnly) {
 		super(name, domain,
-			new LockState("lockState") {
-				private int state = LockState.Locked;
+			new BooleanDataPoint(DatapointType.doorLock) {
+				private boolean state = true;
 				@Override
-				public Integer doGetValue() throws DataPointException {
+				public Boolean doGetValue() throws DataPointException {
 					return state;
 				}
 				@Override
-				public void doSetValue(Integer v) throws DataPointException {
+				public void doSetValue(Boolean v) throws DataPointException {
 					state = v;
 				}
 			}
 		);
+		setOpenOnly(openOnly);
 	}
 
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedRunMode.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedRunMode.java
index 2aa8960..7e2c61e 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedRunMode.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedRunMode.java
@@ -7,19 +7,21 @@
  *******************************************************************************/

 package org.eclipse.om2m.sdt.home.mocked.modules;

 

+import java.util.Arrays;

 import java.util.List;

 

 import org.eclipse.om2m.sdt.Domain;

 import org.eclipse.om2m.sdt.datapoints.ArrayDataPoint;

 import org.eclipse.om2m.sdt.exceptions.DataPointException;

 import org.eclipse.om2m.sdt.home.modules.RunMode;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

 

 public class MockedRunMode extends RunMode {

 	

 	public MockedRunMode(String name, Domain domain) {

 		super(name, domain,

-			new ArrayDataPoint<String>("operationMode") {

-				private List<String> operationModes;

+			new ArrayDataPoint<String>(DatapointType.operationMode) {

+				private List<String> operationModes = Arrays.asList("mode1", "mode2", "mode3");

 				@Override

 				public List<String> doGetValue() throws DataPointException {

 					return operationModes;

@@ -29,8 +31,8 @@
 					operationModes = vals;

 				}

 			}, 

-			new ArrayDataPoint<String>("supportedModes") {

-				private List<String> supportedModes;

+			new ArrayDataPoint<String>(DatapointType.supportedModes) {

+				private List<String> supportedModes = Arrays.asList("mode1", "mode3");

 				@Override

 				public List<String> doGetValue() throws DataPointException {

 					return supportedModes;

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedStreaming.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedStreaming.java
index 0dc3ccf..d014a85 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedStreaming.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedStreaming.java
@@ -11,30 +11,31 @@
 import org.eclipse.om2m.sdt.datapoints.StringDataPoint;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
 import org.eclipse.om2m.sdt.home.modules.Streaming;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 
 public class MockedStreaming extends Streaming {
 
 	public MockedStreaming(String name, Domain domain) {
 		super(name, domain,
-			new StringDataPoint("url") {
+			new StringDataPoint(DatapointType.url) {
 				@Override
 				public String doGetValue() throws DataPointException {
 					return "my url";
 				}
 			}, 
-			new StringDataPoint("login") {
+			new StringDataPoint(DatapointType.login) {
 				@Override
 				public String doGetValue() throws DataPointException {
 					return "my login";
 				}
 			}, 
-			new StringDataPoint("password") {
+			new StringDataPoint(DatapointType.password) {
 				@Override
 				public String doGetValue() throws DataPointException {
 					return "my password";
 				}
 			}, 
-			new StringDataPoint("format") {
+			new StringDataPoint(DatapointType.format) {
 				@Override
 				public String doGetValue() throws DataPointException {
 					return "HLS";
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedTemperature.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedTemperature.java
new file mode 100644
index 0000000..25f35db
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.mocked.devices/src/main/java/org/eclipse/om2m/sdt/home/mocked/modules/MockedTemperature.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.home.mocked.modules;
+
+import org.eclipse.om2m.sdt.Domain;
+import org.eclipse.om2m.sdt.datapoints.FloatDataPoint;
+import org.eclipse.om2m.sdt.datapoints.StringDataPoint;
+import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.modules.Temperature;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
+
+public class MockedTemperature extends Temperature {
+
+	public MockedTemperature(String name, Domain domain, FloatDataPoint currentTemperature) {
+		super(name, domain, currentTemperature);
+		
+		setStepValue(new FloatDataPoint(DatapointType.stepValue) {
+			@Override
+			public Float doGetValue() throws DataPointException {
+				return (float) 1;
+			}
+		});
+		
+		setUnit(new StringDataPoint(DatapointType.unit) {
+			@Override
+			protected String doGetValue() throws DataPointException {
+				return "°C";
+			}
+		});
+	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/META-INF/MANIFEST.MF b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/META-INF/MANIFEST.MF
index 7529053..ed120a6 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/META-INF/MANIFEST.MF
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/META-INF/MANIFEST.MF
@@ -13,6 +13,7 @@
  org.eclipse.om2m.sdt.home.devices,
  org.eclipse.om2m.sdt.home.driver,
  org.eclipse.om2m.sdt.home.modules,
+ org.eclipse.om2m.sdt.home.types,
  org.jmock;resolution:=optional,
  org.junit;version="4.12.0";resolution:=optional,
  org.osgi.framework,
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/impl/Activator.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/impl/Activator.java
index 6f72637..9b84edf 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/impl/Activator.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/impl/Activator.java
@@ -36,6 +36,7 @@
 import org.osgi.util.tracker.ServiceTracker;
 import org.osgi.util.tracker.ServiceTrackerCustomizer;
 
+@SuppressWarnings({ "rawtypes", "unchecked" })
 public class Activator implements BundleActivator, HomeListener, ManagedService  {
 	
 	public static final Domain NETATMO_DOMAIN = new Domain("Netatmo_Domain");
@@ -64,7 +65,6 @@
 		sdtWeatherStations = new HashMap<>();
 	}
 
-	@SuppressWarnings({ "rawtypes", "unchecked" })
 	@Override
 	public void start(final BundleContext context) throws Exception {
 		// store bundleContext 
@@ -227,9 +227,9 @@
 		return sdtWelcomeCamera;
 	}
 
-	@SuppressWarnings("rawtypes")
 	@Override
-	public void updated(Dictionary properties) throws ConfigurationException {
+	public synchronized void updated(Dictionary properties) throws ConfigurationException {
+		logger.info("updated(properties=" + properties + ")");
 		// check all parameters are located into properties
 		if (! checkParameters(properties)) {
 			logger.info("Missing a mandatory property --> Netatmo driver is not started");
@@ -254,13 +254,15 @@
 	 * @param properties
 	 * @return true if all is ok
 	 */
-	@SuppressWarnings("rawtypes")
 	private static boolean checkParameters(Dictionary properties) {
+		logger.info("checkParameters");
 		if (properties == null) {
 			// no properties
 			logger.info("No properties to configure SDT Netatmo Driver --> the driver is not started !");
 			return false;
 		}
+		
+		logger.info("checkParameter(properties.length=" + properties.size() + ")");
 		List<String> missing = new ArrayList<String>();
 		if (properties.get(Discovery.CONFIG_CLIENT_ID) == null) {
 			missing.add(Discovery.CONFIG_CLIENT_ID);
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/impl/Discovery.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/impl/Discovery.java
index 85e732f..92271f2 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/impl/Discovery.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/impl/Discovery.java
@@ -19,6 +19,7 @@
 import org.eclipse.om2m.sdt.home.netatmo.model.Home;
 import org.eclipse.om2m.sdt.home.netatmo.model.HomeListener;
 import org.eclipse.om2m.sdt.home.netatmo.model.Person;
+import org.eclipse.om2m.sdt.home.netatmo.model.Token;
 import org.eclipse.om2m.sdt.home.netatmo.model.WeatherStation;
 import org.eclipse.om2m.sdt.home.netatmo.model.WeatherStationModule;
 import org.eclipse.om2m.sdt.home.netatmo.model.WelcomeCamera;
@@ -34,8 +35,8 @@
 	public static final String CONFIG_CAMERA_DETECTION_THRESHOLD = "camera.detection.threshold";
 	public static final String CONFIG_CAMERA_USE_LOCAL_URL = "camera.use.local.url";
 
-	private static final int WELCOME_CAMERA_SAMPLING_DEFAULT_VALUE = 8000;
-	private static final int WEATHER_STATION_SAMPLING_DEFAULT_VALUE = 30000;
+	private static final int WELCOME_CAMERA_SAMPLING_DEFAULT_VALUE = 10000;
+	private static final int WEATHER_STATION_SAMPLING_DEFAULT_VALUE = 500000;
 
 	private Timer discoveryWelcomeTimer;
 	private TimerTask discoveryWelcomeTimerTask;
@@ -72,6 +73,7 @@
 			welcomeCameraSampling = 
 				Integer.parseInt(properties.get(CONFIG_WELCOME_CAMERA_SAMPLING).toString());
 		} catch (Exception e) {
+			e.printStackTrace();
 			welcomeCameraSampling = WELCOME_CAMERA_SAMPLING_DEFAULT_VALUE;
 		}
 		
@@ -80,6 +82,7 @@
 			weatherStationSampling = 
 				Integer.parseInt(properties.get(CONFIG_WEATHER_STATION_SAMPLING).toString());
 		} catch (Exception e) {
+			e.printStackTrace();
 			weatherStationSampling = WEATHER_STATION_SAMPLING_DEFAULT_VALUE;
 		}
 		
@@ -188,6 +191,10 @@
 			discoveryWeatherStationTimer = null;
 		}
 	}
+	
+	public Token checkConnectivity() {
+		return server.getToken();
+	}
 
 	public Home getCurrentHome() {
 		return currentHome;
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/impl/Server.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/impl/Server.java
index e00a94b..00de11f 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/impl/Server.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/impl/Server.java
@@ -321,7 +321,7 @@
 						Server.class);
 			}
 		} catch (IOException e) {
-			Activator.logger.warning("unable to open connection", Server.class, e);
+			Activator.logger.warning("unable to open connection: " + e.getMessage(), Server.class);
 		}
 		return null;
 	}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/model/WelcomeCamera.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/model/WelcomeCamera.java
index 0d99922..7c1ce5c 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/model/WelcomeCamera.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/model/WelcomeCamera.java
@@ -18,7 +18,6 @@
 	public static final String ALIM_STATUS = "alim_status";
 	public static final String NAME = "name";
 	
-
 	private final String id;
 	private final String type;
 	private final String name;
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/sdt/SDTWeatherStation.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/sdt/SDTWeatherStation.java
index 8b5876a..7c3d4b5 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/sdt/SDTWeatherStation.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/sdt/SDTWeatherStation.java
@@ -25,9 +25,11 @@
 import org.eclipse.om2m.sdt.home.modules.Temperature;
 import org.eclipse.om2m.sdt.home.netatmo.impl.Activator;
 import org.eclipse.om2m.sdt.home.netatmo.model.WeatherStationModule;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 
+@SuppressWarnings("rawtypes")
 public class SDTWeatherStation extends WeatherStation {
 
 	private List<ServiceRegistration> serviceRegistrations;
@@ -51,25 +53,25 @@
 		if (stationOrModule.getDataTypes().contains(WeatherStationModule.TEMPERATURE_DATA_TYPE)) {
 			// temperature
 			setTemperature(new Temperature("temperature_" + getId(), Activator.NETATMO_DOMAIN,
-				new FloatDataPoint("currentTemperature") {
+				new FloatDataPoint(DatapointType.currentTemperature) {
 					@Override
 					protected Float doGetValue() throws DataPointException {
 						return new Double(stationOrModule.getCurrentTemperature()).floatValue();
 					}
 				}));
-			getTemperature().setMinValue(new FloatDataPoint("minValue") {
+			getTemperature().setMinValue(new FloatDataPoint(DatapointType.minValue) {
 				@Override
 				protected Float doGetValue() throws DataPointException {
 					return new Double(stationOrModule.getMinTemperature()).floatValue();
 				}
 			});
-			getTemperature().setMaxValue(new FloatDataPoint("maxValue") {
+			getTemperature().setMaxValue(new FloatDataPoint(DatapointType.maxValue) {
 				@Override
 				protected Float doGetValue() throws DataPointException {
 					return new Double(stationOrModule.getMaxTemperature()).floatValue();
 				}
 			});
-			getTemperature().setUnits(new StringDataPoint("units") {
+			getTemperature().setUnit(new StringDataPoint(DatapointType.unit) {
 				@Override
 				protected String doGetValue() throws DataPointException {
 					return "°C";
@@ -79,8 +81,9 @@
 
 		if (stationOrModule.getDataTypes().contains(WeatherStationModule.HUMIDITY_DATA_TYPE)) {
 			// humidity
-			setRelativeHumidity(new RelativeHumidity("relativeHumidity_" + getId(), Activator.NETATMO_DOMAIN,
-				new FloatDataPoint("relativeHumidity") {
+			setRelativeHumidity(new RelativeHumidity("relativeHumidity_" + getId(), 
+				Activator.NETATMO_DOMAIN,
+				new FloatDataPoint(DatapointType.relativeHumidity) {
 					@Override
 					protected Float doGetValue() throws DataPointException {
 						return (float) stationOrModule.getHumidity();
@@ -91,7 +94,7 @@
 		if (stationOrModule.getDataTypes().contains(WeatherStationModule.NOISE_DATA_TYPE)) {
 			// noise
 			setNoise(new Noise("noise_" + getId(), Activator.NETATMO_DOMAIN, 
-				new IntegerDataPoint("noise") {
+				new IntegerDataPoint(DatapointType.noise) {
 					@Override
 					protected Integer doGetValue() throws DataPointException {
 						return new Long(stationOrModule.getNoise()).intValue();
@@ -102,8 +105,8 @@
 		if (stationOrModule.getDataTypes().contains(WeatherStationModule.PRESSURE_DATA_TYPE)) {
 			// pressure
 			setAtmosphericPressureSensor(new AtmosphericPressureSensor("atmosphericPressureSensor_" + getId(), 
-					Activator.NETATMO_DOMAIN, 
-				new FloatDataPoint("atmosphericPressure") {
+				Activator.NETATMO_DOMAIN, 
+				new FloatDataPoint(DatapointType.atmosphericPressure) {
 					@Override
 					protected Float doGetValue() throws DataPointException {
 						return new Double(stationOrModule.getAbsolutePressure()).floatValue();
@@ -114,19 +117,19 @@
 		if (stationOrModule.getDataTypes().contains(WeatherStationModule.CO2_DATA_TYPE)) {
 			// co2
 			setExtendedCarbonDioxideSensor(new ExtendedCarbonDioxideSensor("extendedCarbonDioxideSensor_" + getId(),
-					Activator.NETATMO_DOMAIN, 
-				new BooleanDataPoint("alarm") {
+				Activator.NETATMO_DOMAIN, 
+				new BooleanDataPoint(DatapointType.alarm) {
 					@Override
 					protected Boolean doGetValue() throws DataPointException {
 						return stationOrModule.getCo2() >= 600;
 					}
-			}, 
-			new IntegerDataPoint("carbonDioxideValue") {
-				@Override
-				protected Integer doGetValue() throws DataPointException {
-					return new Long(stationOrModule.getCo2()).intValue();
-				}
-			}));
+				}, 
+				new IntegerDataPoint(DatapointType.carbonDioxideValue) {
+					@Override
+					protected Integer doGetValue() throws DataPointException {
+						return new Long(stationOrModule.getCo2()).intValue();
+					}
+				}));
 		}
 	}
 
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/sdt/SDTWelcomeCameraDevice.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/sdt/SDTWelcomeCameraDevice.java
index 1a1e358..c44c96c 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/sdt/SDTWelcomeCameraDevice.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/main/java/org/eclipse/om2m/sdt/home/netatmo/sdt/SDTWelcomeCameraDevice.java
@@ -15,7 +15,6 @@
 import java.util.List;
 import java.util.Map;
 
-import org.eclipse.om2m.sdt.Property;
 import org.eclipse.om2m.sdt.datapoints.ArrayDataPoint;
 import org.eclipse.om2m.sdt.datapoints.StringDataPoint;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
@@ -27,9 +26,11 @@
 import org.eclipse.om2m.sdt.home.netatmo.impl.Activator;
 import org.eclipse.om2m.sdt.home.netatmo.model.DetectedPerson;
 import org.eclipse.om2m.sdt.home.netatmo.model.WelcomeCamera;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 
+@SuppressWarnings("rawtypes")
 public class SDTWelcomeCameraDevice extends Camera {
 
 	private static final long DEFAULT_DETECTION_THRESHOLD = 75000; // 75 s
@@ -49,7 +50,7 @@
 		this.detectionThreshold = (detectionThreshold <= 0) ? DEFAULT_DETECTION_THRESHOLD 
 				: (detectionThreshold);
 
-		// sdt properties
+		// SDT properties
 		setDeviceManufacturer("Netatmo");
 		setDeviceName(pCamera.getName());
 		setDeviceModelName(camera.getType());
@@ -60,10 +61,11 @@
 		}
 
 		// create properties for vpn
-		addProperty(new Property("vpnUrl", camera.getVpnUrl()));
+		// TODO check if needed
+//		addProperty(new Property("vpnUrl", camera.getVpnUrl()));
 
 		setPersonSensor(new PersonSensor("personSensor_" + getId(), Activator.NETATMO_DOMAIN,
-			new ArrayDataPoint<String>("detectedPersons") {
+			new ArrayDataPoint<String>(DatapointType.detectedPersons) {
 				@Override
 				protected List<String> doGetValue() throws DataPointException {
 					List<String> ret = new ArrayList<>();
@@ -81,7 +83,7 @@
 			}));
 		
 		setStreaming(new Streaming("streaming_" + getId(), Activator.NETATMO_DOMAIN, 
-			new StringDataPoint("url") {
+			new StringDataPoint(DatapointType.url) {
 				@Override
 				protected String doGetValue() throws DataPointException {
 					if (camera.getUseLocalUrl()) {
@@ -91,19 +93,19 @@
 					}
 				}
 			}, 
-			new StringDataPoint("login") {
+			new StringDataPoint(DatapointType.login) {
 				@Override
 				protected String doGetValue() throws DataPointException {
 					return "";
 				}
 			}, 
-			new StringDataPoint("password") {
+			new StringDataPoint(DatapointType.password) {
 				@Override
 				protected String doGetValue() throws DataPointException {
 					return "";
 				}
 			}, 
-			new StringDataPoint("format") {
+			new StringDataPoint(DatapointType.format) {
 				@Override
 				protected String doGetValue() throws DataPointException {
 					return "HLS";
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/test/java/org/eclipse/om2m/sdt/home/netatmo/impl/DiscoveryTestCase.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/test/java/org/eclipse/om2m/sdt/home/netatmo/impl/DiscoveryTestCase.java
index 65fed98..76e279c 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/test/java/org/eclipse/om2m/sdt/home/netatmo/impl/DiscoveryTestCase.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/test/java/org/eclipse/om2m/sdt/home/netatmo/impl/DiscoveryTestCase.java
@@ -13,7 +13,6 @@
 import java.util.Map;
 import java.util.Properties;
 
-import org.eclipse.om2m.sdt.home.devices.Camera;
 import org.eclipse.om2m.sdt.home.netatmo.model.Home;
 import org.eclipse.om2m.sdt.home.netatmo.model.WelcomeCamera;
 
@@ -39,89 +38,117 @@
 				properties.getProperty(Discovery.CONFIG_WEATHER_STATION_SAMPLING));
 		configuration.put(Discovery.CONFIG_WELCOME_CAMERA_SAMPLING,
 				properties.getProperty(Discovery.CONFIG_WELCOME_CAMERA_SAMPLING));
+		
+		
 
 	}
 
 	public void testDiscovery() throws Exception {
 		Discovery disco = new Discovery(configuration);
-		disco.startDiscovery();
-
-		Thread.sleep(40000);
-
-		disco.stopDiscovery();
-
-		Thread.sleep(10000);
-
-		disco.getCurrentHome();
+		
+		if (disco.checkConnectivity() != null) {
+			disco.startDiscovery();
+	
+			Thread.sleep(40000);
+	
+			disco.stopDiscovery();
+	
+			Thread.sleep(10000);
+	
+			disco.getCurrentHome();
+		} else {
+			printWarningMessage();
+		}
 	}
 
 	public void testLocalAddress() throws Exception {
 		configuration.put(Discovery.CONFIG_CAMERA_USE_LOCAL_URL, "true");
 		Discovery disco = new Discovery(configuration);
-		disco.startDiscovery();
-
-		Thread.sleep(10000);
-		Home home = disco.getCurrentHome();
-
-		if (home != null) {
-
-			Map<String, WelcomeCamera> cameras = home.getCameras();
-
-			for (WelcomeCamera camera : cameras.values()) {
-				System.out.println(camera.getUseLocalUrl());
-				assertNotNull(camera);
-				// useLocalUrl must be true
-				assertTrue(camera.getUseLocalUrl());
+		if (disco.checkConnectivity() != null) {
+			disco.startDiscovery();
+	
+			Thread.sleep(10000);
+			Home home = disco.getCurrentHome();
+	
+			if (home != null) {
+	
+				Map<String, WelcomeCamera> cameras = home.getCameras();
+	
+				for (WelcomeCamera camera : cameras.values()) {
+					System.out.println(camera.getUseLocalUrl());
+					assertNotNull(camera);
+					// useLocalUrl must be true
+					assertTrue(camera.getUseLocalUrl());
+				}
+	
 			}
-
+	
+			disco.stopDiscovery();
+		} else {
+			printWarningMessage();
 		}
 
-		disco.stopDiscovery();
-
 	}
 
 	public void testDefaultAddress() throws Exception {
 		Discovery disco = new Discovery(configuration);
-		disco.startDiscovery();
-
-		Thread.sleep(10000);
-		Home home = disco.getCurrentHome();
-		if (home != null) {
-
-			Map<String, WelcomeCamera> cameras = home.getCameras();
-
-			for (WelcomeCamera camera : cameras.values()) {
-				System.out.println(camera.getUseLocalUrl());
-				// useLocalUrl must be true
-				assertFalse(camera.getUseLocalUrl());
+		
+		if (disco.checkConnectivity() != null) {
+			disco.startDiscovery();
+	
+			Thread.sleep(10000);
+			Home home = disco.getCurrentHome();
+			if (home != null) {
+	
+				Map<String, WelcomeCamera> cameras = home.getCameras();
+	
+				for (WelcomeCamera camera : cameras.values()) {
+					System.out.println(camera.getUseLocalUrl());
+					// useLocalUrl must be true
+					assertFalse(camera.getUseLocalUrl());
+				}
 			}
+	
+			disco.stopDiscovery();
+		} else {
+			printWarningMessage();
 		}
 
-		disco.stopDiscovery();
-
 	}
 
 	public void testRemoteAddress() throws Exception {
 		configuration.put(Discovery.CONFIG_CAMERA_USE_LOCAL_URL, "false");
 		Discovery disco = new Discovery(configuration);
-		disco.startDiscovery();
-
-		Thread.sleep(10000);
-		Home home = disco.getCurrentHome();
-
-		if (home != null) {
-
-			Map<String, WelcomeCamera> cameras = home.getCameras();
-
-			for (WelcomeCamera camera : cameras.values()) {
-				System.out.println(camera.getUseLocalUrl());
-				// useLocalUrl must be true
-				assertFalse(camera.getUseLocalUrl());
+		if (disco.checkConnectivity() != null) {
+			disco.startDiscovery();
+	
+			Thread.sleep(10000);
+			Home home = disco.getCurrentHome();
+	
+			if (home != null) {
+	
+				Map<String, WelcomeCamera> cameras = home.getCameras();
+	
+				for (WelcomeCamera camera : cameras.values()) {
+					System.out.println(camera.getUseLocalUrl());
+					// useLocalUrl must be true
+					assertFalse(camera.getUseLocalUrl());
+				}
+	
 			}
-
+	
+			disco.stopDiscovery();
+		} else {
+			printWarningMessage();
 		}
 
-		disco.stopDiscovery();
-
+	}
+	
+	private void printWarningMessage() {
+		System.out.println("--------------------------------------------------------------------------------");
+		System.out.println("#                                                                              #");
+		System.out.println("# Please configure properly src/test/resources/netatmo.sdt.driver.properties   #");
+		System.out.println("#                                                                              #");
+		System.out.println("--------------------------------------------------------------------------------");
 	}
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/test/java/org/eclipse/om2m/sdt/home/netatmo/impl/TestConnection.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/test/java/org/eclipse/om2m/sdt/home/netatmo/impl/TestConnection.java
index 4fdd8c2..61e9236 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/test/java/org/eclipse/om2m/sdt/home/netatmo/impl/TestConnection.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.netatmo/src/test/java/org/eclipse/om2m/sdt/home/netatmo/impl/TestConnection.java
@@ -31,18 +31,39 @@
 		Server server = new Server(properties.getProperty(Discovery.CONFIG_CLIENT_ID),
 				properties.getProperty(Discovery.CONFIG_CLIENT_SECRET),
 				properties.getProperty(Discovery.CONFIG_USERNAME), properties.getProperty(Discovery.CONFIG_PASSWORD));
-		server.getHomeData(null, null);
+		
+		if (server.getToken() != null) {
+			server.getHomeData(null, null);
+		} else {
+			printWarningMessage();
+		}
 	}
 
 	public void testWeatherStationConnection() throws Exception {
 		Server server = new Server(properties.getProperty(Discovery.CONFIG_CLIENT_ID),
 				properties.getProperty(Discovery.CONFIG_CLIENT_SECRET),
 				properties.getProperty(Discovery.CONFIG_USERNAME), properties.getProperty(Discovery.CONFIG_PASSWORD));
-		List<WeatherStation> wss = server.getStationsData();
-
-		for (WeatherStation ws : wss) {
-			System.out.println(ws.toString());
+		
+		if (server.getToken() != null) {
+		
+			List<WeatherStation> wss = server.getStationsData();
+	
+			for (WeatherStation ws : wss) {
+				System.out.println(ws.toString());
+			}
+			
+		} else {
+			printWarningMessage();
 		}
 	}
+	
+	
+	private void printWarningMessage() {
+		System.out.println("--------------------------------------------------------------------------------");
+		System.out.println("#                                                                              #");
+		System.out.println("# Please configure properly src/test/resources/netatmo.sdt.driver.properties   #");
+		System.out.println("#                                                                              #");
+		System.out.println("--------------------------------------------------------------------------------");
+	}
 
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/Activator.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/Activator.java
index 2cbcabf..d2835cc 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/Activator.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/Activator.java
@@ -24,85 +24,86 @@
 import org.osgi.service.cm.ManagedService;

 import org.osgi.service.log.LogService;

 

+@SuppressWarnings({ "rawtypes", "unchecked" })

 public class Activator implements ManagedService, BundleActivator {

-	

+

 	private static final String PID_VALUE = "smarter.coffee";

-	

+

 	static private final String PROTOCOL = "SmarterCoffeeMachine";

-	

+

 	static private final String ID = "SmarterCoffee";

-	

+

 	private static int idNum = 1;

-	

+

 	private Domain domain;

-	

+

 	private boolean activated;

-	

+

 	private BundleContext context;

-	

+

 	private ServiceRegistration serviceRegistration;

-	

+

 	public static Logger logger = new Logger(PROTOCOL);

-	

+

 	private SmarterCoffeeMachine sCoffee;

-	

+

 	private static final String IP = "coffee.machine.ip";

-	

+

 	private static final String PORT = "coffee.machine.port";

-	

+

 	public Activator() {

 		System.out.println("Bundle coffee machine starting");

 		logger.info("Activator");

-		

+

 		this.domain = new HomeDomain("Smarter Coffee Domain");

 	}

-	

 

-	

 	public void addCoffeeMachine(String ip, int port){

 		sCoffee = new SmarterCoffeeMachine((Activator.ID + idNum++), domain, ip, port); 

 		sCoffee.setProtocol(PROTOCOL);

 		sCoffee.register(context);	

-//		test();

-		

+		System.out.println("test - addCoffe");

+		//test();

 	}

-	

+

 	public void test(){

 		try{

+			System.out.println("URUCHOMIONO TEST");

+

 			//logger.debug("SENDING REQUEST TO SMARTER COFFEE");

 			sCoffee.getBrewing().setCupsNumber(1);

 			sCoffee.getBrewing().setStrength(TasteStrength.zero);

-			sCoffee.getBrewing().setKeepWarm(true);

-			sCoffee.getGrinder().setUseGrinder(true);

-			sCoffee.getBrewing().setStatus(1);  	

-			

-			if(sCoffee.getFaultDetection().getStatus()){

+			//sCoffee.getKeepWarm();

+			sCoffee.getKeepWarm().setPowerState(true);

+			//sCoffee.getGrinder().setUseGrinder(true);

+			//sCoffee.getBrewing().setStatus(1); 

+

+			System.out.println("settint true to powerState");

+			sCoffee.getBrewingSwitch().setPowerState(true);

+

+			if (sCoffee.getFaultDetection().getStatus()) {

 				logger.debug("Fault description: " + sCoffee.getFaultDetection().getDescription() + " code: " + sCoffee.getFaultDetection().getCode());

-				logger.debug("Water level in the tank: " + sCoffee.getWaterStatus().getStatus());		

+				logger.debug("Water level in the tank: " + sCoffee.getWaterStatus().getLiquidLevel());		

 			}

-			

-		}catch(DataPointException | AccessException e) {

+		} catch(DataPointException | AccessException e) {

 			e.printStackTrace();

 		}

 	}

-	

+

 	public void setLog(final LogService logService) {

 		logger.setLogService(logService);

 	}

-	

+

 	public void unsetLog(final LogService logService) {

 		logger.unsetLogService();

 	}

 

-

 	@Override

 	public void updated(Dictionary properties) throws ConfigurationException {

 		String ip = null;

 		int port = 0;

-		

 		if (properties == null) {

 			logger.info("No found properties... ");

-	

 		} else {

 			try {

 				ip = (String) properties.get(IP);

@@ -110,13 +111,12 @@
 			} catch (Exception ignored) {

 				ignored.printStackTrace();

 			}

-		

+			System.out.println("zaaaaaaaaraz: addCoffeMachine w UPDATED");

 			addCoffeeMachine(ip, port);

-		

 		}

+		//test();

 	}

 

-

 	@Override

 	public void start(BundleContext context) throws Exception {

 		this.context = context;

@@ -126,18 +126,19 @@
 		Dictionary properties = new Hashtable();

 		properties.put(Constants.SERVICE_PID, PID_VALUE);

 		serviceRegistration = context.registerService(ManagedService.class.getName(), this, properties );

-	}

 

+		//test();

+	}

 

 	@Override

 	public void stop(BundleContext context) throws Exception {

 		activated = false;

 		idNum = 1;

 		sCoffee.unregister();

-		

+

 		if (serviceRegistration != null) {

 			serviceRegistration.unregister();

 		}

 	}

+

 }

-	

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/SmarterCoffeeMachine.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/SmarterCoffeeMachine.java
index 053e8de..9aa4108 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/SmarterCoffeeMachine.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/SmarterCoffeeMachine.java
@@ -11,23 +11,27 @@
 

 import org.eclipse.om2m.sdt.Domain;

 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;

+import org.eclipse.om2m.sdt.datapoints.EnumDataPoint;

 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;

 import org.eclipse.om2m.sdt.datapoints.StringDataPoint;

 import org.eclipse.om2m.sdt.exceptions.AccessException;

 import org.eclipse.om2m.sdt.exceptions.DataPointException;

 import org.eclipse.om2m.sdt.home.devices.CoffeeMachine;

 import org.eclipse.om2m.sdt.home.driver.Utils;

+import org.eclipse.om2m.sdt.home.modules.BinarySwitch;

 import org.eclipse.om2m.sdt.home.modules.Brewing;

 import org.eclipse.om2m.sdt.home.modules.FaultDetection;

 import org.eclipse.om2m.sdt.home.modules.Grinder;

-import org.eclipse.om2m.sdt.home.modules.Level;

+import org.eclipse.om2m.sdt.home.modules.KeepWarm;

 import org.eclipse.om2m.sdt.home.smartercoffee.communication.SmarterCoffeeCommands;

 import org.eclipse.om2m.sdt.home.smartercoffee.communication.SmarterCoffeeCommunication;

-import org.eclipse.om2m.sdt.home.types.LevelType;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

+import org.eclipse.om2m.sdt.home.types.LiquidLevel;

 import org.eclipse.om2m.sdt.home.types.TasteStrength;

 import org.osgi.framework.BundleContext;

 import org.osgi.framework.ServiceRegistration;

 

+@SuppressWarnings({ "rawtypes" })

 public class SmarterCoffeeMachine extends CoffeeMachine{

 	

 	private List<ServiceRegistration> registrations;

@@ -36,6 +40,20 @@
 	private String IP;

 	private int port;

 	private SmarterCoffeeCommunication smarterCoffee;

+	

+	private IntegerDataPoint cupsNumber;

+	private BooleanDataPoint keepWarm;

+	private TasteStrength strength;

+	private IntegerDataPoint status;

+	

+	/*

+	 * Paweł

+	 * Zawartość doGetValue i doSetValue z keepWarma osadzonego jako DataPoint w Brewing została przeniesiona do Modułu keepWarm do dataPointa keepWarm. W kwestii KeepWarm nic więcej nie zostało

+	 * ruszone, więc wszystko powinno (nie)działać tak samo jak wczesniej. 

+	 * 

+	 * 

+	 * 

+	 */

 

 	public SmarterCoffeeMachine(String id, Domain domain, String ip , int port) {

 		super(id, id, domain);

@@ -68,11 +86,20 @@
 		} catch (Exception e) {

 			Activator.logger.warning("Error addWaterStatus", e);

 		}

-		

+		try {

+			addBrewingSwitch();

+		} catch (Exception e) {

+			Activator.logger.warning("Error addBrewingSwitch", e);

+		}

+		try {

+			addKeepWarm();

+		} catch (Exception e) {

+			Activator.logger.warning("Error addKeepWarm", e);

+		}

+				

 		setDeviceManufacturer("Smarter");

 		setDeviceModelName("IKTSMC10EUFR");

 		setDeviceName("Smarter coffee machine");

-		

 	}

 	

 	public void register(BundleContext context) {

@@ -92,20 +119,20 @@
 	

 	private void addFaultDetection() {

 		FaultDetection faultDetection = new FaultDetection("FaultDetection_" + getId(), domain,

-				new BooleanDataPoint("status") {

-			@Override

-			public Boolean doGetValue() throws DataPointException {

-				smarterCoffee.getStatus();

-				return smarterCoffee.getFaultDetection(); 

-			}

-		}, new IntegerDataPoint("code") {

-			

+			new BooleanDataPoint(DatapointType.status) {

+				@Override

+				public Boolean doGetValue() throws DataPointException {

+					smarterCoffee.getStatus();

+					return smarterCoffee.getFaultDetection(); 

+				}

+			});

+		faultDetection.setCode(new IntegerDataPoint(DatapointType.code) {

 			@Override

 			protected Integer doGetValue() throws DataPointException {

 				return smarterCoffee.getCode();

-			}

-		}, new StringDataPoint("description") {

-			

+			}	

+		});

+		faultDetection.setDescription(new StringDataPoint(DatapointType.description) {

 			@Override

 			protected String doGetValue() throws DataPointException {

 				return smarterCoffee.getDescription();

@@ -116,142 +143,134 @@
 	}

 	

 	private void addBrewing(){

-		

 		Activator.logger.info("add Brewing starting");

-		

-		Brewing brewing = new Brewing("Brewing_" + getId(), domain, new IntegerDataPoint("cupsNumber") {

-			

-			int cupNumber = 0;

-			

-			@Override

-			protected Integer doGetValue() throws DataPointException {

-				return cupNumber;

-			}

-			

-			@Override

-			protected void doSetValue(Integer value) throws DataPointException {

-				cupNumber = value;

-				smarterCoffee.setNumberOfCups(value);

-			}

-		}, new BooleanDataPoint("keepWarm") {

-			

-			boolean keepWarm = false;

-			

-			@Override

-			protected Boolean doGetValue() throws DataPointException {

-				return keepWarm;

-			}

-			

-			@Override

-			protected void doSetValue(Boolean value) throws DataPointException {

-				keepWarm = value;

-				if(value)

-					smarterCoffee.setHotPlateOn(5); // argument is a mintues user want to use hot plate

-				else 

-					smarterCoffee.setHotPlateOff();

-			}

-		}, new TasteStrength("strength") {

-			

-			int strength = TasteStrength.zero;

-

-			@Override

-			protected Integer doGetValue() throws DataPointException {

-				return strength;

-			}

-			

-			@Override

-			protected void doSetValue(Integer value) throws DataPointException {

-				strength = value;

-				if(value >= TasteStrength.zero && value < TasteStrength.medium){

-					smarterCoffee.setBrewStrength(SmarterCoffeeCommands.BREW_STRENGTH_0);

+		Brewing brewing = new Brewing("Brewing_" + getId(), domain, 

+			new IntegerDataPoint(DatapointType.cupsNumber) {

+				int cupNumber = 0;

+				@Override

+				protected Integer doGetValue() throws DataPointException {

+					return cupNumber;

 				}

-				else if(value == TasteStrength.medium){

-					smarterCoffee.setBrewStrength(SmarterCoffeeCommands.BREW_STRENGTH_1);

+				@Override

+				protected void doSetValue(Integer value) throws DataPointException {

+					cupNumber = value;

+					smarterCoffee.setNumberOfCups(value);

 				}

-				else if (value > TasteStrength.medium && value <= TasteStrength.maximum){

-					smarterCoffee.setBrewStrength(SmarterCoffeeCommands.BREW_STRENGTH_2);

+			},  

+			new TasteStrength(new EnumDataPoint<Integer>(null) {

+				int strength = TasteStrength.zero;

+				@Override

+				protected Integer doGetValue() throws DataPointException {

+					return strength;

 				}

-			}

-			

-			

-		}, new IntegerDataPoint("status") {

-		

-			@Override

-			protected Integer doGetValue() throws DataPointException {

-				smarterCoffee.getStatus();

-				return smarterCoffee.getCoffeeReadyStatus();

-			}

-			@Override

-			protected void doSetValue(Integer value) throws DataPointException {

-				if(value.intValue() == 1)

-					try {

-						smarterCoffee.start(getGrinder().getUseGrinder(), getBrewing().getCupsNumber(), getBrewing().getStrength(), getBrewing().getKeepWarm());

-												

-					} catch (AccessException e) {

-						throw new DataPointException(e.getMessage());

+				@Override

+				protected void doSetValue(Integer value) throws DataPointException {

+					strength = value;

+					if (value >= TasteStrength.zero && value < TasteStrength.medium) {

+						smarterCoffee.setBrewStrength(SmarterCoffeeCommands.BREW_STRENGTH_0);

 					}

-				else 

-					smarterCoffee.stop();

-			}

-		});

+					else if (value == TasteStrength.medium) {

+						smarterCoffee.setBrewStrength(SmarterCoffeeCommands.BREW_STRENGTH_1);

+					}

+					else if (value > TasteStrength.medium && value <= TasteStrength.maximum) {

+						smarterCoffee.setBrewStrength(SmarterCoffeeCommands.BREW_STRENGTH_2);

+					}

+				}

+		}));

 		

 		addModule(brewing);

+	}

+	

+	public void addBrewingSwitch(){

+		BinarySwitch brewingSwitch = new BinarySwitch(IP, domain, 

+			new BooleanDataPoint(DatapointType.powerState) {

+				@Override

+				protected Boolean doGetValue() throws DataPointException {

+					smarterCoffee.getStatus();

+					return (smarterCoffee.getCoffeeReadyStatus() == 1);

+				}

+				@Override

+				protected void doSetValue(Boolean value) throws DataPointException {

+					if (value) {

+						try {

+							System.out.println("start brewing swtich");

+							smarterCoffee.start(getGrinder().getUseGrinder(), 

+									getBrewing().getCupsNumber(), 

+									getBrewing().getStrength(), 

+									getKeepWarm().getPowerState());//tu się powinno pojawić getKeepWarm();

+							//smarterCoffee.start(true, 1, getBrewing().getStrength(), false);

+						} catch (AccessException e) {

+							throw new DataPointException(e.getMessage());

+						}

+					} else {

+						smarterCoffee.stop();

+					}

+				}

+			});

 		

+		addModule(brewingSwitch);

 	}

 	

 	private void addGrinder(){

-	

 		Activator.logger.info("add Grinder starting");

-		

-		Grinder grinder = new Grinder("Grinder_" + getId(), domain, new BooleanDataPoint("useGrinder") {

-			

-			boolean useGrinder = false;

-			

-			@Override

-			protected Boolean doGetValue() throws DataPointException {

-				return useGrinder;

-			}

-			

-			@Override

-			protected void doSetValue(Boolean value) throws DataPointException {

-				useGrinder = value.booleanValue();

-			}

-		}, new IntegerDataPoint("grindCoarsenes") {

-			

-			@Override

-			protected Integer doGetValue() throws DataPointException {

-				// set and get coarsenes of beans is NOT POSSIBLE through API in SmarterCoffee (is's setted via physical potentiometer on the device)

-				return null;

-			}

-		});

+		Grinder grinder = new Grinder("Grinder_" + getId(), domain, 

+			new BooleanDataPoint(DatapointType.useGrinder) {

+				boolean useGrinder = false;

+				@Override

+				protected Boolean doGetValue() throws DataPointException {

+					return useGrinder;

+				}

+				

+				@Override

+				protected void doSetValue(Boolean value) throws DataPointException {

+					useGrinder = value.booleanValue();

+				}

+			}, 

+			new IntegerDataPoint(DatapointType.coarseness) {

+				@Override

+				protected Integer doGetValue() throws DataPointException {

+					// set and get coarsenes of beans is NOT POSSIBLE through API in SmarterCoffee (is's setted via physical potentiometer on the device)

+					return null;

+				}

+			});

 	

 		addModule(grinder);

 	}

 	

 	private void addWaterStatus(){

-		

 		Activator.logger.info("add WaterStatus starting");

-		

-		Level waterStatus = new Level("waterStatus", domain, null, new LevelType("waterStatus") {

-			

-			@Override

-			protected Integer doGetValue() throws DataPointException {

-				smarterCoffee.getStatus();

-				return smarterCoffee.getWaterStatus();

-			}

-		});

-		

+		org.eclipse.om2m.sdt.home.modules.LiquidLevel waterStatus = new org.eclipse.om2m.sdt.home.modules.LiquidLevel("waterStatus", 

+			domain, 

+			new LiquidLevel(DatapointType.water, new EnumDataPoint<Integer>(null) {

+				@Override

+				protected Integer doGetValue() throws DataPointException {

+					smarterCoffee.getStatus();

+					return smarterCoffee.getWaterStatus();

+				}

+			}));

 		addModule(waterStatus);

-		

 	}

 	

-	

+	private void addKeepWarm(){

+		KeepWarm keepWarm = new KeepWarm(name, domain, 

+			new BooleanDataPoint(DatapointType.powerState) {

+				@Override

+				protected Boolean doGetValue() throws DataPointException {

+					return smarterCoffee.getKeepWarmStatus();

+				}

+				protected void doSetValue(Boolean value) {

+					if (value)

+						smarterCoffee.setHotPlateOn(5); // argument is a mintues user want to use hot plate

+					else 

+						smarterCoffee.setHotPlateOff();

+				}

+			});

+		addModule(keepWarm);

+	}

 	

 	public void setProperties(){

 		

 	}

 	

-	

-	

 }

 

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/communication/SmarterCoffeeCommands.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/communication/SmarterCoffeeCommands.java
index e9b3e38..28acae1 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/communication/SmarterCoffeeCommands.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/communication/SmarterCoffeeCommands.java
@@ -13,19 +13,12 @@
 	//HashMap<Integer, String> cupNum = new HashMap<Integer, String>();

 	

 	public static final int MAX_NUMBER_OF_CUPS = 12;

-	

 	public static final int MIN_NUMBER_OF_CUPS = 1;

-	

-	

 

 	public static final byte HEADER_STATUS = 		50; // TODO Add to doc: The status message is periodically sending after establish a connection with the machine

-	

 	public static final byte HEADER_START =			51; //Starts brewing coffee as specified by parameter values

-	

 	public static final byte HEADER_STARTX =		55; // Starts brewing coffee using parameter values set on the machine.

-	

 	public static final byte HEADER_STOP =			52;

-	

 	public static final byte HEADER_SETSTR =		53; //Sets brew strength. Doesn't start brewing.

 	public static final byte HEADER_SETCUPS =		54; //Sets number of cups. Doesn't start brewing.

 	public static final byte HEADER_GRINDTGGL =		60; //Toggles grinder use on and off. The coffee maker LCD shows Beans/Filter respectively. There are no separate 'set grinder on' and 'set grinder off' commands

@@ -39,7 +32,6 @@
 	

 	public static final byte HEADER_ACK = 			3;

 	

-	

 	public static final byte STATUS_FLAGS_MASK_SCHEDULE_7 = 		(byte) 0x80;

 	public static final byte STATUS_FLAGS_MASK_KEEP_WARM_6 = 		(byte) 0x40;

 	public static final byte STATUS_FLAGS_MASK_CYCLE_COMPLETE_5 = 	(byte) 0x20;

@@ -49,7 +41,6 @@
 	public static final byte STATUS_FLAGS_MASK_USE_GRIDNER_1 = 		(byte) 0x02;

 	public static final byte STATUS_FLAGS_CARAFE_DETECTED_0 = 		(byte) 0x01;

 	

-	

 	public static final byte WATER_LEVEL_EMPTY = 	0;

 	public static final byte WATER_LEVEL_LOW = 		1;

 	public static final byte WATER_LEVEL_HALF = 	2;

@@ -61,5 +52,4 @@
 	

 	public static final byte END_OF_MESSAGE = 		126;

 	

-	

-}
\ No newline at end of file
+}

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/communication/SmarterCoffeeCommunication.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/communication/SmarterCoffeeCommunication.java
index c13f38d..2cc487e 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/communication/SmarterCoffeeCommunication.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/communication/SmarterCoffeeCommunication.java
@@ -15,21 +15,15 @@
 public class SmarterCoffeeCommunication {

 	

 	private static final String IP = "10.0.1.25";

-	

 	private static final int PORT = 2081;

 	

 	private String ip;

-	

 	private int port = 0;

-	

 	//TODO status

-	

 	private SmarterCoffeeStatus status;

 	

-	

-	

-	public SmarterCoffeeCommunication (String ip, int port){

-		if(ip != null && port != 0){

+	public SmarterCoffeeCommunication (String ip, int port) {

+		if (ip != null && port != 0) {

 			this.ip = ip;

 			this.port = port;		

 		}

@@ -40,28 +34,27 @@
 		status = new SmarterCoffeeStatus();

 	}

 	

-	public boolean getFaultDetection(){

+	public boolean getFaultDetection() {

 		return status.getFaultDetection();

 	}

 	

-	public int getCode(){

+	public int getCode() {

 		return status.getCode();

 	}

 	

-	public String getDescription(){

+	public String getDescription() {

 		return status.getDescription();

 	}

 	

-	public void start(boolean useGrinder, int numberOfCups, int sdtStrength, boolean keepWarm){ 

-		

+	public void start(boolean useGrinder, int numberOfCups, int sdtStrength, boolean keepWarm) { 

 		byte strength = 0;

-		if(sdtStrength >= TasteStrength.zero && sdtStrength < TasteStrength.medium){

+		if (sdtStrength >= TasteStrength.zero && sdtStrength < TasteStrength.medium) {

 			strength = SmarterCoffeeCommands.BREW_STRENGTH_0;

 		}

-		else if(sdtStrength == TasteStrength.medium){

+		else if (sdtStrength == TasteStrength.medium) {

 			strength = SmarterCoffeeCommands.BREW_STRENGTH_1;

 		}

-		else if (sdtStrength > TasteStrength.medium && sdtStrength <= TasteStrength.maximum){

+		else if (sdtStrength > TasteStrength.medium && sdtStrength <= TasteStrength.maximum) {

 			strength = SmarterCoffeeCommands.BREW_STRENGTH_2;

 		}

 		

@@ -77,30 +70,28 @@
 		detectCoffeeReady(tcp.sendTCPPacket(request)); 

 	}

 	

-	public synchronized void detectCoffeeReady(final byte[] dataToParse){

-		

-		

+	public synchronized void detectCoffeeReady(final byte[] dataToParse) {

 		new Thread(new Runnable() {

 			boolean brewingInProgress = true;

 			boolean isFirst = true;

 			

 			@Override

 			public void run() {

-				while(brewingInProgress){

+				while(brewingInProgress) {

 					Activator.logger.debug("Check coffee ready Thread...");

-					if(isFirst){

+					if (isFirst) {

 						status.parseStatus(dataToParse);

 						isFirst = false;

 					}

-					if(status.getFaultDetection()){

+					if (status.getFaultDetection()) {

 						brewingInProgress = false;

 					}

-					else{

+					else {

 						TCPConnection tcp = new TCPConnection(ip, port);

 						status.parseStatus(tcp.checkStatus());

 					}

 			

-					if(status.isCoffeeReady()) {

+					if (status.isCoffeeReady()) {

 						brewingInProgress = false; 

 						Activator.logger.debug("Coffee is ready!");

 					}

@@ -112,21 +103,21 @@
 				}

 			}

 		}).start();

-		

-		

 	}

 	

-	public int getCoffeeReadyStatus(){

-		

+	public int getCoffeeReadyStatus() {

 		return status.getCoffeePreparationStatus();

 	}

 	

-	public int getWaterStatus(){

+	public int getWaterStatus() {

 		return status.getWaterLevel();

 	}

 	

+	public boolean getKeepWarmStatus() {

+		return status.getKeepWarm();

+	}

 	

-	public void start(){ 

+	public void start() { 

 		TCPConnection tcp = new TCPConnection(this.ip, this.port);

 		tcp.setWaitForResponse(true);

 		byte[] request = new byte[2];

@@ -135,7 +126,7 @@
 		status.parseStatus(tcp.sendTCPPacket(request));

 	}

 	

-	public void getStatus(){ 

+	public void getStatus() { 

 		TCPConnection tcp = new TCPConnection(this.ip, this.port);

 		tcp.setWaitForResponse(true);

 		byte[] request = new byte[2];

@@ -144,10 +135,10 @@
 		status.parseStatus(tcp.sendTCPPacket(request));

 	}

 	

-	public void stop(){		

+	public void stop() {		

 	}

 	

-	public void setBrewStrength(int strength){

+	public void setBrewStrength(int strength) {

 		TCPConnection tcp = new TCPConnection(this.ip, this.port);

 		tcp.setWaitForResponse(true);

 		byte[] request = new byte[3];

@@ -155,10 +146,9 @@
 		request[1] = (byte)strength;

 		request[2] = (byte)SmarterCoffeeCommands.END_OF_MESSAGE;

 		status.parseStatus(tcp.sendTCPPacket(request));

-		

 	}

 	

-	public void setNumberOfCups(int number){

+	public void setNumberOfCups(int number) {

 		TCPConnection tcp = new TCPConnection(this.ip, this.port);

 		tcp.setWaitForResponse(true);

 		byte[] request = new byte[3];

@@ -166,21 +156,18 @@
 		request[1] = (byte)number;

 		request[2] = (byte)SmarterCoffeeCommands.END_OF_MESSAGE;

 		status.parseStatus(tcp.sendTCPPacket(request));

-		

 	}

 	

-	

-	public void tooggleGrinder(){

+	public void tooggleGrinder() {

 		TCPConnection tcp = new TCPConnection(this.ip, this.port);

 		tcp.setWaitForResponse(true);

 		byte[] request = new byte[2];

 		request[0] = SmarterCoffeeCommands.HEADER_GRINDTGGL;

 		request[1] = (byte)SmarterCoffeeCommands.END_OF_MESSAGE;

 		status.parseStatus(tcp.sendTCPPacket(request));

-		

 	}

 	

-	public void setHotPlateOn(int minutes){

+	public void setHotPlateOn(int minutes) {

 		TCPConnection tcp = new TCPConnection(this.ip, this.port);

 		tcp.setWaitForResponse(true);

 		byte[] request = new byte[3];

@@ -190,10 +177,7 @@
 		status.parseStatus(tcp.sendTCPPacket(request));

 	}

 	

-	

-	public void setHotPlateOff(){

-		

-

+	public void setHotPlateOff() {

 		TCPConnection tcp = new TCPConnection(this.ip, this.port);

 		tcp.setWaitForResponse(true);

 		byte[] request = new byte[2];

@@ -202,27 +186,21 @@
 		status.parseStatus(tcp.sendTCPPacket(request));

 	}

 	

-	public void setTime(Date date){  //Calendar??

-		

-		

+	public void setTime(Date date) {  //Calendar??

 	}

 	

-	public void reset(){

-

+	public void reset() {

 		TCPConnection tcp = new TCPConnection(this.ip, this.port);

 		tcp.setWaitForResponse(true);

 		byte[] request = new byte[2];

 		request[0] = SmarterCoffeeCommands.HEADER_RESET;

 		request[1] = (byte)SmarterCoffeeCommands.END_OF_MESSAGE;

 		status.parseStatus(tcp.sendTCPPacket(request));

-		

 	}

 	

-	public void checkStatus(){

+	public void checkStatus() {

 		TCPConnection tcp = new TCPConnection(this.ip, this.port);

 		tcp.checkStatus();

 	}

 

-	

-

 }

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/communication/SmarterCoffeeStatus.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/communication/SmarterCoffeeStatus.java
index 4429fdb..9aadc23 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/communication/SmarterCoffeeStatus.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/communication/SmarterCoffeeStatus.java
@@ -8,7 +8,7 @@
 package org.eclipse.om2m.sdt.home.smartercoffee.communication;

 

 import org.eclipse.om2m.sdt.home.smartercoffee.Activator;

-import org.eclipse.om2m.sdt.home.types.LevelType;

+import org.eclipse.om2m.sdt.home.types.LiquidLevel;

 

 public class SmarterCoffeeStatus {

 	

@@ -198,16 +198,16 @@
 		

 		System.out.println("raw water level=" + waterLevel);

 		if(waterLevel == 0){

-			return LevelType.low;

+			return LiquidLevel.low;

 		}

 		if(waterLevel == 17){		//about HALF -> from about level 7 on the right side of the tank			

-			return LevelType.medium;

+			return LiquidLevel.medium;

 		}

 		if(waterLevel == 18){	//from about level 7 to 10					

-			return LevelType.high;

+			return LiquidLevel.high;

 		}

 		if(waterLevel == 19){							//almost FULL -> from about level 10

-			return LevelType.maximum;

+			return LiquidLevel.maximum;

 		}

 		else{

 			return -1;

@@ -215,4 +215,12 @@
 		

 	}

 

+	public void setKeepWarm(boolean keepWarm) {

+		this.keepWarm = keepWarm;

+	}

+	

+	public boolean getKeepWarm(){

+		return keepWarm;

+	}

+

 }

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/communication/TCPConnection.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/communication/TCPConnection.java
index 24ad803..1006cf8 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/communication/TCPConnection.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smartercoffee/src/main/java/org/eclipse/om2m/sdt/home/smartercoffee/communication/TCPConnection.java
@@ -11,6 +11,7 @@
 import java.io.IOException;

 import java.io.InputStream;

 import java.io.OutputStream;

+import java.net.ConnectException;

 import java.net.Socket;

 import java.net.UnknownHostException;

 

@@ -58,12 +59,11 @@
 			}

 			

 		} catch (UnknownHostException e) {

-

-			e.printStackTrace();

+			System.out.println(e.getMessage());

 		} catch (IOException e) {

-	

-			e.printStackTrace();

-		}

+			System.out.println(e.getMessage());

+		} 

+		

 		return toRet;

 	}

 

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/.gitignore b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/.gitignore
new file mode 100644
index 0000000..239d9b3
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/.gitignore
@@ -0,0 +1,2 @@
+/.project
+/.classpath
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/META-INF/MANIFEST.MF b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..945e9fc
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/META-INF/MANIFEST.MF
@@ -0,0 +1,20 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.om2m.sdt.home.smarterkettle
+Bundle-SymbolicName: org.eclipse.om2m.sdt.home.smarterkettle
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-Activator: org.eclipse.om2m.sdt.home.smarterkettle.Activator
+Bundle-ClassPath: .
+Import-Package: org.eclipse.om2m.sdt,
+ org.eclipse.om2m.sdt.datapoints,
+ org.eclipse.om2m.sdt.exceptions,
+ org.eclipse.om2m.sdt.home,
+ org.eclipse.om2m.sdt.home.actions,
+ org.eclipse.om2m.sdt.home.devices,
+ org.eclipse.om2m.sdt.home.driver,
+ org.eclipse.om2m.sdt.home.modules,
+ org.eclipse.om2m.sdt.home.types,
+ org.osgi.framework,
+ org.osgi.service.cm,
+ org.osgi.service.log
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/build.properties b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/build.properties
new file mode 100644
index 0000000..4e9b649
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/build.properties
@@ -0,0 +1,23 @@
+###############################################################################
+# Copyright (c) 2013-2016 LAAS-CNRS (www.laas.fr)
+# 7 Colonel Roche 31077 Toulouse - France
+# 
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+# 
+# Initial Contributors:
+# 	Thierry Monteil : Project manager, technical co-manager
+# 	Mahdi Ben Alaya : Technical co-manager
+# 	Samir Medjiah : Technical co-manager
+# 	Khalil Drira : Strategy expert
+# 	Guillaume Garzone : Developer
+# 	François Aïssaoui : Developer
+# 
+# New contributors :
+###############################################################################
+source.. = src/main/java/
+output.. = bin/
+bin.includes = META-INF/,\
+               .
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/pom.xml b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/pom.xml
new file mode 100644
index 0000000..7f46744
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/pom.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Copyright (c) 2014, 2016 Orange.
+    All rights reserved. This program and the accompanying materials
+    are made available under the terms of the Eclipse Public License v1.0
+    which accompanies this distribution, and is available at
+    http://www.eclipse.org/legal/epl-v10.html
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+	<modelVersion>4.0.0</modelVersion>
+
+	<parent>
+		<groupId>org.eclipse.om2m</groupId>
+		<artifactId>org.eclipse.om2m.sdt</artifactId>
+		<version>1.0.0-SNAPSHOT</version>
+	</parent>
+
+	<artifactId>org.eclipse.om2m.sdt.home.smarterkettle</artifactId>
+	<packaging>eclipse-plugin</packaging>
+
+	<dependencies>
+
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>3.8.2</version>
+			<scope>test</scope>
+		</dependency>
+
+	</dependencies>
+
+	<build>
+
+		<testSourceDirectory>src/test/java</testSourceDirectory>
+		<plugins>
+
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<version>2.3.2</version>
+				<configuration>
+					<source>1.7</source>
+					<target>1.7</target>
+				</configuration>
+				<executions>
+					<execution>
+						<id>compiletests</id>
+						<phase>test-compile</phase>
+						<goals>
+							<goal>testCompile</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-surefire-plugin</artifactId>
+				<version>2.12.4</version>
+				<executions>
+					<execution>
+						<id>test</id>
+						<phase>test</phase>
+						<configuration>
+							<includes>
+								<include>**/*Test.java</include>
+							</includes>
+						</configuration>
+						<goals>
+							<goal>test</goal>
+						</goals>
+					</execution>
+				</executions>
+			</plugin>
+		</plugins>
+	</build>
+
+</project>
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/Activator.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/Activator.java
new file mode 100644
index 0000000..a9f9fc6
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/Activator.java
@@ -0,0 +1,122 @@
+/*******************************************************************************

+ * Copyright (c) 2014, 2016 Orange.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *******************************************************************************/

+package org.eclipse.om2m.sdt.home.smarterkettle;

+

+import java.util.Dictionary;

+import java.util.Hashtable;

+

+import javax.naming.Context;

+import javax.net.ssl.SSLException;

+

+import org.eclipse.om2m.sdt.Domain;

+import org.eclipse.om2m.sdt.exceptions.AccessException;

+import org.eclipse.om2m.sdt.exceptions.ActionException;

+import org.eclipse.om2m.sdt.exceptions.DataPointException;

+import org.eclipse.om2m.sdt.home.HomeDomain;

+import org.eclipse.om2m.sdt.home.driver.Logger;

+import org.eclipse.om2m.sdt.home.types.TasteStrength;

+import org.omg.CORBA.SystemException;

+import org.osgi.framework.BundleActivator;

+import org.osgi.framework.BundleContext;

+import org.osgi.framework.Constants;

+import org.osgi.framework.ServiceRegistration;

+import org.osgi.service.cm.ConfigurationException;

+import org.osgi.service.cm.ManagedService;

+import org.osgi.service.log.LogService;

+

+public class Activator implements ManagedService, BundleActivator {

+	

+	private BundleContext context;

+	private Boolean activated;

+	private Domain domain;

+	private static final String ID = "SmarterKettle";

+	

+	private SmarterKettle sKettle;

+	private static int idNum = 1;

+	

+	

+	public Activator() {

+		

+		this.domain = new HomeDomain("Smarter Kettle Domain");

+	}

+	

+	private void addKettleMachine(String ip, int port){

+		System.out.println("AddKettleMachine");

+		System.out.println(ip + ":" + port);

+		

+		

+		sKettle = new SmarterKettle(ID + idNum++, domain, ip, port);

+		

+		sKettle.register(context);

+		

+	}

+

+	@Override

+	public void start(BundleContext context) throws Exception {

+		System.out.println("Bundle kettle machine starting");

+		this.context = context;

+		activated = true;

+		

+		addKettleMachine("10.0.1.27", 2081);

+		//test();

+	}

+	

+	public void test() throws ActionException, AccessException, InterruptedException, DataPointException{

+		System.out.println("----Test----");

+		

+		if(!sKettle.getFaultDetection().getStatus()){			

+			System.out.println("KOD bledu: " + sKettle.getFaultDetection().getCode() + " Opis: " + sKettle.getFaultDetection().getDescription());

+		}

+		else{

+			System.out.println("Brak błędów");

+		}

+		

+		

+		System.out.println("----Test modułu temperatury---");

+		

+		sKettle.getTemperature().setTargetTemperature(50);

+		sKettle.getTemperature().setTargetTemperature(50);

+		

+		

+		System.out.println("Current: " + sKettle.getTemperature().getCurrentTemperature());

+		System.out.println("Target: " + sKettle.getTemperature().getTargetTemperature());

+		System.out.println("Max: " + sKettle.getTemperature().getMaxValue());

+		System.out.println("Min: " + sKettle.getTemperature().getMinValue());

+		System.out.println("Step: " + sKettle.getTemperature().getStepValue());

+		

+		

+		

+		

+		sKettle.getBoilingSwitch().toggle();

+		

+		

+		System.out.println("Test modułu BOILING");

+		System.out.println("Spradzenie statusu za pomocą modułu BOILING");

+		//System.out.println("Czy gotuje: " + sKettle.getBoiling().getStatus());

+		System.out.println("Czy goutje: " + sKettle.getBoilingSwitch().getPowerState());

+		

+		

+		

+		

+	}

+

+

+	@Override

+	public void updated(Dictionary properties) throws ConfigurationException {

+		System.out.println("Uptaded");

+		addKettleMachine("10.0.1.28", 2081);

+				

+	}

+	

+

+	@Override

+	public void stop(BundleContext context) throws Exception {

+		activated = false;

+	}

+}

+	

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/SmarterKettle.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/SmarterKettle.java
new file mode 100644
index 0000000..9f7e008
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/SmarterKettle.java
@@ -0,0 +1,249 @@
+/*******************************************************************************

+ * Copyright (c) 2014, 2016 Orange.

+ * All rights reserved. This program and the accompanying materials

+ * are made available under the terms of the Eclipse Public License v1.0

+ * which accompanies this distribution, and is available at

+ * http://www.eclipse.org/legal/epl-v10.html

+ *******************************************************************************/

+package org.eclipse.om2m.sdt.home.smarterkettle;

+

+import java.awt.KeyboardFocusManager;

+import java.nio.channels.NonWritableChannelException;

+import java.util.List;

+

+import org.eclipse.om2m.sdt.Domain;

+import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;

+import org.eclipse.om2m.sdt.datapoints.FloatDataPoint;

+import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;

+import org.eclipse.om2m.sdt.datapoints.StringDataPoint;

+import org.eclipse.om2m.sdt.exceptions.AccessException;

+import org.eclipse.om2m.sdt.exceptions.ActionException;

+import org.eclipse.om2m.sdt.exceptions.DataPointException;

+import org.eclipse.om2m.sdt.home.actions.Toggle;

+import org.eclipse.om2m.sdt.home.devices.Kettle;

+import org.eclipse.om2m.sdt.home.driver.Utils;

+import org.eclipse.om2m.sdt.home.modules.BinarySwitch;

+import org.eclipse.om2m.sdt.home.modules.Boiling;

+import org.eclipse.om2m.sdt.home.modules.Brewing;

+import org.eclipse.om2m.sdt.home.modules.FaultDetection;

+import org.eclipse.om2m.sdt.home.modules.Grinder;

+import org.eclipse.om2m.sdt.home.modules.KeepWarm;

+import org.eclipse.om2m.sdt.home.modules.Level;

+import org.eclipse.om2m.sdt.home.modules.Temperature;

+import org.eclipse.om2m.sdt.home.smarterkettle.communication.SmarterKettleCommands;

+import org.eclipse.om2m.sdt.home.smarterkettle.communication.SmarterKettleCommunication;

+import org.eclipse.om2m.sdt.home.smarterkettle.communication.SmarterKettleStatus;

+import org.eclipse.om2m.sdt.home.types.DeviceType;

+import org.eclipse.om2m.sdt.home.types.LevelType;

+import org.eclipse.om2m.sdt.home.types.TasteStrength;

+import org.omg.CORBA.PRIVATE_MEMBER;

+import org.osgi.framework.BundleContext;

+import org.osgi.framework.ServiceRegistration;

+

+public class SmarterKettle extends Kettle{

+	

+	

+	private List<ServiceRegistration> registrations;

+	private Domain domain; 

+	private String serial = "SmarterKettle";

+	private String IP;

+	private int port;

+	

+	

+	private SmarterKettleCommunication smarterKettle;

+	

+	private IntegerDataPoint cupsNumber;

+	private BooleanDataPoint keepWarm;

+	private TasteStrength strength;

+	private IntegerDataPoint status;

+	

+	

+

+	public SmarterKettle(String id, Domain domain, String ip , int port) {

+		

+		super(id, id, domain);

+		this.domain = domain;

+		this.serial = id;

+		this.IP = ip;

+		this.port = port;

+		

+		smarterKettle = new SmarterKettleCommunication(ip, port);

+		

+		System.out.println("TUTAJ HALO: " + DeviceType.deviceKettle);

+		

+		

+		addBinarySwitch();

+		addFaultDetection();

+		addTemperature();

+		

+		setDeviceManufacturer("Smarter");

+		setDeviceName("SmarterKettle 2.0");

+	

+		

+		

+		

+	}

+	

+	

+	public void register(BundleContext context) {

+		registrations = Utils.register(this, context);

+	}

+	

+	

+	

+//*********************BinarySwitch*********************	

+	

+	private void addBinarySwitch(){

+		

+		

+

+		BinarySwitch binarySwitch = new BinarySwitch("BinarySwitch" + getId(), domain, new BooleanDataPoint("powerState"){

+

+			@Override

+			protected Boolean doGetValue() throws DataPointException {

+				return smarterKettle.kettleStatus.isBoiling();

+			}

+			

+			@Override

+			protected void doSetValue(Boolean v)throws DataPointException{

+				if(!smarterKettle.kettleStatus.isBoiling()){

+					smarterKettle.startKettle(smarterKettle.kettleStatus.getTargetTemperature());

+					System.out.println("Włączanie");

+				}

+					

+				else{

+					smarterKettle.stopKettle();	

+					System.out.println("Wyłączanie");

+				}

+									

+			}			

+		});

+		

+		binarySwitch.setToggle(new Toggle("toggle"){

+

+			@Override

+			protected void doToggle() throws ActionException {

+				

+				smarterKettle.checkStatus();

+				

+				System.out.println("Uruchomiony toggle");

+				if(!smarterKettle.kettleStatus.isBoiling()){

+					smarterKettle.startKettle();

+					System.out.println("Włączanie");

+				}

+					

+				else{

+					smarterKettle.stopKettle();	

+					System.out.println("Wyłączanie");

+				}

+								

+			}			

+		});

+		

+		

+		addModule(binarySwitch);

+	}

+//*********************BinarySwitch*********************

+	

+//***************Fault Detection Module*****************

+

+	

+	private void addFaultDetection() {

+		FaultDetection faultDetection = new FaultDetection("FaultDetection_" + getId(), domain,

+				new BooleanDataPoint("status") {

+			@Override

+			public Boolean doGetValue() throws DataPointException {

+				smarterKettle.checkStatus();

+				return smarterKettle.getFaultDetection(); 

+			}

+		}, new IntegerDataPoint("code") {

+			

+			@Override

+			protected Integer doGetValue() throws DataPointException {

+				return smarterKettle.getCode();

+			}	

+		}, new StringDataPoint("description") {

+			

+			@Override

+			protected String doGetValue() throws DataPointException {

+				return smarterKettle.getDescription();

+			}

+		});

+		

+		

+		

+		addModule(faultDetection);

+	}

+	

+	

+//***************Fault Detection Module*****************

+	

+//*****************Temperature Module*******************

+	

+	

+	private void addTemperature(){

+		System.out.println("Dodawanie modułu temperatury...");

+		Temperature temperature = new Temperature("Temperature_" + getId(), domain, new FloatDataPoint("currentTemperature") {

+			

+			@Override

+			protected Float doGetValue() throws DataPointException {

+				return (float) smarterKettle.kettleStatus.getCurrentTemperature();

+			}

+			

+			

+			

+		}, new FloatDataPoint("targetTemperature") {

+			

+			@Override

+			protected Float doGetValue() throws DataPointException {

+				return (float)smarterKettle.kettleStatus.getTargetTemperature();

+			}

+			

+			@Override

+			protected void doSetValue(Float b) throws DataPointException {

+				

+				smarterKettle.kettleStatus.setTargetTemperature(Math.round(b));

+			}

+					

+			

+		}, new StringDataPoint("unit") {

+			

+			@Override

+			protected String doGetValue() throws DataPointException {

+				return null;

+			}

+		}, new FloatDataPoint("minValue") {

+			

+			@Override

+			protected Float doGetValue() throws DataPointException {

+				return (float)smarterKettle.kettleStatus.getMinTemperature();

+			}

+			

+			

+		}, new FloatDataPoint("maxValue") {

+			

+			@Override

+			protected Float doGetValue() throws DataPointException {

+				return (float)smarterKettle.kettleStatus.getMaxTemperature();

+			}

+		}, new FloatDataPoint("stepValue") {

+			

+			@Override

+			protected Float doGetValue() throws DataPointException {

+				return (float)smarterKettle.kettleStatus.getStepTemperature();

+			}

+		});

+		

+		

+		

+		addModule(temperature);

+	}

+	

+//*****************Temperature Module*******************

+

+

+}

+

+	

+	

+

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/communication/SmarterKettleCommands.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/communication/SmarterKettleCommands.java
new file mode 100644
index 0000000..a437375
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/communication/SmarterKettleCommands.java
@@ -0,0 +1,15 @@
+package org.eclipse.om2m.sdt.home.smarterkettle.communication;

+

+public class SmarterKettleCommands {

+	

+	public static final byte START_KETTLE = 21; //START KETTLE

+	public static final byte STOP_KETTLE = 22; //STOP KETTLE

+	public static final byte SHEDULE_TEST = 65;

+	

+	public static final byte END_OF_MESSAGE = 126; //ENDING MESSAGE

+	

+	

+	

+	

+

+}

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/communication/SmarterKettleCommunication.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/communication/SmarterKettleCommunication.java
new file mode 100644
index 0000000..877b496
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/communication/SmarterKettleCommunication.java
@@ -0,0 +1,160 @@
+package org.eclipse.om2m.sdt.home.smarterkettle.communication;

+

+import javax.net.ssl.SSLEngineResult.Status;

+

+public class SmarterKettleCommunication {

+	

+	

+	public SmarterKettleStatus kettleStatus;

+	

+	public SmarterKettleCommunication(String ip, int port) {

+		TCPConnection.setAddress(ip);

+		TCPConnection.setPort(port);

+		

+		kettleStatus = new SmarterKettleStatus();

+	}

+

+

+	public void startKettle(int temperature){

+		TCPConnection tcp = new TCPConnection();

+		tcp.setWaitForResponse(true);;

+		

+		byte[] request = new byte[4];

+		

+		request[0] = SmarterKettleCommands.START_KETTLE;

+		request[1] = (byte)temperature;

+		request[2] = (byte)0;

+		request[3] = SmarterKettleCommands.END_OF_MESSAGE;

+		

+		System.out.println("sent: " + "0:" + request[0] + "| 1: " + request[1] + "| 2: " + request[2] + "| 3: " + request[3] + "|");

+		

+		tcp.sendTCPPacket(request);	

+		

+		

+		

+	}

+	

+	public void startKettle(){

+		TCPConnection tcp = new TCPConnection();

+		tcp.setWaitForResponse(true);;

+		

+		byte[] request = new byte[4];

+		

+		int temperature = kettleStatus.getTargetTemperature();

+		

+		request[0] = SmarterKettleCommands.START_KETTLE;

+		request[1] = (byte)temperature;

+		request[2] = (byte)0;

+		request[3] = SmarterKettleCommands.END_OF_MESSAGE;

+		

+		System.out.println("sent: " + "0:" + request[0] + "| 1: " + request[1] + "| 2: " + request[2] + "| 3: " + request[3] + "|");

+		

+		tcp.sendTCPPacket(request);	

+		

+		

+		

+	}

+	

+	public void stopKettle(){

+		TCPConnection tcp = new TCPConnection();

+		tcp.setWaitForResponse(true);;

+		

+		byte[] request = new byte[2];

+		

+		request[0] = SmarterKettleCommands.STOP_KETTLE;

+		request[1] = SmarterKettleCommands.END_OF_MESSAGE;

+		

+		

+		System.out.println("sent: " + "0:" + request[0] + "| 1: " + request[1] + "|");

+		tcp.sendTCPPacket(request);

+		

+		

+			

+	}

+	

+	public void checkDeviceInfo(){

+		TCPConnection tcp = new TCPConnection();

+		tcp.setWaitForResponse(true);

+		

+		byte[] request = new byte[1];

+		//request[0] = SmarterKettleCommands.CHECK_STATUS;

+		request[0] = SmarterKettleCommands.END_OF_MESSAGE;

+		

+		System.out.println("sent: " + "0:" + request[0] + "|");

+		

+		tcp.sendTCPPacket(request);

+		

+		

+	}

+	

+	public void sheduleTest(){

+		TCPConnection tcp = new TCPConnection();

+		tcp.setWaitForResponse(true);

+		

+		byte[] request = new byte[1];

+		request[0] = SmarterKettleCommands.SHEDULE_TEST;

+		System.out.println("sent: " + "0:" + request[0] + "|");

+		tcp.sendTCPPacket(request);

+	}

+	

+	

+	

+	

+	public void checkStatus(){//Water level and current temperature are available only when kettle isPlugged.

+		TCPConnection tcp = new TCPConnection();

+		byte[] statusAnswer = new byte[7];

+		statusAnswer = tcp.checkStatus();	

+		

+		kettleStatus.setCurrentTemperature(Byte.toUnsignedInt(statusAnswer[2]));

+		kettleStatus.setWaterLevel(Byte.toUnsignedInt(statusAnswer[4]));	

+		

+		

+		

+		

+		if(statusAnswer[1] == 0)

+			kettleStatus.setBoiling(false);

+		else 

+			kettleStatus.setBoiling(true);

+		

+		if(statusAnswer[3] == (int)8)

+			kettleStatus.setPlugged(true);

+		else

+			kettleStatus.setPlugged(false);

+		

+		kettleStatus.setWaterLevel(Byte.toUnsignedInt(statusAnswer[4]));

+		kettleStatus.setWaterLevelEnum(Byte.toUnsignedInt(statusAnswer[4]));

+		

+		

+		System.out.println("STATUS -------- Czy gotuje: " + kettleStatus.isBoiling());

+		System.out.println("Czy stoi na podstawie: " + kettleStatus.isPlugged());

+		System.out.println("Ile wody: " + kettleStatus.getWaterLevel());

+		System.out.println("Aktualna temperatura: " + kettleStatus.getCurrentTemperature());

+		System.out.println("Ile wody nazwa: " + kettleStatus.getWaterLevelName());

+		

+		

+		

+		

+		

+		

+		

+		

+		

+		

+	}

+

+

+	public Boolean getFaultDetection() {

+		return kettleStatus.getFaultDetection();

+	}

+

+

+	public Integer getCode() {

+		return kettleStatus.getCode();

+	}

+

+

+	public String getDescription() {

+		return kettleStatus.getDescription();

+	}

+

+}

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/communication/SmarterKettleMain.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/communication/SmarterKettleMain.java
new file mode 100644
index 0000000..ba0ddd3
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/communication/SmarterKettleMain.java
@@ -0,0 +1,62 @@
+package org.eclipse.om2m.sdt.home.smarterkettle.communication;

+

+

+import java.util.Scanner;

+

+public class SmarterKettleMain {

+	

+	public static void main(String[] args) throws InterruptedException {

+		

+		System.out.println("Smart Kettle 2.0");

+		System.out.println("1 - wlacz, 2 - wylacz, 3- checkStatus");

+		

+		

+		TCPConnection.setAddress("10.0.1.27");

+		TCPConnection.setPort(2081);

+		

+		while(true){

+			SmarterKettleCommunication kettle = new SmarterKettleCommunication("10.0.1.27", 2081);

+			

+			int action = 100;

+			

+			

+			Scanner input = new Scanner(System.in);

+			String inputString = input.nextLine();

+			action = Integer.parseInt(inputString);

+			

+			switch(action){

+			case 1:

+				System.out.println("Temperatura: ");

+				int temperature = 100;

+				inputString = input.nextLine();

+				temperature = Integer.parseInt(inputString);

+				kettle.startKettle(temperature);

+				action = 100;

+				break;

+			case 2: 

+				kettle.stopKettle();

+				action = 100;

+				break;

+			case 3:

+				kettle.checkStatus();

+				action = 100;

+				break;

+			

+			

+				

+				

+			}

+		}

+

+		

+		

+		

+

+

+		

+	}

+		

+	

+

+

+}

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/communication/SmarterKettleStatus.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/communication/SmarterKettleStatus.java
new file mode 100644
index 0000000..af403d1
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/communication/SmarterKettleStatus.java
@@ -0,0 +1,156 @@
+package org.eclipse.om2m.sdt.home.smarterkettle.communication;

+

+public class SmarterKettleStatus {

+	

+	public final SmarterKettleStatusDescriptor NO_FAULT = new SmarterKettleStatusDescriptor(0, "No faults detected");

+	public final SmarterKettleStatusDescriptor UNREACHABLE = new SmarterKettleStatusDescriptor(-1, "Kettle is unreachable");

+	public final SmarterKettleStatusDescriptor WATER_ERROR = new SmarterKettleStatusDescriptor(-2,  "There's no water in the kettle");

+	public final SmarterKettleStatusDescriptor UNPLUGGED = new SmarterKettleStatusDescriptor(-3, "Kettle isn't plugged");

+	

+	public final SmarterKettleStatusDescriptor BOILING_IN_PROGRESS = new SmarterKettleStatusDescriptor(1,  "Boiling in progress");

+	

+

+	private int currentTemperature = 0;

+	private  int waterLevel = 0;

+

+	private boolean isPlugged = false;

+	private boolean isBoiling = false;

+	private boolean isEmpty = false;

+	

+	private int targetTemperature = 30;

+	private int minTemperature = 20;;

+	private int maxTemperature = 100;

+	private int stepTemperature = 1;

+	

+	public int getCode(){

+		if(!isPlugged)

+			return UNPLUGGED.getCode();

+		else if (isEmpty) 

+			return WATER_ERROR.getCode();

+		else 

+			return NO_FAULT.getCode();

+	}

+	

+	public String getDescription(){

+		if(!isPlugged)

+			return UNPLUGGED.getDescription();

+		else if (isEmpty) 

+			return WATER_ERROR.getDescription();

+		else 

+			return NO_FAULT.getDescription();

+	}

+	

+	

+

+	public enum waterLevels {

+		EMPTY, LOW, HALF, QUARTER, FULL;

+	}

+

+	private waterLevels waterLevelName = waterLevels.EMPTY;

+

+	public waterLevels getWaterLevelName() {

+		return waterLevelName;

+	}

+

+	public void setWaterLevelName(waterLevels waterLevelName) {

+		this.waterLevelName = waterLevelName;

+	}

+

+	public int getCurrentTemperature() {

+		return currentTemperature;

+	}

+

+	public void setCurrentTemperature(int currentTemperature) {

+		this.currentTemperature = currentTemperature;

+	}

+

+	public int getWaterLevel() {

+		return waterLevel;

+	}

+

+	public  void setWaterLevel(int waterLevel) {

+		this.waterLevel = waterLevel;

+	}

+

+	public  void setWaterLevelEnum(int waterLevel) {

+		if (waterLevel >= 190)

+			waterLevelName = waterLevels.FULL;

+		else if (waterLevel < 190 && waterLevel >= 120)

+			waterLevelName = waterLevels.QUARTER;

+		else if (waterLevel < 120 && waterLevel >= 80)

+			waterLevelName = waterLevels.HALF;

+		else if (waterLevel < 80 && waterLevel >= 20)

+			waterLevelName = waterLevels.LOW;

+		else

+			waterLevelName = waterLevels.EMPTY;

+	}

+

+	public  boolean isPlugged() {

+		return isPlugged;

+	}

+

+	public  void setPlugged(boolean isPlugged) {

+		this.isPlugged = isPlugged;

+	}

+

+	public  boolean isBoiling() {

+		return isBoiling;

+	}

+

+	public  void setBoiling(boolean isBoiling) {

+		this.isBoiling = isBoiling;

+	}

+	

+	

+	

+	public boolean getFaultDetection(){

+		if(!isPlugged)

+			return false;

+		else if(isEmpty)

+			return false;

+		else

+			return true;

+	}

+

+	public boolean isEmpty() {

+		return isEmpty;

+	}

+

+	public void setEmpty(boolean isEmpty) {

+		this.isEmpty = isEmpty;

+	}

+

+	public int getTargetTemperature() {

+		return targetTemperature;

+	}

+

+	public void setTargetTemperature(int targetTemperature) {

+		this.targetTemperature = targetTemperature;

+	}

+

+	public int getMinTemperature() {

+		return minTemperature;

+	}

+

+	public void setMinTemperature(int minTemperature) {

+		this.minTemperature = minTemperature;

+	}

+

+	public int getMaxTemperature() {

+		return maxTemperature;

+	}

+

+	public void setMaxTemperature(int maxTemperature) {

+		this.maxTemperature = maxTemperature;

+	}

+

+	public int getStepTemperature() {

+		return stepTemperature;

+	}

+

+	public void setStepTemperature(int stepTemperature) {

+		this.stepTemperature = stepTemperature;

+	}

+

+

+}
\ No newline at end of file
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/communication/SmarterKettleStatusDescriptor.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/communication/SmarterKettleStatusDescriptor.java
new file mode 100644
index 0000000..d2aa56c
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/communication/SmarterKettleStatusDescriptor.java
@@ -0,0 +1,29 @@
+package org.eclipse.om2m.sdt.home.smarterkettle.communication;

+

+public class SmarterKettleStatusDescriptor {

+	

+	private int code;

+	private String description;

+	

+	public SmarterKettleStatusDescriptor(int code, String desc){

+		this.code = code;

+		this.description = desc;

+	}

+

+	public int getCode() {

+		return code;

+	}

+

+	public void setCode(int code) {

+		this.code = code;

+	}

+

+	public String getDescription() {

+		return description;

+	}

+

+	public void setDescription(String description) {

+		this.description = description;

+	}

+

+}

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/communication/TCPConnection.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/communication/TCPConnection.java
new file mode 100644
index 0000000..52c632c
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.smarterkettle/src/main/java/org/eclipse/om2m/sdt/home/smarterkettle/communication/TCPConnection.java
@@ -0,0 +1,189 @@
+package org.eclipse.om2m.sdt.home.smarterkettle.communication;

+

+import java.io.DataOutputStream;

+import java.io.IOException;

+import java.io.InputStream;

+import java.io.OutputStream;

+import java.net.Socket;

+import java.net.UnknownHostException;

+

+

+public class TCPConnection {

+	

+	private static String address = "";

+

+	private static int port = 2081;

+

+	private Socket socket;

+

+	private boolean waitForResponse = true;  // should be set true if ACK or Status expected

+	

+	/*public TCPConnection(String address, int port){

+		

+		this.address = address;

+		this.port = port;

+		

+	}*/

+	

+

+	public void sendTCPPacket(byte[] bytes2send){

+		sendTCPPacket(bytes2send, this.address, this.port);

+		

+	}

+	

+	

+	public void sendTCPPacket(byte[] bytes2send, String address, int port){

+		try {

+			socket = new Socket(address, port);

+			

+			sendBytes(bytes2send, socket);

+			

+			if(!waitForResponse ){

+				socket.close();

+			}else{

+				/*if(bytes2send[0] == SmarterCoffeeCommands.HEADER_START){

+					

+				}

+				else{*/

+					readBytes();

+				//}

+				//socket.close();

+			}

+			

+		} catch (UnknownHostException e) {

+			// TODO Auto-generated catch block

+			e.printStackTrace();

+		} catch (IOException e) {

+			// TODO Auto-generated catch block

+			e.printStackTrace();

+		}

+	}

+

+

+

+public void sendBytes(byte[] bytes2send, Socket socket) throws IOException {

+    sendBytes(bytes2send, 0, bytes2send.length, socket);

+}

+

+public void sendBytes(byte[] bytes2send, int start, int len, Socket socket) throws IOException {

+    if (len < 0)

+        throw new IllegalArgumentException("Negative length not allowed");

+    if (start < 0 || start >= bytes2send.length)

+        throw new IndexOutOfBoundsException("Out of bounds: " + start);

+

+    if(socket != null){

+    	OutputStream out = socket.getOutputStream(); 

+    	DataOutputStream dos = new DataOutputStream(out);

+

+    	//dos.writeInt(len);

+    	if (len > 0) {

+    		dos.write(bytes2send, start, len);

+    	}

+    	

+    	//dos.close();

+    	//out.close();

+    }

+    

+}

+

+public byte[] readBytes() throws IOException {

+	boolean statusMsg = false;

+	 byte[] buffer = new byte[1024];

+	    int charsRead = 0;

+	    if(socket!= null){

+	    	InputStream in = this.socket.getInputStream();

+	    	

+	    	

+	    	while(!statusMsg){

+	    		int k = 0;

+	    		int iterator = 0;

+	    		while ((charsRead = in.read(buffer)) != -1)

+	    			

+	    		

+	    

+	    

+	    		{	

+	    			

+	    			iterator++;

+	    			

+	    			if(charsRead == 3) break;  //ACK received

+	    			if(charsRead > 3) statusMsg = true; //Status received

+	    		

+	    				for(int i = 0; i < charsRead; i++){

+	    					if(i == 2)

+	    						System.out.print( "Temp ( " + i + ")" +": " + Byte.toUnsignedInt(buffer[i]) + " | ");

+	    					else

+	    						System.out.print( i +": " + Byte.toUnsignedInt(buffer[i]) + " | ");	        

+	    				}

+	    				System.out.println(" ");

+	    		

+	    			if(buffer[charsRead-1] == SmarterKettleCommands.END_OF_MESSAGE) break; 

+	    		   

+	    			

+	    		

+	    		}

+	    		

+	    	}

+	    		in.close();

+	    }

+	    byte[] data = new byte[charsRead];

+	    System.arraycopy(buffer, 0, data, 0, charsRead);

+	    	 

+    return data;

+}

+

+public byte[] checkStatus(){

+	

+	byte[] result = new byte[7];

+	

+	try {

+		socket = new Socket(address, port);

+		result = readBytes();

+		return result;

+		//socket.close();

+		

+	} catch (UnknownHostException e) {

+

+		e.printStackTrace();

+	} catch (IOException e) {

+

+		e.printStackTrace();

+	}

+	

+	return result;

+	

+	

+}

+

+

+public static String getAddress() {

+	return address;

+}

+

+

+public static void setAddress(String address) {

+	TCPConnection.address = address;

+}

+

+

+public boolean isWaitForResponse() {

+	return waitForResponse;

+}

+

+

+public void setWaitForResponse(boolean waitForResponse) {

+	this.waitForResponse = waitForResponse;

+}

+

+public static int getPort() {

+	return port;

+}

+

+

+public static void setPort(int port) {

+	TCPConnection.port = port;

+}

+

+

+

+}

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.tester/META-INF/MANIFEST.MF b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.tester/META-INF/MANIFEST.MF
index 6cee944..8879ed1 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.tester/META-INF/MANIFEST.MF
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.tester/META-INF/MANIFEST.MF
@@ -12,6 +12,7 @@
  org.eclipse.om2m.sdt.datapoints,
  org.eclipse.om2m.sdt.events,
  org.eclipse.om2m.sdt.exceptions,
+ org.eclipse.om2m.sdt.home.actions,
  org.eclipse.om2m.sdt.home.devices,
  org.eclipse.om2m.sdt.home.modules,
  org.eclipse.om2m.sdt.home.types,
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.tester/src/main/java/org/eclipse/om2m/sdt/home/tester/Activator.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.tester/src/main/java/org/eclipse/om2m/sdt/home/tester/Activator.java
index c42f006..5706396 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.tester/src/main/java/org/eclipse/om2m/sdt/home/tester/Activator.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.tester/src/main/java/org/eclipse/om2m/sdt/home/tester/Activator.java
@@ -22,7 +22,6 @@
 import org.eclipse.om2m.sdt.DataPoint;
 import org.eclipse.om2m.sdt.Device;
 import org.eclipse.om2m.sdt.Module;
-import org.eclipse.om2m.sdt.args.Command;
 import org.eclipse.om2m.sdt.datapoints.AbstractDateDataPoint;
 import org.eclipse.om2m.sdt.datapoints.ArrayDataPoint;
 import org.eclipse.om2m.sdt.datapoints.EnumDataPoint;
@@ -34,15 +33,16 @@
 import org.eclipse.om2m.sdt.home.devices.WaterValve;
 import org.eclipse.om2m.sdt.home.modules.AlarmSpeaker;
 import org.eclipse.om2m.sdt.home.modules.AudioVolume;
-import org.eclipse.om2m.sdt.home.types.LevelType;
+import org.eclipse.om2m.sdt.home.types.LiquidLevel;
 import org.eclipse.om2m.sdt.types.Array;
-import org.eclipse.om2m.sdt.types.SimpleType;
 import org.eclipse.om2m.sdt.types.DataType.TypeChoice;
+import org.eclipse.om2m.sdt.types.SimpleType;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.component.ComponentContext;
 import org.osgi.service.log.LogService;
 
+@SuppressWarnings({ "rawtypes", "unchecked" })
 public class Activator implements SDTEventListener {
 
 	private List<Device> devices;
@@ -126,9 +126,8 @@
 			Logger.info("test light " + light);//.prettyPrint());
 			Logger.info("fault status: " + light.getFaultDetection().getStatus());
 			Logger.info("powered: " + light.getBinarySwitch().getPowerState());
-//			light.getBinarySwitch().toggle();
 			try {
-				((Command)light.getBinarySwitch().getAction("org.onem2m.home.actions.toggle__toggle")).invoke(null);
+				light.getBinarySwitch().toggle();
 			} catch (Exception e) {
 				Logger.warning("Error", e);
 			}
@@ -141,28 +140,38 @@
 				Thread.sleep(2000);
 				light.getColour().setBlue((int) Math.random() * 255);
 				Thread.sleep(2000);
-				light.getColourSaturation().setColourSaturation((int) Math.random() * 100);
+				light.getColourSaturation().setColourSat((int) Math.random() * 100);
 				List<String> modes = light.getRunMode().getSupportedModes();
 				if (! modes.isEmpty()) {
 					String mode = modes.get((int) (Math.random() * modes.size()));
 					Logger.info("set run mode: " + mode + " from supported " + modes);
 					light.getRunMode().setOperationMode(mode);
 				}
+//				List<Integer> states = light.getRunState().getJobStates();
+//				if (! states.isEmpty()) {
+//					Integer mode = states.get((int) (Math.random() * states.size()));
+//					Logger.info("set run state: " + mode + " from supported " + states);
+//					light.getRunState().setJobState(mode);
+//				}
 			}
 		}
 		Thread.sleep(1000);
 		for (Light light : lights) {
 			Logger.info("light color: r=" + light.getColour().getRed() + ", g=" + light.getColour().getGreen() + ", b="
 					+ light.getColour().getBlue());
-			Logger.info("light color saturation: " + light.getColourSaturation().getColourSaturation());
-			Logger.info("light modes: " + light.getRunMode().getOperationMode());
+			Logger.info("light color saturation: " + light.getColourSaturation().getColourSat());
+			Logger.info("light states: " + light.getRunMode().getSupportedModes());
 		}
 		Thread.sleep(1000);
 		for (Light light : lights) {
 			try {
 				for (Module mod : light.getModules()) {
 					if (mod instanceof AudioVolume) {
-						((AudioVolume) mod).upOrDown(up);
+						AudioVolume vol = (AudioVolume) mod;
+						if (up)
+							vol.upVolume();
+						else
+							vol.downVolume();
 					}
 				}
 			} catch (Exception e) {
@@ -172,7 +181,6 @@
 		}
 	}
 
-	@SuppressWarnings("unchecked")
 	private void testDevices() throws Exception {
 		for (Device dev : devices) {
 			Logger.info("test device " + dev);//.prettyPrint());
@@ -303,16 +311,16 @@
 		if (valveTests == 0)
 			return;
 		try {
-			int on = LevelType.zero;
+			int on = LiquidLevel.zero;
 			try {
-				on = valve.getWaterLevel().getQuantity();
+				on = valve.getWaterLevel().getLiquidLevel();
 				Logger.info("test valve: " + on);
 			} catch (Exception e) {
 				Logger.warning("", e);
 			}
-			on = (on == LevelType.zero) ? LevelType.maximum
-					: LevelType.zero;
-			valve.getWaterLevel().setQuantity(on);
+			on = (on == LiquidLevel.zero) ? LiquidLevel.maximum
+					: LiquidLevel.zero;
+			valve.getWaterLevel().setLiquidLevel(on);
 			Logger.info("test valve: OK");
 		} catch (Exception e) {
 			Logger.warning("", e);
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.thekeys/src/main/java/org/eclipse/om2m/sdt/home/thekeys/ADoorLock.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.thekeys/src/main/java/org/eclipse/om2m/sdt/home/thekeys/ADoorLock.java
new file mode 100644
index 0000000..2a958d8
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.thekeys/src/main/java/org/eclipse/om2m/sdt/home/thekeys/ADoorLock.java
@@ -0,0 +1,76 @@
+package org.eclipse.om2m.sdt.home.thekeys;
+
+import org.eclipse.om2m.sdt.home.types.DoorState;
+
+public abstract class ADoorLock {
+
+	private String id;
+	private boolean lockState = true; // locked
+	private int doorState = DoorState.Closed;
+	private boolean status;
+	private int code;
+	private String message;
+	
+	public ADoorLock(String id) {
+		this.id = id;
+	}
+
+	public String getId() {
+		return id;
+	}
+
+	public String getSerial() {
+		return id;
+	}
+	
+	public abstract void test() throws Exception;
+	
+	public abstract void open() throws Exception;
+	
+	public abstract void disconnect() throws Exception;
+	
+	public abstract void close() throws Exception;
+	
+	public abstract void cancel() throws Exception;
+
+	public boolean getLockState() {
+		return lockState;
+	}
+	
+	protected void setLockState(boolean s) {
+		lockState = s;
+	}
+
+	public int getDoorState() {
+		return doorState;
+	}
+	
+	protected void setDoorState(int s) {
+		doorState = s;
+	}
+
+	public boolean getStatus() {
+		return status;
+	}
+
+	protected void setStatus(boolean status) {
+		this.status = status;
+	}
+
+	public int getCode() {
+		return code;
+	}
+
+	protected void setCode(int code) {
+		this.code = code;
+	}
+
+	public String getMessage() {
+		return message;
+	}
+
+	protected void setMessage(String message) {
+		this.message = message;
+	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/.gitignore b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/.gitignore
new file mode 100644
index 0000000..b981306
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/.gitignore
@@ -0,0 +1,4 @@
+/target/
+.settings
+.project
+.classpath
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/META-INF/MANIFEST.MF b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/META-INF/MANIFEST.MF
new file mode 100644
index 0000000..da1d379
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/META-INF/MANIFEST.MF
@@ -0,0 +1,27 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: org.eclipse.om2m.sdt.home.utils
+Bundle-SymbolicName: org.eclipse.om2m.sdt.home.utils
+Bundle-Version: 1.0.0.qualifier
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
+Bundle-Activator: org.eclipse.om2m.sdt.home.utils.Activator
+Bundle-ClassPath: .
+Import-Package: 
+ org.apache.commons.logging,
+ org.eclipse.om2m.commons.constants,
+ org.eclipse.om2m.commons.resource,
+ org.eclipse.om2m.core.service,
+ org.eclipse.om2m.sdt,
+ org.eclipse.om2m.sdt.args,
+ org.eclipse.om2m.sdt.datapoints,
+ org.eclipse.om2m.sdt.events,
+ org.eclipse.om2m.sdt.exceptions,
+ org.eclipse.om2m.sdt.home.devices,
+ org.eclipse.om2m.sdt.home.driver,
+ org.eclipse.om2m.sdt.home.modules,
+ org.eclipse.om2m.sdt.home.types,
+ org.eclipse.om2m.sdt.types,
+ org.osgi.framework,
+ org.osgi.service.log,
+ org.osgi.util.tracker
+Export-Package: org.eclipse.om2m.sdt.home.utils.api
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/build.properties b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/build.properties
new file mode 100644
index 0000000..4e9b649
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/build.properties
@@ -0,0 +1,23 @@
+###############################################################################
+# Copyright (c) 2013-2016 LAAS-CNRS (www.laas.fr)
+# 7 Colonel Roche 31077 Toulouse - France
+# 
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Eclipse Public License v1.0
+# which accompanies this distribution, and is available at
+# http://www.eclipse.org/legal/epl-v10.html
+# 
+# Initial Contributors:
+# 	Thierry Monteil : Project manager, technical co-manager
+# 	Mahdi Ben Alaya : Technical co-manager
+# 	Samir Medjiah : Technical co-manager
+# 	Khalil Drira : Strategy expert
+# 	Guillaume Garzone : Developer
+# 	François Aïssaoui : Developer
+# 
+# New contributors :
+###############################################################################
+source.. = src/main/java/
+output.. = bin/
+bin.includes = META-INF/,\
+               .
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/pom.xml b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/pom.xml
new file mode 100644
index 0000000..bae5585
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/pom.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Copyright (c) 2014, 2016 Orange.
+    All rights reserved. This program and the accompanying materials
+    are made available under the terms of the Eclipse Public License v1.0
+    which accompanies this distribution, and is available at
+    http://www.eclipse.org/legal/epl-v10.html
+ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+
+	<modelVersion>4.0.0</modelVersion>
+	
+	<parent>
+		<groupId>org.eclipse.om2m</groupId>
+		<artifactId>org.eclipse.om2m.sdt</artifactId>
+		<version>1.0.0-SNAPSHOT</version>
+	</parent>
+
+	<artifactId>org.eclipse.om2m.sdt.home.utils</artifactId>
+	<packaging>eclipse-plugin</packaging>
+	<name>${project.artifactId}</name>
+	<description>Orange Utility library for SDT Connectors</description>
+					
+	<build>
+		<plugins>
+		
+			<plugin>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<version>2.3.2</version>
+				<configuration>
+					<source>1.7</source>
+					<target>1.7</target>
+				</configuration>
+			</plugin>
+			
+		</plugins>
+	</build>
+
+</project>
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/src/main/java/org/eclipse/om2m/sdt/home/utils/Activator.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/src/main/java/org/eclipse/om2m/sdt/home/utils/Activator.java
new file mode 100644
index 0000000..7dd69fa
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/src/main/java/org/eclipse/om2m/sdt/home/utils/Activator.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.home.utils;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.om2m.core.service.CseService;
+import org.eclipse.om2m.sdt.home.utils.api.ISDTDiscovery;
+import org.eclipse.om2m.sdt.home.utils.api.ISDTDiscoveryFactory;
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.util.tracker.ServiceTracker;
+
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public class Activator implements BundleActivator {
+
+	static private BundleContext context;
+
+	public static final Log LOGGER = LogFactory.getLog(Activator.class);
+
+	private ServiceTracker cseServiceTracker;
+    private ServiceRegistration registeredFactory;
+
+	@Override
+	public void start(BundleContext ctxt) throws Exception {
+		try {
+			context = ctxt;
+			initCseServiceTracker();
+		} catch (Exception e) {
+			LOGGER.error("Error starting cloud connector", e);
+		}
+	}
+	
+	private void initCseServiceTracker() {
+		cseServiceTracker = new ServiceTracker(context, CseService.class.getName(), null) {
+			public void removedService(ServiceReference reference, Object service) {
+				LOGGER.info("CSEService removed");
+        		registeredFactory.unregister();
+        		registeredFactory = null;
+            }
+            public Object addingService(ServiceReference reference) {
+            	LOGGER.info("CSE Service found");
+            	CseService cseService = (CseService) this.context.getService(reference); 
+            	SDTDiscovery.initCseService(cseService);
+            	registeredFactory = this.context.registerService(ISDTDiscoveryFactory.class.getName(),
+            			new ISDTDiscoveryFactory() {
+							@Override
+							public ISDTDiscovery getSDTDiscovery(String mnName) throws Exception {
+								return new SDTDiscovery(mnName);
+							}
+						}, 
+						null);
+                return cseService;
+            }
+        };
+        cseServiceTracker.open();
+	}
+	
+	@Override
+	public void stop(BundleContext context) throws Exception {
+		cseServiceTracker.close();
+		registeredFactory.unregister();
+		registeredFactory = null;
+		context = null;
+	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/src/main/java/org/eclipse/om2m/sdt/home/utils/SDTDiscovery.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/src/main/java/org/eclipse/om2m/sdt/home/utils/SDTDiscovery.java
new file mode 100644
index 0000000..5433d47
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/src/main/java/org/eclipse/om2m/sdt/home/utils/SDTDiscovery.java
@@ -0,0 +1,822 @@
+package org.eclipse.om2m.sdt.home.utils;
+
+import java.math.BigInteger;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.om2m.commons.constants.Constants;
+import org.eclipse.om2m.commons.constants.FilterUsage;
+import org.eclipse.om2m.commons.constants.MimeMediaType;
+import org.eclipse.om2m.commons.constants.Operation;
+import org.eclipse.om2m.commons.constants.ResourceType;
+import org.eclipse.om2m.commons.constants.ResponseStatusCode;
+import org.eclipse.om2m.commons.constants.ResultContent;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;
+import org.eclipse.om2m.commons.resource.ChildResourceRef;
+import org.eclipse.om2m.commons.resource.CustomAttribute;
+import org.eclipse.om2m.commons.resource.FilterCriteria;
+import org.eclipse.om2m.commons.resource.FlexContainer;
+import org.eclipse.om2m.commons.resource.AbstractFlexContainerAnnc;
+import org.eclipse.om2m.commons.resource.RequestPrimitive;
+import org.eclipse.om2m.commons.resource.ResponsePrimitive;
+import org.eclipse.om2m.commons.resource.URIList;
+import org.eclipse.om2m.core.service.CseService;
+import org.eclipse.om2m.sdt.Action;
+import org.eclipse.om2m.sdt.Arg;
+import org.eclipse.om2m.sdt.DataPoint;
+import org.eclipse.om2m.sdt.Domain;
+import org.eclipse.om2m.sdt.Identifiers;
+import org.eclipse.om2m.sdt.Module;
+import org.eclipse.om2m.sdt.Property;
+import org.eclipse.om2m.sdt.args.Command;
+import org.eclipse.om2m.sdt.datapoints.ArrayDataPoint;
+import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
+import org.eclipse.om2m.sdt.datapoints.ByteDataPoint;
+import org.eclipse.om2m.sdt.datapoints.DateDataPoint;
+import org.eclipse.om2m.sdt.datapoints.DateTimeDataPoint;
+import org.eclipse.om2m.sdt.datapoints.EnumDataPoint;
+import org.eclipse.om2m.sdt.datapoints.FloatDataPoint;
+import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;
+import org.eclipse.om2m.sdt.datapoints.StringDataPoint;
+import org.eclipse.om2m.sdt.datapoints.TimeDataPoint;
+import org.eclipse.om2m.sdt.exceptions.ActionException;
+import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.devices.GenericDevice;
+import org.eclipse.om2m.sdt.home.modules.GenericSensor;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
+import org.eclipse.om2m.sdt.home.types.PropertyType;
+import org.eclipse.om2m.sdt.home.utils.api.ISDTDiscovery;
+
+public class SDTDiscovery implements ISDTDiscovery {
+
+	private static class MyFlexContainer {
+
+		private AbstractFlexContainer flex;
+		private AbstractFlexContainerAnnc flexA;
+
+		public MyFlexContainer(AbstractFlexContainer flex) {
+			this.flex = flex;
+		}
+
+		public MyFlexContainer(AbstractFlexContainerAnnc flex) {
+			this.flexA = flex;
+		}
+
+		public List<String> getLabels() {
+			return (flex == null) ? flexA.getLabels() : flex.getLabels();
+		}
+
+		public String getContainerDefinition() {
+			return (flex == null) ? flexA.getContainerDefinition() : flex.getContainerDefinition();
+		}
+
+		public CustomAttribute getCustomAttribute(String name) {
+			return (flex == null) ? flexA.getCustomAttribute(name) : flex.getCustomAttribute(name);
+		}
+
+		public List<CustomAttribute> getCustomAttributes() {
+			return (flex == null) ? flexA.getCustomAttributes() : flex.getCustomAttributes();
+		}
+
+		public List<ChildResourceRef> getChildResource() {
+			return (flex == null) ? flexA.getChildResource() : flex.getChildResource();
+		}
+
+		public String toString() {
+			return (flex == null) ? flexA.toString() : flex.toString();
+		}
+		
+		public String getLongName() {
+			return (flex == null) ? flexA.getName() : flex.getLongName();
+		}
+		
+		public String getShortName() {
+			return (flex == null) ? flexA.getName() : flex.getShortName();
+		}
+
+	}
+
+	static private final String SEP = "/";
+	static private final String SDT_IPE = "SDT_IPE";
+	static private final String SDT_IPE_ANNC = "SDT_IPE_Annc";
+
+	static private final String SDT_DEVICE_PACKAGE = GenericDevice.class.getPackage().getName();
+	static private final String SDT_MODULE_PACKAGE = GenericSensor.class.getPackage().getName();
+
+	static private final String RESOURCE_ID_SEARCH_STRING = "ResourceID/";
+	static private final String NAME_SEARCH_STRING = "name/";
+	static private final String CNT_DEF_SEARCH_STRING = "cntDef/";
+	static private final String APPLICATION_TYPE_SEARCH_STRING = "ResourceType/Application";
+	static private final String DEVICE_TYPE_SEARCH_STRING = "object.type/device";
+
+	static private  CseService cseService;
+
+	private String mnName;
+	private Domain cloudDomain;
+	private Domain localDomain;
+
+	static public void initCseService(CseService srv) {
+		cseService = srv;
+	}
+
+	public SDTDiscovery(final String mnName) throws Exception {
+		this.mnName = mnName;
+		cloudDomain = new Domain("CloudDevices" + mnName);
+		localDomain = new Domain("LocalDevices" + mnName);
+	}
+
+	@Override
+	public void validateUserCredentials(final String appName, 
+			final String userName, final String password) throws Exception {
+		Activator.LOGGER.info("validateUserCredentials " + appName + " " + userName + "/" + password);
+		RequestPrimitive request = new RequestPrimitive();
+		request.setReturnContentType(MimeMediaType.OBJ);
+		request.setRequestContentType(MimeMediaType.OBJ);
+		request.setOperation(Operation.RETRIEVE);
+		request.setFrom(userName + ":" + password);
+		request.setFilterCriteria(new FilterCriteria());
+		request.getFilterCriteria().setFilterUsage(FilterUsage.DISCOVERY_CRITERIA);
+		request.getFilterCriteria().getLabels().add(RESOURCE_ID_SEARCH_STRING + appName);
+		request.getFilterCriteria().getLabels().add(APPLICATION_TYPE_SEARCH_STRING);
+		request.setTargetId(//SEP + Constants.CSE_ID + SEP + Constants.CSE_NAME);
+			SEP + Constants.CSE_ID + SEP + Constants.CSE_NAME + SEP + mnName);
+		Activator.LOGGER.info(request);
+		
+		ResponsePrimitive resp = cseService.doRequest(request);
+		Activator.LOGGER.info(resp);
+		BigInteger result = resp.getResponseStatusCode();
+		if (! ResponseStatusCode.OK.equals(result)) {
+			Activator.LOGGER.warn("Retrieve error " + result);
+			throw new Exception("Internal error");
+		}
+		URIList uriList = (URIList) resp.getContent();
+		Activator.LOGGER.info("Application URIs " + uriList);
+		if (uriList.getListOfUri().isEmpty()) {
+			Activator.LOGGER.warn("Application not found");
+			throw new Exception("Access denied");
+		}
+	}
+
+	@Override
+	public List<GenericDevice> getDevices(final boolean cloud, 
+			final String name, final String password) throws Exception {
+		return getDevices(null, cloud, name, password);
+	}
+
+	@Override
+	public List<GenericDevice> getDevices(final String cntDef, final boolean cloud,
+			final String name, final String password) throws Exception {
+		String cred = name + ":" + password;
+		List<GenericDevice> ret = new ArrayList<GenericDevice>();
+		List<String> all = retrieveDeviceURIs(cntDef, cred);
+		if ((all != null) && ! all.isEmpty()) {
+			for (String uri : all) {
+				if (cloud) {
+					if (uri.contains(SDT_IPE) && ! uri.contains(SDT_IPE_ANNC))
+						ret.add(readDevice(uri, true, cred));
+				} else if (uri.contains(SDT_IPE_ANNC))
+					ret.add(readDevice(uri, false, cred));
+			}
+		}
+		return ret;
+	}
+
+	@Override
+	public GenericDevice getDevice(final String deviceId, final boolean cloud,
+			final String name, final String password) throws Exception {
+		String cred = name + ":" + password;
+		List<String> labels = new ArrayList<String>();
+		labels.add(DEVICE_TYPE_SEARCH_STRING);
+		labels.add(NAME_SEARCH_STRING + deviceId);
+		List<String> uris = retrieveDeviceURIs(labels, cred);
+		if ((uris == null) || uris.isEmpty()) {
+			throw new Exception("Device not found " + deviceId);
+		}
+		String uri = uris.get(0);
+		return readDevice(uri, cloud, cred);
+	}
+
+	private List<String> retrieveDeviceURIs(final String cntDef, final String cred) 
+			throws Exception {
+		List<String> labels = new ArrayList<String>();
+		labels.add(DEVICE_TYPE_SEARCH_STRING);
+		if (cntDef != null)
+			labels.add(CNT_DEF_SEARCH_STRING + cntDef);
+		return retrieveDeviceURIs(labels, cred);
+	}
+
+	private List<String> retrieveDeviceURIs(List<String> labels, final String cred) 
+			throws Exception {
+		RequestPrimitive request = new RequestPrimitive();
+		request.setTargetId(//Constants.SP_RELATIVE_URI_SEPARATOR +
+				SEP + Constants.CSE_ID + SEP + Constants.CSE_NAME
+				+ SEP + mnName);
+		request.setReturnContentType(MimeMediaType.OBJ);
+		request.setRequestContentType(MimeMediaType.OBJ);
+		request.setOperation(Operation.RETRIEVE);
+		request.setFilterCriteria(new FilterCriteria());
+		request.getFilterCriteria().setFilterUsage(FilterUsage.DISCOVERY_CRITERIA);
+		request.getFilterCriteria().getLabels().addAll(labels);
+		request.setFrom(cred);
+
+		ResponsePrimitive resp = cseService.doRequest(request);
+		if (! ResponseStatusCode.OK.equals(resp.getResponseStatusCode())) {
+			throw new Exception("Could not read devices list: " + resp);
+		}
+		List<String> ret = ((URIList) resp.getContent()).getListOfUri();
+		Activator.LOGGER.info("Device URIs found for " + labels + ": " + ret.size() + " " + ret);
+		return ret;
+	}
+
+	private GenericDevice readDevice(final String uri, final boolean cloud, final String cred) 
+			throws Exception {
+		Activator.LOGGER.info("Get device " + uri);
+		MyFlexContainer deviceFlex = retrieveFlexContainer(uri, ResultContent.ORIGINAL_RES, cred);
+		Activator.LOGGER.info("Got device " + deviceFlex);
+		Map<String, String> labels = new HashMap<String, String>();
+		for (String label : deviceFlex.getLabels()) {
+			int idx = label.indexOf('/');
+			if (idx > 0)
+				labels.put(label.substring(0, idx), label.substring(idx+1));
+		}
+		String deviceId = labels.get("id");
+		CustomAttribute serialAttr = 
+				deviceFlex.getCustomAttribute(PropertyType.deviceSerialNum.getShortName());
+		String serial = null;
+		if (serialAttr == null) {
+			Activator.LOGGER.info("No serial number property. Take id instead.");
+			serial = deviceId;
+		} else {
+			serial = serialAttr.getCustomAttributeValue();
+		}
+		Domain domain = cloud ? cloudDomain : localDomain;
+		GenericDevice device = (GenericDevice) domain.getDevice(deviceId);
+		if (device == null) {
+			String cntDef = deviceFlex.getContainerDefinition();
+			if (deviceId.startsWith(cntDef + "__")) {
+				deviceId = deviceId.substring(cntDef.length() + 2);
+			}
+			String devName = cntDef.substring(cntDef.lastIndexOf('.') + 1);
+			if (devName.toLowerCase().startsWith("device"))
+				devName = devName.substring(6); // remove "device" prefix
+			devName = Character.toUpperCase(devName.charAt(0)) + devName.substring(1);
+			String className = SDT_DEVICE_PACKAGE + "." + devName;
+			Class<?> clazz = Class.forName(className);
+			device = (GenericDevice) clazz.getConstructor(String.class, String.class, Domain.class)
+					.newInstance(deviceId, serial, domain);
+			Activator.LOGGER.info("Created SDT device " + device);
+		}
+		for (CustomAttribute attr : deviceFlex.getCustomAttributes()) {
+			Activator.LOGGER.info("dev CustomAttribute: " + attr.getCustomAttributeName()
+				 + "/" + attr.getCustomAttributeValue());
+			PropertyType propType = PropertyType.fromShortName(attr.getCustomAttributeName());
+			if (propType != null) {
+//				Property prop = new Property(propType, attr.getCustomAttributeValue());
+//				device.addProperty(prop);
+				device.addProperty(propType, attr.getCustomAttributeValue());
+			}
+		}
+		// Search children resources: modules
+		MyFlexContainer ctr = retrieveFlexContainer(uri, 
+				ResultContent.ATTRIBUTES_AND_CHILD_REF, cred);
+		for (ChildResourceRef ref : ctr.getChildResource()) {
+			if (ref.getType().equals(BigInteger.valueOf(ResourceType.FLEXCONTAINER_ANNC))
+					|| ref.getType().equals(BigInteger.valueOf(ResourceType.FLEXCONTAINER))) {
+				Module module = readModule(ref.getValue(), cloud, cred);
+				if (device.getModule(module.getName()) == null) {
+					Activator.LOGGER.info("Add new module " + module);
+					device.addModule(module); // module URI
+				} else {
+					Activator.LOGGER.info("Already present module " + module);
+				}
+			}
+		}
+		Activator.LOGGER.info("Full SDT device " + device);//.prettyPrint());
+		return device;
+	}
+
+	private Module readModule(final String uri, final boolean cloud, final String cred) 
+			throws Exception {
+		Activator.LOGGER.info("Get module " + uri);
+		MyFlexContainer moduleFlex = retrieveFlexContainer(uri, 
+				ResultContent.ORIGINAL_RES, cred);
+		Activator.LOGGER.info("Got module " + moduleFlex);
+		Map<String,String> labels = new HashMap<String,String>();
+		for (String label : moduleFlex.getLabels()) {
+			int idx = label.indexOf('/');
+			if (idx > 0)
+				labels.put(label.substring(0, idx), label.substring(idx+1));
+		}
+		List<Property> props = new ArrayList<Property>();
+		List<CustomAttribute> dpAttrs = new ArrayList<CustomAttribute>();
+		for (CustomAttribute attr : moduleFlex.getCustomAttributes()) {
+			Activator.LOGGER.info("CustomAttribute(1): " + attr.getCustomAttributeName()
+					+ "/" + attr.getCustomAttributeValue());
+			PropertyType propType = PropertyType.fromShortName(attr.getCustomAttributeName());
+			if (propType != null) {
+				Property prop = new Property(propType, attr.getCustomAttributeValue());
+				props.add(prop);
+			} else {
+				dpAttrs.add(attr);
+			}
+		}
+		String modName = labels.get("name");
+		Domain domain = cloud ? cloudDomain : localDomain;
+		Module module = (Module) domain.getModule(modName);
+		if (module != null) {
+			for (Property prop : props) {
+				module.addProperty(prop);
+			}
+			Activator.LOGGER.info("Full retrieved SDT module " + module);//.prettyPrint());
+			return module;
+		}
+		// Case new module
+		String cntDef = moduleFlex.getContainerDefinition();
+		int idx = cntDef.lastIndexOf('.') + 1;
+		String className = SDT_MODULE_PACKAGE + "." + Character.toUpperCase(cntDef.charAt(idx)) 
+				+ cntDef.substring(idx + 1);
+		List<DataPoint> dps = new ArrayList<DataPoint>();
+		for (CustomAttribute attr : dpAttrs) {
+			DatapointType datapointType = DatapointType.fromShortName(attr.getCustomAttributeName());
+			if (datapointType == null) {
+				Activator.LOGGER.warn("Unknown custom attribute, neither property nor datapoint: " 
+						+ attr.getCustomAttributeName());
+				continue;
+			}
+			String type = datapointType.getDataType().getTypeChoice().getOneM2MType();
+			switch (type) {
+			case "xs:integer": dps.add(getIntegerDataPoint(attr, uri, cred)); break;
+			case "xs:boolean": dps.add(getBooleanDataPoint(attr, uri, cred)); break;
+			case "xs:string": dps.add(getStringDataPoint(attr, uri, cred)); break;
+			case "xs:byte": dps.add(getByteDataPoint(attr, uri, cred)); break;
+			case "xs:float": dps.add(getFloatDataPoint(attr, uri, cred)); break;
+			case "xs:datetime": dps.add(getDateTimeDataPoint(attr, uri, cred)); break;
+			case "xs:time": dps.add(getTimeDataPoint(attr, uri, cred)); break;
+			case "xs:date": dps.add(getDateDataPoint(attr, uri, cred)); break;
+			case "xs:enum": dps.add(getArrayDataPoint(attr, uri, cred)); break;
+			default:
+				if (type.startsWith("hd:")) {
+					type = type.substring(3);
+					dps.add(getEnumDataPoint(type, attr, uri, cred));
+				}
+				break;
+			}
+		}
+		Map<String, DataPoint> dpsMap = new HashMap<String, DataPoint>();
+		for (DataPoint dp : dps) {
+			dpsMap.put(dp.getShortDefinitionType(), dp);
+		}
+		Class<?> clazz = Class.forName(className);
+		if (modName.startsWith(cntDef + "__")) {
+			modName = modName.substring(cntDef.length() + 2);
+		}
+		module = (Module) clazz.getConstructor(String.class, Domain.class, Map.class)
+				.newInstance(modName, domain, dpsMap);
+		Activator.LOGGER.info("Created SDT module " + module);
+		for (Property prop : props) {
+			module.addProperty(prop);
+		}
+		Activator.LOGGER.info("Full new SDT module " + module);//.prettyPrint());
+		// Search children resources: modules
+		MyFlexContainer ctr = retrieveFlexContainer(uri, 
+				ResultContent.ATTRIBUTES_AND_CHILD_REF, cred);
+		Activator.LOGGER.info("Children " + ctr.getChildResource());
+		for (ChildResourceRef ref : ctr.getChildResource()) {
+			if (ref.getType().equals(BigInteger.valueOf(ResourceType.FLEXCONTAINER_ANNC))
+					|| ref.getType().equals(BigInteger.valueOf(ResourceType.FLEXCONTAINER))) {
+				try {
+					Action action = readAction(ref.getValue(), module, cred);
+					if (module.getAction(action.getName()) == null) {
+						Activator.LOGGER.info("Add new action " + action);
+						module.addAction(action);
+					} else {
+						Activator.LOGGER.info("Already present action " + action);
+					}
+				} catch (Exception e) {
+					Activator.LOGGER.error("Error creating action " + ref.getValue());
+				}
+			}
+		}
+		return module;
+	}
+
+	private Action readAction(final String uri, final Module module, final String cred) 
+			throws Exception {
+		Activator.LOGGER.info("Get action " + uri);
+		final MyFlexContainer actionFlexContainer = retrieveFlexContainer(uri, 
+				ResultContent.ORIGINAL_RES, cred);
+		Activator.LOGGER.info("Got action " + actionFlexContainer);
+		Map<String,String> labels = new HashMap<String,String>();
+		for (String label : actionFlexContainer.getLabels()) {
+			int idx = label.indexOf('/');
+			if (idx > 0)
+				labels.put(label.substring(0, idx), label.substring(idx+1));
+		}
+		List<Arg> args = new ArrayList<Arg>();
+		final List<CustomAttribute> attributes = actionFlexContainer.getCustomAttributes();
+		// 2017 07 17 - BONNARDEL Gregory
+		// I commented out the next piece of code because there is no way
+		// to retrieve Arg type with current SDT apis.
+		// As we have only no-args action, this is not a problem.
+//		for (final CustomAttribute attr : attributes) {
+//			String type = attr.getCustomAttributeType();
+//			Arg arg = new ValuedArg<Object>(attr.getCustomAttributeName(), 
+//					new DataType(type, SimpleType.getSimpleType(type))) {
+//				public void setValue(Object value) {
+//					try {
+//						SDTUtil.setValue(attr, value);
+//						updateAttribute(uri, attr, cred);
+//					} catch (Exception e) {
+//						Activator.LOGGER.warn("Could not set arg", e);
+//					}
+//				}
+//			};
+//			args.add(arg);
+//		}
+		final String cntDef = actionFlexContainer.getContainerDefinition();
+		String actionName = labels.get("name");
+		if (actionName == null)
+			actionName = cntDef.substring(cntDef.lastIndexOf('.') + 1);
+		Action action = module.getAction(actionName);
+		if (action != null) {
+			Activator.LOGGER.info("Full retrieved SDT action " + action);
+			return action;
+		}
+		action = new Command(actionName, args,
+			new Identifiers() {
+				@Override
+				public String getShortName() {
+					return actionFlexContainer.getShortName();
+				}
+				@Override
+				public String getLongName() {
+					return actionFlexContainer.getLongName();
+				}
+				@Override
+				public String getDefinition() {
+					return cntDef;
+				}
+			}) {
+			@Override
+			protected Object doInvoke() throws ActionException {
+				Activator.LOGGER.info("invoke SDT action");
+				try {
+					return invokeAction(uri, attributes, cred);
+				} catch (Exception e) {
+					throw new ActionException(e);
+				}
+			}
+		};
+		//		
+		Activator.LOGGER.info("Created SDT action " + action);
+		return action;
+	}
+
+	private IntegerDataPoint getIntegerDataPoint(final CustomAttribute attr,
+			final String uri, final String cred) {
+		return new IntegerDataPoint(DatapointType.fromShortName(attr.getCustomAttributeName())) {
+			@Override
+			public void doSetValue(Integer val) throws DataPointException {
+				try {
+					SDTUtil.setValue(attr, val, "xs:integer");
+					updateAttribute(uri, attr, cred);
+				} catch (Exception e) {
+					throw new DataPointException(e);
+				}
+			}
+			@Override
+			public Integer doGetValue() throws DataPointException {
+				try {
+					return (Integer) retrieveAttribute(uri, 
+							attr.getCustomAttributeName(), cred);
+				} catch (Exception e) {
+					throw new DataPointException(e);
+				}
+			}
+		};
+	}
+
+	private BooleanDataPoint getBooleanDataPoint(final CustomAttribute attr, 
+			final String uri, final String cred) {
+		BooleanDataPoint ret = new BooleanDataPoint(DatapointType.fromShortName(attr.getCustomAttributeName())) {
+			@Override
+			public void doSetValue(Boolean val) throws DataPointException {
+				try {
+					SDTUtil.setValue(attr, val, "xs:boolean");
+					updateAttribute(uri, attr, cred);
+				} catch (Exception e) {
+					throw new DataPointException(e);
+				}
+			}
+			@Override
+			public Boolean doGetValue() throws DataPointException {
+				try {
+					return (Boolean) retrieveAttribute(uri, 
+							attr.getCustomAttributeName(), cred);
+				} catch (Exception e) {
+					throw new DataPointException(e);
+				}
+			}
+		};
+		return ret;
+	}
+
+	private StringDataPoint getStringDataPoint(final CustomAttribute attr, 
+			final String uri, final String cred) {
+		return new StringDataPoint(DatapointType.fromShortName(attr.getCustomAttributeName())) {
+			@Override
+			public void doSetValue(String val) throws DataPointException {
+				try {
+					SDTUtil.setValue(attr, val, "xs:string");
+					updateAttribute(uri, attr, cred);
+				} catch (Exception e) {
+					throw new DataPointException(e);
+				}
+			}
+			@Override
+			public String doGetValue() throws DataPointException {
+				try {
+					return (String) retrieveAttribute(uri, 
+							attr.getCustomAttributeName(), cred);
+				} catch (Exception e) {
+					throw new DataPointException(e);
+				}
+			}
+		};
+	}
+
+	private ByteDataPoint getByteDataPoint(final CustomAttribute attr, 
+			final String uri, final String cred) {
+		return new ByteDataPoint(DatapointType.fromShortName(attr.getCustomAttributeName())) {
+			@Override
+			public void doSetValue(Byte val) throws DataPointException {
+				try {
+					SDTUtil.setValue(attr, val, "xs:byte");
+					updateAttribute(uri, attr, cred);
+				} catch (Exception e) {
+					throw new DataPointException(e);
+				}
+			}
+			@Override
+			public Byte doGetValue() throws DataPointException {
+				try {
+					return (Byte) retrieveAttribute(uri, 
+							attr.getCustomAttributeName(), cred);
+				} catch (Exception e) {
+					throw new DataPointException(e);
+				}
+			}
+		};
+	}
+
+	private FloatDataPoint getFloatDataPoint(final CustomAttribute attr, 
+			final String uri, final String cred) {
+		return new FloatDataPoint(DatapointType.fromShortName(attr.getCustomAttributeName())) {
+			@Override
+			public void doSetValue(Float val) throws DataPointException {
+				try {
+					SDTUtil.setValue(attr, val, "xs:float");
+					updateAttribute(uri, attr, cred);
+				} catch (Exception e) {
+					throw new DataPointException(e);
+				}
+			}
+			@Override
+			public Float doGetValue() throws DataPointException {
+				try {
+					return (Float) retrieveAttribute(uri, 
+							attr.getCustomAttributeName(), cred);
+				} catch (Exception e) {
+					throw new DataPointException(e);
+				}
+			}
+		};
+	}
+
+	private DateTimeDataPoint getDateTimeDataPoint(final CustomAttribute attr, 
+			final String uri, final String cred) {
+		return new DateTimeDataPoint(DatapointType.fromShortName(attr.getCustomAttributeName())) {
+			@Override
+			public void doSetValue(Date val) throws DataPointException {
+				try {
+					SDTUtil.setValue(attr, val, "xs:datetime");
+					updateAttribute(uri, attr, cred);
+				} catch (Exception e) {
+					throw new DataPointException(e);
+				}
+			}
+			@Override
+			public Date doGetValue() throws DataPointException {
+				try {
+					return (Date) retrieveAttribute(uri, 
+							attr.getCustomAttributeName(), cred);
+				} catch (Exception e) {
+					throw new DataPointException(e);
+				}
+			}
+		};
+	}
+
+	private DateDataPoint getDateDataPoint(final CustomAttribute attr, 
+			final String uri, final String cred) {
+		return new DateDataPoint(DatapointType.fromShortName(attr.getCustomAttributeName())) {
+			@Override
+			public void doSetValue(Date val) throws DataPointException {
+				try {
+					SDTUtil.setValue(attr, val, "xs:date");
+					updateAttribute(uri, attr, cred);
+				} catch (Exception e) {
+					throw new DataPointException(e);
+				}
+			}
+			@Override
+			public Date doGetValue() throws DataPointException {
+				try {
+					return (Date) retrieveAttribute(uri, 
+							attr.getCustomAttributeName(), cred);
+				} catch (Exception e) {
+					throw new DataPointException(e);
+				}
+			}
+		};
+	}
+
+	private TimeDataPoint getTimeDataPoint(final CustomAttribute attr, 
+			final String uri, final String cred) {
+		return new TimeDataPoint(DatapointType.fromShortName(attr.getCustomAttributeName())) {
+			@Override
+			public void doSetValue(Date val) throws DataPointException {
+				try {
+					SDTUtil.setValue(attr, val, "xs:time");
+					updateAttribute(uri, attr, cred);
+				} catch (Exception e) {
+					throw new DataPointException(e);
+				}
+			}
+			@Override
+			public Date doGetValue() throws DataPointException {
+				try {
+					return (Date) retrieveAttribute(uri, 
+							attr.getCustomAttributeName(), cred);
+				} catch (Exception e) {
+					throw new DataPointException(e);
+				}
+			}
+		};
+	}
+
+	private ArrayDataPoint<String> getArrayDataPoint(final CustomAttribute attr, 
+			final String uri, final String cred) {
+		return new ArrayDataPoint<String>(DatapointType.fromShortName(attr.getCustomAttributeName())) {
+			@Override
+			public void doSetValue(List<String> val) throws DataPointException {
+				try {
+					SDTUtil.setValue(attr, val, "xs:enum");
+					updateAttribute(uri, attr, cred);
+				} catch (Exception e) {
+					throw new DataPointException(e);
+				}
+			}
+			@SuppressWarnings("unchecked")
+			@Override
+			public List<String> doGetValue() throws DataPointException {
+				try {
+					return (List<String>) retrieveAttribute(uri, 
+							attr.getCustomAttributeName(), cred);
+				} catch (Exception e) {
+					throw new DataPointException(e);
+				}
+			}
+		};
+	}
+	
+	@SuppressWarnings("unchecked")
+	private static EnumDataPoint<Integer> getEnumDataPoint(String type, final CustomAttribute attr,
+			final String uri, final String cred) {
+		try {
+			String className = DatapointType.class.getPackage().getName() + "." 
+				+ type.substring(0, 1).toUpperCase() + type.substring(1);
+			Class<?> clazz = Class.forName(className);
+			return (EnumDataPoint<Integer>) 
+				clazz.getConstructor(Identifiers.class, EnumDataPoint.class)
+					.newInstance(DatapointType.fromShortName(attr.getCustomAttributeName()), 
+						new EnumDataPoint<Integer>(null) {
+							@Override
+							public void doSetValue(Integer val) throws DataPointException {
+								try {
+									SDTUtil.setValue(attr, val, "xs:enum");
+									updateAttribute(uri, attr, cred);
+								} catch (Exception e) {
+									throw new DataPointException(e);
+								}
+							}
+							@Override
+							public Integer doGetValue() throws DataPointException {
+								try {
+									return (Integer) retrieveAttribute(uri, 
+											attr.getCustomAttributeName(), cred);
+								} catch (Exception e) {
+									throw new DataPointException(e);
+								}
+							}
+						});
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	private MyFlexContainer retrieveFlexContainer(final String uri, 
+			final BigInteger resultContent, final String cred) throws Exception {
+		RequestPrimitive request = new RequestPrimitive();
+		request.setOperation(Operation.RETRIEVE);
+		request.setReturnContentType(MimeMediaType.OBJ);
+		request.setRequestContentType(MimeMediaType.OBJ);
+		request.setFilterCriteria(new FilterCriteria());
+		request.getFilterCriteria().setLevel(BigInteger.ONE);
+		request.setFrom(cred);
+		request.setTargetId(uri);
+		request.setResultContent(resultContent);
+
+		ResponsePrimitive resp = cseService.doRequest(request);
+		BigInteger code = resp.getResponseStatusCode();
+		if (! ResponseStatusCode.OK.equals(code))
+			throw new Exception("Error searching " + uri + ": " + code);
+		Object ret = resp.getContent();
+		if (ret instanceof AbstractFlexContainer)
+			return new MyFlexContainer((AbstractFlexContainer)ret);
+		else if (ret instanceof AbstractFlexContainerAnnc)
+			return new MyFlexContainer((AbstractFlexContainerAnnc)ret);
+		else 
+			throw new Exception("Error not a FlexContainer " + uri);
+	}
+
+	static private Object retrieveAttribute(final String uri, final String attr,
+			final String cred) throws Exception {
+		
+		DatapointType datapointType = DatapointType.fromShortName(attr);
+		
+		if (datapointType == null) {
+			return null;
+		}
+		RequestPrimitive request = new RequestPrimitive();
+		request.setOperation(Operation.RETRIEVE);
+		request.setReturnContentType(MimeMediaType.OBJ);
+		request.setRequestContentType(MimeMediaType.OBJ);
+		request.setFrom(cred);
+		request.setTargetId(uri);
+		request.setResultContent(ResultContent.ORIGINAL_RES);
+
+		ResponsePrimitive resp = cseService.doRequest(request);
+		Activator.LOGGER.info("read " + attr + " -> " + resp.getResponseStatusCode());
+		if (! ResponseStatusCode.OK.equals(resp.getResponseStatusCode()))
+			throw new Exception("Error reading cloud data: " + resp.getResponseStatusCode());
+		return SDTUtil.getValue(((AbstractFlexContainer) resp.getContent()).getCustomAttribute(attr), datapointType.getDataType().getTypeChoice().getOneM2MType());
+	}
+
+	static public void updateAttribute(final String uri, 
+			final CustomAttribute customAttribute, final String cred) throws Exception {
+		FlexContainer flexContainer = new FlexContainer();
+		flexContainer.getCustomAttributes().add(customAttribute);
+
+		RequestPrimitive request = new RequestPrimitive();
+		request.setContent(flexContainer);
+		request.setReturnContentType(MimeMediaType.OBJ);
+		request.setRequestContentType(MimeMediaType.OBJ);
+		request.setResultContent(ResultContent.ORIGINAL_RES);
+		request.setOperation(Operation.UPDATE);
+		request.setFrom(cred);
+		request.setTargetId(uri);
+
+		ResponsePrimitive resp = cseService.doRequest(request);
+		Activator.LOGGER.info("write " + customAttribute + " -> " + resp.getResponseStatusCode());
+		if (! ResponseStatusCode.UPDATED.equals(resp.getResponseStatusCode()))
+			throw new Exception("Error writing cloud data: " + resp.getResponseStatusCode());
+	}
+
+	public String invokeAction(final String uri, 
+			final List<CustomAttribute> customAttributes, final String cred) throws Exception {
+		FlexContainer flexContainer = new FlexContainer();
+		flexContainer.getCustomAttributes().addAll(customAttributes);
+
+		RequestPrimitive request = new RequestPrimitive();
+		request.setContent(flexContainer);
+		request.setReturnContentType(MimeMediaType.OBJ);
+		request.setRequestContentType(MimeMediaType.OBJ);
+		request.setResultContent(ResultContent.ORIGINAL_RES);
+		request.setOperation(Operation.UPDATE);
+		request.setFrom(cred);
+		request.setTargetId(uri);
+
+		ResponsePrimitive resp = cseService.doRequest(request);
+		Activator.LOGGER.info("invoke " + customAttributes + " -> " + resp.getResponseStatusCode());
+		if (! ResponseStatusCode.UPDATED.equals(resp.getResponseStatusCode()))
+			throw new Exception("Error invoking cloud action: " + resp.getResponseStatusCode());
+		CustomAttribute ret = ((AbstractFlexContainer) resp.getContent()).getCustomAttribute("output");
+		return (ret == null) ? null : ret.getCustomAttributeValue();
+	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/src/main/java/org/eclipse/om2m/sdt/home/utils/SDTUtil.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/src/main/java/org/eclipse/om2m/sdt/home/utils/SDTUtil.java
new file mode 100644
index 0000000..b9a8149
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/src/main/java/org/eclipse/om2m/sdt/home/utils/SDTUtil.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.home.utils;
+
+import java.net.URI;
+import java.text.DateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import org.eclipse.om2m.commons.resource.CustomAttribute;
+
+public class SDTUtil {
+	
+	static final private DateFormat dateTimeFormat = DateFormat.getDateTimeInstance();
+	static final private DateFormat dateFormat = DateFormat.getDateInstance();
+	static final private DateFormat timeFormat = DateFormat.getTimeInstance();
+
+	public static Object getValue(CustomAttribute attr, String type) throws Exception {
+		return (attr == null) ? null
+			: getValue(attr.getCustomAttributeValue(), type);
+	}
+	
+	public static Object getValue(String value, String type) throws Exception {
+		if (value == null)
+			return null;
+		switch (type) {
+		case "xs:string": return value;
+		case "xs:integer": return Integer.parseInt(value);
+		case "xs:float": return Float.parseFloat(value);
+		case "xs:boolean": return Boolean.parseBoolean(value);
+		case "xs:datetime": return dateTimeFormat.parse(value);
+		case "xs:time": return timeFormat.parse(value);
+		case "xs:date": return dateFormat.parse(value);
+		case "xs:byte": return Byte.parseByte(value);
+		case "xs:enum":
+			List<String> ret = new ArrayList<String>();
+			value = value.trim();
+			if (value.charAt(0) == '[')
+				value = value.substring(1);
+			int last = value.length() - 1;
+			if (value.charAt(last) == ']')
+				value = value.substring(0, last);
+			for (String val : value.split(",")) {
+					String valueToAdd = val.trim();
+					if (valueToAdd.length() > 0) {
+						ret.add(valueToAdd);
+					}
+			}
+			return ret;
+		case "xs:uri": return new URI(value);
+		case "xs:blob": return value;
+		default:
+			return type.startsWith("hd:") ? Integer.parseInt(value) : null;
+		}
+	}
+	
+	public static void setValue(CustomAttribute attr, Object val, String type) throws Exception {
+		if (val == null) {
+			attr.setCustomAttributeValue(null);
+			return;
+		}
+		switch (type) {
+		case "xs:string":
+		case "xs:integer": 
+		case "xs:float":
+		case "xs:boolean":
+		case "xs:byte":
+		case "xs:uri":
+			attr.setCustomAttributeValue(val.toString()); return;
+		case "xs:datetime": attr.setCustomAttributeValue(dateTimeFormat.format((Date)val)); return;
+		case "xs:time": attr.setCustomAttributeValue(timeFormat.format((Date)val)); return;
+		case "xs:date": attr.setCustomAttributeValue(dateFormat.format((Date)val)); return;
+		case "xs:enum":
+			String ret = "";
+			boolean first = true;
+			for (Object s : (List<?>)val) {
+				if (first) ret += ",";
+				else first = false;
+				ret += s.toString();
+			}
+			attr.setCustomAttributeValue(ret); return;
+		case "xs:blob": return;// TODO serialize byte array
+		default:
+			if (type.startsWith("hd:")) 
+				attr.setCustomAttributeValue(val.toString());
+			return;
+		}
+	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/src/main/java/org/eclipse/om2m/sdt/home/utils/api/ISDTDiscovery.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/src/main/java/org/eclipse/om2m/sdt/home/utils/api/ISDTDiscovery.java
new file mode 100644
index 0000000..9c89290
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/src/main/java/org/eclipse/om2m/sdt/home/utils/api/ISDTDiscovery.java
@@ -0,0 +1,21 @@
+package org.eclipse.om2m.sdt.home.utils.api;
+
+import java.util.List;
+
+import org.eclipse.om2m.sdt.home.devices.GenericDevice;
+
+public interface ISDTDiscovery {
+	
+	public void validateUserCredentials(final String appName, 
+			final String userName, final String password) throws Exception;
+
+	public List<GenericDevice> getDevices(final boolean cloud, final String name, 
+			final String password) throws Exception;
+
+	public List<GenericDevice> getDevices(final String cntDef, final boolean cloud,
+			final String name, final String password) throws Exception;
+
+	public GenericDevice getDevice(final String deviceId, final boolean cloud,
+			final String name, final String password) throws Exception;
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/src/main/java/org/eclipse/om2m/sdt/home/utils/api/ISDTDiscoveryFactory.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/src/main/java/org/eclipse/om2m/sdt/home/utils/api/ISDTDiscoveryFactory.java
new file mode 100644
index 0000000..6edfe59
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home.utils/src/main/java/org/eclipse/om2m/sdt/home/utils/api/ISDTDiscoveryFactory.java
@@ -0,0 +1,7 @@
+package org.eclipse.om2m.sdt.home.utils.api;
+
+public interface ISDTDiscoveryFactory {
+	
+	public ISDTDiscovery getSDTDiscovery(final String mnName) throws Exception;
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/actions/DownVolume.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/actions/DownVolume.java
new file mode 100644
index 0000000..677bc01
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/actions/DownVolume.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.home.actions;
+
+import org.eclipse.om2m.sdt.args.Command;
+import org.eclipse.om2m.sdt.exceptions.AccessException;
+import org.eclipse.om2m.sdt.exceptions.ActionException;
+import org.eclipse.om2m.sdt.home.types.ActionType;
+
+public abstract class DownVolume extends Command {
+	
+	public DownVolume(String name) {
+		super(name, ActionType.downVolume);
+		setDoc("Decrease volume by the amount of the stepValue upto 0");
+	}
+
+	public final void downVolume() throws AccessException, ActionException {
+		invoke();
+	}
+	
+	abstract protected void doDownVolume() throws ActionException;
+	
+	@Override
+	protected Object doInvoke() throws ActionException {
+		doDownVolume();
+		return null;
+	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/actions/Toggle.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/actions/Toggle.java
index f594927..d770d0e 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/actions/Toggle.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/actions/Toggle.java
@@ -10,11 +10,12 @@
 import org.eclipse.om2m.sdt.args.Command;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.ActionException;
+import org.eclipse.om2m.sdt.home.types.ActionType;
 
 public abstract class Toggle extends Command {
 
 	public Toggle(String name) {
-		super(name, "org.onem2m.home.actions.toggle");
+		super(name, ActionType.toggle);
 		setDoc("Toggle the switch.");
 	}
 
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/actions/UpVolume.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/actions/UpVolume.java
new file mode 100644
index 0000000..d239414
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/actions/UpVolume.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.home.actions;
+
+import org.eclipse.om2m.sdt.args.Command;
+import org.eclipse.om2m.sdt.exceptions.AccessException;
+import org.eclipse.om2m.sdt.exceptions.ActionException;
+import org.eclipse.om2m.sdt.home.types.ActionType;
+
+public abstract class UpVolume extends Command {
+	
+//	private BooleanArg upArg;
+
+	public UpVolume(String name) {
+		super(name, ActionType.upVolume);
+		setDoc("Increase volume by the amount of the stepValue upto the maxValue");
+//		upArg = new BooleanArg("up");
+//		addArg(upArg);
+	}
+
+//	public final void upOrDown(final boolean up) throws ActionException, AccessException {
+//		upArg.setValue(up);
+//		invoke();
+//	}
+//	
+//	abstract protected void doUpOrDown(final boolean up) throws ActionException;
+//	
+//	@Override
+//	protected Object doInvoke() throws ActionException {
+//		doUpOrDown(upArg.getValue());
+//		return null;
+//	}
+
+	public final void upVolume() throws ActionException, AccessException {
+		invoke();
+	}
+	
+	abstract protected void doUpVolume() throws ActionException;
+	
+	@Override
+	protected Object doInvoke() throws ActionException {
+		doUpVolume();
+		return null;
+	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/actions/Volume.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/actions/Volume.java
deleted file mode 100644
index bcb0076..0000000
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/actions/Volume.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2016 Orange.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.om2m.sdt.home.actions;
-
-import org.eclipse.om2m.sdt.args.BooleanArg;
-import org.eclipse.om2m.sdt.args.Command;
-import org.eclipse.om2m.sdt.exceptions.AccessException;
-import org.eclipse.om2m.sdt.exceptions.ActionException;
-
-public abstract class Volume extends Command {
-	
-	private BooleanArg upArg;
-
-	public Volume(String name) {
-		super(name, "org.onem2m.home.actions.volume");
-		setDoc("Increase/Decrease volume by the amount of the stepValue upto the maxValue");
-		upArg = new BooleanArg("up");
-		addArg(upArg);
-	}
-
-	public final void upOrDown(final boolean up) throws ActionException, AccessException {
-		upArg.setValue(up);
-		invoke();
-	}
-	
-	abstract protected void doUpOrDown(final boolean up) throws ActionException;
-	
-	@Override
-	protected Object doInvoke() throws ActionException {
-		doUpOrDown(upArg.getValue());
-		return null;
-	}
-
-}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/CoffeeMachine.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/CoffeeMachine.java
index 0ddf2f8..4e920ea 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/CoffeeMachine.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/CoffeeMachine.java
@@ -1,46 +1,39 @@
 package org.eclipse.om2m.sdt.home.devices;

 

-

 import java.util.Collection;

 

 import org.eclipse.om2m.sdt.Domain;

 import org.eclipse.om2m.sdt.Module;

+import org.eclipse.om2m.sdt.home.modules.BinarySwitch;

 import org.eclipse.om2m.sdt.home.modules.Brewing;

 import org.eclipse.om2m.sdt.home.modules.Clock;

 import org.eclipse.om2m.sdt.home.modules.FaultDetection;

 import org.eclipse.om2m.sdt.home.modules.Foaming;

 import org.eclipse.om2m.sdt.home.modules.Grinder;

-import org.eclipse.om2m.sdt.home.modules.Level;

+import org.eclipse.om2m.sdt.home.modules.KeepWarm;

+import org.eclipse.om2m.sdt.home.modules.LiquidLevel;

 import org.eclipse.om2m.sdt.home.modules.RunMode;

 import org.eclipse.om2m.sdt.home.types.DeviceType;

 

-public class CoffeeMachine extends GenericDevice{

-

+public class CoffeeMachine extends GenericDevice {

+	

+	private FaultDetection faultDetection;

+	private RunMode runMode;

+	private Clock clock;

+	private Brewing brewing;

+	private LiquidLevel waterStatus;

+	private LiquidLevel milkStatus;

+	private LiquidLevel beansStatus;

+	private Grinder grinder;

+	private Foaming foamedMilk;

+	private LiquidLevel milkQuantity;

+	private KeepWarm keepWarm;

+	private BinarySwitch brewingSwitch;

 	

 	public CoffeeMachine(final String id, final String serial, final Domain domain) {

 		super(id, serial, DeviceType.deviceCoffeeMachine, domain);

 	}

 	

-	private FaultDetection faultDetection;

-	

-	private RunMode runMode;

-	

-	private Clock clock;

-	

-	private Brewing brewing;

-	

-	private Level waterStatus;

-	

-	private Level milkStatus;

-	

-	private Level beansStatus;

-	

-	private Grinder grinder;

-	

-	private Foaming foamedMilk;

-	

-	private Level milkQuantity;

-	

 	public void addModule(Module module) {

 		if (module instanceof FaultDetection)

 			addModule((FaultDetection)module);

@@ -50,25 +43,29 @@
 			addModule((Clock)module);

 		else if (module instanceof Brewing)

 			addModule((Brewing)module);

-		else if (module instanceof Level){

+		else if (module instanceof LiquidLevel){

 			Collection<String> col = module.getDataPointNames();

 			if(col.contains("waterStatus")){

-				addModuleWaterStatus((Level)module);

+				addModuleWaterStatus((LiquidLevel)module);

 			}

 			if(col.contains("milkStatus")){

-				addModuleMilkStatus((Level)module);

+				addModuleMilkStatus((LiquidLevel)module);

 			}

 			if(col.contains("beansStatus")){

-				addModuleBeansStatus((Level)module);

+				addModuleBeansStatus((LiquidLevel)module);

 			}

 			if(col.contains("milkQuantity")){

-				addModuleMilkQuantity((Level)module);

+				addModuleMilkQuantity((LiquidLevel)module);

 			}

 		}

 		else if (module instanceof Grinder)

 			addModule((Grinder)module);

 		else if (module instanceof Foaming)

 			addModule((Foaming)module);

+		else if(module instanceof KeepWarm)

+			addModule((KeepWarm)module);

+		else if(module instanceof BinarySwitch)

+			addModule((BinarySwitch)module);

 		else

 			super.addModule(module);

 	}

@@ -78,6 +75,17 @@
 		super.addModule(faultDetection);

 	}

 	

+	public void addModule(BinarySwitch mod){

+		this.brewingSwitch = mod;

+		super.addModule(brewingSwitch);

+	}

+	

+	public void addModule(KeepWarm mod){

+		this.keepWarm = mod;

+		super.addModule(keepWarm);

+	}

+

+	

 	public void addModule(RunMode mod) {

 		this.runMode = mod;

 		super.addModule(runMode);

@@ -104,23 +112,23 @@
 	}

 	

 	

-	public void addModuleWaterStatus(Level mod) {

+	public void addModuleWaterStatus(LiquidLevel mod) {

 		this.waterStatus = mod;

 		super.addModule(waterStatus);

 	}

 	

-	public void addModuleMilkStatus(Level mod) {

+	public void addModuleMilkStatus(LiquidLevel mod) {

 		this.milkStatus = mod;

 		super.addModule(milkStatus);

 	}

 	

-	public void addModuleBeansStatus(Level mod) {

+	public void addModuleBeansStatus(LiquidLevel mod) {

 		this.beansStatus = mod;

 		super.addModule(beansStatus);

 	}

 	

 	

-	public void addModuleMilkQuantity(Level mod) {

+	public void addModuleMilkQuantity(LiquidLevel mod) {

 		this.milkQuantity = mod;

 		super.addModule(milkQuantity);

 	}

@@ -141,15 +149,15 @@
 		return brewing;

 	}

 

-	public Level getWaterStatus() {

+	public LiquidLevel getWaterStatus() {

 		return waterStatus;

 	}

 

-	public Level getMilkStatus() {

+	public LiquidLevel getMilkStatus() {

 		return milkStatus;

 	}

 

-	public Level getBeansStatus() {

+	public LiquidLevel getBeansStatus() {

 		return beansStatus;

 	}

 

@@ -161,10 +169,26 @@
 		return foamedMilk;

 	}

 

-	public Level getMilkQuantity() {

+	public LiquidLevel getMilkQuantity() {

 		return milkQuantity;

 	}

 

+	public KeepWarm getKeepWarm() {

+		return keepWarm;

+	}

+

+	public void setKeepWarm(KeepWarm keepWarm) {

+		this.keepWarm = keepWarm;

+	}

+

+	public BinarySwitch getBrewingSwitch() {

+		return brewingSwitch;

+	}

+

+	public void setBrewingSwitch(BinarySwitch brewingSwitch) {

+		this.brewingSwitch = brewingSwitch;

+	}

+

 	

 	

 	

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/Door.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/Door.java
index 005a6bf..c2e2951 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/Door.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/Door.java
@@ -9,14 +9,14 @@
 
 import org.eclipse.om2m.sdt.Domain;
 import org.eclipse.om2m.sdt.Module;
+import org.eclipse.om2m.sdt.home.modules.Battery;
 import org.eclipse.om2m.sdt.home.modules.DoorStatus;
-import org.eclipse.om2m.sdt.home.modules.FaultDetection;
 import org.eclipse.om2m.sdt.home.modules.Lock;
 import org.eclipse.om2m.sdt.home.types.DeviceType;
 
 public class Door extends GenericDevice {
 	
-	private FaultDetection faultDetection;
+	private Battery battery;
 	
 	private DoorStatus doorStatus;
 	
@@ -28,8 +28,8 @@
 	}
 	
 	public void addModule(Module module) {
-		if (module instanceof FaultDetection)
-			addModule((FaultDetection)module);
+		if (module instanceof Battery)
+			addModule((Battery)module);
 		else if (module instanceof DoorStatus)
 			addModule((DoorStatus)module);
 		else if (module instanceof Lock)
@@ -38,9 +38,9 @@
 			super.addModule(module);
 	}
 
-	public void addModule(FaultDetection faultDetection) {
-		this.faultDetection = faultDetection;
-		super.addModule(faultDetection);
+	public void addModule(Battery battery) {
+		this.battery = battery;
+		super.addModule(battery);
 	}
 
 	public void addModule(DoorStatus doorStatus) {
@@ -53,8 +53,8 @@
 		super.addModule(lock);
 	}
 
-	public FaultDetection getFaultDetection() {
-		return faultDetection;
+	public Battery getBattery() {
+		return battery;
 	}
 
 	public DoorStatus getDoorStatus() {
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/GenericDevice.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/GenericDevice.java
index bbd9d4a..8583ace 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/GenericDevice.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/GenericDevice.java
@@ -9,30 +9,33 @@
 import org.eclipse.om2m.sdt.Property;
 import org.eclipse.om2m.sdt.exceptions.PropertyException;
 import org.eclipse.om2m.sdt.home.types.DeviceType;
+import org.eclipse.om2m.sdt.home.types.PropertyType;
 import org.eclipse.om2m.sdt.types.SimpleType;
 
 public class GenericDevice extends Device {
 
-	private Property propDeviceManufacturer;
-	private Property propDeviceSerialNum;
-	private Property propDeviceModelName;
+	private Property deviceManufacturer;
+	private Property deviceSerialNum;
+	private Property deviceModelName;
 
+	private Property deviceType;
 	private DeviceType type;
 
-	private Property propDeviceName;
-	private Property propDeviceSubModelName;
-	private Property propDeviceAliasName;
-	private Property propDeviceFirmwareVersion;
-	private Property propHardwareVersion;
-	private Property propOsVersion;
-	private Property propProtocol;
-	private Property propCountry;
-	private Property propLocation;
-	private Property propSystemTime;
-	private Property propManufacturerDetailsLink;
-	private Property propDateOfManufacture;
-	private Property propSupportURL;
-	private Property propPresentationURL;
+	private Property deviceName;
+	private Property deviceSubModelName;
+	private Property deviceAliasName;
+	private Property deviceFirmwareVersion;
+	private Property hardwareVersion;
+	private Property osVersion;
+	private Property protocol;
+	private Property country;
+	private Property location;
+	private Property systemTime;
+	private Property manufacturerDetailsLink;
+	private Property dateOfManufacture;
+	private Property supportURL;
+	private Property presentationURL;
+	private Property cloud;
 
 	public GenericDevice(final String id, final String serial, final Domain domain) {
 		this(id, serial, DeviceType.undefinedVendorExt, domain);
@@ -40,111 +43,63 @@
 
 	public GenericDevice(final String id, final String serial, 
 			final DeviceType type, final Domain domain) {
-		super(id, domain, type.getDefinition());
+		super(id, domain, type);
 		this.type = type;
+		deviceType = new Property(PropertyType.deviceType, Integer.toString(type.getValue()));
+		deviceType.setType(SimpleType.Integer);
+		deviceType.setDoc("Device type");
+		super.addProperty(deviceType);
 
-		propDeviceSerialNum = new Property("propDeviceSerialNum", serial);
-		propDeviceSerialNum.setType(SimpleType.String);
-		propDeviceSerialNum.setDoc("Device serial number (assigned by manufacturer)");
-		addProperty(propDeviceSerialNum);
+		deviceSerialNum = new Property(PropertyType.deviceSerialNum, serial);
+		deviceSerialNum.setType(SimpleType.String);
+		deviceSerialNum.setDoc("Device serial number (assigned by manufacturer)");
+		super.addProperty(deviceSerialNum);
 
-		propDeviceManufacturer = new Property("propDeviceManufacturer");
-		propDeviceManufacturer.setType(SimpleType.String);
-		propDeviceManufacturer.setDoc("Manufacturer name of the device");
-		addProperty(propDeviceManufacturer);
+		deviceManufacturer = new Property(PropertyType.deviceManufacturer);
+		deviceManufacturer.setType(SimpleType.String);
+		deviceManufacturer.setDoc("Manufacturer name of the device");
+		super.addProperty(deviceManufacturer);
 
-		propDeviceModelName = new Property("propDeviceModelName");
-		propDeviceModelName.setType(SimpleType.String);
-		propDeviceModelName.setDoc("Device Model Name");
-		addProperty(propDeviceModelName);
+		deviceModelName = new Property(PropertyType.deviceModelName);
+		deviceModelName.setType(SimpleType.String);
+		deviceModelName.setDoc("Device Model Name");
+		super.addProperty(deviceModelName);
+	}
 
-		propDeviceName = new Property("propDeviceName");
-		propDeviceName.setType(SimpleType.String);
-		propDeviceName.setOptional(true);
-		propDeviceName.setDoc("Device name");
-		addProperty(propDeviceName);
+	public void addProperty(Property property) {
+		PropertyType type = PropertyType.fromShortName(property.getShortName());
+//		if (type == null)
+//			throw new IllegalAccessException("");
+		addProperty(type, property.getValue());
+	}
 
-		propDeviceSubModelName = new Property("propDeviceSubModelName");
-		propDeviceSubModelName.setType(SimpleType.String);
-		propDeviceSubModelName.setOptional(true);
-		propDeviceSubModelName.setDoc("Device sub-modelname");
-		addProperty(propDeviceSubModelName);
-
-		propDeviceAliasName = new Property("propDeviceAliasName");
-		propDeviceAliasName.setType(SimpleType.String);
-		propDeviceAliasName.setOptional(true);
-		propDeviceAliasName.setDoc("Device alias name");
-		addProperty(propDeviceAliasName);
-
-		propDeviceFirmwareVersion = new Property("propDeviceFirmwareVersion");
-		propDeviceFirmwareVersion.setType(SimpleType.String);
-		propDeviceFirmwareVersion.setOptional(true);
-		propDeviceFirmwareVersion.setDoc("Device firmware version");
-		addProperty(propDeviceFirmwareVersion);
-
-		propHardwareVersion = new Property("propHardwareVersion");
-		propHardwareVersion.setType(SimpleType.String);
-		propHardwareVersion.setOptional(true);
-		propHardwareVersion.setDoc("Device hardware version");
-		addProperty(propHardwareVersion);
-
-		propOsVersion = new Property("propOsVersion");
-		propOsVersion.setType(SimpleType.String);
-		propOsVersion.setOptional(true);
-		propOsVersion.setDoc("Version of the operation system (defined by manufacturer)");
-		addProperty(propOsVersion);
-
-		propProtocol = new Property("propProtocol");
-		propProtocol.setType(SimpleType.String);
-		propProtocol.setOptional(true);
-		propProtocol.setDoc("A comma separated list of MIME types for all supported communication protocol(s) of the device. Example: “application/x-alljoin;version=1.0,application/x-echonet-lite;version=1.0” indicates the device supports both AllJoyn v1.0 and Echonet Lite v1.0.");
-		addProperty(propProtocol);
-
-		propCountry = new Property("propCountry");
-		propCountry.setType(SimpleType.String);
-		propCountry.setOptional(true);
-		propCountry.setDoc("Country code of the device");
-		addProperty(propCountry);
-
-		propLocation = new Property("propLocation");
-		propLocation.setType(SimpleType.String);
-		propLocation.setOptional(true);
-		propLocation.setDoc("Location where the device is installed. It may be configured via the user interface provided by  the ‘presentationURL’ property or any other means.");
-		addProperty(propLocation);
-
-		propSystemTime = new Property("propSystemTime");
-		propSystemTime.setType(SimpleType.Datetime);
-		propSystemTime.setOptional(true);
-		propSystemTime.setDoc("Reference time for the device");
-		addProperty(propSystemTime);
-
-		propManufacturerDetailsLink = new Property("propManufacturerDetailsLink");
-		propManufacturerDetailsLink.setType(SimpleType.String);
-		propManufacturerDetailsLink.setOptional(true);
-		propManufacturerDetailsLink.setDoc("URL to manufacturer’s website");
-		addProperty(propManufacturerDetailsLink);
-
-		propDateOfManufacture = new Property("propDateOfManufacture");
-		propDateOfManufacture.setType(SimpleType.Datetime);
-		propDateOfManufacture.setOptional(true);
-		propDateOfManufacture.setDoc("Manufacturing date of device");
-		addProperty(propDateOfManufacture);
-
-		propSupportURL = new Property("propSupportURL");
-		propSupportURL.setType(SimpleType.String);
-		propSupportURL.setOptional(true);
-		propSupportURL.setDoc("URL that points to product support information of the device");
-		addProperty(propSupportURL);
-
-		propPresentationURL = new Property("propPresentationURL");
-		propPresentationURL.setType(SimpleType.String);
-		propPresentationURL.setOptional(true);
-		propPresentationURL.setDoc("To quote UPnP: “the control point can retrieve a page from this URL, load the page into a web browser, and depending on the capabilities of the page, allow a user to control the device and/or view device status. The degree to which each of these can be accomplished depends on the specific capabilities of the presentation page and device.”");
-		addProperty(propPresentationURL);
+	public void addProperty(PropertyType type, String val) {
+		switch (type) {
+		case deviceManufacturer: setDeviceManufacturer(val); return;
+		case deviceModelName: setDeviceModelName(val); return;
+		case deviceName: setDeviceName(val); return;
+		case deviceSubModelName: setDeviceSubModelName(val); return;
+		case deviceAliasName: setDeviceAliasName(val); return;
+		case deviceFirmwareVersion: setDeviceFirmwareVersion(val); return;
+		case hardwareVersion: setHardwareVersion(val); return;
+		case osVersion: setOsVersion(val); return;
+		case protocol: setProtocol(val); return;
+		case country: setCountry(val); return;
+		case location: setLocation(val); return;
+		case systemTime: setSystemTime(val); return;
+		case manufacturerDetailsLink: setManufacturerDetailsLink(val); return;
+		case dateOfManufacture: setDateOfManufacture(val); return;
+		case supportURL: setSupportURL(val); return;
+		case presentationURL: setPresentationURL(val); return;
+		case cloud: setCloud(val); return;
+		default:
+			super.addProperty(new Property(type, val)); return;
+		}
 	}
 
 	protected void setDeviceType(DeviceType type) {
 		this.type = type;
+		this.deviceType.setValue(Integer.toString(type.getValue()));
 	}
 
 	public DeviceType getDeviceType() {
@@ -152,102 +107,165 @@
 	}
 
 	public String getSerialNumber() {
-		return propDeviceSerialNum.getValue();
+		return deviceSerialNum.getValue();
 	}
 
 	public String getDeviceManufacturer() {
-		String s = propDeviceManufacturer.getValue();
-		return (s == null) ? "Undefined" : s;
+		return deviceManufacturer.getValue();
 	}
 
 	public void setDeviceManufacturer(final String s) {
-		propDeviceManufacturer.setValue(s);
+		deviceManufacturer.setValue(s);
 	}
 
 	public String getDeviceModelName() {
-		String s = propDeviceModelName.getValue();
-		return (s == null) ? "Undefined" : s;
+		return deviceModelName.getValue();
 	}
 
 	public void setDeviceModelName(String s) {
-		propDeviceModelName.setValue(s);
+		deviceModelName.setValue(s);
 	}
 	
 	public String getDeviceName() {
-		return propDeviceName.getValue();
+		return (deviceName == null) ? null : deviceName.getValue();
 	}
 	
 	public void setDeviceName(String s) {
-		propDeviceName.setValue(s);
+		if (deviceName == null) {
+			deviceName = new Property(PropertyType.deviceName);
+			deviceName.setType(SimpleType.String);
+			deviceName.setOptional(true);
+			deviceName.setDoc("Device name");
+			super.addProperty(deviceName);
+		}
+		deviceName.setValue(s);
 	}
 	
 	public String getDeviceSubModelName() {
-		return propDeviceSubModelName.getValue();
+		return (deviceSubModelName == null) ? null : deviceSubModelName.getValue();
 	}
 	
 	public void setDeviceSubModelName(String s) {
-		propDeviceSubModelName.setValue(s);
+		if (deviceSubModelName == null) {
+			deviceSubModelName = new Property(PropertyType.deviceSubModelName);
+			deviceSubModelName.setType(SimpleType.String);
+			deviceSubModelName.setOptional(true);
+			deviceSubModelName.setDoc("Device sub-modelname");
+			super.addProperty(deviceSubModelName);
+		}
+		deviceSubModelName.setValue(s);
 	}
 	
 	public String getDeviceAliasName() {
-		return propDeviceAliasName.getValue();
+		return (deviceAliasName == null) ? null : deviceAliasName.getValue();
 	}
 	
 	public void setDeviceAliasName(String s) {
-		propDeviceAliasName.setValue(s);
+		if (deviceAliasName == null) {
+			deviceAliasName = new Property(PropertyType.deviceAliasName);
+			deviceAliasName.setType(SimpleType.String);
+			deviceAliasName.setOptional(true);
+			deviceAliasName.setDoc("Device alias name");
+			super.addProperty(deviceAliasName);
+		}
+		deviceAliasName.setValue(s);
 	}
 	
 	public String getDeviceFirmwareVersion() {
-		return propDeviceFirmwareVersion.getValue();
+		return (deviceFirmwareVersion == null) ? null : deviceFirmwareVersion.getValue();
 	}
 	
 	public void setDeviceFirmwareVersion(String s) {
-		propDeviceFirmwareVersion.setValue(s);
+		if (deviceFirmwareVersion == null) {
+			deviceFirmwareVersion = new Property(PropertyType.deviceFirmwareVersion);
+			deviceFirmwareVersion.setType(SimpleType.String);
+			deviceFirmwareVersion.setOptional(true);
+			deviceFirmwareVersion.setDoc("Device firmware version");
+			super.addProperty(deviceFirmwareVersion);
+		}
+		deviceFirmwareVersion.setValue(s);
 	}
 	
 	public String getHardwareVersion() {
-		return propHardwareVersion.getValue();
+		return (hardwareVersion == null) ? null : hardwareVersion.getValue();
 	}
 	
 	public void setHardwareVersion(String s) {
-		propHardwareVersion.setValue(s);
+		if (hardwareVersion == null) {
+			hardwareVersion = new Property(PropertyType.hardwareVersion);
+			hardwareVersion.setType(SimpleType.String);
+			hardwareVersion.setOptional(true);
+			hardwareVersion.setDoc("Device hardware version");
+			super.addProperty(hardwareVersion);
+		}
+		hardwareVersion.setValue(s);
 	}
 	
 	public String getOsVersion() {
-		return propOsVersion.getValue();
+		return (osVersion == null) ? null : osVersion.getValue();
 	}
 	
 	public void setOsVersion(String s) {
-		propOsVersion.setValue(s);
+		if (osVersion == null) {
+			osVersion = new Property(PropertyType.osVersion);
+			osVersion.setType(SimpleType.String);
+			osVersion.setOptional(true);
+			osVersion.setDoc("Version of the operation system (defined by manufacturer)");
+			super.addProperty(osVersion);
+		}
+		osVersion.setValue(s);
 	}
 	
 	public String getProtocol() {
-		return propProtocol.getValue();
+		return (protocol == null) ? null : protocol.getValue();
 	}
 	
 	public void setProtocol(String s) {
-		propProtocol.setValue(s);
+		if (protocol == null) {
+			protocol = new Property(PropertyType.protocol);
+			protocol.setType(SimpleType.String);
+			protocol.setOptional(true);
+			protocol.setDoc("A comma separated list of MIME types for all supported communication protocol(s) of the device. Example: “application/x-alljoin;version=1.0,application/x-echonet-lite;version=1.0” indicates the device supports both AllJoyn v1.0 and Echonet Lite v1.0.");
+			super.addProperty(protocol);
+		}
+		protocol.setValue(s);
 	}
 	
 	public String getCountry() {
-		return propCountry.getValue();
+		return (country == null) ? null : country.getValue();
 	}
 	
 	public void setCountry(String s) {
-		propCountry.setValue(s);
+		if (country == null) {
+			country = new Property(PropertyType.country);
+			country.setType(SimpleType.String);
+			country.setOptional(true);
+			country.setDoc("Country code of the device");
+			super.addProperty(country);
+		}
+		country.setValue(s);
 	}
 	
 	public String getLocation() {
-		return propLocation.getValue();
+		return (location == null) ? null : location.getValue();
 	}
 	
 	public void setLocation(String s) {
-		propLocation.setValue(s);
+		if (location == null) {
+			location = new Property(PropertyType.location);
+			location.setType(SimpleType.String);
+			location.setOptional(true);
+			location.setDoc("Location where the device is installed. It may be configured via the user interface provided by  the ‘presentationURL’ property or any other means.");
+			super.addProperty(location);
+		}
+		location.setValue(s);
 	}
-	
+
 	public Date getSystemTime() throws PropertyException {
+		if (systemTime == null)
+			return null;
 		try {
-			String s = propSystemTime.getValue();
+			String s = systemTime.getValue();
 			return (s == null) ? null : new Date(Long.parseLong(s));
 		} catch (NumberFormatException e) {
 			throw new PropertyException("Implementation Error");
@@ -255,12 +273,27 @@
 	}
 	
 	public void setSystemTime(Date s) {
-		propSystemTime.setValue((s == null) ? null : Long.toString(s.getTime()));
+		if (s != null)
+			setSystemTime(Long.toString(s.getTime()));
+	}
+	
+	private void setSystemTime(String s) {
+		if (systemTime == null) {
+			systemTime = new Property(PropertyType.systemTime);
+			systemTime.setType(SimpleType.Datetime);
+			systemTime.setOptional(true);
+			systemTime.setDoc("Reference time for the device");
+			super.addProperty(systemTime);
+		}
+		if (s != null)
+			systemTime.setValue(s);
 	}
 	
 	public URL getManufacturerDetailsLink() throws PropertyException {
+		if (manufacturerDetailsLink == null)
+			return null;
 		try {
-			String s = propManufacturerDetailsLink.getValue();
+			String s = manufacturerDetailsLink.getValue();
 			return (s == null) ? null : new URL(s);
 		} catch (MalformedURLException e) {
 			throw new PropertyException("Implementation Error");
@@ -268,12 +301,27 @@
 	}
 	
 	public void setManufacturerDetailsLink(URL s) {
-		propManufacturerDetailsLink.setValue((s == null) ? null : s.toString());
+		if (s != null)
+			setManufacturerDetailsLink(s.toString());
+	}
+	
+	private void setManufacturerDetailsLink(String s) {
+		if (manufacturerDetailsLink == null) {
+			manufacturerDetailsLink = new Property(PropertyType.manufacturerDetailsLink);
+			manufacturerDetailsLink.setType(SimpleType.String);
+			manufacturerDetailsLink.setOptional(true);
+			manufacturerDetailsLink.setDoc("URL to manufacturer’s website");
+			super.addProperty(manufacturerDetailsLink);
+		}
+		if (s != null)
+			manufacturerDetailsLink.setValue(s);
 	}
 	
 	public Date getDateOfManufacture() throws PropertyException {
+		if (dateOfManufacture == null)
+			return null;
 		try {
-			String s = propDateOfManufacture.getValue();
+			String s = dateOfManufacture.getValue();
 			return (s == null) ? null : new Date(Long.parseLong(s));
 		} catch (NumberFormatException e) {
 			throw new PropertyException("Implementation Error");
@@ -281,12 +329,27 @@
 	}
 	
 	public void setDateOfManufacture(Date s) {
-		propDateOfManufacture.setValue((s == null) ? null : Long.toString(s.getTime()));
+		if (s != null)
+			setDateOfManufacture(Long.toString(s.getTime()));
+	}
+	
+	private void setDateOfManufacture(String s) {
+		if (dateOfManufacture == null) {
+			dateOfManufacture = new Property(PropertyType.dateOfManufacture);
+			dateOfManufacture.setType(SimpleType.Datetime);
+			dateOfManufacture.setOptional(true);
+			dateOfManufacture.setDoc("Manufacturing date of device");
+			super.addProperty(dateOfManufacture);
+		}
+		if (s != null)
+			dateOfManufacture.setValue(s);
 	}
 	
 	public URL getSupportURL() throws PropertyException {
+		if (supportURL == null)
+			return null;
 		try {
-			String s = propSupportURL.getValue();
+			String s = supportURL.getValue();
 			return (s == null) ? null : new URL(s);
 		} catch (MalformedURLException e) {
 			throw new PropertyException("Implementation Error");
@@ -294,12 +357,27 @@
 	}
 	
 	public void setSupportURL(URL s) {
-		propSupportURL.setValue((s == null) ? null : s.toString());
+		if (s != null)
+			setSupportURL(s.toString());
+	}
+	
+	private void setSupportURL(String s) {
+		if (supportURL == null) {
+			supportURL = new Property(PropertyType.supportURL);
+			supportURL.setType(SimpleType.String);
+			supportURL.setOptional(true);
+			supportURL.setDoc("URL that points to product support information of the device");
+			super.addProperty(supportURL);
+		}
+		if (s != null)
+			supportURL.setValue(s);
 	}
 	
 	public URL getPresentationURL() throws PropertyException {
+		if (presentationURL == null)
+			return null;
 		try {
-			String s = propPresentationURL.getValue();
+			String s = presentationURL.getValue();
 			return (s == null) ? null : new URL(s);
 		} catch (MalformedURLException e) {
 			throw new PropertyException("Implementation Error");
@@ -307,7 +385,41 @@
 	}
 	
 	public void setPresentationURL(URL s) {
-		propPresentationURL.setValue((s == null) ? null : s.toString());
+		if (s != null)
+			setPresentationURL(s.toString());
+	}
+	
+	private void setPresentationURL(String s) {
+		if (presentationURL == null) {
+			presentationURL = new Property(PropertyType.presentationURL);
+			presentationURL.setType(SimpleType.String);
+			presentationURL.setOptional(true);
+			presentationURL.setDoc("To quote UPnP: “the control point can retrieve a page from this URL, load the page into a web browser, and depending on the capabilities of the page, allow a user to control the device and/or view device status. The degree to which each of these can be accomplished depends on the specific capabilities of the presentation page and device.”");
+			super.addProperty(presentationURL);
+		}
+		if (s != null)
+			presentationURL.setValue(s);
+	}
+	
+	public boolean getCloud() throws PropertyException {
+		if (cloud == null)
+			throw new PropertyException("Not implemented");
+		return Boolean.parseBoolean(cloud.getValue());
+	}
+	
+	public void setCloud(boolean s) {
+		setCloud(Boolean.toString(s));
+	}
+	
+	private void setCloud(String s) {
+		if (cloud == null) {
+			cloud = new Property(PropertyType.cloud);
+			cloud.setType(SimpleType.Boolean);
+			cloud.setOptional(true);
+			cloud.setDoc("Device managed from the cloud");
+			super.addProperty(cloud);
+		}
+		cloud.setValue(s);
 	}
 	
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/Kettle.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/Kettle.java
new file mode 100644
index 0000000..617405e
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/Kettle.java
@@ -0,0 +1,128 @@
+package org.eclipse.om2m.sdt.home.devices;

+

+import org.eclipse.om2m.sdt.Domain;

+import org.eclipse.om2m.sdt.Module;

+import org.eclipse.om2m.sdt.home.modules.BinarySwitch;

+import org.eclipse.om2m.sdt.home.modules.Boiling;

+import org.eclipse.om2m.sdt.home.modules.FaultDetection;

+import org.eclipse.om2m.sdt.home.modules.KeepWarm;

+import org.eclipse.om2m.sdt.home.modules.RunMode;

+import org.eclipse.om2m.sdt.home.modules.RunState;

+import org.eclipse.om2m.sdt.home.modules.Temperature;

+import org.eclipse.om2m.sdt.home.types.DeviceType;

+

+public class Kettle extends GenericDevice {

+

+	private FaultDetection faultDetection;

+	private RunMode runMode;

+	//private LiquidRemaining waterLevel;

+	private BinarySwitch boilingSwitch;

+	private Temperature temperature;

+	//private Boiling boiling;

+	private KeepWarm keepWarm;

+

+	public Kettle(String id, String serial, DeviceType type, Domain domain) {

+		super(id, serial, DeviceType.deviceKettle, domain);

+	}

+

+	public Kettle(final String id, final String serial, final Domain domain){

+		super(id, serial, DeviceType.deviceKettle, domain);

+	}

+

+	public void addModule(Module module){

+		if(module instanceof FaultDetection)

+			addModule((FaultDetection)module);

+		else if(module instanceof RunMode)

+			addModule((RunMode)module);

+		/*else if(module instanceof LiquidRemaining)

+			addModule((LiquidRemaining)module);*/

+		else if(module instanceof BinarySwitch)

+			addModule((BinarySwitch)module);

+		else if(module instanceof KeepWarm)

+			addModule((KeepWarm)module);

+		else if(module instanceof Temperature)

+			addModule((Temperature)module);

+		else if(module instanceof Boiling)

+			addModule((Boiling)module);

+		else 

+			super.addModule(module);

+

+

+	}

+

+	//******************ADD MODULES******************

+

+	public void addModule(FaultDetection mod) {

+		this.faultDetection = mod;

+		super.addModule(faultDetection);

+	}

+

+	public void addModule(RunMode mod){

+		this.runMode = mod;

+		super.addModule(runMode);

+	}

+

+	/*(public void addModule(Boiling mod){

+		this.boiling = mod;

+		super.addModule(boiling);

+	}

+	 */

+	/*public void addModule(LiquidRemaining mod){

+		this.waterLevel = mod;

+		super.addModule(waterLevel);

+	}*/

+

+	public void addModule(BinarySwitch mod){

+		this.boilingSwitch = mod;

+		super.addModule(boilingSwitch);

+	}

+

+	public void addModule(Temperature mod){

+		this.temperature = mod;

+		super.addModule(temperature);

+	}

+

+	public void addModule(KeepWarm mod){

+		this.keepWarm = mod;

+		super.addModule(keepWarm);

+	}

+

+	//******************GETTERS******************

+

+	public FaultDetection getFaultDetection() {

+		return faultDetection;

+	}

+

+	public Temperature getTemperature(){

+		return temperature;

+	}

+

+

+	public KeepWarm getKeepWarm(){

+		return keepWarm;

+	}

+

+	public RunMode getRunMode() {

+		return runMode;

+	}

+

+	/*public LiquidRemaining getWaterLevel() {

+		return waterLevel;

+	}*/

+

+	public BinarySwitch getBoilingSwitch() {

+		return boilingSwitch;

+	}

+

+	/*

+	  public Boiling getBoiling() {

+

+		return boiling;

+	}

+

+	public void setBoiling(Boiling boiling) {

+		this.boiling = boiling;

+	}

+

+	 */

+}

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/SmartElectricMeter.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/SmartElectricMeter.java
index 112f293..4201a11 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/SmartElectricMeter.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/SmartElectricMeter.java
@@ -17,6 +17,7 @@
 import org.eclipse.om2m.sdt.home.modules.FaultDetection;
 import org.eclipse.om2m.sdt.home.modules.RunMode;
 import org.eclipse.om2m.sdt.home.types.DeviceType;
+import org.eclipse.om2m.sdt.home.types.PropertyType;
 import org.eclipse.om2m.sdt.types.SimpleType;
 
 public class SmartElectricMeter extends GenericDevice {
@@ -33,7 +34,7 @@
 	public SmartElectricMeter(final String id, final String serial, final Domain domain) {
 		super(id, serial, DeviceType.deviceSmartElectricMeter, domain);
 		
-		measuringScope = new Property("propMeasuringScope");
+		measuringScope = new Property(PropertyType.measuringScope);
 		measuringScope.setType(SimpleType.String);
 		measuringScope.setOptional(true);
 		measuringScope.setDoc("Measuring scope of the meter (ex. Whole house, room, or device)");
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/Thermostat.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/Thermostat.java
new file mode 100644
index 0000000..e97ec73
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/Thermostat.java
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.home.devices;
+
+import org.eclipse.om2m.sdt.Domain;
+import org.eclipse.om2m.sdt.Module;
+import org.eclipse.om2m.sdt.home.modules.RunMode;
+import org.eclipse.om2m.sdt.home.modules.Temperature;
+import org.eclipse.om2m.sdt.home.modules.Timer;
+import org.eclipse.om2m.sdt.home.types.DeviceType;
+
+public class Thermostat extends GenericDevice {
+	
+	private RunMode runMode;
+	private Temperature temperature;
+	private Timer timer;
+	
+	public Thermostat(final String id, final String serial, final Domain domain) {
+		super(id, serial, DeviceType.deviceThermostat, domain);
+	}
+	
+	public void addModule(Module module) {
+		if (module instanceof RunMode)
+			addModule((RunMode)module);
+		else if (module instanceof Temperature)
+			addModule((Temperature)module);
+		else if (module instanceof Timer)
+			addModule((Timer)module);
+		else 
+			super.addModule(module);
+	}
+
+	public void addModule(RunMode runMode) {
+		this.runMode = runMode;
+		super.addModule(runMode);
+	}
+
+	public void addModule(Temperature temperature) {
+		this.temperature = temperature;
+		super.addModule(temperature);
+	}
+
+	public void addModule(Timer timer) {
+		this.timer = timer;
+		super.addModule(timer);
+	}
+
+	public RunMode getRunMode() {
+		return runMode;
+	}
+
+	public Temperature getTemperature() {
+		return temperature;
+	}
+
+	public Timer getTimer() {
+		return timer;
+	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/WaterValve.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/WaterValve.java
index 206a277..2c17ad7 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/WaterValve.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/devices/WaterValve.java
@@ -9,12 +9,12 @@
 
 import org.eclipse.om2m.sdt.Domain;
 import org.eclipse.om2m.sdt.Module;
-import org.eclipse.om2m.sdt.home.modules.Level;
+import org.eclipse.om2m.sdt.home.modules.LiquidLevel;
 import org.eclipse.om2m.sdt.home.types.DeviceType;
 
 public class WaterValve extends GenericActuator {
 	
-	private Level waterLevel;
+	private LiquidLevel waterLevel;
 
 	public WaterValve(final String id, final String serial, final Domain domain) {
 		super(id, serial, DeviceType.deviceWaterValve, domain);
@@ -22,18 +22,18 @@
 	}
 	
 	public void addModule(Module module) {
-		if (module instanceof Level)
-			addModule((Level)module);
+		if (module instanceof LiquidLevel)
+			addModule((LiquidLevel)module);
 		else
 			super.addModule(module);
 	}
 
-	public void addModule(Level waterLevel) {
+	public void addModule(LiquidLevel waterLevel) {
 		this.waterLevel = waterLevel;
 		super.addModule(waterLevel);
 	}
 
-	public Level getWaterLevel() {
+	public LiquidLevel getWaterLevel() {
 		return waterLevel;
 	}
 
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/AbstractAlarmSensor.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/AbstractAlarmSensor.java
index 4c16c24..09ad5af 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/AbstractAlarmSensor.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/AbstractAlarmSensor.java
@@ -12,6 +12,7 @@
 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class AbstractAlarmSensor extends Module {
@@ -29,8 +30,12 @@
 
 	public AbstractAlarmSensor(final String name, final Domain domain, 
 			BooleanDataPoint alarm, ModuleType type, String doc) {
-		super(name, domain, type.getDefinition());
-
+		super(name, domain, type);
+		if ((alarm == null) ||
+				! alarm.getShortDefinitionType().equals(DatapointType.alarm.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong alarm datapoint: " + alarm);
+		}
 		this.alarm = alarm;
 		this.alarm.setWritable(false);
 		this.alarm.setDoc(doc);
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/AlarmSpeaker.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/AlarmSpeaker.java
index 962f020..885be4c 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/AlarmSpeaker.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/AlarmSpeaker.java
@@ -16,6 +16,7 @@
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
 import org.eclipse.om2m.sdt.home.types.AlertColourCode;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 import org.eclipse.om2m.sdt.home.types.Tone;
 
@@ -26,19 +27,24 @@
 	private AlertColourCode light;
 
 	public AlarmSpeaker(final String name, final Domain domain, BooleanDataPoint alarmStatus) {
-		super(name, domain, ModuleType.alarmSpeaker.getDefinition());
+		super(name, domain, ModuleType.alarmSpeaker);
 		
+		if ((alarmStatus == null) ||
+				! alarmStatus.getShortDefinitionType().equals(DatapointType.alarmStatus.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong alarmStatus datapoint: " + alarmStatus);
+		}
 		this.alarmStatus = alarmStatus;
 		this.alarmStatus.setDoc("\"True\" indicates the alarm start while \"False\" indicates the alarm stop");
 		addDataPoint(this.alarmStatus);
 	}
 
 	public AlarmSpeaker(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (BooleanDataPoint) dps.get("alarmStatus"));
-		Tone tone = (Tone) dps.get("tone");
+		this(name, domain, (BooleanDataPoint) dps.get(DatapointType.alarmStatus.getShortName()));
+		Tone tone = (Tone) dps.get(DatapointType.tone.getShortName());
 		if (tone != null)
 			setTone(tone);
-		AlertColourCode light = (AlertColourCode) dps.get("light");
+		AlertColourCode light = (AlertColourCode) dps.get(DatapointType.light.getShortName());
 		if (light != null)
 			setLight(light);
 	}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/AtmosphericPressureSensor.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/AtmosphericPressureSensor.java
index a0ef5c6..8755892 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/AtmosphericPressureSensor.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/AtmosphericPressureSensor.java
@@ -15,6 +15,7 @@
 import org.eclipse.om2m.sdt.datapoints.FloatDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class AtmosphericPressureSensor extends Module {
@@ -23,8 +24,13 @@
 
 	public AtmosphericPressureSensor(final String name, final Domain domain, 
 			FloatDataPoint atmosphericPressure) {
-		super(name, domain, ModuleType.atmosphericPressureSensor.getDefinition());
+		super(name, domain, ModuleType.atmosphericPressureSensor);
 		
+		if ((atmosphericPressure == null) ||
+				! atmosphericPressure.getShortDefinitionType().equals(DatapointType.atmosphericPressure.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong atmosphericPressure datapoint: " + atmosphericPressure);
+		}
 		this.atmosphericPressure = atmosphericPressure;
 		this.atmosphericPressure.setWritable(false);
 		this.atmosphericPressure.getDataType().setUnitOfMeasure("Mbar");
@@ -34,7 +40,7 @@
 	
 	public AtmosphericPressureSensor(final String name, final Domain domain, 
 			Map<String, DataPoint> dps) {
-		this(name, domain, (FloatDataPoint) dps.get("atmosphericPressure"));
+		this(name, domain, (FloatDataPoint) dps.get(DatapointType.atmosphericPressure.getShortName()));
 	}
 
 	public float getAtmosphericPressure() throws DataPointException, AccessException {
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/AudioVolume.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/AudioVolume.java
index e244a75..c9dae5e 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/AudioVolume.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/AudioVolume.java
@@ -13,12 +13,16 @@
 import org.eclipse.om2m.sdt.DataPoint;
 import org.eclipse.om2m.sdt.Domain;
 import org.eclipse.om2m.sdt.Module;
+import org.eclipse.om2m.sdt.args.Command;
 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.ActionException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
-import org.eclipse.om2m.sdt.home.actions.Volume;
+import org.eclipse.om2m.sdt.home.actions.DownVolume;
+import org.eclipse.om2m.sdt.home.actions.UpVolume;
+import org.eclipse.om2m.sdt.home.types.ActionType;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class AudioVolume extends Module {
@@ -28,16 +32,26 @@
 	private IntegerDataPoint stepValue;
 	private IntegerDataPoint maxValue;
 	
-	private Volume volume;
+	private Action upVolume;
+	private Action downVolume;
 	
 	public AudioVolume(final String name, final Domain domain, 
 			IntegerDataPoint volumePercentage, BooleanDataPoint muteEnabled) {
-		super(name, domain, ModuleType.audioVolume.getDefinition());
+		super(name, domain, ModuleType.audioVolume);
 
+		if ((muteEnabled == null) ||
+				! muteEnabled.getShortDefinitionType().equals(DatapointType.muteEnabled.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong muteEnabled datapoint: " + muteEnabled);
+		}
 		this.muteEnabled = muteEnabled;
 		this.muteEnabled.setDoc("The current status of the mute enablement. \"True\" indicates enabaled, and \"False\" indicates not enabled.");
 		addDataPoint(this.muteEnabled);
 		
+		if ((volumePercentage == null) ||
+				! volumePercentage.getShortDefinitionType().equals(DatapointType.volumePercentage.getShortName())) {
+			throw new IllegalArgumentException("Wrong volumePercentage datapoint: " + volumePercentage);
+		}
 		this.volumePercentage = volumePercentage;
 		this.volumePercentage.setDoc("The rounded percentage of the current volume in the range of [0, maxValue]. 0% shall mean no sound produced.");
 		addDataPoint(this.volumePercentage);
@@ -45,37 +59,60 @@
 	
 	public AudioVolume(final String name, final Domain domain, Map<String, DataPoint> dps) {
 		this(name, domain, 
-			(IntegerDataPoint) dps.get("volumePercentage"), 
-			(BooleanDataPoint) dps.get("muteEnabled"));
-		IntegerDataPoint stepValue = (IntegerDataPoint) dps.get("stepValue");
+			(IntegerDataPoint) dps.get(DatapointType.volumePercentage.getShortName()), 
+			(BooleanDataPoint) dps.get(DatapointType.muteEnabled.getShortName()));
+		IntegerDataPoint stepValue = (IntegerDataPoint) dps.get(DatapointType.stepValue.getShortName());
 		if (stepValue != null)
 			setStepValue(stepValue);
-		IntegerDataPoint maxValue = (IntegerDataPoint) dps.get("maxValue");
+		IntegerDataPoint maxValue = (IntegerDataPoint) dps.get(DatapointType.maxValue.getShortName());
 		if (maxValue != null)
 			setMaxValue(maxValue);
 	}
 	
 	public void addAction(Action action) {
-		if (action instanceof Volume)
-			setVolume((Volume)action);
-		else
-			super.addAction(action);
+		if (action.getShortDefinitionName().equals(ActionType.upVolume.getShortName())) {
+			this.upVolume = action;
+			super.addAction(upVolume);
+		} else if (action.getShortDefinitionName().equals(ActionType.downVolume.getShortName())) {
+			this.downVolume = action;
+			super.addAction(downVolume);
+		} else {
+			throw new IllegalArgumentException("Wrong toggle action: " + action);
+		}
+//		if (action instanceof UpVolume)
+//			setUpVolume((UpVolume)action);
+//		else if (action instanceof DownVolume)
+//			setDownVolume((DownVolume)action);
+//		else
+//			super.addAction(action);
 	}
 
-	public Volume getVolume() {
-		return volume;
+	public void setUpVolume(UpVolume upVolume) {
+		addAction(upVolume);
 	}
 
-	public void setVolume(Volume volume) {
-		this.volume = volume;
-		super.addAction(volume);
+	public void setDownVolume(DownVolume downVolume) {
+		addAction(downVolume);
 	}
 	
-	public void upOrDown(final boolean up) throws ActionException, AccessException {
-		if (volume == null)
+	public void upVolume() throws ActionException, AccessException {
+		if (upVolume == null)
 			throw new ActionException("Not implemented");
-		volume.upOrDown(up);
+		((Command)upVolume).invoke(null);
 	}
+	
+	public void downVolume() throws ActionException, AccessException {
+		if (downVolume == null)
+			throw new ActionException("Not implemented");
+//		downVolume.downVolume();
+		((Command)downVolume).invoke(null);
+	}
+	
+//	public void upOrDown(final boolean up) throws ActionException, AccessException {
+//		if (volume == null)
+//			throw new ActionException("Not implemented");
+//		volume.upOrDown(up);
+//	}
 
 	public boolean getMuteEnabled() throws DataPointException, AccessException {
 		return muteEnabled.getValue();
@@ -111,7 +148,7 @@
 		maxValue = mv;
 		maxValue.setWritable(false);
 		maxValue.setOptional(true);
-		maxValue.setDoc("Maximum value allowed for Volume.");
+		maxValue.setDoc("Maximum value allowed for UpVolume.");
 		addDataPoint(maxValue);
 	}
 
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Battery.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Battery.java
new file mode 100644
index 0000000..71d9ec6
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Battery.java
@@ -0,0 +1,206 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.home.modules;
+
+import java.util.Map;
+
+import javax.xml.bind.PropertyException;
+
+import org.eclipse.om2m.sdt.DataPoint;
+import org.eclipse.om2m.sdt.Domain;
+import org.eclipse.om2m.sdt.Module;
+import org.eclipse.om2m.sdt.Property;
+import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
+import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;
+import org.eclipse.om2m.sdt.exceptions.AccessException;
+import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
+import org.eclipse.om2m.sdt.home.types.ModuleType;
+import org.eclipse.om2m.sdt.home.types.PropertyType;
+import org.eclipse.om2m.sdt.types.SimpleType;
+
+public class Battery extends Module {
+	
+	private IntegerDataPoint level;
+	
+	private IntegerDataPoint capacity;
+	private IntegerDataPoint batteryThreshold;
+	
+	private BooleanDataPoint charging;
+	private BooleanDataPoint discharging;
+	private BooleanDataPoint lowBattery;
+	
+	private Property electricEnergy;
+	private Property voltage;
+	private Property material;
+	
+	public Battery(final String name, final Domain domain, IntegerDataPoint level) {
+		super(name, domain, ModuleType.battery);
+
+		if ((level == null) ||
+				! level.getShortDefinitionType().equals(DatapointType.level.getShortName())) {
+			throw new IllegalArgumentException("Wrong level datapoint: " + level);
+		}
+		this.level = level;
+		this.level.setWritable(false);
+		this.level.setDoc("The rounded percentage of the current level of battery in the range of [0, 100]. 0 percentage shall mean no battery remained.");
+		addDataPoint(this.level);
+	}
+	
+	public Battery(final String name, final Domain domain, Map<String, DataPoint> dps) {
+		this(name, domain, (IntegerDataPoint) dps.get(DatapointType.level.getShortName()));
+		
+		IntegerDataPoint capacity = 
+				(IntegerDataPoint) dps.get(DatapointType.capacity.getShortName());
+		if (capacity != null)
+			setCapacity(capacity);
+		IntegerDataPoint batteryThreshold = 
+				(IntegerDataPoint) dps.get(DatapointType.batteryThreshold.getShortName());
+		if (batteryThreshold != null)
+			setBatteryThreshold(batteryThreshold);
+		BooleanDataPoint charging = 
+				(BooleanDataPoint) dps.get(DatapointType.charging.getShortName());
+		if (charging != null)
+			setCharging(charging);
+		BooleanDataPoint discharging = (BooleanDataPoint) dps.get(DatapointType.discharging.getShortName());
+		if (discharging != null)
+			setDischarging(discharging);
+		BooleanDataPoint lowBattery = (BooleanDataPoint) dps.get(DatapointType.lowBattery.getShortName());
+		if (lowBattery != null)
+			setLowBattery(lowBattery);
+	}
+
+	public float getLevel() throws DataPointException, AccessException {
+		return level.getValue();
+	}
+
+	public void setCharging(BooleanDataPoint dp) {
+		this.charging = dp;
+		this.charging.setOptional(true);
+		this.charging.setWritable(false);
+		this.charging.setDoc("The status of charging. \"True\" indicates enabled, and \"False\" indicates not enabled.");
+		addDataPoint(charging);
+	}
+
+	public boolean getCharging() throws DataPointException, AccessException {
+		if (charging == null)
+			throw new DataPointException("Not implemented");
+		return charging.getValue();
+	}
+
+	public void setDischarging(BooleanDataPoint dp) {
+		this.discharging = dp;
+		this.discharging.setOptional(true);
+		this.discharging.setWritable(false);
+		this.discharging.setDoc("The status of discharging. \"True\" indicates enabled, and \"False\" indicates not enabled");
+		addDataPoint(discharging);
+	}
+
+	public boolean getDischarging() throws DataPointException, AccessException {
+		if (discharging == null)
+			throw new DataPointException("Not implemented");
+		return discharging.getValue();
+	}
+
+	public void setLowBattery(BooleanDataPoint dp) {
+		this.lowBattery = dp;
+		this.lowBattery.setOptional(true);
+		this.lowBattery.setWritable(false);
+		this.lowBattery.setDoc("To indicate that the battery is in low charge level.");
+		addDataPoint(lowBattery);
+	}
+
+	public boolean getLowBattery() throws DataPointException, AccessException {
+		if (lowBattery == null)
+			throw new DataPointException("Not implemented");
+		return lowBattery.getValue();
+	}
+
+	public void setCapacity(IntegerDataPoint dp) {
+		this.capacity = dp;
+		this.capacity.setOptional(true);
+		this.capacity.setWritable(false);
+		this.capacity.setDoc("The total capacity of battery in mAh.");
+		addDataPoint(capacity);
+	}
+
+	public int getCapacity() throws DataPointException, AccessException {
+		if (capacity == null)
+			throw new DataPointException("Not implemented");
+		return capacity.getValue();
+	}
+
+	public void setBatteryThreshold(IntegerDataPoint dp) {
+		this.batteryThreshold = dp;
+		this.batteryThreshold.setOptional(true);
+		this.batteryThreshold.setWritable(true);
+		this.batteryThreshold.setDoc("When the battery level is less than batteryThreshold then the lowBattery is true (and optionally to generate an alarm).");
+		addDataPoint(batteryThreshold);
+	}
+
+	public int getBatteryThreshold() throws DataPointException, AccessException {
+		if (batteryThreshold == null)
+			throw new DataPointException("Not implemented");
+		return batteryThreshold.getValue();
+	}
+
+	public void setBatteryThreshold(int b) throws DataPointException, AccessException {
+		if (batteryThreshold == null)
+			throw new DataPointException("Not implemented");
+		batteryThreshold.setValue(b);
+	}
+	
+	public void setElectricEnergy(int v) {
+		if (electricEnergy == null) {
+			electricEnergy = new Property(PropertyType.electricEnergy);
+			electricEnergy.setType(SimpleType.Integer);
+			electricEnergy.setDoc("Rated electric energy");
+			addProperty(electricEnergy);
+		}
+		electricEnergy.setValue(Integer.toString(v));
+	}
+	
+	public int getElectricEnergy() throws PropertyException {
+		if (electricEnergy == null)
+			throw new PropertyException("Not implemented");
+		return Integer.parseInt(electricEnergy.getValue());
+	}
+	
+	public void setVoltage(int v) {
+		if (voltage == null) {
+			voltage = new Property(PropertyType.voltage);
+			voltage.setType(SimpleType.Integer);
+			voltage.setDoc("Rated voltage");
+			addProperty(voltage);
+		}
+		voltage.setValue(Integer.toString(v));
+	}
+	
+	public int getVoltage() throws PropertyException {
+		if (voltage == null)
+			throw new PropertyException("Not implemented");
+		return Integer.parseInt(voltage.getValue());
+	}
+	
+	public void setMaterial(String v) {
+		if (material == null) {
+			material = new Property(PropertyType.material);
+			material.setType(SimpleType.String);
+			material.setDoc("The material (e.g. lithium ion, nickel and lead) of the cell.");
+			addProperty(material);
+		}
+		material.setValue(v);
+	}
+	
+	public String getMaterial() throws PropertyException {
+		if (material == null)
+			throw new PropertyException("Not implemented");
+		return material.getValue();
+	}
+	
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/BinarySwitch.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/BinarySwitch.java
index beefef5..8ef547e 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/BinarySwitch.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/BinarySwitch.java
@@ -13,37 +13,51 @@
 import org.eclipse.om2m.sdt.DataPoint;
 import org.eclipse.om2m.sdt.Domain;
 import org.eclipse.om2m.sdt.Module;
+import org.eclipse.om2m.sdt.args.Command;
 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.ActionException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
 import org.eclipse.om2m.sdt.home.actions.Toggle;
+import org.eclipse.om2m.sdt.home.types.ActionType;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class BinarySwitch extends Module {
 	
 	private BooleanDataPoint powerState;
 	
-	private Toggle toggle;
+	private Action toggle;
 	
 	public BinarySwitch(final String name, final Domain domain, 
 			BooleanDataPoint powerState) {
-		super(name, domain, ModuleType.binarySwitch.getDefinition());
+		this(name, domain, powerState, ModuleType.binarySwitch);
+	}
+	
+	protected BinarySwitch(final String name, final Domain domain,
+			BooleanDataPoint powerState, ModuleType type) {
+		super(name, domain, type);
 
+		if ((powerState == null) ||
+				! powerState.getShortDefinitionType().equals(DatapointType.powerState.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong powerState datapoint: " + powerState);
+		}
 		this.powerState = powerState;
 		this.powerState.setDoc("The current status of the BinarySwitch. \"True\" indicates turned-on, and \"False\" indicates turned-off.");
 		addDataPoint(this.powerState);
 	}
 	
 	public BinarySwitch(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (BooleanDataPoint) dps.get("powerState"));
+		this(name, domain, (BooleanDataPoint) dps.get(DatapointType.powerState.getShortName()));
 	}
 	
 	public void addAction(Action action) {
-		if (action instanceof Toggle)
-			setToggle((Toggle)action);
-		else
-			super.addAction(action);
+		if (! action.getShortDefinitionName().equals(ActionType.toggle.getShortName()))
+			throw new IllegalArgumentException("Wrong toggle action: " + action);
+		this.toggle = action;
+		this.toggle.setDoc("Toggle the switch");
+		super.addAction(toggle);
 	}
 
 	public boolean getPowerState() throws DataPointException, AccessException {
@@ -54,20 +68,20 @@
 		powerState.setValue(v);
 	}
 
-	public Toggle getToggle() {
-		return toggle;
-	}
-
 	public void setToggle(Toggle toggle) {
-		this.toggle = toggle;
-		this.toggle.setDoc("Toggle the switch");
-		super.addAction(toggle);
+//		this.toggle = toggle;
+//		this.toggle.setDoc("Toggle the switch");
+//		super.addAction(toggle);
+		addAction(toggle);
 	}
 	
 	public void toggle() throws ActionException, AccessException {
 		if (toggle == null)
 			throw new ActionException("Not implemented");
-		toggle.toggle();
+		if (toggle instanceof Toggle)
+			((Toggle) toggle).toggle();
+		else
+			((Command)toggle).invoke(null);
 	}
 
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Boiler.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Boiler.java
index bfdfda9..25a6335 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Boiler.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Boiler.java
@@ -15,6 +15,7 @@
 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class Boiler extends Module {
@@ -22,15 +23,20 @@
 	private BooleanDataPoint status;
 
 	public Boiler(final String name, final Domain domain, BooleanDataPoint status) {
-		super(name, domain, ModuleType.boiler.getDefinition());
+		super(name, domain, ModuleType.boiler);
 		
+		if ((status == null) ||
+				! status.getShortDefinitionType().equals(DatapointType.status.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong status datapoint: " + status);
+		}
 		this.status = status;
 		this.status.setDoc("The status of boiling");
 		addDataPoint(status);
 	}
 
 	public Boiler(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (BooleanDataPoint) dps.get("status"));
+		this(name, domain, (BooleanDataPoint) dps.get(DatapointType.status.getShortName()));
 	}
 
 	public boolean getStatus() throws DataPointException, AccessException {
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Boiling.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Boiling.java
new file mode 100644
index 0000000..2e0f38e
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Boiling.java
@@ -0,0 +1,56 @@
+package org.eclipse.om2m.sdt.home.modules;

+

+import org.eclipse.om2m.sdt.Domain;

+import org.eclipse.om2m.sdt.Module;

+import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;

+import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;

+import org.eclipse.om2m.sdt.exceptions.AccessException;

+import org.eclipse.om2m.sdt.exceptions.DataPointException;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

+import org.eclipse.om2m.sdt.home.types.ModuleType;

+

+public class Boiling extends Module {

+	

+	private BooleanDataPoint keepWarm;

+	private IntegerDataPoint status;

+	

+	public Boiling(String name, Domain domain, 

+			BooleanDataPoint keepWarm, IntegerDataPoint status) {

+		super(name, domain, ModuleType.boiling);

+		

+		if ((status == null) ||

+				! status.getShortDefinitionType().equals(DatapointType.status.getShortName())) {

+			domain.removeDevice(name);

+			throw new IllegalArgumentException("Wrong status datapoint: " + status);

+		}

+		this.status = status;

+		this.status.setDoc("The current status of the machine which prepares the drinks. Status equals 1 means the boiling is ongoing, 0 means the boiling is not ongoing.");

+		status.setReadable(true);

+		addDataPoint(this.status);

+		

+//		if ((keepWarm == null) ||

+//				! keepWarm.getShortDefinitionType().equals(DatapointType.keepWarm.getShortName())) {

+//			throw new IllegalArgumentException("Wrong status datapoint: " + keepWarm);

+//		}

+		this.keepWarm = keepWarm;

+		this.keepWarm.setDoc("The current status of the keeping a drink warm after brewing enabling. “True” indicates enabled, and “False” indicates not enabled");

+		addDataPoint(this.keepWarm);

+	}

+

+	public Boolean getKeepWarm() throws DataPointException, AccessException{

+		return keepWarm.getValue();

+	}

+	

+	public int getStatus() throws DataPointException, AccessException{

+		return status.getValue();

+	}

+	

+	public void setKeepWarm(Boolean v) throws DataPointException, AccessException{

+		keepWarm.setValue(v);

+	}

+	

+	public void setStatus(int v) throws DataPointException, AccessException{

+		status.setValue(v);

+	}

+

+}

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Brewing.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Brewing.java
index c95dd0c..6b3eafb 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Brewing.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Brewing.java
@@ -5,66 +5,53 @@
 import org.eclipse.om2m.sdt.DataPoint;

 import org.eclipse.om2m.sdt.Domain;

 import org.eclipse.om2m.sdt.Module;

-import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;

 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;

 import org.eclipse.om2m.sdt.exceptions.AccessException;

 import org.eclipse.om2m.sdt.exceptions.DataPointException;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

 import org.eclipse.om2m.sdt.home.types.ModuleType;

 import org.eclipse.om2m.sdt.home.types.TasteStrength;

 

 public class Brewing extends Module{

-	

-	private IntegerDataPoint cupsNumber;

-	

-	private BooleanDataPoint keepWarm;

-	

-	private TasteStrength strength;

-	

-	private IntegerDataPoint status;

-	

-	//TODO add properties maxCupsNumber

 

-	public Brewing(String name, Domain domain, IntegerDataPoint cupsNumber, BooleanDataPoint keepWarm, TasteStrength strength, IntegerDataPoint status) {

-		super(name, domain, ModuleType.brewing.getDefinition());

-		

+	private IntegerDataPoint cupsNumber;

+	private TasteStrength strength;

+

+	public Brewing(String name, Domain domain, IntegerDataPoint cupsNumber, TasteStrength strength) {

+		super(name, domain, ModuleType.brewing);

+

+		if ((cupsNumber == null) ||

+				! cupsNumber.getShortDefinitionType().equals(DatapointType.cupsNumber.getShortName())) {

+			domain.removeDevice(name);

+			throw new IllegalArgumentException("Wrong cupsNumber datapoint: " + cupsNumber);

+		}

 		this.cupsNumber = cupsNumber;

 		this.cupsNumber.setDoc("The current number of the cups requested to brew.");

 		addDataPoint(this.cupsNumber);

-		

-		this.keepWarm = keepWarm;

-		this.keepWarm.setDoc("The current status of the keeping a drink warm after brewing enabling. “True” indicates enabled, and “False” indicates not enabled.");

-		addDataPoint(this.keepWarm);

-	

+

+		if ((strength == null) ||

+				! strength.getShortDefinitionType().equals(DatapointType.strength.getShortName())) {

+			domain.removeDevice(name);

+			throw new IllegalArgumentException("Wrong strength datapoint: " + strength);

+		}

 		this.strength = strength;

 		this.strength.setDoc("The current strength of the drink taste. A higher value indicates a stronger taste.");

 		addDataPoint(this.strength);

-		

-		this.status = status;

-		this.status.setDoc("The current status of the machine which prepares the drinks. Status equals 1 means the brewing is ongoing, 0 means the brewing is not ongoing.");

-		addDataPoint(this.status);

-

 	}

-	

+

 	public Brewing(final String name, final Domain domain, Map<String, DataPoint> dps) {

-	        this(name, domain, (IntegerDataPoint) dps.get("cupsNumber"), (BooleanDataPoint) dps.get("keepWarm"), (TasteStrength) dps.get("strength"), (IntegerDataPoint) dps.get("status"));

+		this(name, domain, (IntegerDataPoint) dps.get(DatapointType.cupsNumber.getShortName()),

+				(TasteStrength) dps.get(DatapointType.strength.getShortName()));

 	}

 

 	public int getCupsNumber() throws DataPointException, AccessException {

-			return cupsNumber.getValue();

-		}

+		return cupsNumber.getValue();

+	}

 

 	public void setCupsNumber(int v) throws DataPointException, AccessException {

-			cupsNumber.setValue(v);

-		}	

-	

-	public boolean getKeepWarm() throws DataPointException, AccessException {

-		return keepWarm.getValue();

-	}

+		cupsNumber.setValue(v);

+	}	

 

-	public void setKeepWarm(boolean v) throws DataPointException, AccessException {

-		keepWarm.setValue(v);

-	}

-	

 	public int getStrength() throws DataPointException, AccessException {

 		return strength.getValue();

 	}

@@ -72,13 +59,5 @@
 	public void setStrength(int v) throws DataPointException, AccessException {

 		strength.setValue(v);

 	}

-	

-	public int getStatus() throws DataPointException, AccessException {

-		return status.getValue();

-	}

-

-	public void setStatus(int v) throws DataPointException, AccessException {

-		status.setValue(v);

-	}

 

 }
\ No newline at end of file
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Brightness.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Brightness.java
index 51e6070..1d0e30e 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Brightness.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Brightness.java
@@ -15,6 +15,7 @@
 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class Brightness extends Module {
@@ -22,15 +23,20 @@
 	private IntegerDataPoint brightness;
 
 	public Brightness(final String name, final Domain domain, IntegerDataPoint brightness) {
-		super(name, domain, ModuleType.brightness.getDefinition());
+		super(name, domain, ModuleType.brightness);
 		
+		if ((brightness == null) ||
+				! brightness.getShortDefinitionType().equals(DatapointType.brightness.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong brightness datapoint: " + brightness);
+		}
 		this.brightness = brightness;
 		this.brightness.setDoc("Current sensed or set value for Brightness");
 		addDataPoint(this.brightness);
 	}
 
 	public Brightness(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (IntegerDataPoint) dps.get("brightness"));
+		this(name, domain, (IntegerDataPoint) dps.get(DatapointType.brightness.getShortName()));
 	}
 
 	public int getBrightness() throws DataPointException, AccessException {
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/CarbonDioxideSensor.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/CarbonDioxideSensor.java
index 5916598..f609712 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/CarbonDioxideSensor.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/CarbonDioxideSensor.java
@@ -12,6 +12,7 @@
 import org.eclipse.om2m.sdt.DataPoint;
 import org.eclipse.om2m.sdt.Domain;
 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class CarbonDioxideSensor extends AbstractAlarmSensor {
@@ -27,7 +28,7 @@
 	}
 
 	public CarbonDioxideSensor(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (BooleanDataPoint) dps.get("alarm"));
+		this(name, domain, (BooleanDataPoint) dps.get(DatapointType.alarm.getShortName()));
 	}
 
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/CarbonMonoxideSensor.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/CarbonMonoxideSensor.java
index ade0ac3..334d575 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/CarbonMonoxideSensor.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/CarbonMonoxideSensor.java
@@ -12,6 +12,7 @@
 import org.eclipse.om2m.sdt.DataPoint;
 import org.eclipse.om2m.sdt.Domain;
 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class CarbonMonoxideSensor extends AbstractAlarmSensor {
@@ -22,7 +23,7 @@
 	}
 
 	public CarbonMonoxideSensor(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (BooleanDataPoint) dps.get("alarm"));
+		this(name, domain, (BooleanDataPoint) dps.get(DatapointType.alarm.getShortName()));
 	}
 
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Clock.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Clock.java
index 8d2cccf..f638d6e 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Clock.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Clock.java
@@ -17,6 +17,7 @@
 import org.eclipse.om2m.sdt.datapoints.TimeDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class Clock extends Module {
@@ -26,12 +27,22 @@
 
 	public Clock(final String name, final Domain domain, TimeDataPoint currentTime,
 			DateDataPoint currentDate) {
-		super(name, domain, ModuleType.clock.getDefinition());
+		super(name, domain, ModuleType.clock);
 		
+		if ((currentDate == null) ||
+				! currentDate.getShortDefinitionType().equals(DatapointType.currentDate.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong currentDate datapoint: " + currentDate);
+		}
 		this.currentDate = currentDate;
 		currentDate.setDoc("Information of the current date");
 		addDataPoint(currentDate);
 		
+		if ((currentTime == null) ||
+				! currentTime.getShortDefinitionType().equals(DatapointType.currentTime.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong currentTime datapoint: " + currentTime);
+		}
 		this.currentTime = currentTime;
 		currentTime.setDoc("Information of the current time");
 		addDataPoint(currentTime);
@@ -39,8 +50,8 @@
 
 	public Clock(final String name, final Domain domain, Map<String, DataPoint> dps) {
 		this(name, domain, 
-				(TimeDataPoint) dps.get("currentTime"), 
-				(DateDataPoint) dps.get("currentDate"));
+				(TimeDataPoint) dps.get(DatapointType.currentTime.getShortName()), 
+				(DateDataPoint) dps.get(DatapointType.currentDate.getShortName()));
 	}
 
 	public Date getCurrentTime() throws DataPointException, AccessException {
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Colour.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Colour.java
index 2a5bb51..10f9215 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Colour.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Colour.java
@@ -15,6 +15,7 @@
 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class Colour extends Module {
@@ -25,15 +26,32 @@
 
 	public Colour(final String name, final Domain domain, IntegerDataPoint red, 
 			IntegerDataPoint green, IntegerDataPoint blue) {
-		super(name, domain, ModuleType.colour.getDefinition());
+		super(name, domain, ModuleType.colour);
 		setExtends(domain.getName(), "Colour");
 		
+		if ((red == null) ||
+				! red.getShortDefinitionType().equals(DatapointType.red.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong red datapoint: " + red);
+		}
 		this.red = red;
 		this.red.setDoc("The R value of RGB; the range is [0,255]");
 		addDataPoint(this.red);
+		
+		if ((green == null) ||
+				! green.getShortDefinitionType().equals(DatapointType.green.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong green datapoint: " + green);
+		}
 		this.green = green;
 		this.green.setDoc("The G value of RGB; the range is [0,255]");
 		addDataPoint(this.green);
+		
+		if ((blue == null) ||
+				! blue.getShortDefinitionType().equals(DatapointType.blue.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong blue datapoint: " + blue);
+		}
 		this.blue = blue;
 		this.blue.setDoc("The B value of RGB; the range is [0,255]");
 		addDataPoint(this.blue);
@@ -41,9 +59,9 @@
 
 	public Colour(final String name, final Domain domain, Map<String, DataPoint> dps) {
 		this(name, domain, 
-			(IntegerDataPoint) dps.get("red"),
-			(IntegerDataPoint) dps.get("green"),
-			(IntegerDataPoint) dps.get("blue"));
+			(IntegerDataPoint) dps.get(DatapointType.red.getShortName()),
+			(IntegerDataPoint) dps.get(DatapointType.green.getShortName()),
+			(IntegerDataPoint) dps.get(DatapointType.blue.getShortName()));
 	}
 
 	public int getRed() throws DataPointException, AccessException {
@@ -70,4 +88,13 @@
 		blue.setValue(value);
 	}
 	
+	public void setValues(Integer red, Integer green, Integer blue) throws DataPointException, AccessException {
+		if (red != null)
+			setRed(red);
+		if (green != null)
+			setGreen(green);
+		if (blue != null)
+			setBlue(blue);
+	}
+	
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/ColourSaturation.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/ColourSaturation.java
index 221ba5d..4a0ebec 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/ColourSaturation.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/ColourSaturation.java
@@ -15,29 +15,36 @@
 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class ColourSaturation extends Module {
 	
-	private IntegerDataPoint colourSaturation;
+	private IntegerDataPoint colourSat;
 
-	public ColourSaturation(final String name, final Domain domain, IntegerDataPoint colourSaturation) {
-		super(name, domain, ModuleType.colourSaturation.getDefinition());
+	public ColourSaturation(final String name, final Domain domain, IntegerDataPoint colourSat) {
+		super(name, domain, ModuleType.colourSaturation);
 		setExtends(domain.getName(), "ColourSaturation");
-		this.colourSaturation = colourSaturation;
-		addDataPoint(this.colourSaturation);
+		
+		if ((colourSat == null) ||
+				! colourSat.getShortDefinitionType().equals(DatapointType.colourSat.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong colourSat datapoint: " + colourSat);
+		}
+		this.colourSat = colourSat;
+		addDataPoint(this.colourSat);
 	}
 
 	public ColourSaturation(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (IntegerDataPoint) dps.get("colourSaturation"));
+		this(name, domain, (IntegerDataPoint) dps.get(DatapointType.colourSat.getShortName()));
 	}
 
-	public int getColourSaturation() throws DataPointException, AccessException {
-		return colourSaturation.getValue();
+	public int getColourSat() throws DataPointException, AccessException {
+		return colourSat.getValue();
 	}
 	
-	public void setColourSaturation(int value) throws DataPointException, AccessException {
-		colourSaturation.setValue(value);
+	public void setColourSat(int value) throws DataPointException, AccessException {
+		colourSat.setValue(value);
 	}
 	
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/ContactSensor.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/ContactSensor.java
index ed25761..0fd0dcb 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/ContactSensor.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/ContactSensor.java
@@ -12,6 +12,7 @@
 import org.eclipse.om2m.sdt.DataPoint;
 import org.eclipse.om2m.sdt.Domain;
 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class ContactSensor extends AbstractAlarmSensor {
@@ -21,7 +22,7 @@
 	}
 
 	public ContactSensor(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (BooleanDataPoint) dps.get("alarm"));
+		this(name, domain, (BooleanDataPoint) dps.get(DatapointType.alarm.getShortName()));
 	}
 
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Dimming.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Dimming.java
deleted file mode 100644
index 2ad3429..0000000
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Dimming.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2016 Orange.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.om2m.sdt.home.modules;
-
-import java.util.Map;
-
-import org.eclipse.om2m.sdt.DataPoint;
-import org.eclipse.om2m.sdt.Domain;
-import org.eclipse.om2m.sdt.Module;
-import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;
-import org.eclipse.om2m.sdt.datapoints.StringDataPoint;
-import org.eclipse.om2m.sdt.exceptions.AccessException;
-import org.eclipse.om2m.sdt.exceptions.DataPointException;
-import org.eclipse.om2m.sdt.home.types.ModuleType;
-
-public class Dimming extends Module {
-	
-	private IntegerDataPoint dimmingSetting;
-	
-	private StringDataPoint range;
-	
-	private IntegerDataPoint step;
-	
-	public Dimming(final String name, final Domain domain, 
-			IntegerDataPoint value) {
-		super(name, domain, ModuleType.dimming.getDefinition());
-
-		this.dimmingSetting = value;
-		this.dimmingSetting.setDoc("Current dimming value.");
-		addDataPoint(this.dimmingSetting);
-	}
-
-	public Dimming(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (IntegerDataPoint) dps.get("dimmingSetting"));
-		StringDataPoint range = (StringDataPoint) dps.get("range");
-		if (range != null)
-			setRange(range);
-		IntegerDataPoint step = (IntegerDataPoint) dps.get("step");
-		if (step != null)
-			setStep(step);
-	}
-
-	public int getDimmingSetting() throws DataPointException, AccessException {
-		return dimmingSetting.getValue();
-	}
-
-	public void setDimmingSetting(int b) throws DataPointException, AccessException {
-		dimmingSetting.setValue(b);
-	}
-
-	public void setRange(StringDataPoint dp) {
-		this.range = dp;
-		this.range.setOptional(true);
-		this.range.setWritable(false);
-		this.range.setDoc("Min And Max Values For The Dimming Setting.");
-		addDataPoint(range);
-	}
-
-	public String getRange() throws DataPointException, AccessException {
-		if (range == null)
-			throw new DataPointException("Not implemented");
-		return range.getValue();
-	}
-
-	public void setStep(IntegerDataPoint dp) {
-		this.step = dp;
-		this.step.setOptional(true);
-		this.step.setWritable(false);
-		this.step.setDoc("Step Increment For Dimming Values.");
-		addDataPoint(step);
-	}
-
-	public int getStep() throws DataPointException, AccessException {
-		if (step == null)
-			throw new DataPointException("Not implemented");
-		return step.getValue();
-	}
-
-}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/DoorStatus.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/DoorStatus.java
index d7b4239..a381ebf 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/DoorStatus.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/DoorStatus.java
@@ -16,6 +16,7 @@
 import org.eclipse.om2m.sdt.datapoints.StringDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.DoorState;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
@@ -29,8 +30,13 @@
 	
 	
 	public DoorStatus(final String name, final Domain domain, DoorState state) {
-		super(name, domain, ModuleType.doorStatus.getDefinition());
+		super(name, domain, ModuleType.doorStatus);
 
+		if ((state == null) ||
+				! state.getShortDefinitionType().equals(DatapointType.doorState.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong doorState datapoint: " + state);
+		}
 		this.doorState = state;
 		this.doorState.setWritable(false);
 		this.doorState.setDoc("\"True\" indicates that door is closed, \"False\"indicates the door is open.");
@@ -38,11 +44,11 @@
 	}
 	
 	public DoorStatus(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (DoorState) dps.get("doorState"));
-		StringDataPoint openDuration = (StringDataPoint) dps.get("openDuration");
+		this(name, domain, (DoorState) dps.get(DatapointType.doorState.getShortName()));
+		StringDataPoint openDuration = (StringDataPoint) dps.get(DatapointType.openDuration.getShortName());
 		if (openDuration != null)
 			setOpenDuration(openDuration);
-		BooleanDataPoint openAlarm = (BooleanDataPoint) dps.get("openAlarm");
+		BooleanDataPoint openAlarm = (BooleanDataPoint) dps.get(DatapointType.openAlarm.getShortName());
 		if (openAlarm != null)
 			setOpenAlarm(openAlarm);
 	}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/EnergyConsumption.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/EnergyConsumption.java
index dd7e90c..85e9edf 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/EnergyConsumption.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/EnergyConsumption.java
@@ -16,6 +16,7 @@
 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class EnergyConsumption extends Module {
@@ -33,37 +34,46 @@
 	private IntegerDataPoint multiplyingFactors;
 
 	
-	public EnergyConsumption(final String name, final Domain domain, FloatDataPoint value) {
-		super(name, domain, ModuleType.energyConsumption.getDefinition());
+	public EnergyConsumption(final String name, final Domain domain, FloatDataPoint power) {
+		super(name, domain, ModuleType.energyConsumption);
 
-		this.power = value;
+		if ((power == null) ||
+				! power.getShortDefinitionType().equals(DatapointType.power.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong power datapoint: " + power);
+		}
+		this.power = power;
 		this.power.setWritable(false);
 		this.power.setDoc("The power of the device; The common unit is Watt (W).");
 		addDataPoint(this.power);
 	}
 	
 	public EnergyConsumption(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (FloatDataPoint) dps.get("power"));
+		this(name, domain, (FloatDataPoint) dps.get(DatapointType.power.getShortName()));
 		
-		IntegerDataPoint roundingEnergyConsumption = (IntegerDataPoint) dps.get("roundingEnergyConsumption");
+		IntegerDataPoint roundingEnergyConsumption = 
+				(IntegerDataPoint) dps.get(DatapointType.roundingEnergyConsumption.getShortName());
 		if (roundingEnergyConsumption != null)
 			setRoundingEnergyConsumption(roundingEnergyConsumption);
-		IntegerDataPoint significantDigits = (IntegerDataPoint) dps.get("significantDigits");
+		IntegerDataPoint significantDigits = 
+				(IntegerDataPoint) dps.get(DatapointType.significantDigits.getShortName());
 		if (significantDigits != null)
 			setSignificantDigits(significantDigits);
-		IntegerDataPoint multiplyingFactors = (IntegerDataPoint) dps.get("multiplyingFactors");
+		IntegerDataPoint multiplyingFactors = 
+				(IntegerDataPoint) dps.get(DatapointType.multiplyingFactors.getShortName());
 		if (multiplyingFactors != null)
 			setMultiplyingFactors(multiplyingFactors);
-		FloatDataPoint absoluteEnergyConsumption = (FloatDataPoint) dps.get("absoluteEnergyConsumption");
+		FloatDataPoint absoluteEnergyConsumption = 
+				(FloatDataPoint) dps.get(DatapointType.absoluteEnergyConsumption.getShortName());
 		if (absoluteEnergyConsumption != null)
 			setAbsoluteEnergyConsumption(absoluteEnergyConsumption);
-		FloatDataPoint voltage = (FloatDataPoint) dps.get("voltage");
+		FloatDataPoint voltage = (FloatDataPoint) dps.get(DatapointType.voltage.getShortName());
 		if (voltage != null)
 			setVoltage(voltage);
-		FloatDataPoint current = (FloatDataPoint) dps.get("current");
+		FloatDataPoint current = (FloatDataPoint) dps.get(DatapointType.current.getShortName());
 		if (current != null)
 			setCurrent(current);
-		FloatDataPoint frequency = (FloatDataPoint) dps.get("frequency");
+		FloatDataPoint frequency = (FloatDataPoint) dps.get(DatapointType.frequency.getShortName());
 		if (frequency != null)
 			setFrequency(frequency);
 	}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/EnergyGeneration.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/EnergyGeneration.java
index c6df5f2..0623f51 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/EnergyGeneration.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/EnergyGeneration.java
@@ -16,6 +16,7 @@
 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class EnergyGeneration extends Module {
@@ -27,21 +28,25 @@
 	private IntegerDataPoint multiplyingFactors;
 	
 	public EnergyGeneration(final String name, final Domain domain) {
-		super(name, domain, ModuleType.energyGeneration.getDefinition());
+		super(name, domain, ModuleType.energyGeneration);
 	}
 	
 	public EnergyGeneration(final String name, final Domain domain, Map<String, DataPoint> dps) {
 		this(name, domain);
-		FloatDataPoint powerGenerationData = (FloatDataPoint) dps.get("powerGenerationData");
+		FloatDataPoint powerGenerationData = 
+				(FloatDataPoint) dps.get(DatapointType.powerGenerationData.getShortName());
 		if (powerGenerationData != null)
 			setPowerGenerationData(powerGenerationData);
-		IntegerDataPoint roundingEnergyGeneration = (IntegerDataPoint) dps.get("roundingEnergyGeneration");
+		IntegerDataPoint roundingEnergyGeneration = 
+				(IntegerDataPoint) dps.get(DatapointType.roundingEnergyGeneration.getShortName());
 		if (roundingEnergyGeneration != null)
 			setRoundingEnergyGeneration(roundingEnergyGeneration);
-		IntegerDataPoint significantDigits = (IntegerDataPoint) dps.get("significantDigits");
+		IntegerDataPoint significantDigits = 
+				(IntegerDataPoint) dps.get(DatapointType.significantDigits.getShortName());
 		if (significantDigits != null)
 			setSignificantDigits(significantDigits);
-		IntegerDataPoint multiplyingFactors = (IntegerDataPoint) dps.get("multiplyingFactors");
+		IntegerDataPoint multiplyingFactors = 
+				(IntegerDataPoint) dps.get(DatapointType.multiplyingFactors.getShortName());
 		if (multiplyingFactors != null)
 			setMultiplyingFactors(multiplyingFactors);
 	}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/EnergyOverloadCircuitBreaker.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/EnergyOverloadCircuitBreaker.java
index 1f7d4a2..d0526b8 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/EnergyOverloadCircuitBreaker.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/EnergyOverloadCircuitBreaker.java
@@ -12,6 +12,7 @@
 import org.eclipse.om2m.sdt.DataPoint;
 import org.eclipse.om2m.sdt.Domain;
 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class EnergyOverloadCircuitBreaker extends AbstractAlarmSensor {
@@ -22,7 +23,7 @@
 	}
 
 	public EnergyOverloadCircuitBreaker(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (BooleanDataPoint) dps.get("alarm"));
+		this(name, domain, (BooleanDataPoint) dps.get(DatapointType.alarm.getShortName()));
 	}
 
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/ExtendedCarbonDioxideSensor.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/ExtendedCarbonDioxideSensor.java
index 3d1035e..ca63833 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/ExtendedCarbonDioxideSensor.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/ExtendedCarbonDioxideSensor.java
@@ -8,6 +8,7 @@
 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class ExtendedCarbonDioxideSensor extends CarbonDioxideSensor {
@@ -18,6 +19,11 @@
 			IntegerDataPoint carbonDioxideValue) {
 		super(name, domain, ModuleType.extendedCarbonDioxideSensor, alarm);
 		
+		if ((carbonDioxideValue == null) ||
+				! carbonDioxideValue.getShortDefinitionType().equals(DatapointType.carbonDioxideValue.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong carbonDioxideValue datapoint: " + carbonDioxideValue);
+		}
 		this.carbonDioxideValue = carbonDioxideValue;
 		this.carbonDioxideValue.setWritable(false);
 		addDataPoint(carbonDioxideValue);
@@ -25,8 +31,8 @@
 
 	public ExtendedCarbonDioxideSensor(final String name, final Domain domain,
 			Map<String, DataPoint> dps) {
-		this(name, domain, (BooleanDataPoint) dps.get("alarm"),
-				(IntegerDataPoint) dps.get("carbonDioxideValue"));
+		this(name, domain, (BooleanDataPoint) dps.get(DatapointType.alarm.getShortName()),
+				(IntegerDataPoint) dps.get(DatapointType.carbonDioxideValue.getShortName()));
 	}
 
 	public int getCarbonDioxideValue() throws DataPointException, AccessException {
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/FaultDetection.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/FaultDetection.java
index 1f552e0..2008e24 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/FaultDetection.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/FaultDetection.java
@@ -17,6 +17,7 @@
 import org.eclipse.om2m.sdt.datapoints.StringDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class FaultDetection extends Module {
@@ -26,43 +27,26 @@
 	private StringDataPoint description;
 
 	public FaultDetection(final String name, final Domain domain, BooleanDataPoint status) {
-		super(name, domain, ModuleType.faultDetection.getDefinition());
+		super(name, domain, ModuleType.faultDetection);
 		
+		if ((status == null) ||
+				! status.getShortDefinitionType().equals(DatapointType.status.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong status datapoint: " + status);
+		}
 		this.status = status;
 		this.status.setWritable(false);
 		this.status.setDoc("Status of fault detection");
 		addDataPoint(this.status);
 	}
-	
-	public FaultDetection(final String name, final Domain domain, BooleanDataPoint status, IntegerDataPoint code, StringDataPoint description) {
-		super(name, domain, ModuleType.faultDetection.getDefinition());
-		
-		this.status = status;
-		this.status.setWritable(false);
-		this.status.setDoc("Status of fault detection");
-		addDataPoint(this.status);
-		
-		if(code!=null){
-			this.code = code;
-			this.code.setWritable(false);
-			this.code.setDoc("Code of the fault.");
-			addDataPoint(this.code);
-		}
-		if(description!= null){
-			this.description = description;
-			this.description.setWritable(false);
-			this.description.setDoc("Message of the fault.");
-			addDataPoint(this.description);
-		}
-	}
 
 	public FaultDetection(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (BooleanDataPoint) dps.get("status"), (IntegerDataPoint)dps.get("code"), (StringDataPoint) dps.get("description"));
+		this(name, domain, (BooleanDataPoint) dps.get(DatapointType.status.getShortName()));
 
-		IntegerDataPoint code = (IntegerDataPoint) dps.get("code");
+		IntegerDataPoint code = (IntegerDataPoint) dps.get(DatapointType.code.getShortName());
 		if (code != null)
 			setCode(code);
-		StringDataPoint description = (StringDataPoint) dps.get("description");
+		StringDataPoint description = (StringDataPoint) dps.get(DatapointType.description.getShortName());
 		if (description != null)
 			setDescription(description);
 	}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Foaming.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Foaming.java
index 787673a..1152b93 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Foaming.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Foaming.java
@@ -7,34 +7,37 @@
 import org.eclipse.om2m.sdt.Module;

 import org.eclipse.om2m.sdt.exceptions.AccessException;

 import org.eclipse.om2m.sdt.exceptions.DataPointException;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

 import org.eclipse.om2m.sdt.home.types.FoamStrength;

 import org.eclipse.om2m.sdt.home.types.ModuleType;

 

 public class Foaming extends Module{

-	

+

 	private FoamStrength foamingStrength;

-	

-	public Foaming(String name, Domain domain, FoamStrength dp) {

-		super(name, domain, ModuleType.foaming.getDefinition());

-		

-		foamingStrength = dp;

-		foamingStrength.setDoc("The current strength of foamed milk. A higher value indicates a milk which is more foamed.");

-		addDataPoint(foamingStrength);

+

+	public Foaming(String name, Domain domain, FoamStrength foamingStrength) {

+		super(name, domain, ModuleType.foaming);

+

+		if ((foamingStrength == null) ||

+				! foamingStrength.getShortDefinitionType().equals(DatapointType.foamingStrength.getShortName())) {

+			domain.removeDevice(name);

+			throw new IllegalArgumentException("Wrong foamingStrength datapoint: " + foamingStrength);

+		}

+		this.foamingStrength = foamingStrength;

+		this.foamingStrength.setDoc("The current strength of foamed milk. A higher value indicates a milk which is more foamed.");

+		addDataPoint(this.foamingStrength);

 	}

-	

 

-    public Foaming(final String name, final Domain domain,  Map<String, DataPoint> dps) {

-        this(name, domain,  (FoamStrength) dps.get("foamingStrength"));

-    }

+	public Foaming(final String name, final Domain domain,  Map<String, DataPoint> dps) {

+		this(name, domain,  (FoamStrength) dps.get(DatapointType.foamingStrength.getShortName()));

+	}

 

-    

-    public int getFoamingStrength() throws DataPointException, AccessException{

+	public int getFoamingStrength() throws DataPointException, AccessException{

 		return foamingStrength.getValue();

 	}

 

-

 	public void setFoamingStrength(int v)  throws DataPointException, AccessException{

 		this.foamingStrength.setValue(v);

 	}

-	

-}
\ No newline at end of file
+

+}

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/GenericSensor.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/GenericSensor.java
index f3f9983..e94b451 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/GenericSensor.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/GenericSensor.java
@@ -9,6 +9,7 @@
 
 import org.eclipse.om2m.sdt.Domain;
 import org.eclipse.om2m.sdt.Module;
+import org.eclipse.om2m.sdt.Identifiers;
 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
@@ -20,13 +21,17 @@
 	
 	public GenericSensor(final String name, final Domain domain, 
 			BooleanDataPoint value) {
-		this(name, domain, value, ModuleType.genericSensor.getDefinition());
+		this(name, domain, value, ModuleType.genericSensor);
 	}
 	
 	public GenericSensor(final String name, final Domain domain, 
-			BooleanDataPoint value, String containerDefinition) {
-		super(name, domain, containerDefinition);
+			BooleanDataPoint value, Identifiers identifiers) {
+		super(name, domain, identifiers); 
 
+		if (value == null) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong value datapoint: " + value);
+		}
 		this.value = value;
 		this.value.setWritable(false);
 		this.value.setDoc("True = Sensed, False = Not Sensed");
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/GlassBreakSensor.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/GlassBreakSensor.java
index c8800d2..22484c7 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/GlassBreakSensor.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/GlassBreakSensor.java
@@ -12,6 +12,7 @@
 import org.eclipse.om2m.sdt.DataPoint;
 import org.eclipse.om2m.sdt.Domain;
 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class GlassBreakSensor extends AbstractAlarmSensor {
@@ -22,7 +23,7 @@
 	}
 
 	public GlassBreakSensor(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (BooleanDataPoint) dps.get("alarm"));
+		this(name, domain, (BooleanDataPoint) dps.get(DatapointType.alarm.getShortName()));
 	}
 
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Grinder.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Grinder.java
index fbbee0f..c47d142 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Grinder.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Grinder.java
@@ -9,29 +9,43 @@
 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;

 import org.eclipse.om2m.sdt.exceptions.AccessException;

 import org.eclipse.om2m.sdt.exceptions.DataPointException;

+import org.eclipse.om2m.sdt.home.types.DatapointType;

 import org.eclipse.om2m.sdt.home.types.ModuleType;

 

 public class Grinder extends Module {

 	

 	private BooleanDataPoint useGrinder;

 	

-	private IntegerDataPoint grindCoarsenes;

+	private IntegerDataPoint coarseness;

 	

-	public Grinder(final String name, final Domain domain, BooleanDataPoint useGrinder, IntegerDataPoint grindCoarsenes){

-		super(name, domain, ModuleType.grinder.getDefinition());

+	public Grinder(final String name, final Domain domain, 

+			BooleanDataPoint useGrinder, IntegerDataPoint coarseness){

+		super(name, domain, ModuleType.grinder);

 		setExtends(domain.getName(), "Grinder");

 		

+		if ((useGrinder == null) ||

+				! useGrinder.getShortDefinitionType().equals(DatapointType.useGrinder.getShortName())) {

+			domain.removeDevice(name);

+			throw new IllegalArgumentException("Wrong useGrinder datapoint: " + useGrinder);

+		}

 		this.useGrinder = useGrinder;

 		this.useGrinder.setDoc("The current status of the grinder enablement");

 		addDataPoint(this.useGrinder);

 		

-		this.grindCoarsenes = grindCoarsenes;

-		this.grindCoarsenes.setDoc("The current coarseness of the object after grinding.");

-		addDataPoint(this.grindCoarsenes);

+		if ((coarseness == null) ||

+				! coarseness.getShortDefinitionType().equals(DatapointType.coarseness.getShortName())) {

+			domain.removeDevice(name);

+			throw new IllegalArgumentException("Wrong coarseness datapoint: " + coarseness);

+		}

+		this.coarseness = coarseness;

+		this.coarseness.setDoc("The current coarseness of the object after grinding.");

+		addDataPoint(this.coarseness);

 	}

 	

     public Grinder(final String name, final Domain domain, Map<String, DataPoint> dps) {

-        this(name, domain, (BooleanDataPoint) dps.get("useGrinder"), (IntegerDataPoint) dps.get("grindCoarsenes"));

+        this(name, domain, 

+        		(BooleanDataPoint) dps.get(DatapointType.useGrinder.getShortName()), 

+        		(IntegerDataPoint) dps.get(DatapointType.coarseness.getShortName()));

     }

 	

 	public boolean getUseGrinder() throws DataPointException, AccessException {

@@ -43,11 +57,11 @@
 	}

 

 	public int getGrindCoarsenes() throws DataPointException, AccessException  {

-		return grindCoarsenes.getValue();

+		return coarseness.getValue();

 	}

 

 	public void setGrindCoarsenes(int v) throws DataPointException, AccessException  {

-		this.grindCoarsenes.setValue(v);

+		this.coarseness.setValue(v);

 	}

 	

 }
\ No newline at end of file
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/HotWaterSupply.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/HotWaterSupply.java
index 0c860cb..572b47d 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/HotWaterSupply.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/HotWaterSupply.java
@@ -15,6 +15,7 @@
 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class HotWaterSupply extends Module {
@@ -23,8 +24,13 @@
 	private BooleanDataPoint bath;
 
 	public HotWaterSupply(final String name, final Domain domain, BooleanDataPoint status) {
-		super(name, domain, ModuleType.hotWaterSupply.getDefinition());
+		super(name, domain, ModuleType.hotWaterSupply);
 		
+		if ((status == null) ||
+				! status.getShortDefinitionType().equals(DatapointType.status.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong status datapoint: " + status);
+		}
 		this.status = status;
 		this.status.setWritable(false);
 		this.status.setDoc("The status of watering operation");
@@ -32,8 +38,8 @@
 	}
 
 	public HotWaterSupply(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (BooleanDataPoint) dps.get("status"));
-		BooleanDataPoint bath = (BooleanDataPoint) dps.get("bath");
+		this(name, domain, (BooleanDataPoint) dps.get(DatapointType.status.getShortName()));
+		BooleanDataPoint bath = (BooleanDataPoint) dps.get(DatapointType.bath.getShortName());
 		if (bath != null)
 			setBath(bath);
 	}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/KeepWarm.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/KeepWarm.java
new file mode 100644
index 0000000..1566745
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/KeepWarm.java
@@ -0,0 +1,27 @@
+package org.eclipse.om2m.sdt.home.modules;

+

+import org.eclipse.om2m.sdt.Domain;

+import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;

+import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;

+import org.eclipse.om2m.sdt.exceptions.AccessException;

+import org.eclipse.om2m.sdt.exceptions.DataPointException;

+import org.eclipse.om2m.sdt.home.types.ModuleType;

+

+public class KeepWarm extends BinarySwitch {

+	

+	private IntegerDataPoint time;

+	

+	public KeepWarm(String name, Domain domain, BooleanDataPoint keepWarmSwitch) {

+		super(name, domain, keepWarmSwitch, ModuleType.keepWarm);

+	}

+

+	public int getTime() throws DataPointException, AccessException {

+		return time.getValue();

+	}

+

+	public void setTime(IntegerDataPoint time) {

+		this.time = time;

+		addDataPoint(this.time);

+	}

+	

+}

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Level.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Level.java
deleted file mode 100644
index 3449256..0000000
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Level.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2016 Orange.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.om2m.sdt.home.modules;
-
-import java.util.Map;
-
-import org.eclipse.om2m.sdt.DataPoint;
-import org.eclipse.om2m.sdt.Domain;
-import org.eclipse.om2m.sdt.Module;
-import org.eclipse.om2m.sdt.exceptions.AccessException;
-import org.eclipse.om2m.sdt.exceptions.DataPointException;
-import org.eclipse.om2m.sdt.home.types.ModuleType;
-
-public class Level extends Module {
-	
-	private org.eclipse.om2m.sdt.home.types.LevelType quantity;
-	
-	private org.eclipse.om2m.sdt.home.types.LevelType status;
-
-	public Level(final String name, final Domain domain, org.eclipse.om2m.sdt.home.types.LevelType dpQuantity, org.eclipse.om2m.sdt.home.types.LevelType dpStatus) {
-		super(name, domain, ModuleType.level.getDefinition());
-
-		if(dpQuantity != null){
-			quantity = dpQuantity;
-			quantity.setDoc("The desired quantity of supplies to be used; e.g. of rinse liquid, of water, of milk in a cup of coffee.");
-			addDataPoint(quantity);
-		}
-		if(dpStatus != null){
-			status = dpStatus;
-			status.setDoc("The current status of supplies e.g. of water, of coffee beans.");
-			addDataPoint(status);
-		}
-	}
-	
-	
-    public Level(final String name, final Domain domain, Map<String, DataPoint> dps) {
-        this(name, domain, (org.eclipse.om2m.sdt.home.types.LevelType) dps.get("quantity"), (org.eclipse.om2m.sdt.home.types.LevelType) dps.get("status"));
-    }
-
-	
-	public int getQuantity() throws DataPointException, AccessException {
-		return quantity.getValue();
-	}
-
-	public void setQuantity(int v) throws DataPointException, AccessException {
-		quantity.setValue(v);
-	}
-	
-
-	public int getStatus() throws DataPointException, AccessException {
-		return status.getValue();
-	}
-
-	public void setStatus(int v) throws DataPointException, AccessException {
-		status.setValue(v);
-	}
-
-}
\ No newline at end of file
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/LiquidLevel.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/LiquidLevel.java
new file mode 100644
index 0000000..a545266
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/LiquidLevel.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.home.modules;
+
+import java.util.Map;
+
+import org.eclipse.om2m.sdt.DataPoint;
+import org.eclipse.om2m.sdt.Domain;
+import org.eclipse.om2m.sdt.Module;
+import org.eclipse.om2m.sdt.exceptions.AccessException;
+import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
+import org.eclipse.om2m.sdt.home.types.ModuleType;
+
+public class LiquidLevel extends Module {
+	
+	private org.eclipse.om2m.sdt.home.types.LiquidLevel liquidLevel;
+
+	public LiquidLevel(final String name, final Domain domain, 
+			org.eclipse.om2m.sdt.home.types.LiquidLevel liquidLevel) {
+		super(name, domain, ModuleType.liquidLevel);
+
+		if ((liquidLevel == null) ||
+				! liquidLevel.getShortDefinitionType().equals(DatapointType.liquidLevel.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong liquidLevel datapoint: " + liquidLevel);
+		}
+		this.liquidLevel = liquidLevel;
+		liquidLevel.setDoc("The desired quantity of supplies to be used; e.g. of rinse liquid, of water, of milk in a cup of coffee.");
+		addDataPoint(liquidLevel);
+	}
+		
+    public LiquidLevel(final String name, final Domain domain, Map<String, DataPoint> dps) {
+        this(name, domain, (org.eclipse.om2m.sdt.home.types.LiquidLevel) dps.get(DatapointType.liquidLevel.getShortName()));
+    }
+
+	public int getLiquidLevel() throws DataPointException, AccessException {
+		return liquidLevel.getValue();
+	}
+
+	public void setLiquidLevel(int v) throws DataPointException, AccessException {
+		liquidLevel.setValue(v);
+	}
+	
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Lock.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Lock.java
index 46e28f9..2487c4a 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Lock.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Lock.java
@@ -9,36 +9,64 @@
 
 import java.util.Map;
 
+import javax.xml.bind.PropertyException;
+
 import org.eclipse.om2m.sdt.DataPoint;
 import org.eclipse.om2m.sdt.Domain;
 import org.eclipse.om2m.sdt.Module;
+import org.eclipse.om2m.sdt.Property;
+import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
-import org.eclipse.om2m.sdt.home.types.LockState;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
+import org.eclipse.om2m.sdt.home.types.PropertyType;
+import org.eclipse.om2m.sdt.types.SimpleType;
 
 public class Lock extends Module {
 	
-	private LockState lockState;
+	private BooleanDataPoint doorLock;
+	
+	private Property openOnly;
 
-	public Lock(final String name, final Domain domain, LockState lock) {
-		super(name, domain, ModuleType.lock.getDefinition());
+	public Lock(final String name, final Domain domain, BooleanDataPoint doorLock) {
+		super(name, domain, ModuleType.lock);
 		
-		this.lockState = lock;
-		this.lockState.setDoc("Status of the lock (Locked / Unlocked)");
-		addDataPoint(this.lockState);
+		if ((doorLock == null) ||
+				! doorLock.getShortDefinitionType().equals(DatapointType.doorLock.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong doorLock datapoint: " + doorLock);
+		}
+		this.doorLock = doorLock;
+		this.doorLock.setDoc("\"True\" indicates the door is locked, while \"False\" indicates the door is not locked");
+		addDataPoint(this.doorLock);
+
+		openOnly = new Property(PropertyType.openOnly);
+		openOnly.setType(SimpleType.Boolean);
+		openOnly.setOptional(true);
+		addProperty(openOnly);
 	}
 	
 	public Lock(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (LockState) dps.get("lockState"));
+		this(name, domain, (BooleanDataPoint) dps.get(DatapointType.doorLock.getShortName()));
 	}
 
-	public void setLockState(int c) throws DataPointException, AccessException {
-		lockState.setValue(c);
+	public void setDoorLock(boolean c) throws DataPointException, AccessException {
+		doorLock.setValue(c);
 	}
 	
-	public int getLockState() throws DataPointException, AccessException {
-		return lockState.getValue();
+	public boolean getDoorLock() throws DataPointException, AccessException {
+		return doorLock.getValue();
+	}
+	
+	public void setOpenOnly(boolean v) {
+		openOnly.setValue(Boolean.toString(v));
+	}
+	
+	public boolean getOpenOnly() throws PropertyException {
+		if (openOnly.getValue() == null)
+			throw new PropertyException("Not implemented");
+		return Boolean.parseBoolean(openOnly.getValue());
 	}
 
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/MotionSensor.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/MotionSensor.java
index 920c868..a0abd81 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/MotionSensor.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/MotionSensor.java
@@ -15,6 +15,7 @@
 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class MotionSensor extends AbstractAlarmSensor {
@@ -29,10 +30,12 @@
 
 	public MotionSensor(final String name, final Domain domain, Map<String, DataPoint> dps) {
 		this(name, domain, (BooleanDataPoint) dps.get("alarm"));
-		IntegerDataPoint silentTime = (IntegerDataPoint) dps.get("silentTime");
+		IntegerDataPoint silentTime = 
+				(IntegerDataPoint) dps.get(DatapointType.silentTime.getShortName());
 		if (silentTime != null)
 			setSilentTime(silentTime);
-		IntegerDataPoint sensitivity = (IntegerDataPoint) dps.get("sensitivity");
+		IntegerDataPoint sensitivity = 
+				(IntegerDataPoint) dps.get(DatapointType.sensitivity.getShortName());
 		if (sensitivity != null)
 			setSensitivity(sensitivity);
 	}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Noise.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Noise.java
index 6f05475..602437e 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Noise.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Noise.java
@@ -8,21 +8,27 @@
 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class Noise extends Module {
 
 	private IntegerDataPoint noise;
 	
-	public Noise(String name, Domain domain, IntegerDataPoint noiseDataPoint) {
-		super(name, domain, ModuleType.noise.getDefinition());
-		this.noise = noiseDataPoint;
+	public Noise(String name, Domain domain, IntegerDataPoint noise) {
+		super(name, domain, ModuleType.noise);
+		if ((noise == null) ||
+				! noise.getShortDefinitionType().equals(DatapointType.noise.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong noise datapoint: " + noise);
+		}
+		this.noise = noise;
 		this.noise.setWritable(false);
 		addDataPoint(this.noise);
 	}
 
 	public Noise(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (IntegerDataPoint) dps.get("noise"));
+		this(name, domain, (IntegerDataPoint) dps.get(DatapointType.noise.getShortName()));
 	}
 
 	public int getNoise() throws DataPointException, AccessException {
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/PersonSensor.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/PersonSensor.java
index 6882c23..e2afa31 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/PersonSensor.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/PersonSensor.java
@@ -9,6 +9,7 @@
 import org.eclipse.om2m.sdt.datapoints.ArrayDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class PersonSensor extends Module {
@@ -16,15 +17,22 @@
 	private final ArrayDataPoint<String> detectedPersons;
 
 	public PersonSensor(final String name, final Domain domain,
-			final ArrayDataPoint pDetectedPerson) {
-		super(name, domain, ModuleType.personSensor.getDefinition());
-		detectedPersons = pDetectedPerson;
-		detectedPersons.setWritable(false);
-		addDataPoint(detectedPersons);
+			final ArrayDataPoint<String> detectedPersons) {
+		super(name, domain, ModuleType.personSensor);
+		if ((detectedPersons == null) ||
+				! detectedPersons.getShortDefinitionType().equals(DatapointType.detectedPersons.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong detectedPersons datapoint: " + detectedPersons);
+		}
+		this.detectedPersons = detectedPersons;
+		this.detectedPersons.setWritable(false);
+		addDataPoint(this.detectedPersons);
 	}
 
+	@SuppressWarnings("unchecked")
 	public PersonSensor(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (ArrayDataPoint<String>) dps.get("detectedPersons"));
+		this(name, domain, 
+				(ArrayDataPoint<String>) dps.get(DatapointType.detectedPersons.getShortName()));
 	}
 
 	public List<String> getDetectedPersons() throws DataPointException, AccessException  {
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/PresenceSensor.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/PresenceSensor.java
index 0ae0dfb..9c8fc88 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/PresenceSensor.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/PresenceSensor.java
@@ -12,6 +12,7 @@
 import org.eclipse.om2m.sdt.DataPoint;
 import org.eclipse.om2m.sdt.Domain;
 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class PresenceSensor extends AbstractAlarmSensor {
@@ -21,7 +22,7 @@
 	}
 
 	public PresenceSensor(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (BooleanDataPoint) dps.get("alarm"));
+		this(name, domain, (BooleanDataPoint) dps.get(DatapointType.alarm.getShortName()));
 	}
 
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/PushButton.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/PushButton.java
index a2385cd..6305d85 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/PushButton.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/PushButton.java
@@ -15,6 +15,7 @@
 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class PushButton extends Module {
@@ -22,17 +23,22 @@
 	private BooleanDataPoint pushed;
 	
 	public PushButton(final String name, final Domain domain, 
-			BooleanDataPoint pressed) {
-		super(name, domain, ModuleType.pushButton.getDefinition());
+			BooleanDataPoint pushed) {
+		super(name, domain, ModuleType.pushButton);
 
-		this.pushed = pressed;
+		if ((pushed == null) ||
+				! pushed.getShortDefinitionType().equals(DatapointType.pushed.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong pushed datapoint: " + pushed);
+		}
+		this.pushed = pushed;
 		this.pushed.setWritable(false);
 		this.pushed.setDoc("To indicate the press of the button.");
 		addDataPoint(this.pushed);
 	}
 
 	public PushButton(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (BooleanDataPoint) dps.get("pushed"));
+		this(name, domain, (BooleanDataPoint) dps.get(DatapointType.pushed.getShortName()));
 	}
 
 	public boolean isPushed() throws DataPointException, AccessException {
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/RelativeHumidity.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/RelativeHumidity.java
index 394e80c..12c4f7d 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/RelativeHumidity.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/RelativeHumidity.java
@@ -16,6 +16,7 @@
 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class RelativeHumidity extends Module {
@@ -23,18 +24,24 @@
 	private FloatDataPoint relativeHumidity;
 	private IntegerDataPoint desiredHumidity;
 	
-	public RelativeHumidity(final String name, final Domain domain, FloatDataPoint dp) {
-		super(name, domain, ModuleType.relativeHumidity.getDefinition());
+	public RelativeHumidity(final String name, final Domain domain, 
+			FloatDataPoint relativeHumidity) {
+		super(name, domain, ModuleType.relativeHumidity);
 
-		this.relativeHumidity = dp;
+		if ((relativeHumidity == null) ||
+				! relativeHumidity.getShortDefinitionType().equals(DatapointType.relativeHumidity.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong relativeHumidity datapoint: " + relativeHumidity);
+		}
+		this.relativeHumidity = relativeHumidity;
 		this.relativeHumidity.setWritable(false);
 		this.relativeHumidity.setDoc("The measurement of the relative humidity value; the common unit is percentage.");
 		addDataPoint(relativeHumidity);
 	}
 
 	public RelativeHumidity(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (FloatDataPoint) dps.get("relativeHumidity"));
-		IntegerDataPoint desiredHumidity = (IntegerDataPoint) dps.get("desiredHumidity");
+		this(name, domain, (FloatDataPoint) dps.get(DatapointType.relativeHumidity.getShortName()));
+		IntegerDataPoint desiredHumidity = (IntegerDataPoint) dps.get(DatapointType.desiredHumidity.getShortName());
 		if (desiredHumidity != null)
 			setDesiredHumidity(desiredHumidity);
 	}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/RunMode.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/RunMode.java
index 9d1d7c1..59d7dc8 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/RunMode.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/RunMode.java
@@ -17,8 +17,10 @@
 import org.eclipse.om2m.sdt.datapoints.ArrayDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
+@SuppressWarnings("unchecked")
 public class RunMode extends Module {
 	
 	private ArrayDataPoint<String> operationMode;
@@ -27,12 +29,22 @@
 	public RunMode(final String name, final Domain domain,
 			ArrayDataPoint<String> operationMode,
 			ArrayDataPoint<String> supportedModes) {
-		super(name, domain, ModuleType.runMode.getDefinition());
+		super(name, domain, ModuleType.runMode);
 		
+		if ((operationMode == null) ||
+				! operationMode.getShortDefinitionType().equals(DatapointType.operationMode.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong operationMode datapoint: " + operationMode);
+		}
 		this.operationMode = operationMode;
 		this.operationMode.setDoc("Comma separated list of the currently active mode(s)");
 		addDataPoint(this.operationMode);
 		
+		if ((supportedModes == null) ||
+				! supportedModes.getShortDefinitionType().equals(DatapointType.supportedModes.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong supportedModes datapoint: " + supportedModes);
+		}
 		this.supportedModes = supportedModes;
 		this.supportedModes.setDoc("Comma separated list of possible modes the device supports");
 		addDataPoint(this.supportedModes);
@@ -40,8 +52,8 @@
 	
 	public RunMode(final String name, final Domain domain, Map<String, DataPoint> dps) {
 		this(name, domain, 
-			(ArrayDataPoint<String>) dps.get("operationMode"),
-			(ArrayDataPoint<String>) dps.get("supportedModes"));
+			(ArrayDataPoint<String>) dps.get(DatapointType.operationMode.getShortName()),
+			(ArrayDataPoint<String>) dps.get(DatapointType.supportedModes.getShortName()));
 	}
 
 	public List<String> getOperationMode() throws DataPointException, AccessException {
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/RunState.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/RunState.java
new file mode 100644
index 0000000..f51f93e
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/RunState.java
@@ -0,0 +1,134 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.home.modules;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.om2m.sdt.DataPoint;
+import org.eclipse.om2m.sdt.Domain;
+import org.eclipse.om2m.sdt.Module;
+import org.eclipse.om2m.sdt.datapoints.ArrayDataPoint;
+import org.eclipse.om2m.sdt.datapoints.FloatDataPoint;
+import org.eclipse.om2m.sdt.exceptions.AccessException;
+import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
+import org.eclipse.om2m.sdt.home.types.JobStates;
+import org.eclipse.om2m.sdt.home.types.MachineState;
+import org.eclipse.om2m.sdt.home.types.ModuleType;
+
+public class RunState extends Module {
+	
+	private JobStates currentJobState;
+	private ArrayDataPoint<Integer> jobStates;
+	private MachineState currentMachineState;
+	private ArrayDataPoint<Integer> machineStates;
+	
+	private FloatDataPoint progressPercentage;
+
+	public RunState(final String name, final Domain domain,
+			JobStates jobState, ArrayDataPoint<Integer> jobStates,
+			MachineState machineState, ArrayDataPoint<Integer> machineStates) {
+		super(name, domain, ModuleType.runMode);
+		
+		if ((jobState == null) ||
+				! jobState.getShortDefinitionType().equals(DatapointType.currentJobState.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong currentJobState datapoint: " + jobState);
+		}
+		this.currentJobState = jobState;
+		this.currentJobState.setDoc("Currently active job state. The value of this property shall be idle unless the value of currentMachineState property is active");
+		addDataPoint(this.currentJobState);
+		
+		if ((jobStates == null) ||
+				! jobStates.getShortDefinitionType().equals(DatapointType.jobStates.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong jobStates datapoint: " + jobStates);
+		}
+		this.jobStates = jobStates;
+		this.jobStates.setWritable(false);
+		this.jobStates.setDoc("List of possible job states the device supports");
+		addDataPoint(this.jobStates);
+		
+		if ((machineState == null) ||
+				! machineState.getShortDefinitionType().equals(DatapointType.currentMachineState.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong currentMachineState datapoint: " + machineState);
+		}
+		this.currentMachineState = machineState;
+		this.currentMachineState.setDoc("Currently active machine state");
+		addDataPoint(this.currentMachineState);
+		
+		if ((machineStates == null) ||
+				! machineStates.getShortDefinitionType().equals(DatapointType.machineStates.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong machineStates datapoint: " + machineStates);
+		}
+		this.machineStates = machineStates;
+		this.machineStates.setWritable(false);
+		this.machineStates.setDoc("List of possible machine states the device supports ");
+		addDataPoint(this.machineStates);
+	}
+	
+	@SuppressWarnings("unchecked")
+	public RunState(final String name, final Domain domain, Map<String, DataPoint> dps) {
+		this(name, domain,
+			(JobStates) dps.get(DatapointType.currentJobState.getShortName()),
+			(ArrayDataPoint<Integer>) dps.get(DatapointType.jobStates.getShortName()),
+			(MachineState) dps.get(DatapointType.currentMachineState.getShortName()), 
+			(ArrayDataPoint<Integer>) dps.get(DatapointType.machineStates.getShortName()));
+		FloatDataPoint progressPercentage = (FloatDataPoint) dps.get(DatapointType.progressPercentage.getShortName());
+		if (progressPercentage != null)
+			setProgressPercentage(progressPercentage);
+	}
+
+	public int getJobState() throws DataPointException, AccessException {
+		return currentJobState.getValue();
+	}
+
+	public void setJobState(int v) throws DataPointException, AccessException {
+		if (! getJobStates().contains(v)) {
+			throw new DataPointException("value " + v + " is not permitted");
+		}
+		currentJobState.setValue(v);
+	}
+
+	public List<Integer> getJobStates() throws DataPointException, AccessException {
+		return jobStates.getValue();
+	}
+
+	public int getMachineState() throws DataPointException, AccessException {
+		return currentMachineState.getValue();
+	}
+
+	public void setMachineState(int v) throws DataPointException, AccessException {
+		if (! getMachineStates().contains(v)) {
+			throw new DataPointException("value " + v + " is not permitted");
+		}
+		currentMachineState.setValue(v);
+	}
+
+	public List<Integer> getMachineStates() throws DataPointException, AccessException {
+		return machineStates.getValue();
+	}
+
+	public void setProgressPercentage(FloatDataPoint dp) {
+		this.progressPercentage = dp;
+		this.progressPercentage.setOptional(true);
+		this.progressPercentage.setWritable(false);
+		this.progressPercentage.setDoc("Indication of current progress in percentage.");
+		addDataPoint(progressPercentage);
+	}
+
+	public float getProgressPercentage() throws DataPointException, AccessException {
+		if (progressPercentage == null)
+			throw new DataPointException("Not implemented");
+		return progressPercentage.getValue();
+	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/SmokeSensor.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/SmokeSensor.java
index 43e809c..16cfef6 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/SmokeSensor.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/SmokeSensor.java
@@ -15,6 +15,7 @@
 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class SmokeSensor extends AbstractAlarmSensor {
@@ -22,13 +23,12 @@
 	private IntegerDataPoint detectedTime;
 	
 	public SmokeSensor(final String name, final Domain domain, BooleanDataPoint alarm) {
-		super(name, domain, alarm, ModuleType.smokeSensor,
-				"The detection of smoke.");
+		super(name, domain, alarm, ModuleType.smokeSensor, "The detection of smoke.");
 	}
 	
 	public SmokeSensor(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (BooleanDataPoint) dps.get("alarm"));
-		IntegerDataPoint detectedTime = (IntegerDataPoint) dps.get("detectedTime");
+		this(name, domain, (BooleanDataPoint) dps.get(DatapointType.alarm.getShortName()));
+		IntegerDataPoint detectedTime = (IntegerDataPoint) dps.get(DatapointType.detectedTime.getShortName());
 		if (detectedTime != null)
 			setDetectedTime(detectedTime);
 	}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Streaming.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Streaming.java
index 74fe99d..2a7cc1a 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Streaming.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Streaming.java
@@ -8,6 +8,7 @@
 import org.eclipse.om2m.sdt.datapoints.StringDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class Streaming extends Module {
@@ -17,30 +18,52 @@
 	private final StringDataPoint password;
 	private final StringDataPoint format;
 
-	public Streaming(String name, Domain domain, final StringDataPoint urlDP,
-			final StringDataPoint loginDP, final StringDataPoint passwordDP, 
-			final StringDataPoint formatDP) {
-		super(name, domain, ModuleType.streaming.getDefinition());
-		this.url = urlDP;
-		addDataPoint(url);
-		this.login = loginDP;
-		addDataPoint(login);
-		this.password = passwordDP;
-		addDataPoint(password);
-		this.format = formatDP;
-		addDataPoint(format);
+	public Streaming(String name, Domain domain, 
+			final StringDataPoint url, final StringDataPoint login, 
+			final StringDataPoint password, final StringDataPoint format) {
+		super(name, domain, ModuleType.streaming);
+		if ((url == null) ||
+				! url.getShortDefinitionType().equals(DatapointType.url.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong url datapoint: " + url);
+		}
+		this.url = url;
+		this.url.setWritable(false);
+		addDataPoint(this.url);
 		
-		url.setWritable(false);
-		login.setWritable(false);
-		password.setWritable(false);
-		format.setWritable(false);
+		if ((login == null) ||
+				! login.getShortDefinitionType().equals(DatapointType.login.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong login datapoint: " + login);
+		}
+		this.login = login;
+		this.login.setWritable(false);
+		addDataPoint(this.login);
+		
+		if ((password == null) ||
+				! password.getShortDefinitionType().equals(DatapointType.password.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong password datapoint: " + password);
+		}
+		this.password = password;
+		this.password.setWritable(false);
+		addDataPoint(this.password);
+		
+		if ((format == null) ||
+				! format.getShortDefinitionType().equals(DatapointType.format.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong format datapoint: " + format);
+		}
+		this.format = format;
+		this.format.setWritable(false);
+		addDataPoint(this.format);
 	}
 
 	public Streaming(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (StringDataPoint) dps.get("url"),
-				(StringDataPoint) dps.get("login"),
-				(StringDataPoint) dps.get("password"),
-				(StringDataPoint) dps.get("format"));
+		this(name, domain, (StringDataPoint) dps.get(DatapointType.url.getShortName()),
+				(StringDataPoint) dps.get(DatapointType.login.getShortName()),
+				(StringDataPoint) dps.get(DatapointType.password.getShortName()),
+				(StringDataPoint) dps.get(DatapointType.format.getShortName()));
 	}
 	
 	public String getUrlValue() throws DataPointException, AccessException {
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Temperature.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Temperature.java
index 70f2072..5d68ce5 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Temperature.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Temperature.java
@@ -16,6 +16,7 @@
 import org.eclipse.om2m.sdt.datapoints.StringDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class Temperature extends Module {
@@ -25,34 +26,44 @@
 	private FloatDataPoint minValue;
 	private FloatDataPoint maxValue;
 	private FloatDataPoint stepValue;
-	private StringDataPoint units;
+	private StringDataPoint unit;
 	
-	public Temperature(final String name, final Domain domain, FloatDataPoint dp) {
-		super(name, domain, ModuleType.temperature.getDefinition());
+	public Temperature(final String name, final Domain domain, FloatDataPoint currentTemperature) {
+		super(name, domain, ModuleType.temperature);
 
-		currentTemperature = dp;
-		currentTemperature.setWritable(false);
-		currentTemperature.setDoc("The current currentTemperature");
-		addDataPoint(currentTemperature);
+		if ((currentTemperature == null) ||
+				! currentTemperature.getShortDefinitionType().equals(DatapointType.currentTemperature.getShortName())) {
+			domain.removeDevice(name);
+			throw new IllegalArgumentException("Wrong currentTemperature datapoint: " + currentTemperature);
+		}
+		this.currentTemperature = currentTemperature;
+		this.currentTemperature.setWritable(false);
+		this.currentTemperature.setDoc("The current currentTemperature");
+		addDataPoint(this.currentTemperature);
 	}
 
 	public Temperature(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (FloatDataPoint) dps.get("currentTemperature"));
-		FloatDataPoint targetTemperature = (FloatDataPoint) dps.get("targetTemperature");
+		this(name, domain, (FloatDataPoint) dps.get(DatapointType.currentTemperature.getShortName()));
+		
+		FloatDataPoint targetTemperature = (FloatDataPoint) dps.get(DatapointType.targetTemperature.getShortName());
 		if (targetTemperature != null)
 			setTargetTemperature(targetTemperature);
-		FloatDataPoint minValue = (FloatDataPoint) dps.get("minValue");
+			
+		FloatDataPoint minValue = (FloatDataPoint) dps.get(DatapointType.minValue.getShortName());
 		if (minValue != null)
 			setMinValue(minValue);
-		FloatDataPoint maxValue = (FloatDataPoint) dps.get("maxValue");
+		
+		FloatDataPoint maxValue = (FloatDataPoint) dps.get(DatapointType.maxValue.getShortName());
 		if (maxValue != null)
 			setMaxValue(maxValue);
-		FloatDataPoint stepValue = (FloatDataPoint) dps.get("stepValue");
+		
+		FloatDataPoint stepValue = (FloatDataPoint) dps.get(DatapointType.stepValue.getShortName());
 		if (stepValue != null)
 			setStepValue(stepValue);
-		StringDataPoint units = (StringDataPoint) dps.get("units");
-		if (units != null)
-			setUnits(units);
+		
+		StringDataPoint unit = (StringDataPoint) dps.get(DatapointType.unit.getShortName());
+		if (unit != null)
+			setUnit(unit);
 	}
 
 	public float getCurrentTemperature() throws DataPointException, AccessException {
@@ -61,6 +72,7 @@
 
 	public void setTargetTemperature(FloatDataPoint dp) {
 		this.targetTemperature = dp;
+		this.targetTemperature.setWritable(true);
 		this.targetTemperature.setOptional(true);
 		this.targetTemperature.setDoc("The desired temperature to reach.");
 		addDataPoint(targetTemperature);
@@ -120,18 +132,18 @@
 		return stepValue.getValue();
 	}
 
-	public void setUnits(StringDataPoint dp) {
-		this.units = dp;
-		this.units.setOptional(true);
-		this.units.setWritable(false);
-		this.units.setDoc("The list of units for the temperature values. The default is Celsius only [C].");
-		addDataPoint(units);
+	public void setUnit(StringDataPoint dp) {
+		this.unit = dp;
+		this.unit.setOptional(true);
+		this.unit.setWritable(false);
+		this.unit.setDoc("The list of units for the temperature values. The default is Celsius only [C].");
+		addDataPoint(unit);
 	}
 
-	public String getUnits() throws DataPointException, AccessException {
-		if (units == null)
+	public String getUnit() throws DataPointException, AccessException {
+		if (unit == null)
 			throw new DataPointException("Not implemented");
-		return units.getValue();
+		return unit.getValue();
 	}
 
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/TemperatureAlarm.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/TemperatureAlarm.java
index ebe2b90..9f0a19e 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/TemperatureAlarm.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/TemperatureAlarm.java
@@ -15,6 +15,7 @@
 import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;
 import org.eclipse.om2m.sdt.exceptions.AccessException;
 import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class TemperatureAlarm extends AbstractAlarmSensor {
@@ -28,7 +29,11 @@
 	}
 
 	public TemperatureAlarm(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (BooleanDataPoint) dps.get("alarm"));
+		this(name, domain, (BooleanDataPoint) dps.get(DatapointType.alarm.getShortName()));
+		IntegerDataPoint temperatureThreshhold = 
+				(IntegerDataPoint) dps.get(DatapointType.temperatureThreshhold.getShortName());
+		if (temperatureThreshhold != null)
+			setTemperatureThreshhold(temperatureThreshhold);
 	}
 
 	public void setTemperature(IntegerDataPoint dp) {
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Timer.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Timer.java
new file mode 100644
index 0000000..66f4c39
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/Timer.java
@@ -0,0 +1,227 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.home.modules;
+
+import java.util.Date;
+import java.util.Map;
+
+import org.eclipse.om2m.sdt.DataPoint;
+import org.eclipse.om2m.sdt.Domain;
+import org.eclipse.om2m.sdt.Module;
+import org.eclipse.om2m.sdt.datapoints.IntegerDataPoint;
+import org.eclipse.om2m.sdt.datapoints.TimeDataPoint;
+import org.eclipse.om2m.sdt.exceptions.AccessException;
+import org.eclipse.om2m.sdt.exceptions.DataPointException;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
+import org.eclipse.om2m.sdt.home.types.ModuleType;
+
+public class Timer extends Module {
+	
+	private IntegerDataPoint referenceTimer;
+	private IntegerDataPoint targetTimeToStart;
+	private IntegerDataPoint targetTimeToStop;
+	private IntegerDataPoint estimatedTimeToEnd;
+	private IntegerDataPoint runningTime;
+	private IntegerDataPoint targetDuration;
+	private TimeDataPoint absoluteStartTime;
+	private TimeDataPoint absoluteStopTime;
+	
+	public Timer(final String name, final Domain domain) {
+		super(name, domain, ModuleType.timer);
+	}
+
+	public Timer(final String name, final Domain domain, Map<String, DataPoint> dps) {
+		this(name, domain);
+		IntegerDataPoint referenceTimer = 
+				(IntegerDataPoint) dps.get(DatapointType.referenceTimer.getShortName());
+		if (referenceTimer != null)
+			setReferenceTimer(referenceTimer);
+		
+		IntegerDataPoint targetTimeToStart = 
+				(IntegerDataPoint) dps.get(DatapointType.targetTimeToStart.getShortName());
+		if (targetTimeToStart != null)
+			setTargetTimeToStart(targetTimeToStart);
+		
+		IntegerDataPoint targetTimeToStop = 
+				(IntegerDataPoint) dps.get(DatapointType.targetTimeToStop.getShortName());
+		if (targetTimeToStop != null)
+			setTargetTimeToStop(targetTimeToStop);
+		
+		IntegerDataPoint estimatedTimeToEnd = 
+				(IntegerDataPoint) dps.get(DatapointType.estimatedTimeToEnd.getShortName());
+		if (estimatedTimeToEnd != null)
+			setEstimatedTimeToEnd(estimatedTimeToEnd);
+		
+		IntegerDataPoint runningTime = 
+				(IntegerDataPoint) dps.get(DatapointType.runningTime.getShortName());
+		if (runningTime != null)
+			setRunningTime(runningTime);
+		
+		IntegerDataPoint targetDuration = 
+				(IntegerDataPoint) dps.get(DatapointType.targetDuration.getShortName());
+		if (targetDuration != null)
+			setTargetDuration(targetDuration);
+	}
+
+	public void setReferenceTimer(IntegerDataPoint dp) {
+		referenceTimer = dp;
+		referenceTimer.setOptional(true);
+		referenceTimer.setWritable(false);
+		referenceTimer.setDoc("...");
+		addDataPoint(referenceTimer);
+	}
+
+	public int getReferenceTimer() throws DataPointException, AccessException {
+		if (referenceTimer == null)
+			throw new DataPointException("Not implemented");
+		return referenceTimer.getValue();
+	}
+
+	public void setTargetTimeToStart(IntegerDataPoint dp) {
+		this.targetTimeToStart = dp;
+		this.targetTimeToStart.setOptional(true);
+		this.targetTimeToStart.setDoc("...");
+		addDataPoint(targetTimeToStart);
+	}
+
+	public int getTargetTimeToStart() throws DataPointException, AccessException {
+		if (targetTimeToStart == null)
+			throw new DataPointException("Not implemented");
+		return targetTimeToStart.getValue();
+	}
+
+	public void setTargetTimeToStart(int b) throws DataPointException, AccessException {
+		if (targetTimeToStart == null)
+			throw new DataPointException("Not implemented");
+		targetTimeToStart.setValue(b);
+	}
+
+	public void setTargetTimeToStop(IntegerDataPoint dp) {
+		this.targetTimeToStop = dp;
+		this.targetTimeToStop.setOptional(true);
+		this.targetTimeToStop.setDoc("...");
+		addDataPoint(targetTimeToStop);
+	}
+
+	public int getTargetTimeToStop() throws DataPointException, AccessException {
+		if (targetTimeToStop == null)
+			throw new DataPointException("Not implemented");
+		return targetTimeToStop.getValue();
+	}
+
+	public void setTargetTimeToStop(int b) throws DataPointException, AccessException {
+		if (targetTimeToStop == null)
+			throw new DataPointException("Not implemented");
+		targetTimeToStop.setValue(b);
+	}
+
+	public void setEstimatedTimeToEnd(IntegerDataPoint dp) {
+		this.estimatedTimeToEnd = dp;
+		this.estimatedTimeToEnd.setOptional(true);
+		this.estimatedTimeToEnd.setWritable(false);
+		this.estimatedTimeToEnd.setDoc("...");
+		addDataPoint(estimatedTimeToEnd);
+	}
+
+	public int getEstimatedTimeToEnd() throws DataPointException, AccessException {
+		if (estimatedTimeToEnd == null)
+			throw new DataPointException("Not implemented");
+		return estimatedTimeToEnd.getValue();
+	}
+
+	public void setRunningTime(IntegerDataPoint dp) {
+		this.runningTime = dp;
+		this.runningTime.setOptional(true);
+		this.runningTime.setWritable(false);
+		this.runningTime.setDoc("...");
+		addDataPoint(runningTime);
+	}
+
+	public int getRunningTime() throws DataPointException, AccessException {
+		if (runningTime == null)
+			throw new DataPointException("Not implemented");
+		return runningTime.getValue();
+	}
+
+	public void setTargetDuration(IntegerDataPoint dp) {
+		this.targetDuration = dp;
+		this.targetDuration.setOptional(true);
+		this.targetDuration.setWritable(false);
+		this.targetDuration.setDoc("...");
+		addDataPoint(targetDuration);
+	}
+
+	public int getTargetDuration() throws DataPointException, AccessException {
+		if (targetDuration == null)
+			throw new DataPointException("Not implemented");
+		return targetDuration.getValue();
+	}
+
+	public void setAbsoluteStartTime(TimeDataPoint dp) {
+		this.absoluteStartTime = dp;
+		this.absoluteStartTime.setOptional(true);
+		this.absoluteStartTime.setDoc("...");
+		addDataPoint(absoluteStartTime);
+	}
+
+	public Date getAbsoluteStartTime() throws DataPointException, AccessException {
+		if (absoluteStartTime == null)
+			throw new DataPointException("Not implemented");
+		return absoluteStartTime.getValue();
+	}
+
+	public void setAbsoluteStartTime(long b) throws DataPointException, AccessException {
+		if (absoluteStartTime == null)
+			throw new DataPointException("Not implemented");
+		absoluteStartTime.setValue(b);
+	}
+
+	public void setAbsoluteStartTime(Date d) throws DataPointException, AccessException {
+		if (absoluteStartTime == null)
+			throw new DataPointException("Not implemented");
+		absoluteStartTime.setValue(d);
+	}
+
+	public void setAbsoluteStartTime(String d) throws DataPointException, AccessException {
+		if (absoluteStartTime == null)
+			throw new DataPointException("Not implemented");
+		absoluteStartTime.setValue(d);
+	}
+
+	public void setAbsoluteStopTime(TimeDataPoint dp) {
+		this.absoluteStopTime = dp;
+		this.absoluteStopTime.setOptional(true);
+		this.absoluteStopTime.setDoc("...");
+		addDataPoint(absoluteStopTime);
+	}
+
+	public Date getAbsoluteStopTime() throws DataPointException, AccessException {
+		if (absoluteStopTime == null)
+			throw new DataPointException("Not implemented");
+		return absoluteStopTime.getValue();
+	}
+
+	public void setAbsoluteStopTime(long b) throws DataPointException, AccessException {
+		if (absoluteStopTime == null)
+			throw new DataPointException("Not implemented");
+		absoluteStopTime.setValue(b);
+	}
+
+	public void setAbsoluteStopTime(Date d) throws DataPointException, AccessException {
+		if (absoluteStopTime == null)
+			throw new DataPointException("Not implemented");
+		absoluteStopTime.setValue(d);
+	}
+
+	public void setAbsoluteStopTime(String d) throws DataPointException, AccessException {
+		if (absoluteStopTime == null)
+			throw new DataPointException("Not implemented");
+		absoluteStopTime.setValue(d);
+	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/TouchSensor.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/TouchSensor.java
index 39f92f3..eb3458b 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/TouchSensor.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/TouchSensor.java
@@ -12,6 +12,7 @@
 import org.eclipse.om2m.sdt.DataPoint;
 import org.eclipse.om2m.sdt.Domain;
 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class TouchSensor extends AbstractAlarmSensor {
@@ -22,7 +23,7 @@
 	}
 
 	public TouchSensor(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (BooleanDataPoint) dps.get("alarm"));
+		this(name, domain, (BooleanDataPoint) dps.get(DatapointType.alarm.getShortName()));
 	}
 
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/WaterSensor.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/WaterSensor.java
index 15a5292..7ac2dd6 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/WaterSensor.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/modules/WaterSensor.java
@@ -12,6 +12,7 @@
 import org.eclipse.om2m.sdt.DataPoint;
 import org.eclipse.om2m.sdt.Domain;
 import org.eclipse.om2m.sdt.datapoints.BooleanDataPoint;
+import org.eclipse.om2m.sdt.home.types.DatapointType;
 import org.eclipse.om2m.sdt.home.types.ModuleType;
 
 public class WaterSensor extends AbstractAlarmSensor {
@@ -22,7 +23,7 @@
 	}
 	
 	public WaterSensor(final String name, final Domain domain, Map<String, DataPoint> dps) {
-		this(name, domain, (BooleanDataPoint) dps.get("alarm"));
+		this(name, domain, (BooleanDataPoint) dps.get(DatapointType.alarm.getShortName()));
 	}
 
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/ActionType.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/ActionType.java
new file mode 100644
index 0000000..6f8461e
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/ActionType.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.home.types;
+
+import org.eclipse.om2m.sdt.Identifiers;
+
+public enum ActionType implements Identifiers {
+	
+	activateClockTimer(1, "timer.activateClockTimer", "activateClockTimer", "acCTr"),
+	deactivateClockTimer(2, "timer.deactivateClockTimer", "deactivateClockTimer","deCTr"),
+	downChannel(3, "televisionchannel.downChannel", "downChannel", "dowCl"),
+	downVolume(4, "audiovolume.downVolume", "downVolume", "dowVe"),
+	toggle(5, "binaryswitch.toggle", "toggle", "togge"),
+	upChannel(6, "televisionchannel.upChannel", "upChannel", "uphCl"),
+	upVolume(7, "audiovolume.upVolume", "upVolume", "upVol");
+	
+	static private final String PATH = "org.onem2m.home.moduleclass.";
+	
+	private int value;
+	private String def;
+	private final String longDefinitionName;
+	private final String shortDefinitionName;
+	
+	ActionType(final int v, final String s, final String longDef, final String shortDef) {
+		value = v;
+		def = s;
+		longDefinitionName = longDef;
+		shortDefinitionName = shortDef;
+	}
+
+    public int getValue() {
+        return value;
+    }
+    
+	@Override
+    public String getDefinition() {
+    	return PATH + def;
+    }
+
+	@Override
+	public String getShortName() {
+		return shortDefinitionName;
+	}
+
+	@Override
+	public String getLongName() {
+		return longDefinitionName;
+	}
+
+	public static ActionType fromValue(int v) {
+        for (ActionType c: ActionType.values()) {
+            if (c.value == v) {
+                return c;
+            }
+        }
+        throw new IllegalArgumentException("Undefined value " + v);
+    }
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/AlertColourCode.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/AlertColourCode.java
index 096c63b..6cf9920 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/AlertColourCode.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/AlertColourCode.java
@@ -7,16 +7,25 @@
  *******************************************************************************/
 package org.eclipse.om2m.sdt.home.types;
 
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.om2m.sdt.Identifiers;
+import org.eclipse.om2m.sdt.datapoints.ClonedEnum;
 import org.eclipse.om2m.sdt.datapoints.EnumDataPoint;
 
-public abstract class AlertColourCode extends EnumDataPoint<Integer> {
+public class AlertColourCode extends ClonedEnum {
 	
 	static public final int Red = 1;
 	static public final int Green = 2;
 	
-	public AlertColourCode(String name) {
-		super(name, HomeDataType.AlertColourCode);
-		setValidValues(new Integer[] { Red, Green });
+	static private List<Integer> values = Arrays.asList(
+			Red, Green
+	);
+
+	public AlertColourCode(Identifiers identifiers, EnumDataPoint<Integer> dp) {
+		super(identifiers, HomeDataType.AlertColourCode, dp);
+		setValidValues(values);
 	}
 
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/DatapointType.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/DatapointType.java
new file mode 100644
index 0000000..21424fc
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/DatapointType.java
@@ -0,0 +1,188 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2017 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.home.types;
+
+import org.eclipse.om2m.sdt.Identifiers;
+import org.eclipse.om2m.sdt.types.DataType;
+
+public enum DatapointType implements Identifiers {
+	
+	absoluteEnergyConsumption("absoluteEnergyConsumption", "abECn", DataType.Float),
+	absoluteStartTime("absoluteStartTime", "abSTe", DataType.Time),
+	absoluteStopTime("absoluteStopTime", "abST0", DataType.Time),
+	alarm("alarm", "alarm", DataType.Boolean),
+	alarmStatus("alarmStatus", "alaSs", DataType.Boolean),
+	availableChannels("availableChannels", "avaCs", DataType.Integer),
+	bath("bath", "bath", DataType.Boolean),
+	batteryThreshold("batteryThreshold", "batTd", DataType.Integer),
+	blue("blue", "blue", DataType.Integer),
+	bone("bone", "bone", DataType.Float),
+	brightness("brightness", "brigs",  DataType.Integer),
+	capacity("capacity", "capay",  DataType.Integer),
+	channelId("channelId", "chaId", DataType.Integer),
+	charging("charging", "charg", DataType.Boolean),
+	code("code", "code", DataType.Integer),
+	colourSat("colourSat", "colSn",  DataType.Integer),
+	current("current", "currt", DataType.Float),
+	currentDate("currentDate", "curDe", DataType.Date),
+	currentTemperature("currentTemperature", "curT0", DataType.Float),
+	currentTime("currentTime", "curTe", DataType.Time),
+	defrost("defrost", "defrt", DataType.Boolean),
+	description("description", "descn", DataType.String),
+	desiredHumidity("desiredHumidity", "desHy", DataType.Float),
+	detectedTime("detectedTime", "detTe", DataType.Datetime),
+	diastolicPressure("diastolicPressure", "diaPe", DataType.Integer),
+	directionAuto("directionAuto", "dirAo", DataType.Boolean),
+	directionDown("directionDown", "dirDn", DataType.Boolean),
+	directionLeft("directionLeft", "dirLt", DataType.Boolean),
+	directionRight("directionRight", "dirRt", DataType.Boolean),
+	directionUp("directionUp", "dirUp", DataType.Boolean),
+	discharging("discharging", "discg", DataType.Boolean),
+	doorState("doorState", "dooSt", DataType.Integer),
+	duration("duration", "duran", DataType.Integer),
+	estimatedTimeToEnd("estimatedTimeToEnd", "eTTEd", DataType.Integer),
+	fat("fat", "fat", DataType.Float),
+	filterLifetime("filterLifetime", "filLe", DataType.Integer),
+	frequency("frequency", "freqy", DataType.Float),
+	green("green", "green", DataType.Integer),
+	height("height", "heigt", DataType.Float),
+	inputSourceID("inputSourceID", "inSId", DataType.Integer),
+	kcal("kcal", "kcal", DataType.Float),
+	keyNumber("keyNumber", "keyNr", DataType.Integer),
+	level("level", "level", DataType.Integer),
+	light("light", "light", DataType.Integer),
+	liquidLevel("liquidLevel", "liqLv", DataType.Integer),
+	lowBattery("lowBattery", "lowBy", DataType.Boolean),
+	lqi("lqi", "lqi", DataType.Integer),
+	maxValue("maxValue", "maxVe", DataType.Float),
+	minValue("minValue", "minVe", DataType.Float),
+	multiplyingFactors("multiplyingFactors", "mulFs", DataType.Float),
+	muscle("muscle", "musce", DataType.Float),
+	muteEnabled("muteEnabled", "mutEd", DataType.Boolean),
+	openAlarm("openAlarm", "opeAm", DataType.Boolean),
+	openDuration("openDuration", "opeDn", DataType.Time),
+	operationMode("operationMode", "opeMe", DataType.Integer),
+	oxygenSaturation("oxygenSaturation", "oxySn", DataType.Integer),
+	power("power", "power", DataType.Float),
+	powerGenerationData("powerGenerationData", "poGDa", DataType.Float),
+	powerSaveEnabled("powerSaveEnabled", "poSEd", DataType.Boolean),
+	powerState("powerState", "powSe", DataType.Boolean),
+	previousChannel("previousChannel", "preCl", DataType.Integer),
+	pulseRate("pulseRate", "pulRe", DataType.Integer),
+	pushed("pushed", "pusBn", DataType.Boolean),
+	rapidCool("rapidCool", "rapCl", DataType.Boolean),
+	rapidFreeze("rapidFreeze", "rapFe", DataType.Boolean),
+	red("red", "red", DataType.Integer),
+	referenceTimer("referenceTimer", "refTr", DataType.Integer),
+	relativeHumidity("relativeHumidity", "relHy", DataType.Float),
+	resistance("resistance", "resie", DataType.Float),
+	rinseLevel("rinseLevel", "rinLl", DataType.Integer),
+	roundingEnergyConsumption("roundingEnergyConsumption", "roECn", DataType.Integer),
+	roundingEnergyGeneration("roundingEnergyGeneration", "roEGn", DataType.Integer),
+	rssi("rssi", "rssi", DataType.Float),
+	runningTime("runningTime", "runTe", DataType.Integer),
+	sensitivity("sensitivity", "sensy", DataType.Integer),
+	significantDigits("significantDigits", "sigDs", DataType.Integer),
+	silentTime("silentTime", "silTe", DataType.Integer),
+	status("status", "stats", DataType.Boolean),
+	stepValue("stepValue", "steVe", DataType.Float),
+	strength("strength", "streh", DataType.Integer),
+	supportedInputSources("supportedInputSources", "suISs", DataType.Integer),
+	supportedModes("supportedModes", "supMs", DataType.Integer),
+	systolicPressure("systolicPressure", "sysPe", DataType.Integer),
+	targetDuration("targetDuration", "tarDn", DataType.Integer),
+	targetTemperature("targetTemperature", "tarTe", DataType.Float),
+	targetTimeToStart("targetTimeToStart", "tTTSt", DataType.Integer),
+	targetTimeToStop("targetTimeToStop", "tTTSp", DataType.Integer),
+	temperature("temperature", "tempe", DataType.Float),
+	temperatureThreshhold("temperatureThreshhold", "temTd", DataType.Integer),
+	tone("tone", "tone", DataType.Integer),
+	turboEnabled("turboEnabled", "turEd", DataType.Boolean),
+	unit("unit", "unit", DataType.String),
+	visceraFat("visceraFat", "visFt", DataType.Float),
+	voltage("voltage", "volte", DataType.Float),
+	volumePercentage("volumePercentage", "volPe", DataType.Integer),
+	water("water", "water", DataType.Float),
+	weight("weight", "weigt", DataType.Float),
+
+	atmosphericPressure("atmosphericPressure", "atmPe", DataType.Float),
+	carbonDioxideValue("carbonDioxideValue", "cDeVe", DataType.Float),
+	coarseness("coarseness", "coass", DataType.Integer),
+	cupsNumber("cupsNumber", "cupsN", DataType.Integer),
+	currentJobState("currentJobState", "curJS", DataType.String),
+	currentMachineState("currentMachineState", "curMS", DataType.String),
+	detectedPersons("detectedPersons", "detPs", DataType.String),
+	doorLock("doorLock", "dooLk", DataType.Boolean),
+	foamingStrength("foamingStrength", "foaSt", DataType.Integer),
+	format("format", "frmt", DataType.String),
+	jobStates("jobStates", "jobSt", DataType.String),
+	login("login", "login", DataType.String),
+	machineStates("machineStates", "mchSt", DataType.String),
+	noise("noise", "noise", DataType.Integer),
+	password("password", "psWd", DataType.String),
+	progressPercentage("progressPercentage", "prgPc", DataType.Integer),
+	url("url", "url", DataType.String),
+	useGrinder("useGrinder", "useGr", DataType.Boolean),
+
+	undefinedVendorExt("undefinedVendorExt", "undef", DataType.String);
+	
+	private final String longDefinitionName;
+	private final String shortDefinitionName;
+	private final DataType dataType;
+	
+	DatapointType(String longDef, String shortDef, DataType pDataType) {
+		longDefinitionName = longDef;
+		shortDefinitionName = shortDef;
+		dataType = pDataType;
+		
+	}
+
+    /**
+	 * @return the longDefinitionName
+	 */
+	@Override
+	public String getLongName() {
+		return longDefinitionName;
+	}
+
+	/**
+	 * @return the shortDefinitionName
+	 */
+	@Override
+	public String getShortName() {
+		return shortDefinitionName;
+	}
+
+	@Override
+	public String getDefinition() {
+		return null;
+	}
+	
+	public DataType getDataType() {
+		return dataType;
+	}
+
+    public static DatapointType fromLongName(String def) {
+        for (DatapointType c: DatapointType.values()) {
+            if (c.longDefinitionName.equals(def)) {
+                return c;
+            }
+        }
+		return null;
+    }
+
+    public static DatapointType fromShortName(String def) {
+        for (DatapointType c: DatapointType.values()) {
+            if (c.shortDefinitionName.equals(def)) {
+                return c;
+            }
+        }
+		return null;
+    }
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/DeviceType.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/DeviceType.java
index 00a5b50..b3a1bbc 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/DeviceType.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/DeviceType.java
@@ -7,50 +7,57 @@
  *******************************************************************************/
 package org.eclipse.om2m.sdt.home.types;
 
-public enum DeviceType {
+import org.eclipse.om2m.sdt.Identifiers;
+
+public enum DeviceType implements Identifiers {
 	
-	deviceAirConditioner(1, "deviceAirConditioner"),
-	deviceClothesWasher(2, "deviceClothesWasher"),
-	deviceElectricVehicleCharger(3, "deviceElectricVehicleCharger"),
-	deviceLight(4, "deviceLight"),
-	deviceMicrogeneration (5, "deviceMicrogeneration"),
-	deviceOven(6, "deviceOven"),
-	deviceRefrigerator(7, "deviceRefrigerator"),
-	deviceRobotCleaner(8, "deviceRobotCleaner"),
-	deviceSmartElectricMeter(9, "deviceSmartElectricMeter"),
-	deviceStorageBattery(10, "deviceStorageBattery"),
-	deviceTelevision(11, "deviceTelevision"),
-	deviceThermostat(12, "deviceThermostat"),
-	deviceWaterHeater(13, "deviceWaterHeater"),
-	deviceCoffeeMachine(14, "deviceCoffeeMachine"), 
+	deviceAirConditioner(1, "deviceAirConditioner", "deviceAirConditioner", "deACr"),
+	deviceClothesWasher(2, "deviceClothesWasher", "deviceClothesWasher", "deCWr"),
+	deviceElectricVehicleCharger(3, "deviceElectricVehicleCharger", "deviceElectricVehicleCharger", "dEVCr"),
+	deviceLight(4, "deviceLight", "deviceLight", "devLt"),
+	deviceMicrogeneration (5, "deviceMicrogeneration", "deviceMicrogeneration", "devMn"),
+	deviceOven(6, "deviceOven", "deviceOven", "devOn"),
+	deviceRefrigerator(7, "deviceRefrigerator", "deviceRefrigerator", "devRr"),
+	deviceRobotCleaner(8, "deviceRobotCleaner", "deviceRobotCleaner", "devRCr"),
+	deviceSmartElectricMeter(9, "deviceSmartElectricMeter", "deviceSmartElectricMeter", "dSEMr"),
+	deviceStorageBattery(10, "deviceStorageBattery", "deviceStorageBattery", "deSBy"),
+	deviceTelevision(11, "deviceTelevision", "deviceTelevision", "devTn"),
+	deviceThermostat(12, "deviceThermostat", "deviceThermostat", "devTt"),
+	deviceWaterHeater(13, "deviceWaterHeater", "deviceWaterHeater", "devWHr"),
+	deviceCoffeeMachine(14, "deviceCoffeeMachine", "deviceCoffeeMachine", "dCeMe"), 
+	deviceKettle(15, "deviceKettle", "deviceKettle", "dKtle"),
 	
-	deviceDoor(100, "deviceDoor"),
-	deviceSmokeExtractor(101, "deviceSmokeExtractor"),
-	deviceSwitchButton(102, "deviceSwitchButton"),
-	deviceWarningDevice(103, "deviceWarningDevice"),
+	deviceDoor(100, "deviceDoor", "deviceDoor", "devDr"),
+	deviceSmokeExtractor(101, "deviceSmokeExtractor", "deviceSmokeExtractor", "dSeEr"),
+	deviceSwitchButton(102, "deviceSwitchButton", "deviceSwitchButton", "dShBn"),
+	deviceWarningDevice(103, "deviceWarningDevice", "deviceWarningDevice", "deWDe"),
 	
-	deviceGasValve(200, "deviceGasValve"),
-	deviceWaterValve(201, "deviceWaterValve"),
+	deviceGasValve(200, "deviceGasValve", "deviceGasValve", "dGsVe"),
+	deviceWaterValve(201, "deviceWaterValve", "deviceWaterValve", "deWVe"),
 	
-	deviceFloodDetector(300, "deviceFloodDetector"),
-	deviceMotionDetector(301, "deviceMotionDetector"),
-	deviceSmokeDetector(302, "deviceSmokeDetector"),
-	deviceTemperatureDetector(303, "deviceTemperatureDetector"),
-	deviceContactDetector(304, "deviceContactDetector"),
+	deviceFloodDetector(300, "deviceFloodDetector", "deviceFloodDetector", "deFDr"),
+	deviceMotionDetector(301, "deviceMotionDetector", "deviceMotionDetector", "deMDr"),
+	deviceSmokeDetector(302, "deviceSmokeDetector", "deviceSmokeDetector", "deSDr"),
+	deviceTemperatureDetector(303, "deviceTemperatureDetector", "deviceTemperatureDetector", "deTDr"),
+	deviceContactDetector(304, "deviceContactDetector", "deviceContactDetector", "deCDr"),
 	
-	deviceCamera(400, "deviceCamera"),
-	deviceWeatherStation(500, "deviceWeatherStation"),
+	deviceCamera(400, "deviceCamera", "deviceCamera", "devCa"),
+	deviceWeatherStation(500, "deviceWeatherStation", "deviceWeatherStation", "deWSn"),
 	
-	undefinedVendorExt(0, "undefinedVendorExt");
+	undefinedVendorExt(0, "undefinedVendorExt", "", "");
 	
 	static public final String PATH = "org.onem2m.home.device.";
 	
 	private int value;
-	private String def;
+	private final String def;
+	private final String longDefinitionName;
+	private final String shortDefinitionName;
 	
-	DeviceType(int v, String s) {
+	DeviceType(int v, String s, String longDef, String shortDef) {
 		value = v;
 		def = s;
+		longDefinitionName = longDef;
+		shortDefinitionName = shortDef;
 	}
 
     public int getValue() {
@@ -60,8 +67,26 @@
     public String getDefinition() {
     	return PATH + def;
     }
+    
+    
 
-    public static DeviceType fromValue(int v) {
+    /**
+	 * @return the longDefinitionName
+	 */
+	@Override
+	public String getLongName() {
+		return longDefinitionName;
+	}
+
+	/**
+	 * @return the shortDefinitionName
+	 */
+	@Override
+	public String getShortName() {
+		return shortDefinitionName;
+	}
+
+	public static DeviceType fromValue(int v) {
         for (DeviceType c: DeviceType.values()) {
             if (c.value == v) {
                 return c;
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/DoorState.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/DoorState.java
index 71db123..c1a4274 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/DoorState.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/DoorState.java
@@ -7,9 +7,14 @@
  *******************************************************************************/
 package org.eclipse.om2m.sdt.home.types;
 
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.om2m.sdt.Identifiers;
+import org.eclipse.om2m.sdt.datapoints.ClonedEnum;
 import org.eclipse.om2m.sdt.datapoints.EnumDataPoint;
 
-public abstract class DoorState extends EnumDataPoint<Integer> {
+public class DoorState extends ClonedEnum {
 	
 	static public final int Closed = 1;
 	static public final int Open = 2;
@@ -17,9 +22,17 @@
 	static public final int Closing = 4;
 	static public final int Stopped = 5;
 	
-	public DoorState(String name) {
-		super(name, HomeDataType.DoorState);
-		setValidValues(new Integer[] { Closed, Open, Opening, Closing, Stopped });
+	static private List<Integer> values = Arrays.asList(
+			Closed, Open, Opening, Closing, Stopped
+	);
+
+	public DoorState(EnumDataPoint<Integer> dp) {
+		this(DatapointType.doorState, dp);
+	}
+	
+	public DoorState(Identifiers name, EnumDataPoint<Integer> dp) {
+		super(name, HomeDataType.DoorState, dp);
+		setValidValues(values);
 	}
 
 }
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/FoamStrength.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/FoamStrength.java
index 2166390..fd507f9 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/FoamStrength.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/FoamStrength.java
@@ -1,15 +1,29 @@
 package org.eclipse.om2m.sdt.home.types;

 

+import java.util.Arrays;

+import java.util.List;

+

+import org.eclipse.om2m.sdt.Identifiers;

+import org.eclipse.om2m.sdt.datapoints.ClonedEnum;

 import org.eclipse.om2m.sdt.datapoints.EnumDataPoint;

 

-public abstract class FoamStrength extends EnumDataPoint<Integer> {

+public class FoamStrength extends ClonedEnum {

 

 	static public final int zero = 1;

 	static public final int medium = 2;

 	static public final int maximum = 3;

 	

-	public FoamStrength(String name) {

-		super(name, HomeDataType.FoamStrength);

-		setValidValues(new Integer[] { zero, medium, maximum });	

+	static private List<Integer> values = Arrays.asList(

+			zero, medium, maximum

+	);

+

+	public FoamStrength(EnumDataPoint<Integer> dp) {

+		this(DatapointType.foamingStrength, dp);

 	}

+	

+	public FoamStrength(Identifiers name, EnumDataPoint<Integer> dp) {

+		super(name, HomeDataType.FoamStrength, dp);

+		setValidValues(values);	

+	}

+	

 }

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/HomeBasicType.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/HomeBasicType.java
index 991ac39..ec84767 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/HomeBasicType.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/HomeBasicType.java
@@ -4,14 +4,25 @@
 
 public class HomeBasicType extends BasicType {
 
-	static public final HomeBasicType ALERTCOLOURCODE = new HomeBasicType("alertColourCode", Integer.class);
+	static public final HomeBasicType DEVICETYPE = new HomeBasicType("deviceType", Integer.class);
+	static public final HomeBasicType SUPPORTEDINPUTSOURCES = new HomeBasicType("supportedInputSources", Integer.class);
+	static public final HomeBasicType LIQUIDLEVEL = new HomeBasicType("liquidLevel", Integer.class);
+	static public final HomeBasicType SPINLEVELSTRENGTH = new HomeBasicType("spinLevelStrength", Integer.class);
 	static public final HomeBasicType DOORSTATE = new HomeBasicType("doorState", Integer.class);
-	static public final HomeBasicType LEVEL = new HomeBasicType("level", Integer.class);
-	static public final HomeBasicType LOCKSTATE = new HomeBasicType("lockState", Integer.class);
-	static public final HomeBasicType SUPPORTEDMODE = new HomeBasicType("supportedMode", Integer.class);
 	static public final HomeBasicType TONE = new HomeBasicType("tone", Integer.class);
-	static public final HomeBasicType FOAMSTRENGTH =  new HomeBasicType("foamStrength", Integer.class);
-	static public final HomeBasicType TASTESTRENGTH =  new HomeBasicType("tasteStrength", Integer.class);
+	static public final HomeBasicType JOBSTATES = new HomeBasicType("jobStates", Integer.class);
+	static public final HomeBasicType ALERTCOLOURCODE = new HomeBasicType("alertColourCode", Integer.class);
+	static public final HomeBasicType WATERFLOWSTRENGTH = new HomeBasicType("waterFlowStrength", Integer.class);
+	static public final HomeBasicType WINDSTRENGTH = new HomeBasicType("windStrength", Integer.class);
+	static public final HomeBasicType GRAINSLEVEL = new HomeBasicType("grainsLevel", Integer.class);
+	static public final HomeBasicType FOAMSTRENGTH = new HomeBasicType("foamStrength", Integer.class);
+	static public final HomeBasicType TASTESTRENGTH = new HomeBasicType("tasteStrength", Integer.class);
+	static public final HomeBasicType GRINDCOARSENESS = new HomeBasicType("grindCoarseness", Integer.class);
+	static public final HomeBasicType MACHINESTATE = new HomeBasicType("machineState", Integer.class);
+	static public final HomeBasicType WASHINGCOURSE = new HomeBasicType("washingCourse", Integer.class);
+	static public final HomeBasicType GENERALTEMPERATURE = new HomeBasicType("generalTemperature", Integer.class);
+	static public final HomeBasicType GENERALLEVEL = new HomeBasicType("generalLevel", Integer.class);
+	static public final HomeBasicType GENERALSPEED = new HomeBasicType("generalSpeed", Integer.class);
 
     protected HomeBasicType(String v, Class<?> c) {
     	super(v, c);
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/HomeDataType.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/HomeDataType.java
index 12b2d9e..eff0098 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/HomeDataType.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/HomeDataType.java
@@ -4,14 +4,25 @@
 
 public class HomeDataType extends DataType {
 
-	static public final HomeDataType AlertColourCode = new HomeDataType("alertColourCode", HomeSimpleType.AlertColourCode);
+	static public final HomeDataType DeviceType = new HomeDataType("deviceType", HomeSimpleType.DeviceType);
+	static public final HomeDataType SupportedInputSources = new HomeDataType("supportedInputSources", HomeSimpleType.SupportedInputSources);
+	static public final HomeDataType LiquidLevel = new HomeDataType("liquidLevel", HomeSimpleType.LiquidLevel);
+	static public final HomeDataType SpinLevelStrength = new HomeDataType("spinLevelStrength", HomeSimpleType.SpinLevelStrength);
 	static public final HomeDataType DoorState = new HomeDataType("doorState", HomeSimpleType.DoorState);
-	static public final HomeDataType Level = new HomeDataType("level", HomeSimpleType.Level);
-	static public final HomeDataType LockState = new HomeDataType("lockState", HomeSimpleType.LockState);
-	static public final HomeDataType SupportedMode = new HomeDataType("supportedMode", HomeSimpleType.SupportedMode);
 	static public final HomeDataType Tone = new HomeDataType("tone", HomeSimpleType.Tone);
+	static public final HomeDataType JobStates = new HomeDataType("jobStates", HomeSimpleType.JobStates);
+	static public final HomeDataType AlertColourCode = new HomeDataType("alertColourCode", HomeSimpleType.AlertColourCode);
+	static public final HomeDataType WaterFlowStrength = new HomeDataType("waterFlowStrength", HomeSimpleType.WaterFlowStrength);
+	static public final HomeDataType WindStrength = new HomeDataType("windStrength", HomeSimpleType.WindStrength);
+	static public final HomeDataType GrainsLevel = new HomeDataType("grainsLevel", HomeSimpleType.GrainsLevel);
 	static public final HomeDataType FoamStrength = new HomeDataType("foamStrength", HomeSimpleType.FoamStrength);
 	static public final HomeDataType TasteStrength = new HomeDataType("tasteStrength", HomeSimpleType.TasteStrength);
+	static public final HomeDataType GrindCoarseness = new HomeDataType("grindCoarseness", HomeSimpleType.GrindCoarseness);
+	static public final HomeDataType MachineState = new HomeDataType("machineState", HomeSimpleType.MachineState);
+	static public final HomeDataType WashingCourse = new HomeDataType("washingCourse", HomeSimpleType.WashingCourse);
+	static public final HomeDataType GeneralTemperature = new HomeDataType("generalTemperature", HomeSimpleType.GeneralTemperature);
+	static public final HomeDataType GeneralLevel = new HomeDataType("generalLevel", HomeSimpleType.GeneralLevel);
+	static public final HomeDataType GeneralSpeed = new HomeDataType("generalSpeed", HomeSimpleType.GeneralSpeed);
 
 	public HomeDataType(final String name, final TypeChoice type) {
 		super(name, type);
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/HomeSimpleType.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/HomeSimpleType.java
index 5c76cd9..dd0d141 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/HomeSimpleType.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/HomeSimpleType.java
@@ -6,13 +6,24 @@
 public class HomeSimpleType extends SimpleType {
 
 	static public final HomeSimpleType AlertColourCode = new HomeSimpleType(HomeBasicType.ALERTCOLOURCODE);
+	static public final HomeSimpleType DeviceType = new HomeSimpleType(HomeBasicType.DEVICETYPE);
+	static public final HomeSimpleType SupportedInputSources = new HomeSimpleType(HomeBasicType.SUPPORTEDINPUTSOURCES);
+	static public final HomeSimpleType LiquidLevel = new HomeSimpleType(HomeBasicType.LIQUIDLEVEL);
+	static public final HomeSimpleType SpinLevelStrength = new HomeSimpleType(HomeBasicType.SPINLEVELSTRENGTH);
 	static public final HomeSimpleType DoorState = new HomeSimpleType(HomeBasicType.DOORSTATE);
-	static public final HomeSimpleType Level = new HomeSimpleType(HomeBasicType.LEVEL);
-	static public final HomeSimpleType LockState = new HomeSimpleType(HomeBasicType.LOCKSTATE);
-	static public final HomeSimpleType SupportedMode = new HomeSimpleType(HomeBasicType.SUPPORTEDMODE);
 	static public final HomeSimpleType Tone = new HomeSimpleType(HomeBasicType.TONE);
+	static public final HomeSimpleType JobStates = new HomeSimpleType(HomeBasicType.JOBSTATES);
+	static public final HomeSimpleType WaterFlowStrength = new HomeSimpleType(HomeBasicType.WATERFLOWSTRENGTH);
+	static public final HomeSimpleType WindStrength = new HomeSimpleType(HomeBasicType.WINDSTRENGTH);
+	static public final HomeSimpleType GrainsLevel = new HomeSimpleType(HomeBasicType.GRAINSLEVEL);
 	static public final HomeSimpleType FoamStrength = new HomeSimpleType(HomeBasicType.FOAMSTRENGTH);
 	static public final HomeSimpleType TasteStrength = new HomeSimpleType(HomeBasicType.TASTESTRENGTH);
+	static public final HomeSimpleType GrindCoarseness = new HomeSimpleType(HomeBasicType.GRINDCOARSENESS);
+	static public final HomeSimpleType MachineState = new HomeSimpleType(HomeBasicType.MACHINESTATE);
+	static public final HomeSimpleType WashingCourse = new HomeSimpleType(HomeBasicType.WASHINGCOURSE);
+	static public final HomeSimpleType GeneralTemperature = new HomeSimpleType(HomeBasicType.GENERALTEMPERATURE);
+	static public final HomeSimpleType GeneralLevel = new HomeSimpleType(HomeBasicType.GENERALLEVEL);
+	static public final HomeSimpleType GeneralSpeed = new HomeSimpleType(HomeBasicType.GENERALSPEED);
 	
 	protected HomeSimpleType(final BasicType type) {
 		super(type);
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/JobStates.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/JobStates.java
new file mode 100644
index 0000000..3181f81
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/JobStates.java
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.home.types;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.om2m.sdt.Identifiers;
+import org.eclipse.om2m.sdt.datapoints.ClonedEnum;
+import org.eclipse.om2m.sdt.datapoints.EnumDataPoint;
+
+public class JobStates extends ClonedEnum {
+	
+//	0~99		Reserved for future use
+//	100~199		Reserved for deviceAirConditioner
+//	200	idle	This value is for deviceClothesWasher and indicates idle state.
+//	201	preWash	This value is for deviceClothesWasher and indicates pre-washing state. pre-wash is a cold water cycle that runs prior to the main wash cycle. It is used for heavily soiled laundy.
+//	202	wash	This value is for deviceClothesWasher and indicates washing state.
+//	203	rinse	This value is for deviceClothesWasher and indicates rinsing state.
+//	204	spin	This value is for deviceClothesWasher and indicates spinning state.
+//	205	dry		This value is for deviceClothesWasher and indicates drying state.
+//	206	airDry	This value is for deviceClothesWasher and indicates air-drying state. In airDry state, a rotating wheel circulates air to get fresh air used to dry laundry.  
+//	207	wrinkleProof	This value is for deviceClothesWasher and indicates wrinkleProof state.
+//	208	soak	This value is for deviceClothesWasher and indicates soak state.
+//	209~299		Reserved for deviceClothesWasher
+//	300~399		Reserved for deviceElectricVehicleCharger
+//	400~499		Reserved for deviceLight
+//	500~599		Reserved for deviceMicrogeneration
+//	600	warmingUp 	This value is for deviceOven and indicates warmingUp state.
+//	601	cooking 	This value is for deviceOven and indicates cooking state.
+//	602	cooling	This value is for deviceOven and indicates cooling state.
+//	603~699		Reserved for deviceOven
+//	700~799		Reserved for deviceRefrigerator
+//	800	charging	This value is for deviceRobotCleaner and indicates charging state.
+//	801	homing	This value is for deviceRobotCleaner and indicates homing state.
+//	802	docking	This value is for deviceRobotCleaner and indicates docking state.
+//	803~899		Reserved for deviceRobotCleaner
+//	900~999		Reserved for deviceSmartElectricMeter
+//	1000~1099		Reserved for deviceStorageBattery
+//	1100~1199		Reserved for deviceTelevision
+//	1200	antifreeze	This mode sets the thermostat to a minimum temperature to avoid home system to freeze when the habitants are not there for a long time
+//	1201	manual	This mode allows for direct change of the temperature indication for the thermostat by the user.
+//	1202	eco	This is to set the thermostat to the economic mode
+//	1203	program	The program mode is used to set the thermostat to a predefined mode
+//	1204~1299		Reserved for deviceThermostat
+//	1300~1399		Reserved for deviceWaterHeater
+//	1400~1499		Reserved for deviceCoffeeMachine
+
+	static public final int idle 			= 200;
+	static public final int preWash			= 201;
+	static public final int wash 			= 202;
+	static public final int rinse	 		= 203;
+	static public final int spin 			= 204;
+	static public final int dry 			= 205;
+	static public final int airDry	 		= 206;
+	static public final int wrinkleProof	= 207;
+	static public final int soak	 		= 208;
+	
+	static public final int noeffect		= 400;
+	static public final int colorloop		= 401;
+	static public final int noalert	 		= 402;
+	static public final int lselect	 		= 403;
+	static public final int select	 		= 404;
+
+	static public final int warmingUp 		= 600;
+	static public final int cooking 		= 601;
+	static public final int cooling 		= 602;
+	
+	static public final int charging 		= 800;
+	static public final int homing 			= 801;
+	static public final int docking 		= 802;
+	
+	static public final int antifreeze 		= 1200;
+	static public final int manual	 		= 1201;
+	static public final int eco		 		= 1202;
+	static public final int program		 	= 1203;
+	
+	static private List<Integer> values = Arrays.asList(
+			idle, preWash, wash, rinse, spin, dry, airDry, wrinkleProof, soak,
+			noeffect, colorloop, noalert, lselect, select,
+			warmingUp, cooking, cooling, 
+			charging, homing, docking,
+			antifreeze, manual, eco, program
+	);
+	
+	public JobStates(EnumDataPoint<Integer> dp) {
+		this(DatapointType.currentJobState, dp);
+	}
+	
+	public JobStates(Identifiers name, EnumDataPoint<Integer> dp) {
+		super(name, HomeDataType.JobStates, dp);
+		setValidValues(values);
+	}
+	
+	static public List<Integer> getValues() {
+		return values;
+	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/LevelType.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/LevelType.java
deleted file mode 100644
index de4eb44..0000000
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/LevelType.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2016 Orange.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.om2m.sdt.home.types;
-
-import org.eclipse.om2m.sdt.datapoints.EnumDataPoint;
-
-public abstract class LevelType extends EnumDataPoint<Integer> {
-	
-	static public final int zero = 1;
-	static public final int low = 2;
-	static public final int medium = 3;
-	static public final int high = 4;
-	static public final int maximum = 5;
-	
-	public LevelType(String name) {
-		super(name, HomeDataType.Level);
-		setValidValues(new Integer[] { zero, low, medium, high, maximum });
-	}
-
-}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/LiquidLevel.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/LiquidLevel.java
new file mode 100644
index 0000000..9f44816
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/LiquidLevel.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.home.types;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.om2m.sdt.Identifiers;
+import org.eclipse.om2m.sdt.datapoints.ClonedEnum;
+import org.eclipse.om2m.sdt.datapoints.EnumDataPoint;
+
+public class LiquidLevel extends ClonedEnum {
+	
+	static public final int zero = 1;
+	static public final int low = 2;
+	static public final int medium = 3;
+	static public final int high = 4;
+	static public final int maximum = 5;
+	
+	static private List<Integer> values = Arrays.asList(
+			zero, low, medium, high, maximum
+	);
+
+	public LiquidLevel(EnumDataPoint<Integer> dp) {
+		this(DatapointType.liquidLevel, dp);
+	}
+	
+	public LiquidLevel(Identifiers names, EnumDataPoint<Integer> dp) {
+		super(names, HomeDataType.LiquidLevel, dp);
+		setValidValues(values);
+	}
+	
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/LockState.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/LockState.java
deleted file mode 100644
index b1cb818..0000000
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/LockState.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2016 Orange.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.om2m.sdt.home.types;
-
-import org.eclipse.om2m.sdt.datapoints.EnumDataPoint;
-
-public abstract class LockState extends EnumDataPoint<Integer> {
-	
-	static public final int Locked  = 1;
-	static public final int Unlocked = 2;
-	static public final int NotfullyLocked = 3;
-	static public final int Unknown = 4;
-	
-	public LockState(String name) {
-		super(name, HomeDataType.LockState);
-		setValidValues(new Integer[] { Locked, Unlocked, NotfullyLocked, Unknown });
-	}
-
-}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/MachineState.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/MachineState.java
new file mode 100644
index 0000000..1a6e35b
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/MachineState.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2016 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.home.types;
+
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.om2m.sdt.Identifiers;
+import org.eclipse.om2m.sdt.datapoints.ClonedEnum;
+import org.eclipse.om2m.sdt.datapoints.EnumDataPoint;
+
+public class MachineState extends ClonedEnum {
+	
+//	1	idle	Machine is ready to operate
+//	2	active	Machine is operating its functions
+//	3	reserved	Reservation is made by user
+//	4	paused	Operation is paused by user
+//	5	cancelled	Operation is cancelled by user
+//	6	stopped	Operation is stopped/aborted by some other reasons
+//	7	complete	Operation is complete
+//	8	error	Error has occurred 
+//	9	diagnostic	Machine reports diagnostic information to the server
+//	10	test	Particular functions run for test
+
+	static public final int idle 		= 1;
+	static public final int active		= 2;
+	static public final int reserved 	= 3;
+	static public final int paused	 	= 4;
+	static public final int cancelled 	= 5;
+	static public final int stopped 	= 6;
+	static public final int complete	= 7;
+	static public final int error		= 8;
+	static public final int diagnostic	= 9;
+	static public final int test 		= 10;
+	
+	static private List<Integer> values = Arrays.asList(
+			idle, active, reserved, paused, cancelled, 
+			stopped, complete, error, diagnostic, test
+	);
+
+	public MachineState(EnumDataPoint<Integer> dp) {
+		this(DatapointType.currentMachineState, dp);
+	}
+
+	public MachineState(Identifiers name, EnumDataPoint<Integer> dp) {
+		super(name, HomeDataType.MachineState, dp);
+		setValidValues(values);
+	}
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/ModuleType.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/ModuleType.java
index 6ff9fb9..d895253 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/ModuleType.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/ModuleType.java
@@ -7,87 +7,94 @@
  *******************************************************************************/
 package org.eclipse.om2m.sdt.home.types;
 
-public enum ModuleType {
+import org.eclipse.om2m.sdt.Identifiers;
+
+public enum ModuleType implements Identifiers {
 	
-	alarmSpeaker(1, "alarmSpeaker"),
-	audioVideoInput(2, "audioVideoInput"),
-	audioVolume(3, "audioVolume"),
-	battery(4, "battery"),
-	binarySwitch(5, "binarySwitch"),
-	bioElectricalImpedanceAnalysis(6, "bioElectricalImpedanceAnalysis"),
-	boiler(7, "boiler"),
-	brightness(8, "brightness"),
-	clock(9, "clock"),
-	colour(10, "colour"),
-	colourSaturation(11, "colourSaturation"),
-	doorStatus(12, "doorStatus"),
-	electricVehicleConnector(13, "electricVehicleConnector"),
-	energyConsumption(14, "energyConsumption"),
-	energyGeneration(15, "energyGeneration"),
-	faultDetection(16, "faultDetection"),
-	height(17, "height"),
-	hotWaterSupply(18, "hotWaterSupply"),
-	keypad(19, "keypad"),
-	motionSensor(20, "motionSensor"),
-	oximeter(21, "oximeter"),
-	powerSave(22, "powerSave"),
-	pushButton(23, "pushButton"),
-	recorder(24, "recorder"),
-	refrigeration(25, "refrigeration"),
-	relativeHumidity(26, "relativeHumidity"),
+	alarmSpeaker(1, "alarmSpeaker", "alarmSpeaker", "alaSr"),
+	audioVideoInput(2, "audioVideoInput", "audioVideoInput","auVIt"),
+	audioVolume(3, "audioVolume", "audioVolume", "audVe"),
+	battery(4, "battery", "battery", "batty"),
+	binarySwitch(5, "binarySwitch", "binarySwitch", "binSh"),
+	bioElectricalImpedanceAnalysis(6, "bioElectricalImpedanceAnalysis", "bioElectricalImpedanceAnalysis", "bEIAs"),
+	boiler(7, "boiler", "boiler", "boilr"),
+	brightness(8, "brightness", "brightness", "brigs"),
+	clock(9, "clock", "clock", "clock"),
+	colour(10, "colour", "colour", "color"),
+	colourSaturation(11, "colourSaturation", "colourSaturation", "colSn"),
+	doorStatus(12, "doorStatus", "doorStatus", "dooSs"),
+	electricVehicleConnector(13, "electricVehicleConnector", "electricVehicleConnector", "elVCr"),
+	energyConsumption(14, "energyConsumption", "energyConsumption", "eneCn"),
+	energyGeneration(15, "energyGeneration", "energyGeneration", "eneGn"),
+	faultDetection(16, "faultDetection", "faultDetection", "fauDn"),
+	height(17, "height", "height", "heigt"),
+	hotWaterSupply(18, "hotWaterSupply", "hotWaterSupply", "hoWSy"),
+	keypad(19, "keypad", "keypad", "keypd"),
+	motionSensor(20, "motionSensor", "motionSensor", "motSr"),
+	oximeter(21, "oximeter", "oximeter", "oximr"),
+	powerSave(22, "powerSave", "powerSave", "powS0"),
+	pushButton(23, "pushButton", "pushButton", "pusBn"),
+	recorder(24, "recorder", "recorder", "recor"),
+	refrigeration(25, "refrigeration", "refrigeration", "refrn"),
+	relativeHumidity(26, "relativeHumidity", "relativeHumidity", "relHy"),
 	//rinseLevel(27, "rinseLevel"),
-	runMode(28, "runMode"),
-	signalStrength(29, "signalStrength"),
-	smokeSensor(30, "smokeSensor"),
-	spinLevel(31, "spinLevel"),
-	televisionChannel(32, "televisionChannel"),
-	temperature(33, "temperature"),
-	temperatureAlarm(34, "temperatureAlarm"),
-	timer(35, "timer"),
-	turbo(36, "turbo"),
-	waterFlow(37, "waterFlow"),
-	//waterLevel(38, "waterLevel"), //COMMENTED by Maciek
-	level(38, "level"), // ADDED by Maciek
-	waterSensor(39, "waterSensor"),
-	weight(40, "weight"),
-	wind(41, "wind"),
+	runState(27, "runState", "runState", "runSt"),
+	runMode(28, "runMode", "runMode", "runMe"),
+	signalStrength(29, "signalStrength", "signalStrength", "sigSh"),
+	smokeSensor(30, "smokeSensor", "smokeSensor", "smoSr"),
+	spinLevel(31, "spinLevel", "spinLevel", "spiLl"),
+	televisionChannel(32, "televisionChannel", "televisionChannel", "telCl"),
+	temperature(33, "temperature", "temperature", "tempe"),
+	temperatureAlarm(34, "temperatureAlarm", "temperatureAlarm", "temAm"),
+	timer(35, "timer", "timer", "timer"),
+	turbo(36, "turbo", "turbo", "turbo"),
+	waterFlow(37, "waterFlow", "waterFlow", "watFw"),
+	liquidLevel(38, "liquidLevel", "liquidLevel", "liqLl"),
+	waterSensor(39, "waterSensor", "waterSensor", "watSr"),
+	weight(40, "weight", "weight", "weigt"),
+	wind(41, "wind", "wind", "wind"),
 	
 	/****ADDED by Maciek****/
 	
-	grinder(42, "grinder"),
-	foaming(43, "foaming"),
-	brewing(44, "brewing"),
-	
+	grinder(42, "grinder", "grinder", "gridr"),
+	foaming(43, "foaming", "foaming", "fomng"),
+	brewing(44, "brewing", "brewing", "brwng"),
+	boiling(45, "boiling", "boiling", "bling"),
+	keepWarm(46, "keepwarm", "keepwarm", "kWarm"),
 	
 	/***********************/
 
-	atmosphericPressureSensor(100, "atmosphericPressureSensor"),
-	carbonDioxideSensor(101, "carbonDioxideSensor"),
-	carbonMonoxideSensor(102, "carbonMonoxideSensor"),
-	contactSensor(103, "contactSensor"),
-	dimming(104, "dimming"),
-	energyOverloadCircuitBreaker(105, "energyOverloadCircuitBreaker"),
-	genericSensor(106, "genericSensor"),
-	glassBreakSensor(107, "glassBreakSensor"),
-	presenceSensor(108, "presenceSensor"),
-	touchSensor(109, "touchSensor"),
-	lock(110, "lock"),
+	atmosphericPressureSensor(100, "atmosphericPressureSensor", "atmosphericPressureSensor", "atPSr"),
+	carbonDioxideSensor(101, "carbonDioxideSensor", "carbonDioxideSensor", "cbDSr"),
+	carbonMonoxideSensor(102, "carbonMonoxideSensor", "carbonMonoxideSensor", "cbMSr"),
+	contactSensor(103, "contactSensor", "contactSensor", "conSr"),
+	dimming(104, "dimming", "dimming", "dimng"),
+	energyOverloadCircuitBreaker(105, "energyOverloadCircuitBreaker", "energyOverloadCircuitBreaker", "eOCBr"),
+	genericSensor(106, "genericSensor", "genericSensor", "genSr"),
+	glassBreakSensor(107, "glassBreakSensor", "glassBreakSensor", "gBkSr"),
+	presenceSensor(108, "presenceSensor", "presenceSensor", "preSr"),
+	touchSensor(109, "touchSensor", "touchSensor", "touSr"),
+	lock(110, "lock", "lock", "lock"),
 
-	personSensor(150, "personSensor"),
-	streaming(151, "streaming"),
-	noise(152, "noise"),
-	extendedCarbonDioxideSensor(153, "extendedCarbonDioxideSensor"),
+	personSensor(150, "personSensor", "personSensor", "perSr"),
+	streaming(151, "streaming", "streaming", "streg"),
+	noise(152, "noise", "noise", "noise"),
+	extendedCarbonDioxideSensor(153, "extendedCarbonDioxideSensor", "extendedCarbonDioxideSensor", "eCDSr"),
 	
-	abstractAlarmSensor(200, "abstractAlarmSensor");
+	abstractAlarmSensor(200, "abstractAlarmSensor", "abstractAlarmSensor", "aAlSr");
 	
 	static private final String PATH = "org.onem2m.home.moduleclass.";
 	
 	private int value;
-	private String def;
+	private final String def;
+	private final String longDefinitionName;
+	private final String shortDefinitionName;
 	
-	ModuleType(int v, String s) {
+	ModuleType(final int v, final String s, final String longDef, final String shortDef) {
 		value = v;
 		def = s;
+		longDefinitionName = longDef;
+		shortDefinitionName = shortDef;
 	}
 
     public int getValue() {
@@ -98,7 +105,23 @@
     	return PATH + def;
     }
 
-    public static ModuleType fromValue(int v) {
+    /**
+	 * @return the longDefinitionName
+	 */
+	@Override
+	public String getLongName() {
+		return longDefinitionName;
+	}
+
+	/**
+	 * @return the shortDefinitionName
+	 */
+	@Override
+	public String getShortName() {
+		return shortDefinitionName;
+	}
+
+	public static ModuleType fromValue(int v) {
         for (ModuleType c: ModuleType.values()) {
             if (c.value == v) {
                 return c;
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/PropertyType.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/PropertyType.java
new file mode 100644
index 0000000..1506d03
--- /dev/null
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/PropertyType.java
@@ -0,0 +1,96 @@
+/*******************************************************************************
+ * Copyright (c) 2014, 2017 Orange.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.om2m.sdt.home.types;
+
+import org.eclipse.om2m.sdt.Identifiers;
+
+public enum PropertyType implements Identifiers {
+	
+	absoluteEnergyConsumption("absoluteEnergyConsumption", "abECn"),
+	country("propCountry", "proCy"),
+	dateOfManufacture("propDateOfManufacture", "pDOMe"),
+	deviceAliasName("propDeviceAliasName", "pDANe"),
+	deviceFirmwareVersion("propDeviceFirmwareVersion", "pDFVn"),
+	deviceManufacturer("propDeviceManufacturer", "prDMr"),
+	deviceModelName("propDeviceModelName", "pDMNe"),
+	deviceName("propDeviceName", "prDNe"),
+	deviceSerialNum("propDeviceSerialNum", "pDSNm"),
+	deviceSubModelName("propDeviceSubModelName", "pDSMN"),
+	deviceType("propDeviceType", "prDTe"),
+	generationSource("generationSource", "genSe"),
+	hardwareVersion("propHardwareVersion", "prHVn"),
+	location("propLocation", "proLn"),
+	manufacturerDetailsLink("propManufacturerDetailsLink", "pMDLk"),
+	manufacturerName("manufacturerName", "manNe"),
+	measuringScope("measuringScope", "meaSe"),
+	osVersion("propOsVersion", "prOVn"),
+	presentationURL("propPresentationURL", "pPURL"),
+	protocol("propProtocol", "proPl"),
+	supportURL("propSupportURL", "pSURL"),
+	systemTime("propSystemTime", "prSTe"),
+	
+	chargingCapacity("chargingCapacity", "chaCy"),
+	dischargingCapacity("dischargingCapacity", "disCy"),
+	electricEnergy("electricEnergy", "eleEy"),
+	material("material", "matel"),
+	voltage("voltage", "volte"),
+	
+	openOnly("openOnly", "opeOy"),
+	cloud("cloud", "cloud"),
+	owner("owner", "owner"),
+
+	undefinedVendorExt("undefinedVendorExt", "undef");
+	
+	private final String longDefinitionName;
+	private final String shortDefinitionName;
+	
+	PropertyType(String longDef, String shortDef) {
+		longDefinitionName = longDef;
+		shortDefinitionName = shortDef;
+	}
+
+    /**
+	 * @return the longDefinitionName
+	 */
+	@Override
+	public String getLongName() {
+		return longDefinitionName;
+	}
+
+	/**
+	 * @return the shortDefinitionName
+	 */
+	@Override
+	public String getShortName() {
+		return shortDefinitionName;
+	}
+
+	@Override
+	public String getDefinition() {
+		return null;
+	}
+
+    public static PropertyType fromLongName(String def) {
+        for (PropertyType c: PropertyType.values()) {
+            if (c.longDefinitionName.equals(def)) {
+                return c;
+            }
+        }
+		return null;
+    }
+
+    public static PropertyType fromShortName(String def) {
+        for (PropertyType c: PropertyType.values()) {
+            if (c.shortDefinitionName.equals(def)) {
+                return c;
+            }
+        }
+		return null;
+    }
+
+}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/SupportedMode.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/SupportedMode.java
deleted file mode 100644
index ba0a83f..0000000
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/SupportedMode.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2014, 2016 Orange.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.om2m.sdt.home.types;
-
-import org.eclipse.om2m.sdt.datapoints.EnumDataPoint;
-
-public abstract class SupportedMode extends EnumDataPoint<Integer> {
-	
-	static public final int antifreeze 		= 1;
-	static public final int manual 			= 2;
-	static public final int eco 			= 3;
-	static public final int program 		= 4;
-	static public final int off 			= 5;
-	static public final int ready 			= 6;
-	static public final int running 		= 7;
-	static public final int paused 			= 8;
-	static public final int aborted 		= 9;
-	static public final int cancelled 		= 10;
-	static public final int completed 		= 11;
-	static public final int washing 		= 12;
-	static public final int spinning 		= 13;
-	static public final int drying 			= 14;
-	static public final int rinsing 		= 15;
-	static public final int warming_up 		= 16;
-	static public final int cooking 		= 17;
-	static public final int cooling 		= 18;
-	static public final int dehumidifying 	= 19;
-	static public final int energy_saving 	= 20;
-	static public final int charging 		= 21;
-	static public final int homing 			= 22;
-	static public final int docking 		= 23;
-	
-	public SupportedMode(String name) {
-		super(name, HomeDataType.SupportedMode);
-		setValidValues(new Integer[] { antifreeze, manual, eco, program, off, ready, running, 
-			paused, aborted, cancelled, completed, washing, spinning, drying, rinsing, 
-			warming_up, cooking, cooling, dehumidifying, energy_saving, charging, homing, docking });
-	}
-
-}
diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/TasteStrength.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/TasteStrength.java
index 6053d25..9deef03 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/TasteStrength.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/TasteStrength.java
@@ -1,8 +1,13 @@
 package org.eclipse.om2m.sdt.home.types;

 

+import java.util.Arrays;

+import java.util.List;

+

+import org.eclipse.om2m.sdt.Identifiers;

+import org.eclipse.om2m.sdt.datapoints.ClonedEnum;

 import org.eclipse.om2m.sdt.datapoints.EnumDataPoint;

 

-public abstract class TasteStrength extends EnumDataPoint<Integer> {

+public class TasteStrength extends ClonedEnum {

 

 	static public final int zero = 1;

 	static public final int sensitive = 2;

@@ -10,8 +15,17 @@
 	static public final int strong = 4;

 	static public final int maximum = 5;

 	

-	public TasteStrength(String name) {

-		super(name, HomeDataType.TasteStrength);

-		setValidValues(new Integer[] { zero, sensitive, medium, strong, maximum  });	

+	static private List<Integer> values = Arrays.asList(

+			zero, sensitive, medium, strong, maximum

+	);

+

+	public TasteStrength(EnumDataPoint<Integer> dp) {

+		this(DatapointType.strength, dp);

 	}

+

+	public TasteStrength(Identifiers name, EnumDataPoint<Integer> dp) {

+		super(name, HomeDataType.TasteStrength, dp);

+		setValidValues(values);	

+	}

+

 }

diff --git a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/Tone.java b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/Tone.java
index da548ca..d2ed13e 100644
--- a/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/Tone.java
+++ b/org.eclipse.om2m.sdt/org.eclipse.om2m.sdt.home/src/main/java/org/eclipse/om2m/sdt/home/types/Tone.java
@@ -7,9 +7,14 @@
  *******************************************************************************/
 package org.eclipse.om2m.sdt.home.types;
 
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.om2m.sdt.Identifiers;
+import org.eclipse.om2m.sdt.datapoints.ClonedEnum;
 import org.eclipse.om2m.sdt.datapoints.EnumDataPoint;
 
-public abstract class Tone extends EnumDataPoint<Integer> {
+public class Tone extends ClonedEnum {
 	
 	static public final int Fire = 1;
 	static public final int Theft = 2;
@@ -18,9 +23,17 @@
 	static public final int DeviceFail = 5;
 	static public final int Silent = 6;
 	
-	public Tone(String name) {
-		super(name, HomeDataType.Tone);
-		setValidValues(new Integer[] { Fire, Theft, Emergency, Doorbell, DeviceFail, Silent });
+	static private List<Integer> values = Arrays.asList(
+			Fire, Theft, Emergency, Doorbell, DeviceFail, Silent
+	);
+
+	public Tone(EnumDataPoint<Integer> dp) {
+		this(DatapointType.tone, dp);
+	}
+	
+	public Tone(Identifiers identifiers, EnumDataPoint<Integer> dp) {
+		super(identifiers, HomeDataType.Tone, dp);
+		setValidValues(values);
 	}
 	
 }
diff --git a/org.eclipse.om2m.sdt/pom.xml b/org.eclipse.om2m.sdt/pom.xml
index 5d27e69..acbd0c4 100644
--- a/org.eclipse.om2m.sdt/pom.xml
+++ b/org.eclipse.om2m.sdt/pom.xml
@@ -46,6 +46,8 @@
 		<module>org.eclipse.om2m.sdt.home.netatmo</module> 
 		<module>org.eclipse.om2m.sdt.home.smartercoffee</module>
 		<module>org.eclipse.om2m.sdt.home.mocked.devices</module> 
+		<module>org.eclipse.om2m.sdt.home.utils</module> 
+		<module>org.eclipse.om2m.sdt.home.applications</module> 
 	</modules>
 
 </project>
diff --git a/org.eclipse.om2m.site.in-cse/configurations/services/sdt.ipe.properties b/org.eclipse.om2m.site.in-cse/configurations/services/sdt.ipe.properties
new file mode 100644
index 0000000..33f1ba0
--- /dev/null
+++ b/org.eclipse.om2m.site.in-cse/configurations/services/sdt.ipe.properties
@@ -0,0 +1,17 @@
+# announcement.enabled defines if the SDT IPE announces ressources to another CSE

+# boolean value

+announcement.enabled false

+

+# ipe.under.announced.resource : boolean

+# defines where the SDT IPE announced object should be located on the remote CSE

+# if true, the SDT_IPEAnnc resource is created under the resource representing the hosting CSE on the remote CSE

+# mandatory if announcement.enable = true

+ipe.under.announced.resource false

+

+# defines the name of the CSE where the SDT IPE resources must be announced 

+# mandatory if announcement.enable = true

+cse.name.to.be.announced mn-name

+

+# defines the id of the CSE where the SDT IPE resources must be announced

+# mandatory if announcement.enable = true

+cse.id.to.be.announced mn-cse
\ No newline at end of file
diff --git a/org.eclipse.om2m.site.in-cse/om2m.product b/org.eclipse.om2m.site.in-cse/om2m.product
index b0342b2..8970d53 100644
--- a/org.eclipse.om2m.site.in-cse/om2m.product
+++ b/org.eclipse.om2m.site.in-cse/om2m.product
@@ -18,7 +18,6 @@
    <windowImages/>
 
    <launcher name="in-cse">
-      <solaris/>
       <win useIco="false">
          <bmp/>
       </win>
@@ -39,7 +38,9 @@
       <plugin id="org.apache.felix.gogo.shell"/>
       <plugin id="org.apache.httpcomponents.httpclient"/>
       <plugin id="org.apache.httpcomponents.httpcore"/>
+      <plugin id="org.eclipse.equinox.cm"/>
       <plugin id="org.eclipse.equinox.console"/>
+      <plugin id="org.eclipse.equinox.ds"/>
       <plugin id="org.eclipse.equinox.event"/>
       <plugin id="org.eclipse.equinox.http.jetty"/>
       <plugin id="org.eclipse.equinox.http.servlet"/>
@@ -53,7 +54,6 @@
       <plugin id="org.eclipse.jetty.util"/>
       <plugin id="org.eclipse.om2m.binding.coap"/>
       <plugin id="org.eclipse.om2m.binding.http"/>
-      <plugin id="org.eclipse.om2m.binding.mqtt"/>
       <plugin id="org.eclipse.om2m.binding.service"/>
       <plugin id="org.eclipse.om2m.commons"/>
       <plugin id="org.eclipse.om2m.commons.logging" fragment="true"/>
@@ -62,8 +62,19 @@
       <plugin id="org.eclipse.om2m.das.testsuite"/>
       <plugin id="org.eclipse.om2m.datamapping.jaxb"/>
       <plugin id="org.eclipse.om2m.datamapping.service"/>
+      <plugin id="org.eclipse.om2m.ipe.sdt"/>
+      <!--plugin id="org.eclipse.om2m.ipe.sdt.testsuite"/-->
       <plugin id="org.eclipse.om2m.persistence.eclipselink"/>
+      <plugin id="org.eclipse.om2m.persistence.mongodb"/>
       <plugin id="org.eclipse.om2m.persistence.service"/>
+      <plugin id="org.eclipse.om2m.sdt.api"/>
+      <plugin id="org.eclipse.om2m.sdt.home"/>
+      <plugin id="org.eclipse.om2m.sdt.home.driver"/>
+      <plugin id="org.eclipse.om2m.sdt.home.mocked.devices"/>
+      <plugin id="org.eclipse.om2m.sdt.home.monitoring"/>
+      <plugin id="org.eclipse.om2m.sdt.comparator.xml"/>
+      <!--plugin id="org.eclipse.om2m.testsuite.flexcontainer"/-->
+      <plugin id="org.eclipse.om2m.webapp.resourcesbrowser.json"/>
       <plugin id="org.eclipse.om2m.webapp.resourcesbrowser.xml"/>
       <plugin id="org.eclipse.osgi"/>
       <plugin id="org.eclipse.osgi.services"/>
@@ -73,16 +84,29 @@
       <plugin id="org.apache.felix.gogo.command" autoStart="true" startLevel="0" />
       <plugin id="org.apache.felix.gogo.runtime" autoStart="true" startLevel="0" />
       <plugin id="org.apache.felix.gogo.shell" autoStart="true" startLevel="0" />
+      <plugin id="org.eclipse.equinox.cm" autoStart="true" startLevel="1" />
       <plugin id="org.eclipse.equinox.console" autoStart="true" startLevel="0" />
+      <plugin id="org.eclipse.equinox.ds" autoStart="true" startLevel="1" />
       <plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="1" />
       <plugin id="org.eclipse.equinox.http.jetty" autoStart="true" startLevel="1" />
       <plugin id="org.eclipse.om2m.binding.coap" autoStart="true" startLevel="2" />
       <plugin id="org.eclipse.om2m.binding.http" autoStart="true" startLevel="2" />
-      <plugin id="org.eclipse.om2m.core" autoStart="true" startLevel="4" />
+      <plugin id="org.eclipse.om2m.core" autoStart="true" startLevel="3" />
       <plugin id="org.eclipse.om2m.das.testsuite" autoStart="false" startLevel="6" />
       <plugin id="org.eclipse.om2m.datamapping.jaxb" autoStart="true" startLevel="1" />
+      <plugin id="org.eclipse.om2m.ipe.sdt" autoStart="true" startLevel="6" />
+      <!--plugin id="org.eclipse.om2m.ipe.sdt.testsuite" autoStart="false" startLevel="6" /-->
       <plugin id="org.eclipse.om2m.persistence.eclipselink" autoStart="true" startLevel="2" />
-      <plugin id="org.eclipse.om2m.webapp.resourcesbrowser.xml" autoStart="true" startLevel="4" />
+      <plugin id="org.eclipse.om2m.persistence.mongodb" autoStart="false" startLevel="2" />
+      <plugin id="org.eclipse.om2m.sdt.api" autoStart="true" startLevel="5" />
+      <plugin id="org.eclipse.om2m.sdt.home" autoStart="true" startLevel="5" />
+      <plugin id="org.eclipse.om2m.sdt.home.driver" autoStart="true" startLevel="5" />
+      <plugin id="org.eclipse.om2m.sdt.home.mocked.devices" autoStart="false" startLevel="5" />
+      <plugin id="org.eclipse.om2m.sdt.home.monitoring" autoStart="false" startLevel="5" />
+      <plugin id="org.eclipse.om2m.sdt.comparator.xml" autoStart="false" startLevel="5"/>
+      <!--plugin id="org.eclipse.om2m.testsuite.flexcontainer" autoStart="false" startLevel="6" /-->
+      <plugin id="org.eclipse.om2m.webapp.resourcesbrowser.json" autoStart="true" startLevel="4" />
+      <plugin id="org.eclipse.om2m.webapp.resourcesbrowser.xml" autoStart="false" startLevel="4" />
       <property name="log4j.configuration" value="file:./log4j.configuration" />
       <property name="org.apache.commons.logging.Log" value="org.apache.commons.logging.impl.Log4JLogger" />
       <property name="org.eclipse.equinox.http.jetty.http.port" value="8080" />
@@ -97,13 +121,15 @@
       <property name="org.eclipse.om2m.dbDriver" value="org.h2.Driver" />
       <property name="org.eclipse.om2m.dbPassword" value="om2m" />
       <property name="org.eclipse.om2m.dbReset" value="true" />
-      <property name="org.eclipse.om2m.dbUrl" value="jdbc:h2:./database/indb" />
+      <property name="org.eclipse.om2m.dbUrl" value="jdbc:h2:./data/mndb" />
+      <property name="org.eclipse.om2m.dbUrl_mongodb" value="127.0.0.1" />
       <property name="org.eclipse.om2m.dbUser" value="om2m" />
       <property name="org.eclipse.om2m.globalContext" value="" />
       <property name="org.eclipse.om2m.guestRequestingEntity" value="guest:guest" />
       <property name="org.eclipse.om2m.m2mSpId" value="om2m.org" />
       <property name="org.eclipse.om2m.resource.idseparator" value="-" />
+      <property name="org.eclipse.om2m.subscriptions.nbOfFailedNotificationsBeforeDeletion" value="3" />
       <property name="org.eclipse.om2m.webInterfaceContext" value="/webpage" />
    </configurations>
 
-</product>
\ No newline at end of file
+</product>
diff --git a/org.eclipse.om2m.site.mn-cse/om2m.product b/org.eclipse.om2m.site.mn-cse/om2m.product
index 2dce0e4..3ee9dba 100644
--- a/org.eclipse.om2m.site.mn-cse/om2m.product
+++ b/org.eclipse.om2m.site.mn-cse/om2m.product
@@ -39,6 +39,8 @@
       <plugin id="org.apache.httpcomponents.httpcore"/>

       <plugin id="org.eclipse.equinox.cm"/>

       <plugin id="org.eclipse.equinox.console"/>

+      <plugin id="org.eclipse.equinox.ds"/>

+      <plugin id="org.eclipse.equinox.event"/>

       <plugin id="org.eclipse.equinox.http.jetty"/>

       <plugin id="org.eclipse.equinox.http.servlet"/>

       <plugin id="org.eclipse.equinox.launcher"/>

@@ -62,10 +64,12 @@
       <plugin id="org.eclipse.om2m.ipe.sample.sdt"/>

       <plugin id="org.eclipse.om2m.ipe.sdt"/>

       <plugin id="org.eclipse.om2m.persistence.eclipselink"/>

+      <plugin id="org.eclipse.om2m.persistence.mongodb"/>

       <plugin id="org.eclipse.om2m.persistence.service"/>

       <plugin id="org.eclipse.om2m.sdt.api"/>

       <plugin id="org.eclipse.om2m.sdt.home"/>

       <plugin id="org.eclipse.om2m.sdt.home.driver"/>

+      <plugin id="org.eclipse.om2m.sdt.home.mocked.devices"/>

       <plugin id="org.eclipse.om2m.testsuite.flexcontainer"/>

       <plugin id="org.eclipse.om2m.webapp.resourcesbrowser.xml"/>

       <plugin id="org.eclipse.osgi"/>

@@ -79,18 +83,21 @@
       <plugin id="org.apache.felix.gogo.shell" autoStart="true" startLevel="0" />

       <plugin id="org.eclipse.equinox.cm" autoStart="true" startLevel="1" />

       <plugin id="org.eclipse.equinox.console" autoStart="true" startLevel="0" />

+      <plugin id="org.eclipse.equinox.ds" autoStart="true" startLevel="1" />

+      <plugin id="org.eclipse.equinox.event" autoStart="true" startLevel="1" />

       <plugin id="org.eclipse.equinox.http.jetty" autoStart="true" startLevel="1" />

       <plugin id="org.eclipse.om2m.binding.http" autoStart="true" startLevel="2" />

       <plugin id="org.eclipse.om2m.core" autoStart="true" startLevel="4" />

       <plugin id="org.eclipse.om2m.datamapping.jaxb" autoStart="true" startLevel="1" />

       <plugin id="org.eclipse.om2m.ipe.sdt" autoStart="true" startLevel="6" />

       <plugin id="org.eclipse.om2m.persistence.eclipselink" autoStart="true" startLevel="2" />

+      <plugin id="org.eclipse.om2m.persistence.mongodb" autoStart="false" startLevel="2" />

       <plugin id="org.eclipse.om2m.sdt.api" autoStart="true" startLevel="4" />

       <plugin id="org.eclipse.om2m.sdt.home" autoStart="false" startLevel="4" />

       <plugin id="org.eclipse.om2m.sdt.home.cloud" autoStart="false" startLevel="6" />

       <plugin id="org.eclipse.om2m.sdt.home.driver" autoStart="false" startLevel="4" />

       <plugin id="org.eclipse.om2m.sdt.home.lifx" autoStart="false" startLevel="6" />

-      <plugin id="org.eclipse.om2m.sdt.home.mocked.devices" autoStart="false" startLevel="5" />

+      <plugin id="org.eclipse.om2m.sdt.home.mocked.devices" autoStart="true" startLevel="6" />

       <plugin id="org.eclipse.om2m.sdt.home.netatmo" autoStart="false" startLevel="6" />

       <plugin id="org.eclipse.om2m.sdt.home.smartercoffee" autoStart="false" startLevel="6" />

       <plugin id="org.eclipse.om2m.sdt.home.tester" autoStart="false" startLevel="5" />

diff --git a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/AccessControlPolicyTest.java b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/AccessControlPolicyTest.java
index 33a4099..b35e332 100644
--- a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/AccessControlPolicyTest.java
+++ b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/AccessControlPolicyTest.java
@@ -13,9 +13,9 @@
 import org.eclipse.om2m.commons.resource.AccessControlPolicy;
 import org.eclipse.om2m.commons.resource.AccessControlRule;
 import org.eclipse.om2m.commons.resource.CustomAttribute;
-import org.eclipse.om2m.commons.resource.FlexContainer;
 import org.eclipse.om2m.commons.resource.ResponsePrimitive;
 import org.eclipse.om2m.commons.resource.SetOfAcrs;
+import org.eclipse.om2m.commons.resource.flexcontainerspec.BinarySwitchFlexContainer;
 import org.eclipse.om2m.core.service.CseService;
 import org.eclipse.om2m.testsuite.flexcontainer.TestReport.Status;
 
@@ -32,7 +32,9 @@
 
 	public void testCreateAccessControlPolicy() {
 
+		String acpName = "acp_" + System.currentTimeMillis();
 		AccessControlPolicy acp = new AccessControlPolicy();
+		acp.setName(acpName);
 		SetOfAcrs privileges = new SetOfAcrs();
 		AccessControlRule accessControlRule = new AccessControlRule();
 		accessControlRule.getAccessControlOriginators().add("greg:greg");
@@ -49,10 +51,10 @@
 		acp.setSelfPrivileges(selfPrivileges);
 
 		String baseLocation = "/" + Constants.CSE_ID + "/" + Constants.CSE_NAME;
-		String acpName = "acp_" + System.currentTimeMillis();
+		
 		String acpLocation = baseLocation + "/" + acpName;
 
-		ResponsePrimitive response = sendCreateAccessControlPolicyRequest(acp, baseLocation, acpName);
+		ResponsePrimitive response = sendCreateAccessControlPolicyRequest(acp, baseLocation);
 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {
 			// KO
 			createTestReport("testAccessControlPolicy", Status.KO, "unable to create a new acp", null);
@@ -62,28 +64,27 @@
 		AccessControlPolicy returnedAcp = (AccessControlPolicy) response.getContent();
 
 		// init a new FlexContainer
-		FlexContainer flexContainer = new FlexContainer();
-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.binaryswitch");
+		BinarySwitchFlexContainer flexContainer = new BinarySwitchFlexContainer();
 		CustomAttribute ca = new CustomAttribute();
-		ca.setCustomAttributeName("powerState");
-		ca.setCustomAttributeType("xs:boolean");
+		ca.setCustomAttributeName("powSe");
 		ca.setCustomAttributeValue("false");
 		flexContainer.getCustomAttributes().add(ca);
 		String flexContainerName = "flexContainerACPTest_" + System.currentTimeMillis();
+		flexContainer.setName(flexContainerName);
 		String flexContainerLocation = baseLocation + "/" + flexContainerName;
 
 		// set acp
 		flexContainer.getAccessControlPolicyIDs().add(returnedAcp.getResourceID());
 
 		// send create FlexContainer request
-		response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);
-		FlexContainer createdFlexContainer = null;
+		response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);
+		BinarySwitchFlexContainer createdFlexContainer = null;
 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {
 			// KO
 			createTestReport("testAccessControlPolicy", Status.KO, "unable to create a FlexContainer", null);
 			return;
 		} else {
-			createdFlexContainer = (FlexContainer) response.getContent();
+			createdFlexContainer = (BinarySwitchFlexContainer) response.getContent();
 		}
 
 		// retrieve the flexContainer with greg:greg credentials
@@ -93,7 +94,7 @@
 			createTestReport("testAccessControlPolicy", Status.KO, "unable to retrieve the FlexContainer", null);
 			return;
 		} else {
-			FlexContainer toBeRetrieved = (FlexContainer) response.getContent();
+			BinarySwitchFlexContainer toBeRetrieved = (BinarySwitchFlexContainer) response.getContent();
 			try {
 				checkFlexContainer(createdFlexContainer, toBeRetrieved);
 			} catch (Exception e) {
@@ -119,7 +120,9 @@
 
 	public void testCreateFlexContainerWithNoRight() {
 		// create an ACP for greg:greg with RETRIEVE rights
+		String acpName = "acp_" + System.currentTimeMillis();
 		AccessControlPolicy acp = new AccessControlPolicy();
+		acp.setName(acpName);
 		SetOfAcrs privileges = new SetOfAcrs();
 		AccessControlRule accessControlRule = new AccessControlRule();
 		accessControlRule.getAccessControlOriginators().add("greg:greg");
@@ -136,10 +139,10 @@
 		acp.setSelfPrivileges(selfPrivileges);
 
 		String baseLocation = "/" + Constants.CSE_ID + "/" + Constants.CSE_NAME;
-		String acpName = "acp_" + System.currentTimeMillis();
+		
 		String acpLocation = baseLocation + "/" + acpName;
 
-		ResponsePrimitive response = sendCreateAccessControlPolicyRequest(acp, baseLocation, acpName);
+		ResponsePrimitive response = sendCreateAccessControlPolicyRequest(acp, baseLocation);
 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {
 			// KO
 			createTestReport("testCreateFlexContainerWithNoRight", Status.KO, "unable to create a new acp", null);
@@ -149,19 +152,19 @@
 		AccessControlPolicy returnedAcp = (AccessControlPolicy) response.getContent();
 
 		// init a new FlexContainer
-		FlexContainer flexContainer = new FlexContainer();
-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.binaryswitch");
+		String flexContainerName = "flexContainerACPTest_" + System.currentTimeMillis();
+		BinarySwitchFlexContainer flexContainer = new BinarySwitchFlexContainer();
+		flexContainer.setName(flexContainerName);
 		CustomAttribute ca = new CustomAttribute();
-		ca.setCustomAttributeName("powerState");
-		ca.setCustomAttributeType("xs:boolean");
+		ca.setCustomAttributeName("powSe");
 		ca.setCustomAttributeValue("false");
 		flexContainer.getCustomAttributes().add(ca);
-		String flexContainerName = "flexContainerACPTest_" + System.currentTimeMillis();
+		
 		String flexContainerLocation = baseLocation + "/" + flexContainerName;
 
 		// try to create a FlexContainer using greg:greg credentials => expect
 		// ACCESS DENIED
-		response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName, "greg:greg");
+		response = sendCreateFlexContainerRequest(flexContainer, baseLocation, "greg:greg");
 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.ACCESS_DENIED)) {
 			// KO
 			createTestReport(
@@ -176,7 +179,9 @@
 
 	public void testDeleteFlexContainerWithNoRight() {
 		// create an ACP for greg:greg with RETRIEVE rights
+		String acpName = "acp_" + System.currentTimeMillis();
 		AccessControlPolicy acp = new AccessControlPolicy();
+		acp.setName(acpName);
 		SetOfAcrs privileges = new SetOfAcrs();
 		AccessControlRule accessControlRule = new AccessControlRule();
 		accessControlRule.getAccessControlOriginators().add("greg:greg");
@@ -193,10 +198,10 @@
 		acp.setSelfPrivileges(selfPrivileges);
 
 		String baseLocation = "/" + Constants.CSE_ID + "/" + Constants.CSE_NAME;
-		String acpName = "acp_" + System.currentTimeMillis();
+		
 		String acpLocation = baseLocation + "/" + acpName;
 
-		ResponsePrimitive response = sendCreateAccessControlPolicyRequest(acp, baseLocation, acpName);
+		ResponsePrimitive response = sendCreateAccessControlPolicyRequest(acp, baseLocation);
 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {
 			// KO
 			createTestReport("testDeleteFlexContainerWithNoRight", Status.KO, "unable to create a new acp", null);
@@ -206,19 +211,20 @@
 		AccessControlPolicy returnedAcp = (AccessControlPolicy) response.getContent();
 
 		// init a new FlexContainer
-		FlexContainer flexContainer = new FlexContainer();
+		String flexContainerName = "flexContainerACPTest_" + System.currentTimeMillis();
+		BinarySwitchFlexContainer flexContainer = new BinarySwitchFlexContainer();
+		flexContainer.setName(flexContainerName);
 		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.binaryswitch");
 		CustomAttribute ca = new CustomAttribute();
-		ca.setCustomAttributeName("powerState");
-		ca.setCustomAttributeType("xs:boolean");
+		ca.setCustomAttributeName("powSe");
 		ca.setCustomAttributeValue("false");
 		flexContainer.getCustomAttributes().add(ca);
-		String flexContainerName = "flexContainerACPTest_" + System.currentTimeMillis();
+		
 		String flexContainerLocation = baseLocation + "/" + flexContainerName;
 
 		// try to create a FlexContainer using admin:admin credentials
-		FlexContainer createdFlexContainer = null;
-		response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName,
+		BinarySwitchFlexContainer createdFlexContainer = null;
+		response = sendCreateFlexContainerRequest(flexContainer, baseLocation,
 				Constants.ADMIN_REQUESTING_ENTITY);
 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {
 			// KO
@@ -227,7 +233,7 @@
 					null);
 			return;
 		} else {
-			createdFlexContainer = (FlexContainer) response.getContent();
+			createdFlexContainer = (BinarySwitchFlexContainer) response.getContent();
 		}
 
 		// try to delete the flexContainer with greg:greg ==> expect
@@ -250,7 +256,7 @@
 			return;
 		} else {
 			try {
-				checkFlexContainer(createdFlexContainer, (FlexContainer) response.getContent());
+				checkFlexContainer(createdFlexContainer, (BinarySwitchFlexContainer) response.getContent());
 			} catch (Exception e) {
 				// KO
 				createTestReport("testDeleteFlexContainerWithNoRight", Status.KO,
@@ -260,4 +266,5 @@
 
 		createTestReport("testDeleteFlexContainerWithNoRight", Status.OK, null, null);
 	}
-}
\ No newline at end of file
+}
+
diff --git a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/Activator.java b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/Activator.java
index d2df699..415794d 100644
--- a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/Activator.java
+++ b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/Activator.java
@@ -7,6 +7,9 @@
  *******************************************************************************/

 package org.eclipse.om2m.testsuite.flexcontainer;

 

+import java.util.ArrayList;

+import java.util.List;

+

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.datamapping.service.DataMapperService;

 import org.osgi.framework.BundleActivator;

@@ -145,13 +148,17 @@
 

 	private void setCseServiceAndStartTesting(CseService cseService) {

 

+		List<FlexContainerTestSuite> tests = new ArrayList<>();

+		

 		currentCseService = cseService;

 		try {

 			BinarySwitchFlexContainerTest test1 = new BinarySwitchFlexContainerTest(currentCseService);

 			test1.executeTestsAndPrintReports();

+			tests.add(test1);

 

 			LocationFlexContainerTest test2 = new LocationFlexContainerTest(currentCseService);

 			test2.executeTestsAndPrintReports();

+			tests.add(test2);

 		} catch (Exception e) {

 			e.printStackTrace();

 		}

@@ -165,48 +172,73 @@
 		

 		AccessControlPolicyTest acpTest = new AccessControlPolicyTest(currentCseService);

 		acpTest.executeTestsAndPrintReports();

+		tests.add(acpTest);

 		

 		FaultDetectionFlexContainerTest faultDetectionTest = new FaultDetectionFlexContainerTest(currentCseService);

 		faultDetectionTest.executeTestsAndPrintReports();

+		tests.add(faultDetectionTest);

 		

 		RunModeFlexContainerTest runModeTest = new RunModeFlexContainerTest(cseService);

 		runModeTest.executeTestsAndPrintReports();

+		tests.add(runModeTest);

 		

-		LightFlexContainerTest light = new LightFlexContainerTest(currentCseService);

-		light.executeTestsAndPrintReports();

+		// 2017 07 17 - BONNARDEL Gregory

+		// Light module does not exist anymore

+		// should be replaced by Color ?

+//		LightFlexContainerTest light = new LightFlexContainerTest(currentCseService);

+//		light.executeTestsAndPrintReports();

+//		tests.add(light);

 		

 		EnergyConsumptionFlexContainerTest energyConsumptionTest = new EnergyConsumptionFlexContainerTest(currentCseService);

 		energyConsumptionTest.executeTestsAndPrintReports();

+		tests.add(energyConsumptionTest);

 		

 		WaterSensorFlexContainerTest waterSensorTest = new WaterSensorFlexContainerTest(currentCseService);

 		waterSensorTest.executeTestsAndPrintReports();

+		tests.add(waterSensorTest);

 		

 		AlarmSpeakerFlexContainerTest alarmSpeakerTest = new AlarmSpeakerFlexContainerTest(currentCseService);

 		alarmSpeakerTest.executeTestsAndPrintReports();

+		tests.add(alarmSpeakerTest);

 		

 		LightDeviceFlexContainerTest lightDeviceTest = new LightDeviceFlexContainerTest(currentCseService);

 		lightDeviceTest.executeTestsAndPrintReports();

+		tests.add(lightDeviceTest);

 		

 		SmartElectricMeterFlexContainerTest smartElectricMeterTest = new SmartElectricMeterFlexContainerTest(currentCseService);

 		smartElectricMeterTest.executeTestsAndPrintReports();

+		tests.add(smartElectricMeterTest);

 		

 		FloodDetectorFlexContainerTest floodDetectorTest = new FloodDetectorFlexContainerTest(currentCseService);

 		floodDetectorTest.executeTestsAndPrintReports();

+		tests.add(floodDetectorTest);

 		

 		GasValveFlexContainerTest gasValveTest = new GasValveFlexContainerTest(currentCseService);

 		gasValveTest.executeTestsAndPrintReports();

+		tests.add(gasValveTest);

 		

 		WarningDeviceFlexContainerTest warningDeviceTest = new WarningDeviceFlexContainerTest(currentCseService);

 		warningDeviceTest.executeTestsAndPrintReports();

+		tests.add(warningDeviceTest);

 		

 		SmokeDetectorFlexContainerTest smokeDetectorTest = new SmokeDetectorFlexContainerTest(currentCseService);

 		smokeDetectorTest.executeTestsAndPrintReports();

+		tests.add(smokeDetectorTest);

 		

 		WaterValveFlexContainerTest waterValveTest = new WaterValveFlexContainerTest(currentCseService);

 		waterValveTest.executeTestsAndPrintReports();

+		tests.add(waterValveTest);

 		

 		CallbackTest callbackTest = new CallbackTest(currentCseService, bundleContext);

 		callbackTest.executeTestsAndPrintReports();

+		tests.add(callbackTest);

+		

+		

+		System.out.println("");

+		System.out.println("#####################################################################################");

+		for(FlexContainerTestSuite test : tests) {

+			test.printTestReports();

+		}

 	}

 

 	private void unsetCseServiceAndStopTesting() {

diff --git a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/AlarmSpeakerFlexContainerTest.java b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/AlarmSpeakerFlexContainerTest.java
index 261aa41..a6a98c7 100644
--- a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/AlarmSpeakerFlexContainerTest.java
+++ b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/AlarmSpeakerFlexContainerTest.java
@@ -10,8 +10,8 @@
 import org.eclipse.om2m.commons.constants.Constants;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.AlarmSpeakerFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.testsuite.flexcontainer.TestReport.Status;

 

@@ -32,33 +32,31 @@
 		String flexContainerName = "AlarmSpeakerFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.alarmspeaker");

+		AlarmSpeakerFlexContainer flexContainer = new AlarmSpeakerFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setOntologyRef("OrangeOntology");

 		flexContainer.setCreator("Greg");

 

 		CustomAttribute toneCustomAttribute = new CustomAttribute();

 		toneCustomAttribute.setCustomAttributeName("tone");

-		toneCustomAttribute.setCustomAttributeType("hd:tone");

 		toneCustomAttribute.setCustomAttributeValue("1");

 		flexContainer.getCustomAttributes().add(toneCustomAttribute);

 

 		CustomAttribute alarmStatusCustomAttribute = new CustomAttribute();

-		alarmStatusCustomAttribute.setCustomAttributeName("alarmStatus");

-		alarmStatusCustomAttribute.setCustomAttributeType("xs:boolean");

+		alarmStatusCustomAttribute.setCustomAttributeName("alaSs");

 		alarmStatusCustomAttribute.setCustomAttributeValue("true");

 		flexContainer.getCustomAttributes().add(alarmStatusCustomAttribute);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

-		FlexContainer createdFlexContainer = null;

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

+		AlarmSpeakerFlexContainer createdFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testCreateAndRetrieveAlarmSpeakerFlexContainer", Status.KO,

 					"unable to create AlarmSpeaker FlexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			createdFlexContainer = (FlexContainer) response.getContent();

+			createdFlexContainer = (AlarmSpeakerFlexContainer) response.getContent();

 

 			if (!flexContainerName.equals(createdFlexContainer.getName())) {

 				createTestReport("testCreateAndRetrieveAlarmSpeakerFlexContainer", Status.KO,

@@ -87,7 +85,7 @@
 					"unable to retrieve AlarmSpeaker FlexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			AlarmSpeakerFlexContainer retrievedFlexContainer = (AlarmSpeakerFlexContainer) response.getContent();

 			try {

 				checkFlexContainer(createdFlexContainer, retrievedFlexContainer);

 			} catch (Exception e) {

@@ -104,26 +102,24 @@
 		String flexContainerName = "AlarmSpeakerFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.alarmspeaker");

+		AlarmSpeakerFlexContainer flexContainer = new AlarmSpeakerFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setOntologyRef("OrangeOntology");

 		flexContainer.setCreator("Greg");

 

 		CustomAttribute toneCustomAttribute = new CustomAttribute();

 		toneCustomAttribute.setCustomAttributeName("tone");

-		toneCustomAttribute.setCustomAttributeType("hd:tone");

 		toneCustomAttribute.setCustomAttributeValue("1");

 		flexContainer.getCustomAttributes().add(toneCustomAttribute);

 

 		CustomAttribute alarmStatusCustomAttribute = new CustomAttribute();

-		alarmStatusCustomAttribute.setCustomAttributeName("alarmStatus");

-		alarmStatusCustomAttribute.setCustomAttributeType("xs:boolean");

+		alarmStatusCustomAttribute.setCustomAttributeName("alaSs");

 		alarmStatusCustomAttribute.setCustomAttributeValue("true");

 		flexContainer.getCustomAttributes().add(alarmStatusCustomAttribute);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

-		FlexContainer createdFlexContainer = null;

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

+		AlarmSpeakerFlexContainer createdFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testDeleteAlarmSpeakerFlexContainer", Status.KO,

@@ -159,41 +155,38 @@
 		String flexContainerName = "AlarmSpeakerFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.alarmspeaker");

+		AlarmSpeakerFlexContainer flexContainer = new AlarmSpeakerFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setOntologyRef("OrangeOntology");

 		flexContainer.setCreator("Greg");

 

 		CustomAttribute toneCustomAttribute = new CustomAttribute();

 		toneCustomAttribute.setCustomAttributeName("tone");

-		toneCustomAttribute.setCustomAttributeType("hd:tone");

 		toneCustomAttribute.setCustomAttributeValue("1");

 		flexContainer.getCustomAttributes().add(toneCustomAttribute);

 

 		CustomAttribute alarmStatusCustomAttribute = new CustomAttribute();

-		alarmStatusCustomAttribute.setCustomAttributeName("alarmStatus");

-		alarmStatusCustomAttribute.setCustomAttributeType("xs:boolean");

+		alarmStatusCustomAttribute.setCustomAttributeName("alaSs");

 		alarmStatusCustomAttribute.setCustomAttributeValue("true");

 		flexContainer.getCustomAttributes().add(alarmStatusCustomAttribute);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

-		FlexContainer createdFlexContainer = null;

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

+		AlarmSpeakerFlexContainer createdFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testUpdateAlarmSpeakerFlexContainer", Status.KO,

 					"unable to create AlarmSpeaker FlexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			createdFlexContainer = (FlexContainer) response.getContent();

+			createdFlexContainer = (AlarmSpeakerFlexContainer) response.getContent();

 		}

 

 		// prepare update

-		FlexContainer toBeUpdated = new FlexContainer();

+		AlarmSpeakerFlexContainer toBeUpdated = new AlarmSpeakerFlexContainer();

 

 		CustomAttribute updatedTone = new CustomAttribute();

 		updatedTone.setCustomAttributeName("tone");

-		updatedTone.setCustomAttributeType("hd:tone");

 		updatedTone.setCustomAttributeValue("1");

 		toBeUpdated.getCustomAttributes().add(updatedTone);

 

@@ -205,7 +198,7 @@
 					"unable to update AlarmSpeaker FlexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			FlexContainer updatedFlexContainer = (FlexContainer) response.getContent();

+			AlarmSpeakerFlexContainer updatedFlexContainer = (AlarmSpeakerFlexContainer) response.getContent();

 

 			if (updatedFlexContainer.getCustomAttributes().size() != 1) {

 				createTestReport("testUpdateAlarmSpeakerFlexContainer", Status.KO, "Expecting 1 customAttribute, found "

@@ -232,7 +225,7 @@
 			return;

 		} else {

 			// OK

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			AlarmSpeakerFlexContainer retrievedFlexContainer = (AlarmSpeakerFlexContainer) response.getContent();

 			

 			// update createdFlexContainer with new tone value

 			createdFlexContainer.getCustomAttribute("tone")

diff --git a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/BinarySwitchFlexContainerTest.java b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/BinarySwitchFlexContainerTest.java
index f2b2ad5..59642d5 100644
--- a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/BinarySwitchFlexContainerTest.java
+++ b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/BinarySwitchFlexContainerTest.java
@@ -10,14 +10,10 @@
 import java.math.BigInteger;

 

 import org.eclipse.om2m.commons.constants.Constants;

-import org.eclipse.om2m.commons.constants.MimeMediaType;

-import org.eclipse.om2m.commons.constants.Operation;

-import org.eclipse.om2m.commons.constants.ResourceType;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

-import org.eclipse.om2m.commons.resource.RequestPrimitive;

-import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.ResponsePrimitive;  

+import org.eclipse.om2m.commons.resource.flexcontainerspec.BinarySwitchFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.testsuite.flexcontainer.TestReport.Status;

 

@@ -38,27 +34,23 @@
 	}

 

 	public void testCreateValidBinarySwitchFlexContainer() {

-		FlexContainer initialFlexContainer = new FlexContainer();

-		initialFlexContainer.setContainerDefinition("org.onem2m.home.moduleclass.binaryswitch");

+		BinarySwitchFlexContainer initialFlexContainer = new BinarySwitchFlexContainer();

 		initialFlexContainer.setOntologyRef("OrangeOntologyRef");

 		initialFlexContainer.setCreator("Greg");

+		initialFlexContainer.setName("GregFirstBinaryFlexContainer" + System.currentTimeMillis());

 		CustomAttribute ca = new CustomAttribute();

-		ca.setCustomAttributeName("powerState");

-		ca.setCustomAttributeType("xs:boolean");

+		ca.setCustomAttributeName("powSe");

 		ca.setCustomAttributeValue("true");

 		initialFlexContainer.getCustomAttributes().add(ca);

 

-		FlexContainer responseCreatedFlexContainer = null;

+		BinarySwitchFlexContainer responseCreatedFlexContainer = null;

 

 		// send CREATE request

 		ResponsePrimitive response = sendCreateFlexContainerRequest(initialFlexContainer, "/" + Constants.CSE_ID,

-				"GregFirstBinaryFlexContainer");

+				"admin:admin");

 		if (response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// OK

-			responseCreatedFlexContainer = (FlexContainer) response.getContent();

-

-			// set name of the FlexContainer

-			initialFlexContainer.setName("GregFirstBinaryFlexContainer");

+			responseCreatedFlexContainer = (BinarySwitchFlexContainer) response.getContent();

 

 			try {

 				checkFlexContainerName(initialFlexContainer, responseCreatedFlexContainer);

@@ -86,10 +78,10 @@
 

 		// send RETRIEVE request

 		response = sendRetrieveRequest(

-				"/" + Constants.CSE_ID + "/" + Constants.CSE_NAME + "/GregFirstBinaryFlexContainer");

+				"/" + Constants.CSE_ID + "/" + Constants.CSE_NAME + "/" + responseCreatedFlexContainer.getName());

 		if (response.getResponseStatusCode().equals(ResponseStatusCode.OK)) {

 			// retrieve FlexContainer is in Content as a FlexContainer object

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			BinarySwitchFlexContainer retrievedFlexContainer = (BinarySwitchFlexContainer) response.getContent();

 

 			try {

 				checkFlexContainer(responseCreatedFlexContainer, retrievedFlexContainer);

@@ -115,21 +107,20 @@
 	}

 

 	public void testCreateInvalidBinarySwitchFlexContainer() {

-		FlexContainer initialFlexContainer = new FlexContainer();

-		initialFlexContainer.setContainerDefinition("org.onem2m.home.moduleclass.binaryswitch");

+		BinarySwitchFlexContainer initialFlexContainer = new BinarySwitchFlexContainer();

 		initialFlexContainer.setOntologyRef("OrangeOntologyRef");

 		initialFlexContainer.setCreator("Greg");

+		initialFlexContainer.setName("GregFirstBinaryFlexContainer" + System.currentTimeMillis());

 		CustomAttribute ca = new CustomAttribute();

 		ca.setCustomAttributeName("powerStateFake");

-		ca.setCustomAttributeType("xs:boolean");

 		ca.setCustomAttributeValue("true");

 		initialFlexContainer.getCustomAttributes().add(ca);

 

-		FlexContainer responseCreatedFlexContainer = null;

+		BinarySwitchFlexContainer responseCreatedFlexContainer = null;

 

 		// send CREATE request

 		ResponsePrimitive response = sendCreateFlexContainerRequest(initialFlexContainer, "/" + Constants.CSE_ID,

-				"GregFirstBinaryFlexContainer" + System.currentTimeMillis());

+				Constants.ADMIN_REQUESTING_ENTITY);

 		if (response.getResponseStatusCode().equals(ResponseStatusCode.BAD_REQUEST)) {

 			// expected BadRequest

 

@@ -151,21 +142,20 @@
 	public void testUpdateBinarySwitchFlexContainer() {

 

 		// create a binary switch flex container

-		FlexContainer initialFlexContainer = new FlexContainer();

-		initialFlexContainer.setContainerDefinition("org.onem2m.home.moduleclass.binaryswitch");

+		BinarySwitchFlexContainer initialFlexContainer = new BinarySwitchFlexContainer();

 		initialFlexContainer.setOntologyRef("OrangeOntologyRef");

 		initialFlexContainer.setCreator("Greg");

+		initialFlexContainer.setName("GregFirstBinaryFlexContainer" + System.currentTimeMillis());

 		CustomAttribute ca = new CustomAttribute();

-		ca.setCustomAttributeName("powerState");

-		ca.setCustomAttributeType("xs:boolean");

+		ca.setCustomAttributeName("powSe");

 		ca.setCustomAttributeValue("true");

 		initialFlexContainer.getCustomAttributes().add(ca);

 

-		FlexContainer responseCreatedFlexContainer = null;

+		BinarySwitchFlexContainer responseCreatedFlexContainer = null;

 

 		// send CREATE request

 		ResponsePrimitive response = sendCreateFlexContainerRequest(initialFlexContainer, "/" + Constants.CSE_ID,

-				"GregFirstBinaryFlexContainer" + System.currentTimeMillis());

+				Constants.ADMIN_REQUESTING_ENTITY);

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport(

@@ -176,11 +166,11 @@
 			return;

 		} else {

 			// OK

-			responseCreatedFlexContainer = (FlexContainer) response.getContent();

+			responseCreatedFlexContainer = (BinarySwitchFlexContainer) response.getContent();

 		}

 

 		// update the flexContainer powerState custom attribute

-		FlexContainer toBeUpdated = new FlexContainer();

+		BinarySwitchFlexContainer toBeUpdated = new BinarySwitchFlexContainer();

 		ca.setCustomAttributeValue("false");

 		toBeUpdated.getCustomAttributes().add(ca);

 

@@ -188,13 +178,13 @@
 		response = sendUpdateFlexContainerRequest(

 				"/" + Constants.CSE_ID + "/" + Constants.CSE_NAME + "/" + responseCreatedFlexContainer.getName(),

 				toBeUpdated);

-		FlexContainer updatedFlexContainer = null;

+		BinarySwitchFlexContainer updatedFlexContainer = null;

 		if (response.getResponseStatusCode().equals(ResponseStatusCode.UPDATED)) {

 			// OK

-			updatedFlexContainer = (FlexContainer) response.getContent();

+			updatedFlexContainer = (BinarySwitchFlexContainer) response.getContent();

 

 			// check powerState has been updated

-			if (!updatedFlexContainer.getCustomAttribute("powerState").getCustomAttributeValue().equals("false")) {

+			if (!updatedFlexContainer.getCustomAttribute("powSe").getCustomAttributeValue().equals("false")) {

 				createTestReport("testUpdateBinarySwitchFlexContainer", Status.KO,

 						"unable to update powerState value to false", null);

 				return;

@@ -214,9 +204,9 @@
 				"/" + Constants.CSE_ID + "/" + Constants.CSE_NAME + "/" + responseCreatedFlexContainer.getName());

 		if (response.getResponseStatusCode().equals(ResponseStatusCode.OK)) {

 			// OK

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			BinarySwitchFlexContainer retrievedFlexContainer = (BinarySwitchFlexContainer) response.getContent();

 

-			responseCreatedFlexContainer.getCustomAttribute("powerState").setCustomAttributeValue("false");

+			responseCreatedFlexContainer.getCustomAttribute("powSe").setCustomAttributeValue("false");

 

 			try {

 				checkFlexContainer(responseCreatedFlexContainer, retrievedFlexContainer);

@@ -240,21 +230,21 @@
 

 	public void testDeleteBinarySwitchFlexContainer() {

 		// create a binary switch flex container

-		FlexContainer initialFlexContainer = new FlexContainer();

+		BinarySwitchFlexContainer initialFlexContainer = new BinarySwitchFlexContainer();

 		initialFlexContainer.setContainerDefinition("org.onem2m.home.moduleclass.binaryswitch");

 		initialFlexContainer.setOntologyRef("OrangeOntologyRef");

 		initialFlexContainer.setCreator("Greg");

+		initialFlexContainer.setName("GregFirstBinaryFlexContainer" + System.currentTimeMillis());

 		CustomAttribute ca = new CustomAttribute();

-		ca.setCustomAttributeName("powerState");

-		ca.setCustomAttributeType("xs:boolean");

+		ca.setCustomAttributeName("powSe");

 		ca.setCustomAttributeValue("true");

 		initialFlexContainer.getCustomAttributes().add(ca);

 

-		FlexContainer responseCreatedFlexContainer = null;

+		BinarySwitchFlexContainer responseCreatedFlexContainer = null;

 

 		// send CREATE request

 		ResponsePrimitive response = sendCreateFlexContainerRequest(initialFlexContainer, "/" + Constants.CSE_ID,

-				"GregFirstBinaryFlexContainer" + System.currentTimeMillis());

+				Constants.ADMIN_REQUESTING_ENTITY);

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport(

@@ -265,7 +255,7 @@
 			return;

 		} else {

 			// OK

-			responseCreatedFlexContainer = (FlexContainer) response.getContent();

+			responseCreatedFlexContainer = (BinarySwitchFlexContainer) response.getContent();

 		}

 

 		// delete the flexContainer

diff --git a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/CallbackTest.java b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/CallbackTest.java
index 95a7bc4..8742f7c 100644
--- a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/CallbackTest.java
+++ b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/CallbackTest.java
@@ -7,15 +7,17 @@
  *******************************************************************************/

 package org.eclipse.om2m.testsuite.flexcontainer;

 

+import java.util.HashMap;

 import java.util.List;

+import java.util.Map;

 

 import org.eclipse.om2m.commons.constants.Constants;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.exceptions.Om2mException;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.RequestPrimitive;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.BinarySwitchFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.flexcontainer.service.FlexContainerService;

 import org.eclipse.om2m.testsuite.flexcontainer.TestReport.Status;

@@ -27,7 +29,7 @@
 	private String parentLocation = "/" + Constants.CSE_ID + "/" + Constants.CSE_NAME;

 	private String flexContainerName = "BinarySwitch_" + System.currentTimeMillis();

 	private String flexContainerLocation = parentLocation + "/" + flexContainerName;

-	private FlexContainer flexContainer;

+	private BinarySwitchFlexContainer flexContainer;

 	private BundleContext bundleContext;

 	private ServiceRegistration flexContainerServiceRegistration;

 

@@ -37,16 +39,15 @@
 		super(pCseService);

 		bundleContext = pBundleContext;

 

-		flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.binaryswitch");

+		flexContainer = new BinarySwitchFlexContainer();

+		flexContainer.setName(flexContainerName);

 		CustomAttribute powerState = new CustomAttribute();

-		powerState.setCustomAttributeType("xs:boolean");

 		powerState.setCustomAttributeValue("false");

-		powerState.setCustomAttributeName("powerState");

+		powerState.setCustomAttributeName("powSe");

 		flexContainer.getCustomAttributes().add(powerState);

 

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, parentLocation, flexContainerName);

-		flexContainer = (FlexContainer) response.getContent();

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, parentLocation, Constants.ADMIN_REQUESTING_ENTITY);

+		flexContainer = (BinarySwitchFlexContainer) response.getContent();

 	}

 

 	@Override

@@ -74,7 +75,7 @@
 

 			@Override

 			public String getCustomAttributeValue(String customAttributeName) throws Om2mException {

-				if (!customAttributeName.equals("powerState")) {

+				if (!customAttributeName.equals("powSe")) {

 					throw new Om2mException(

 							"unexpected getCustomAttributeValue for attributeName=" + customAttributeName,

 							ResponseStatusCode.NOT_IMPLEMENTED);

@@ -83,6 +84,21 @@
 				return Boolean.TRUE.toString();

 			}

 

+			@Override

+			public Map<String, String> getCustomAttributeValues(

+					List<String> customAttributeNames) throws Om2mException {

+				if ((customAttributeNames.size() != 1)

+						|| customAttributeNames.get(0).equals("powSe")) {

+					throw new Om2mException(

+							"unexpected getCustomAttributeValue for attributeName=" + customAttributeNames,

+							ResponseStatusCode.NOT_IMPLEMENTED);

+				}

+				numberOfGetAttributeValue++;

+				Map<String, String> ret = new HashMap<String, String>();

+				ret.put("powSe", Boolean.TRUE.toString());

+				return ret;

+			}

+

 		};

 

 		// register FlexContainerService

@@ -91,9 +107,9 @@
 		// retrieve the FlexContainer

 		ResponsePrimitive response = sendRetrieveRequest(flexContainerLocation);

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.OK)) {

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			BinarySwitchFlexContainer retrievedFlexContainer = (BinarySwitchFlexContainer) response.getContent();

 

-			if (!retrievedFlexContainer.getCustomAttribute("powerState").getCustomAttributeValue()

+			if (!retrievedFlexContainer.getCustomAttribute("powSe").getCustomAttributeValue()

 					.equals(Boolean.TRUE.toString())) {

 				createTestReport("testCallback", Status.KO, "invalid powerState value, expecting true", null);

 				return;

@@ -113,9 +129,9 @@
 		// retrieve the flexContainer again

 		response = sendRetrieveRequest(flexContainerLocation);

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.OK)) {

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			BinarySwitchFlexContainer retrievedFlexContainer = (BinarySwitchFlexContainer) response.getContent();

 

-			if (!retrievedFlexContainer.getCustomAttribute("powerState").getCustomAttributeValue()

+			if (!retrievedFlexContainer.getCustomAttribute("powSe").getCustomAttributeValue()

 					.equals(Boolean.TRUE.toString())) {

 				createTestReport("testCallback", Status.KO, "invalid powerState value, expecting true", null);

 				return;

@@ -149,7 +165,7 @@
 					throw new Om2mException("not allowed. Invalid size of CustomAttribute", ResponseStatusCode.INVALID_ARGUMENTS);

 				}

 				CustomAttribute powerStateCA = customAttributes.get(0);

-				if (!"powerState".equals(powerStateCA.getCustomAttributeName())) {

+				if (!"powSe".equals(powerStateCA.getCustomAttributeName())) {

 					throw new Om2mException("not allowed", ResponseStatusCode.INVALID_ARGUMENTS);

 				}

 

@@ -172,7 +188,7 @@
 

 			@Override

 			public String getCustomAttributeValue(String customAttributeName) throws Om2mException {

-				if (!customAttributeName.equals("powerState")) {

+				if (!customAttributeName.equals("powSe")) {

 					throw new Om2mException(

 							"unexpected getCustomAttributeValue for attributeName=" + customAttributeName,

 							ResponseStatusCode.NOT_IMPLEMENTED);

@@ -181,17 +197,30 @@
 				return Boolean.TRUE.toString();

 			}

 

+			@Override

+			public Map<String, String> getCustomAttributeValues(

+					List<String> customAttributeNames) throws Om2mException {

+				if ((customAttributeNames.size() != 1)

+						|| customAttributeNames.get(0).equals("powSe")) {

+					throw new Om2mException(

+							"unexpected getCustomAttributeValue for attributeName=" + customAttributeNames,

+							ResponseStatusCode.NOT_IMPLEMENTED);

+				}

+				numberOfGetAttributeValue++;

+				Map<String, String> ret = new HashMap<String, String>();

+				ret.put("powSe", Boolean.TRUE.toString());

+				return ret;

+			}

+

 		};

 

 		// register FlexContainerService

 		flexContainerServiceRegistration = bundleContext.registerService(FlexContainerService.class, fcs, null);

 

-		FlexContainer toBeUpdated = new FlexContainer();

-		toBeUpdated.setContainerDefinition("org.onem2m.home.moduleclass.binaryswitch");

+		BinarySwitchFlexContainer toBeUpdated = new BinarySwitchFlexContainer();

 		CustomAttribute powerState = new CustomAttribute();

-		powerState.setCustomAttributeType("xs:boolean");

 		powerState.setCustomAttributeValue("true");

-		powerState.setCustomAttributeName("powerState");

+		powerState.setCustomAttributeName("powSe");

 		toBeUpdated.getCustomAttributes().add(powerState);

 

 		ResponsePrimitive response = sendUpdateFlexContainerRequest(flexContainerLocation, toBeUpdated);

@@ -201,20 +230,20 @@
 			return;

 		}

 

-		FlexContainer updatedFlexContainer = (FlexContainer) response.getContent();

-		if (!updatedFlexContainer.getCustomAttribute("powerState").getCustomAttributeValue()

+		BinarySwitchFlexContainer updatedFlexContainer = (BinarySwitchFlexContainer) response.getContent();

+		if (!updatedFlexContainer.getCustomAttribute("powSe").getCustomAttributeValue()

 				.equals(Boolean.TRUE.toString())) {

 			createTestReport("testCallback_update", Status.KO, "invalid for powerState, expecting TRUE, found"

-					+ updatedFlexContainer.getCustomAttribute("powerState").getCustomAttributeValue(), null);

+					+ updatedFlexContainer.getCustomAttribute("powSe").getCustomAttributeValue(), null);

 			return;

 		}

 		

 		// retrieve the flexContainer

 		response = sendRetrieveRequest(flexContainerLocation);

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.OK)) {

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			BinarySwitchFlexContainer retrievedFlexContainer = (BinarySwitchFlexContainer) response.getContent();

 

-			if (!retrievedFlexContainer.getCustomAttribute("powerState").getCustomAttributeValue()

+			if (!retrievedFlexContainer.getCustomAttribute("powSe").getCustomAttributeValue()

 					.equals(Boolean.TRUE.toString())) {

 				createTestReport("testCallback", Status.KO, "invalid powerState value, expecting true", null);

 				return;

diff --git a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/EnergyConsumptionFlexContainerTest.java b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/EnergyConsumptionFlexContainerTest.java
index ee1183d..d3e737a 100644
--- a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/EnergyConsumptionFlexContainerTest.java
+++ b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/EnergyConsumptionFlexContainerTest.java
@@ -10,8 +10,8 @@
 import org.eclipse.om2m.commons.constants.Constants;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.EnergyConsumptionFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.testsuite.flexcontainer.TestReport.Status;

 

@@ -31,62 +31,54 @@
 		String flexContainerName = "EnergyConsumptionFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.energyconsumption");

+		EnergyConsumptionFlexContainer flexContainer = new EnergyConsumptionFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setOntologyRef("Ontology");

 		flexContainer.setCreator("greg");

 

 		CustomAttribute powerCustomAttribute = new CustomAttribute();

 		powerCustomAttribute.setCustomAttributeName("power");

-		powerCustomAttribute.setCustomAttributeType("xs:float");

 		powerCustomAttribute.setCustomAttributeValue("342");

 		flexContainer.getCustomAttributes().add(powerCustomAttribute);

 

 		CustomAttribute absoluteEnergyConsumptionDataCustomAttribute = new CustomAttribute();

-		absoluteEnergyConsumptionDataCustomAttribute.setCustomAttributeName("absoluteEnergyConsumption");

-		absoluteEnergyConsumptionDataCustomAttribute.setCustomAttributeType("xs:float");

+		absoluteEnergyConsumptionDataCustomAttribute.setCustomAttributeName("abECn");

 		absoluteEnergyConsumptionDataCustomAttribute.setCustomAttributeValue("3434");

 		flexContainer.getCustomAttributes().add(absoluteEnergyConsumptionDataCustomAttribute);

 

 		CustomAttribute roundingEnergyConsumptionDataCustomAttribute = new CustomAttribute();

-		roundingEnergyConsumptionDataCustomAttribute.setCustomAttributeName("roundingEnergyConsumption");

-		roundingEnergyConsumptionDataCustomAttribute.setCustomAttributeType("xs:integer");

+		roundingEnergyConsumptionDataCustomAttribute.setCustomAttributeName("roECn");

 		roundingEnergyConsumptionDataCustomAttribute.setCustomAttributeValue("43242");

 		flexContainer.getCustomAttributes().add(roundingEnergyConsumptionDataCustomAttribute);

 

 		CustomAttribute significantFigures = new CustomAttribute();

-		significantFigures.setCustomAttributeName("significantDigits");

-		significantFigures.setCustomAttributeType("xs:integer");

+		significantFigures.setCustomAttributeName("sigDs");

 		significantFigures.setCustomAttributeValue("3");

 		flexContainer.getCustomAttributes().add(significantFigures);

 

 		CustomAttribute multiplyingFactors = new CustomAttribute();

-		multiplyingFactors.setCustomAttributeName("multiplyingFactors");

-		multiplyingFactors.setCustomAttributeType("xs:integer");

+		multiplyingFactors.setCustomAttributeName("mulFs");

 		multiplyingFactors.setCustomAttributeValue("100");

 		flexContainer.getCustomAttributes().add(multiplyingFactors);

 

 		CustomAttribute voltage = new CustomAttribute();

-		voltage.setCustomAttributeName("voltage");

-		voltage.setCustomAttributeType("xs:float");

+		voltage.setCustomAttributeName("volte");

 		voltage.setCustomAttributeValue("3443");

 		flexContainer.getCustomAttributes().add(voltage);

 

 		CustomAttribute current = new CustomAttribute();

-		current.setCustomAttributeName("current");

-		current.setCustomAttributeType("xs:float");

+		current.setCustomAttributeName("currt");

 		current.setCustomAttributeValue("45353");

 		flexContainer.getCustomAttributes().add(current);

 

 		CustomAttribute frequency = new CustomAttribute();

-		frequency.setCustomAttributeName("frequency");

-		frequency.setCustomAttributeType("xs:float");

+		frequency.setCustomAttributeName("freqy");

 		frequency.setCustomAttributeValue("34");

 		flexContainer.getCustomAttributes().add(frequency);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

-		FlexContainer createdFlexContainer = null;

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

+		EnergyConsumptionFlexContainer createdFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testCreateAndRetrieveEnergyConsumption", Status.KO,

@@ -94,7 +86,7 @@
 

 			return;

 		} else {

-			createdFlexContainer = (FlexContainer) response.getContent();

+			createdFlexContainer = (EnergyConsumptionFlexContainer) response.getContent();

 

 			if (!flexContainerName.equals(createdFlexContainer.getName())) {

 				createTestReport("testCreateAndRetrieveEnergyConsumption", Status.KO,

@@ -143,7 +135,7 @@
 			return;

 		} else {

 			// OK

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			EnergyConsumptionFlexContainer retrievedFlexContainer = (EnergyConsumptionFlexContainer) response.getContent();

 			try {

 				checkFlexContainer(createdFlexContainer, retrievedFlexContainer);

 			} catch (Exception e) {

@@ -161,61 +153,53 @@
 		String flexContainerName = "EnergyConsumptionFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.energyconsumption");

+		EnergyConsumptionFlexContainer flexContainer = new EnergyConsumptionFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setOntologyRef("Ontology");

 		flexContainer.setCreator("greg");

 

 		CustomAttribute powerCustomAttribute = new CustomAttribute();

 		powerCustomAttribute.setCustomAttributeName("power");

-		powerCustomAttribute.setCustomAttributeType("xs:float");

 		powerCustomAttribute.setCustomAttributeValue("342");

 		flexContainer.getCustomAttributes().add(powerCustomAttribute);

 

 		CustomAttribute absoluteEnergyConsumptionDataCustomAttribute = new CustomAttribute();

-		absoluteEnergyConsumptionDataCustomAttribute.setCustomAttributeName("absoluteEnergyConsumption");

-		absoluteEnergyConsumptionDataCustomAttribute.setCustomAttributeType("xs:float");

+		absoluteEnergyConsumptionDataCustomAttribute.setCustomAttributeName("abECn");

 		absoluteEnergyConsumptionDataCustomAttribute.setCustomAttributeValue("3434");

 		flexContainer.getCustomAttributes().add(absoluteEnergyConsumptionDataCustomAttribute);

 

 		CustomAttribute roundingEnergyConsumptionDataCustomAttribute = new CustomAttribute();

-		roundingEnergyConsumptionDataCustomAttribute.setCustomAttributeName("roundingEnergyConsumption");

-		roundingEnergyConsumptionDataCustomAttribute.setCustomAttributeType("xs:integer");

+		roundingEnergyConsumptionDataCustomAttribute.setCustomAttributeName("roECn");

 		roundingEnergyConsumptionDataCustomAttribute.setCustomAttributeValue("43242");

 		flexContainer.getCustomAttributes().add(roundingEnergyConsumptionDataCustomAttribute);

 

 		CustomAttribute significantFigures = new CustomAttribute();

-		significantFigures.setCustomAttributeName("significantDigits");

-		significantFigures.setCustomAttributeType("xs:integer");

+		significantFigures.setCustomAttributeName("sigDs");

 		significantFigures.setCustomAttributeValue("3");

 		flexContainer.getCustomAttributes().add(significantFigures);

 

 		CustomAttribute multiplyingFactors = new CustomAttribute();

-		multiplyingFactors.setCustomAttributeName("multiplyingFactors");

-		multiplyingFactors.setCustomAttributeType("xs:integer");

+		multiplyingFactors.setCustomAttributeName("mulFs");

 		multiplyingFactors.setCustomAttributeValue("100");

 		flexContainer.getCustomAttributes().add(multiplyingFactors);

 

 		CustomAttribute voltage = new CustomAttribute();

-		voltage.setCustomAttributeName("voltage");

-		voltage.setCustomAttributeType("xs:float");

+		voltage.setCustomAttributeName("volte");

 		voltage.setCustomAttributeValue("3443");

 		flexContainer.getCustomAttributes().add(voltage);

 

 		CustomAttribute current = new CustomAttribute();

-		current.setCustomAttributeName("current");

-		current.setCustomAttributeType("xs:float");

+		current.setCustomAttributeName("currt");

 		current.setCustomAttributeValue("45353");

 		flexContainer.getCustomAttributes().add(current);

 

 		CustomAttribute frequency = new CustomAttribute();

-		frequency.setCustomAttributeName("frequency");

-		frequency.setCustomAttributeType("xs:float");

+		frequency.setCustomAttributeName("freqy");

 		frequency.setCustomAttributeValue("34");

 		flexContainer.getCustomAttributes().add(frequency);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testDeleteEnergyConsumptionFlexContainer", Status.KO,

@@ -253,62 +237,54 @@
 		String flexContainerName = "EnergyConsumptionFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.energyconsumption");

+		EnergyConsumptionFlexContainer flexContainer = new EnergyConsumptionFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setOntologyRef("Ontology");

 		flexContainer.setCreator("greg");

 

 		CustomAttribute powerCustomAttribute = new CustomAttribute();

 		powerCustomAttribute.setCustomAttributeName("power");

-		powerCustomAttribute.setCustomAttributeType("xs:float");

 		powerCustomAttribute.setCustomAttributeValue("342");

 		flexContainer.getCustomAttributes().add(powerCustomAttribute);

 

 		CustomAttribute absoluteEnergyConsumptionDataCustomAttribute = new CustomAttribute();

-		absoluteEnergyConsumptionDataCustomAttribute.setCustomAttributeName("absoluteEnergyConsumption");

-		absoluteEnergyConsumptionDataCustomAttribute.setCustomAttributeType("xs:float");

+		absoluteEnergyConsumptionDataCustomAttribute.setCustomAttributeName("abECn");

 		absoluteEnergyConsumptionDataCustomAttribute.setCustomAttributeValue("3434");

 		flexContainer.getCustomAttributes().add(absoluteEnergyConsumptionDataCustomAttribute);

 

 		CustomAttribute roundingEnergyConsumptionDataCustomAttribute = new CustomAttribute();

-		roundingEnergyConsumptionDataCustomAttribute.setCustomAttributeName("roundingEnergyConsumption");

-		roundingEnergyConsumptionDataCustomAttribute.setCustomAttributeType("xs:integer");

+		roundingEnergyConsumptionDataCustomAttribute.setCustomAttributeName("roECn");

 		roundingEnergyConsumptionDataCustomAttribute.setCustomAttributeValue("43242");

 		flexContainer.getCustomAttributes().add(roundingEnergyConsumptionDataCustomAttribute);

 

 		CustomAttribute significantFigures = new CustomAttribute();

-		significantFigures.setCustomAttributeName("significantDigits");

-		significantFigures.setCustomAttributeType("xs:integer");

+		significantFigures.setCustomAttributeName("sigDs");

 		significantFigures.setCustomAttributeValue("3");

 		flexContainer.getCustomAttributes().add(significantFigures);

 

 		CustomAttribute multiplyingFactors = new CustomAttribute();

-		multiplyingFactors.setCustomAttributeName("multiplyingFactors");

-		multiplyingFactors.setCustomAttributeType("xs:integer");

+		multiplyingFactors.setCustomAttributeName("mulFs");

 		multiplyingFactors.setCustomAttributeValue("100");

 		flexContainer.getCustomAttributes().add(multiplyingFactors);

 

 		CustomAttribute voltage = new CustomAttribute();

-		voltage.setCustomAttributeName("voltage");

-		voltage.setCustomAttributeType("xs:float");

+		voltage.setCustomAttributeName("volte");

 		voltage.setCustomAttributeValue("3443");

 		flexContainer.getCustomAttributes().add(voltage);

 

 		CustomAttribute current = new CustomAttribute();

-		current.setCustomAttributeName("current");

-		current.setCustomAttributeType("xs:float");

+		current.setCustomAttributeName("currt");

 		current.setCustomAttributeValue("45353");

 		flexContainer.getCustomAttributes().add(current);

 

 		CustomAttribute frequency = new CustomAttribute();

-		frequency.setCustomAttributeName("frequency");

-		frequency.setCustomAttributeType("xs:float");

+		frequency.setCustomAttributeName("freqy");

 		frequency.setCustomAttributeValue("34");

 		flexContainer.getCustomAttributes().add(frequency);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

-		FlexContainer createdFlexContainer = null;

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

+		EnergyConsumptionFlexContainer createdFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testUpdateEnergyConsumptionFlexContainer", Status.KO,

@@ -316,14 +292,13 @@
 

 			return;

 		} else {

-			createdFlexContainer = (FlexContainer) response.getContent();

+			createdFlexContainer = (EnergyConsumptionFlexContainer) response.getContent();

 		}

 

 		// prepare Update request

-		FlexContainer toBeUpdated = new FlexContainer();

+		EnergyConsumptionFlexContainer toBeUpdated = new EnergyConsumptionFlexContainer();

 		CustomAttribute updatedVoltage = new CustomAttribute();

-		updatedVoltage.setCustomAttributeName("voltage");

-		updatedVoltage.setCustomAttributeType("xs:float");

+		updatedVoltage.setCustomAttributeName("volte");

 		updatedVoltage.setCustomAttributeValue("0");

 		toBeUpdated.getCustomAttributes().add(updatedVoltage);

 

@@ -336,7 +311,7 @@
 

 			return;

 		} else {

-			FlexContainer updatedFlexContainer = (FlexContainer) response.getContent();

+			EnergyConsumptionFlexContainer updatedFlexContainer = (EnergyConsumptionFlexContainer) response.getContent();

 			if (updatedFlexContainer.getCustomAttributes().size() != 1) {

 				createTestReport("testUpdateEnergyConsumptionFlexContainer", Status.KO,

 						"expecting 1 customAttribute, found " + updatedFlexContainer.getCustomAttributes().size()

@@ -346,12 +321,12 @@
 				return;

 			}

 

-			if (!updatedFlexContainer.getCustomAttribute("voltage").getCustomAttributeValue()

+			if (!updatedFlexContainer.getCustomAttribute("volte").getCustomAttributeValue()

 					.equals(updatedVoltage.getCustomAttributeValue())) {

 				createTestReport("testUpdateEnergyConsumptionFlexContainer", Status.KO,

 						"wrong voltage customAttribute value. Expecting: " + updatedVoltage.getCustomAttributeValue()

 								+ " , found: "

-								+ updatedFlexContainer.getCustomAttribute("voltage").getCustomAttributeValue(),

+								+ updatedFlexContainer.getCustomAttribute("volte").getCustomAttributeValue(),

 						null);

 

 				return;

@@ -367,11 +342,11 @@
 

 			return;

 		} else {

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			EnergyConsumptionFlexContainer retrievedFlexContainer = (EnergyConsumptionFlexContainer) response.getContent();

 			

 			// prepare initial flexContainer

 			createdFlexContainer.setName(flexContainerName);

-			createdFlexContainer.getCustomAttribute("voltage").setCustomAttributeValue("0");

+			createdFlexContainer.getCustomAttribute("volte").setCustomAttributeValue("0");

 			

 			try {

 				checkFlexContainer(createdFlexContainer, retrievedFlexContainer);

diff --git a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/FaultDetectionFlexContainerTest.java b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/FaultDetectionFlexContainerTest.java
index a6c5da4..38778ca 100644
--- a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/FaultDetectionFlexContainerTest.java
+++ b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/FaultDetectionFlexContainerTest.java
@@ -10,8 +10,8 @@
 import org.eclipse.om2m.commons.constants.Constants;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.FaultDetectionFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.testsuite.flexcontainer.TestReport.Status;

 

@@ -35,39 +35,36 @@
 		String flexContainerName = "FaultDetectionFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.faultdetection");

+		FaultDetectionFlexContainer flexContainer = new FaultDetectionFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setOntologyRef("OrangeOntology");

 		flexContainer.setCreator("Greg");

 

 		CustomAttribute statusCustomAttribute = new CustomAttribute();

-		statusCustomAttribute.setCustomAttributeName("status");

-		statusCustomAttribute.setCustomAttributeType("xs:boolean");

+		statusCustomAttribute.setCustomAttributeName("stats");

 		statusCustomAttribute.setCustomAttributeValue("false");

 		flexContainer.getCustomAttributes().add(statusCustomAttribute);

 

 		CustomAttribute codeCustomAttribute = new CustomAttribute();

 		codeCustomAttribute.setCustomAttributeName("code");

-		codeCustomAttribute.setCustomAttributeType("xs:integer");

 		codeCustomAttribute.setCustomAttributeValue("123");

 		flexContainer.getCustomAttributes().add(codeCustomAttribute);

 

 		CustomAttribute descriptionCustomAttribute = new CustomAttribute();

-		descriptionCustomAttribute.setCustomAttributeName("description");

-		descriptionCustomAttribute.setCustomAttributeType("xs:string");

+		descriptionCustomAttribute.setCustomAttributeName("descn");

 		descriptionCustomAttribute.setCustomAttributeValue("My description");

 		flexContainer.getCustomAttributes().add(descriptionCustomAttribute);

 

 		// send create Request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

-		FlexContainer createdFlexContainer = null;

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

+		FaultDetectionFlexContainer createdFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testCreateFaultDetectionFlexContainer", Status.KO,

 					"unable to create FaultDetectionFlexContainer", null);

 			return;

 		} else {

-			createdFlexContainer = (FlexContainer) response.getContent();

+			createdFlexContainer = (FaultDetectionFlexContainer) response.getContent();

 

 			if (!flexContainerName.equals(createdFlexContainer.getName())) {

 				createTestReport("testCreateFaultDetectionFlexContainer", Status.KO,

@@ -125,7 +122,7 @@
 					null);

 			return;

 		} else {

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			FaultDetectionFlexContainer retrievedFlexContainer = (FaultDetectionFlexContainer) response.getContent();

 			try {

 				checkFlexContainer(createdFlexContainer, retrievedFlexContainer);

 			} catch (Exception e) {

@@ -145,31 +142,28 @@
 		String flexContainerName = "FaultDetectionFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.faultdetection");

+		FaultDetectionFlexContainer flexContainer = new FaultDetectionFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setOntologyRef("OrangeOntology");

 		flexContainer.setCreator("Greg");

 

 		CustomAttribute statusCustomAttribute = new CustomAttribute();

-		statusCustomAttribute.setCustomAttributeName("status");

-		statusCustomAttribute.setCustomAttributeType("xs:boolean");

+		statusCustomAttribute.setCustomAttributeName("stats");

 		statusCustomAttribute.setCustomAttributeValue("false");

 		flexContainer.getCustomAttributes().add(statusCustomAttribute);

 

 		CustomAttribute codeCustomAttribute = new CustomAttribute();

 		codeCustomAttribute.setCustomAttributeName("code");

-		codeCustomAttribute.setCustomAttributeType("xs:integer");

 		codeCustomAttribute.setCustomAttributeValue("123");

 		flexContainer.getCustomAttributes().add(codeCustomAttribute);

 

 		CustomAttribute descriptionCustomAttribute = new CustomAttribute();

-		descriptionCustomAttribute.setCustomAttributeName("description");

-		descriptionCustomAttribute.setCustomAttributeType("xs:string");

+		descriptionCustomAttribute.setCustomAttributeName("descn");

 		descriptionCustomAttribute.setCustomAttributeValue("My description");

 		flexContainer.getCustomAttributes().add(descriptionCustomAttribute);

 

 		// send create Request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testUpdateFaultDetectionFlexContainer", Status.KO,

@@ -178,25 +172,23 @@
 		}

 

 		// update the status value

-		FlexContainer flexContainerToBeUpdated = new FlexContainer();

-		flexContainerToBeUpdated.setContainerDefinition("org.onem2m.home.moduleclass.faultdetection");

+		FaultDetectionFlexContainer flexContainerToBeUpdated = new FaultDetectionFlexContainer();

 		CustomAttribute statusCustomAttributeToBeUpdated = new CustomAttribute();

-		statusCustomAttributeToBeUpdated.setCustomAttributeName("status");

-		statusCustomAttributeToBeUpdated.setCustomAttributeType("xs:boolean");

+		statusCustomAttributeToBeUpdated.setCustomAttributeName("stats");

 		statusCustomAttributeToBeUpdated.setCustomAttributeValue("true");

 		flexContainerToBeUpdated.getCustomAttributes().add(statusCustomAttributeToBeUpdated);

 

 		// send UPDATE request

 		response = sendUpdateFlexContainerRequest(flexContainerLocation, flexContainerToBeUpdated);

-		FlexContainer updatedFlexContainer = null;

+		FaultDetectionFlexContainer updatedFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.UPDATED)) {

 			// KO

 			createTestReport("testUpdateFaultDetectionFlexContainer", Status.KO,

 					"unable to update FaultDetectionFlexContainer", null);

 			return;

 		} else {

-			updatedFlexContainer = (FlexContainer) response.getContent();

-			if (!updatedFlexContainer.getCustomAttribute("status").getCustomAttributeValue().equals("true")) {

+			updatedFlexContainer = (FaultDetectionFlexContainer) response.getContent();

+			if (!updatedFlexContainer.getCustomAttribute("stats").getCustomAttributeValue().equals("true")) {

 				createTestReport("testUpdateFaultDetectionFlexContainer", Status.KO,

 						"expected \"true\" value for status custom attribute", null);

 				return;

@@ -211,31 +203,28 @@
 		String flexContainerName = "FaultDetectionFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.faultdetection");

+		FaultDetectionFlexContainer flexContainer = new FaultDetectionFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setOntologyRef("OrangeOntology");

 		flexContainer.setCreator("Greg");

 

 		CustomAttribute statusCustomAttribute = new CustomAttribute();

-		statusCustomAttribute.setCustomAttributeName("status");

-		statusCustomAttribute.setCustomAttributeType("xs:boolean");

+		statusCustomAttribute.setCustomAttributeName("stats");

 		statusCustomAttribute.setCustomAttributeValue("false");

 		flexContainer.getCustomAttributes().add(statusCustomAttribute);

 

 		CustomAttribute codeCustomAttribute = new CustomAttribute();

 		codeCustomAttribute.setCustomAttributeName("code");

-		codeCustomAttribute.setCustomAttributeType("xs:integer");

 		codeCustomAttribute.setCustomAttributeValue("123");

 		flexContainer.getCustomAttributes().add(codeCustomAttribute);

 

 		CustomAttribute descriptionCustomAttribute = new CustomAttribute();

-		descriptionCustomAttribute.setCustomAttributeName("description");

-		descriptionCustomAttribute.setCustomAttributeType("xs:string");

+		descriptionCustomAttribute.setCustomAttributeName("descn");

 		descriptionCustomAttribute.setCustomAttributeValue("My description");

 		flexContainer.getCustomAttributes().add(descriptionCustomAttribute);

 

 		// send create Request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testDeleteFaultDetectionFlexContainer", Status.KO,

diff --git a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/FlexContainerTestSuite.java b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/FlexContainerTestSuite.java
index 5526051..9660456 100644
--- a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/FlexContainerTestSuite.java
+++ b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/FlexContainerTestSuite.java
@@ -18,13 +18,12 @@
 import org.eclipse.om2m.commons.constants.Operation;

 import org.eclipse.om2m.commons.constants.ResourceType;

 import org.eclipse.om2m.commons.constants.ResultContent;

+import org.eclipse.om2m.commons.resource.AbstractFlexContainer;

 import org.eclipse.om2m.commons.resource.AccessControlPolicy;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.RequestPrimitive;

 import org.eclipse.om2m.commons.resource.Resource;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

-import org.eclipse.om2m.commons.resource.ResponseTypeInfo;

 import org.eclipse.om2m.commons.resource.Subscription;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.testsuite.flexcontainer.TestReport.Status;

@@ -71,9 +70,9 @@
 		printTestReports();

 	}

 

-	protected ResponsePrimitive sendCreateFlexContainerRequest(FlexContainer flexContainer, String resourceLocation,

-			String resourceName, String from) {

-		return sendCreateRequest(resourceLocation, resourceName, ResourceType.FLEXCONTAINER, flexContainer, from);

+	protected ResponsePrimitive sendCreateFlexContainerRequest(AbstractFlexContainer flexContainer, String resourceLocation,

+			String from) {

+		return sendCreateRequest(resourceLocation, ResourceType.FLEXCONTAINER, flexContainer, from);

 	}

 

 	/**

@@ -84,35 +83,37 @@
 	 * @param resourceLocation

 	 * @param resourceName

 	 */

-	protected ResponsePrimitive sendCreateFlexContainerRequest(FlexContainer flexContainer, String resourceLocation,

-			String resourceName) {

-		return sendCreateRequest(resourceLocation, resourceName, ResourceType.FLEXCONTAINER, flexContainer,

+	protected ResponsePrimitive sendCreateFlexContainerRequest(AbstractFlexContainer flexContainer, String resourceLocation) {

+		return sendCreateRequest(resourceLocation, ResourceType.FLEXCONTAINER, flexContainer,

 				Constants.ADMIN_REQUESTING_ENTITY);

 	}

 

-	protected ResponsePrimitive sendCreateSubscriptionRequest(Subscription subscription, String resourceLocation,

-			String resourceName) {

-		return sendCreateRequest(resourceLocation, resourceName, ResourceType.SUBSCRIPTION, subscription,

-				Constants.ADMIN_REQUESTING_ENTITY);

+	protected ResponsePrimitive sendCreateSubscriptionRequest(Subscription subscription, String resourceLocation, String returnContentType) {

+		return sendCreateRequest(resourceLocation, ResourceType.SUBSCRIPTION, subscription,

+				Constants.ADMIN_REQUESTING_ENTITY, MimeMediaType.OBJ, returnContentType);

 	}

 

 	protected ResponsePrimitive sendCreateAccessControlPolicyRequest(AccessControlPolicy policy,

-			String resourceLocation, String resourceName) {

-		return sendCreateRequest(resourceLocation, resourceName, ResourceType.ACCESS_CONTROL_POLICY, policy,

+			String resourceLocation) {

+		return sendCreateRequest(resourceLocation, ResourceType.ACCESS_CONTROL_POLICY, policy,

 				Constants.ADMIN_REQUESTING_ENTITY);

 	}

 

-	private ResponsePrimitive sendCreateRequest(String resourceLocation, String resourceName, int resourceType,

+	private ResponsePrimitive sendCreateRequest(String resourceLocation, int resourceType,

 			Resource resource, String from) {

+		return sendCreateRequest(resourceLocation, resourceType, resource, from, MimeMediaType.OBJ, MimeMediaType.OBJ);

+	}

+	

+	private ResponsePrimitive sendCreateRequest(String resourceLocation, int resourceType,

+			Resource resource, String from, String requestContentType, String returnContentType) {

 		RequestPrimitive request = new RequestPrimitive();

 		request.setContent(resource);

 		request.setFrom(from);

 		request.setTargetId(resourceLocation);

 		request.setTo(resourceLocation);

 		request.setResourceType(BigInteger.valueOf(resourceType));

-		request.setRequestContentType(MimeMediaType.OBJ);

-		request.setReturnContentType(MimeMediaType.OBJ);

-		request.setName(resourceName);

+		request.setRequestContentType(requestContentType);

+		request.setReturnContentType(returnContentType);

 		request.setOperation(Operation.CREATE);

 		ResponsePrimitive response = cseService.doRequest(request);

 		return response;

@@ -125,7 +126,7 @@
 	 *            flexContainer to be created

 	 * @param resourceLocation

 	 */

-	protected ResponsePrimitive sendUpdateFlexContainerRequest(String resourceLocation, FlexContainer flexContainer) {

+	protected ResponsePrimitive sendUpdateFlexContainerRequest(String resourceLocation, AbstractFlexContainer flexContainer) {

 		return sendUpdateRequest(resourceLocation, ResourceType.FLEXCONTAINER, flexContainer);

 	}

 

@@ -218,7 +219,7 @@
 		return response;

 	}

 

-	protected void checkFlexContainer(FlexContainer initial, FlexContainer toBeCompared) throws Exception {

+	protected void checkFlexContainer(AbstractFlexContainer initial, AbstractFlexContainer toBeCompared) throws Exception {

 

 		checkFlexContainerName(initial, toBeCompared);

 		checkFlexContainerDefinition(initial, toBeCompared);

@@ -228,19 +229,19 @@
 

 	}

 

-	protected void checkFlexContainerName(FlexContainer initial, FlexContainer toBeCompared) throws Exception {

+	protected void checkFlexContainerName(AbstractFlexContainer initial, AbstractFlexContainer toBeCompared) throws Exception {

 		if (!initial.getName().equals(toBeCompared.getName())) {

 			throw new Exception("name are not equal");

 		}

 	}

 

-	protected void checkFlexContainerDefinition(FlexContainer initial, FlexContainer toBeCompared) throws Exception {

+	protected void checkFlexContainerDefinition(AbstractFlexContainer initial, AbstractFlexContainer toBeCompared) throws Exception {

 		if (!initial.getContainerDefinition().equals(toBeCompared.getContainerDefinition())) {

 			throw new Exception("containerDefinition are not equal");

 		}

 	}

 

-	protected void checkFlexContainerOntologyRef(FlexContainer initial, FlexContainer toBeCompared) throws Exception {

+	protected void checkFlexContainerOntologyRef(AbstractFlexContainer initial, AbstractFlexContainer toBeCompared) throws Exception {

 

 		if ((initial.getOntologyRef() == null) && (toBeCompared.getOntologyRef() != null)) {

 			throw new Exception("ontologyRef are not equal");

@@ -250,7 +251,7 @@
 		}

 	}

 

-	protected void checkFlexContainerCreator(FlexContainer initial, FlexContainer toBeCompared) throws Exception {

+	protected void checkFlexContainerCreator(AbstractFlexContainer initial, AbstractFlexContainer toBeCompared) throws Exception {

 

 		if ((initial.getCreator() == null) && (toBeCompared.getCreator() != null)) {

 			throw new Exception("creator are not equal");

@@ -261,7 +262,7 @@
 		}

 	}

 

-	protected void checkFlexContainerCustomAttribute(FlexContainer initial, FlexContainer toBeCompared)

+	protected void checkFlexContainerCustomAttribute(AbstractFlexContainer initial, AbstractFlexContainer toBeCompared)

 			throws Exception {

 		if (initial.getCustomAttributes().size() != toBeCompared.getCustomAttributes().size()) {

 			throw new Exception("customAttributes list size are not equal");

@@ -290,15 +291,6 @@
 							+ ", toBeComparedCaName=" + toBeComparedCa.getCustomAttributeName());

 		}

 

-		// type may be null

-		if ((initialCa.getCustomAttributeType() == null) && (toBeComparedCa.getCustomAttributeType() != null)) {

-			throw new Exception("initialCa type is null but toBeComparedCa type is not null");

-		}

-		if (!initialCa.getCustomAttributeType().equals(toBeComparedCa.getCustomAttributeType())) {

-			throw new Exception(

-					"customAttributeType are differents (initialCaType=" + initialCa.getCustomAttributeType()

-							+ ", toBeComparedCaType=" + toBeComparedCa.getCustomAttributeType());

-		}

 

 		// value may be null

 		if ((initialCa.getCustomAttributeValue() == null) && (toBeComparedCa.getCustomAttributeValue() != null)) {

diff --git a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/FloodDetectorFlexContainerTest.java b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/FloodDetectorFlexContainerTest.java
index 67f1e75..92ed9d8 100644
--- a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/FloodDetectorFlexContainerTest.java
+++ b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/FloodDetectorFlexContainerTest.java
@@ -10,8 +10,8 @@
 import org.eclipse.om2m.commons.constants.Constants;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceFloodDetectorFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.testsuite.flexcontainer.TestReport.Status;

 

@@ -31,51 +31,46 @@
 		String flexContainerName = "FloodDetectorFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.device.deviceflooddetector");

+		DeviceFloodDetectorFlexContainer flexContainer = new DeviceFloodDetectorFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("OntologyRef");

 

 		CustomAttribute serialNumberCA = new CustomAttribute();

-		serialNumberCA.setCustomAttributeName("propDeviceSerialNum");

-		serialNumberCA.setCustomAttributeType("xs:string");

+		serialNumberCA.setCustomAttributeName("pDSNm");

 		serialNumberCA.setCustomAttributeValue("sn1");

 		flexContainer.getCustomAttributes().add(serialNumberCA);

 

 		CustomAttribute locationCA = new CustomAttribute();

-		locationCA.setCustomAttributeName("propLocation");

-		locationCA.setCustomAttributeType("xs:string");

+		locationCA.setCustomAttributeName("proLn");

 		locationCA.setCustomAttributeValue("kitchen");

 		flexContainer.getCustomAttributes().add(locationCA);

 

 		CustomAttribute deviceManufacturerCA = new CustomAttribute();

-		deviceManufacturerCA.setCustomAttributeName("propDeviceManufacturer");

-		deviceManufacturerCA.setCustomAttributeType("xs:string");

+		deviceManufacturerCA.setCustomAttributeName("prDMr");

 		deviceManufacturerCA.setCustomAttributeValue("Orange");

 		flexContainer.getCustomAttributes().add(deviceManufacturerCA);

 

 		CustomAttribute protocolCA = new CustomAttribute();

-		protocolCA.setCustomAttributeName("propProtocol");

-		protocolCA.setCustomAttributeType("xs:string");

+		protocolCA.setCustomAttributeName("proPl");

 		protocolCA.setCustomAttributeValue("ZigBee");

 		flexContainer.getCustomAttributes().add(protocolCA);

 

 		CustomAttribute deviceModelCA = new CustomAttribute();

-		deviceModelCA.setCustomAttributeName("propDeviceModelName");

-		deviceModelCA.setCustomAttributeType("xs:string");

+		deviceModelCA.setCustomAttributeName("pDMNe");

 		deviceModelCA.setCustomAttributeValue("Model1");

 		flexContainer.getCustomAttributes().add(deviceModelCA);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

-		FlexContainer createdFlexContainer = null;

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

+		DeviceFloodDetectorFlexContainer createdFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testCreateAndRetrieveFloodDetectorFlexContainer", Status.KO,

 					"unable to create FloodDetector FlexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			createdFlexContainer = (FlexContainer) response.getContent();

+			createdFlexContainer = (DeviceFloodDetectorFlexContainer) response.getContent();

 

 			if (!flexContainerName.equals(createdFlexContainer.getName())) {

 				createTestReport("testCreateAndRetrieveFloodDetectorFlexContainer", Status.KO,

@@ -103,7 +98,7 @@
 					"unable to retrieve FloodDetector FlexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			DeviceFloodDetectorFlexContainer retrievedFlexContainer = (DeviceFloodDetectorFlexContainer) response.getContent();

 			try {

 				checkFlexContainer(createdFlexContainer, retrievedFlexContainer);

 			} catch (Exception e) {

@@ -122,43 +117,38 @@
 		String flexContainerName = "FloodDetectorFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.device.deviceflooddetector");

+		DeviceFloodDetectorFlexContainer flexContainer = new DeviceFloodDetectorFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("OntologyRef");

 

 		CustomAttribute serialNumberCA = new CustomAttribute();

-		serialNumberCA.setCustomAttributeName("propDeviceSerialNum");

-		serialNumberCA.setCustomAttributeType("xs:string");

+		serialNumberCA.setCustomAttributeName("pDSNm");

 		serialNumberCA.setCustomAttributeValue("sn1");

 		flexContainer.getCustomAttributes().add(serialNumberCA);

 

 		CustomAttribute locationCA = new CustomAttribute();

-		locationCA.setCustomAttributeName("propLocation");

-		locationCA.setCustomAttributeType("xs:string");

+		locationCA.setCustomAttributeName("proLn");

 		locationCA.setCustomAttributeValue("kitchen");

 		flexContainer.getCustomAttributes().add(locationCA);

 

 		CustomAttribute deviceManufacturerCA = new CustomAttribute();

-		deviceManufacturerCA.setCustomAttributeName("propDeviceManufacturer");

-		deviceManufacturerCA.setCustomAttributeType("xs:string");

+		deviceManufacturerCA.setCustomAttributeName("prDMr");

 		deviceManufacturerCA.setCustomAttributeValue("Orange");

 		flexContainer.getCustomAttributes().add(deviceManufacturerCA);

 

 		CustomAttribute protocolCA = new CustomAttribute();

-		protocolCA.setCustomAttributeName("propProtocol");

-		protocolCA.setCustomAttributeType("xs:string");

+		protocolCA.setCustomAttributeName("proPl");

 		protocolCA.setCustomAttributeValue("ZigBee");

 		flexContainer.getCustomAttributes().add(protocolCA);

 

 		CustomAttribute deviceModelCA = new CustomAttribute();

-		deviceModelCA.setCustomAttributeName("propDeviceModelName");

-		deviceModelCA.setCustomAttributeType("xs:string");

+		deviceModelCA.setCustomAttributeName("pDMNe");

 		deviceModelCA.setCustomAttributeValue("Model1");

 		flexContainer.getCustomAttributes().add(deviceModelCA);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testDeleteFloodDetectorFlexContainer", Status.KO,

diff --git a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/GasValveFlexContainerTest.java b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/GasValveFlexContainerTest.java
index 95d9163..4250fec 100644
--- a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/GasValveFlexContainerTest.java
+++ b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/GasValveFlexContainerTest.java
@@ -10,8 +10,8 @@
 import org.eclipse.om2m.commons.constants.Constants;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceGasValveFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.testsuite.flexcontainer.TestReport.Status;

 

@@ -31,51 +31,46 @@
 		String flexContainerName = "GasValveFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.device.devicegasvalve");

+		DeviceGasValveFlexContainer flexContainer = new DeviceGasValveFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("OntologyRef");

 

 		CustomAttribute serialNumberCA = new CustomAttribute();

-		serialNumberCA.setCustomAttributeName("propDeviceSerialNum");

-		serialNumberCA.setCustomAttributeType("xs:string");

+		serialNumberCA.setCustomAttributeName("pDSNm");

 		serialNumberCA.setCustomAttributeValue("sn1");

 		flexContainer.getCustomAttributes().add(serialNumberCA);

 

 		CustomAttribute locationCA = new CustomAttribute();

-		locationCA.setCustomAttributeName("propLocation");

-		locationCA.setCustomAttributeType("xs:string");

+		locationCA.setCustomAttributeName("proLn");

 		locationCA.setCustomAttributeValue("kitchen");

 		flexContainer.getCustomAttributes().add(locationCA);

 

 		CustomAttribute deviceManufacturerCA = new CustomAttribute();

-		deviceManufacturerCA.setCustomAttributeName("propDeviceManufacturer");

-		deviceManufacturerCA.setCustomAttributeType("xs:string");

+		deviceManufacturerCA.setCustomAttributeName("prDMr");

 		deviceManufacturerCA.setCustomAttributeValue("Orange");

 		flexContainer.getCustomAttributes().add(deviceManufacturerCA);

 

 		CustomAttribute protocolCA = new CustomAttribute();

-		protocolCA.setCustomAttributeName("propProtocol");

-		protocolCA.setCustomAttributeType("xs:string");

+		protocolCA.setCustomAttributeName("proPl");

 		protocolCA.setCustomAttributeValue("ZigBee");

 		flexContainer.getCustomAttributes().add(protocolCA);

 

 		CustomAttribute deviceModelCA = new CustomAttribute();

-		deviceModelCA.setCustomAttributeName("propDeviceModelName");

-		deviceModelCA.setCustomAttributeType("xs:string");

+		deviceModelCA.setCustomAttributeName("pDMNe");

 		deviceModelCA.setCustomAttributeValue("Model1");

 		flexContainer.getCustomAttributes().add(deviceModelCA);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

-		FlexContainer createdFlexContainer = null;

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

+		DeviceGasValveFlexContainer createdFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testCreateAndRetrieveGasValveFlexContainer", Status.KO,

 					"unable to create GasValve FlexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			createdFlexContainer = (FlexContainer) response.getContent();

+			createdFlexContainer = (DeviceGasValveFlexContainer) response.getContent();

 

 			if (!flexContainerName.equals(createdFlexContainer.getName())) {

 				createTestReport("testCreateAndRetrieveGasValveFlexContainer", Status.KO,

@@ -103,7 +98,7 @@
 					"unable to retrieve GasValve FlexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			DeviceGasValveFlexContainer retrievedFlexContainer = (DeviceGasValveFlexContainer) response.getContent();

 			try {

 				checkFlexContainer(createdFlexContainer, retrievedFlexContainer);

 			} catch (Exception e) {

@@ -122,43 +117,38 @@
 		String flexContainerName = "GasValveFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.device.devicegasvalve");

+		DeviceGasValveFlexContainer flexContainer = new DeviceGasValveFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("OntologyRef");

 

 		CustomAttribute serialNumberCA = new CustomAttribute();

-		serialNumberCA.setCustomAttributeName("propDeviceSerialNum");

-		serialNumberCA.setCustomAttributeType("xs:string");

+		serialNumberCA.setCustomAttributeName("pDSNm");

 		serialNumberCA.setCustomAttributeValue("sn1");

 		flexContainer.getCustomAttributes().add(serialNumberCA);

 

 		CustomAttribute locationCA = new CustomAttribute();

-		locationCA.setCustomAttributeName("propLocation");

-		locationCA.setCustomAttributeType("xs:string");

+		locationCA.setCustomAttributeName("proLn");

 		locationCA.setCustomAttributeValue("kitchen");

 		flexContainer.getCustomAttributes().add(locationCA);

 

 		CustomAttribute deviceManufacturerCA = new CustomAttribute();

-		deviceManufacturerCA.setCustomAttributeName("propDeviceManufacturer");

-		deviceManufacturerCA.setCustomAttributeType("xs:string");

+		deviceManufacturerCA.setCustomAttributeName("prDMr");

 		deviceManufacturerCA.setCustomAttributeValue("Orange");

 		flexContainer.getCustomAttributes().add(deviceManufacturerCA);

 

 		CustomAttribute protocolCA = new CustomAttribute();

-		protocolCA.setCustomAttributeName("propProtocol");

-		protocolCA.setCustomAttributeType("xs:string");

+		protocolCA.setCustomAttributeName("proPl");

 		protocolCA.setCustomAttributeValue("ZigBee");

 		flexContainer.getCustomAttributes().add(protocolCA);

 

 		CustomAttribute deviceModelCA = new CustomAttribute();

-		deviceModelCA.setCustomAttributeName("propDeviceModelName");

-		deviceModelCA.setCustomAttributeType("xs:string");

+		deviceModelCA.setCustomAttributeName("pDMNe");

 		deviceModelCA.setCustomAttributeValue("Model1");

 		flexContainer.getCustomAttributes().add(deviceModelCA);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testDeleteGasValveFlexContainer", Status.KO,

diff --git a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/LightDeviceFlexContainerTest.java b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/LightDeviceFlexContainerTest.java
index 677df7f..0cd8b99 100644
--- a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/LightDeviceFlexContainerTest.java
+++ b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/LightDeviceFlexContainerTest.java
@@ -10,8 +10,8 @@
 import org.eclipse.om2m.commons.constants.Constants;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceLightFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.testsuite.flexcontainer.TestReport.Status;

 

@@ -31,51 +31,46 @@
 		String flexContainerName = "LightDeviceFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.device.devicelight");

+		DeviceLightFlexContainer flexContainer = new DeviceLightFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("OntologyRef");

 

 		CustomAttribute serialNumberCA = new CustomAttribute();

-		serialNumberCA.setCustomAttributeName("propDeviceSerialNum");

-		serialNumberCA.setCustomAttributeType("xs:string");

+		serialNumberCA.setCustomAttributeName("pDSNm");

 		serialNumberCA.setCustomAttributeValue("sn1");

 		flexContainer.getCustomAttributes().add(serialNumberCA);

 

 		CustomAttribute locationCA = new CustomAttribute();

-		locationCA.setCustomAttributeName("propLocation");

-		locationCA.setCustomAttributeType("xs:string");

+		locationCA.setCustomAttributeName("proLn");

 		locationCA.setCustomAttributeValue("kitchen");

 		flexContainer.getCustomAttributes().add(locationCA);

 

 		CustomAttribute deviceManufacturerCA = new CustomAttribute();

-		deviceManufacturerCA.setCustomAttributeName("propDeviceManufacturer");

-		deviceManufacturerCA.setCustomAttributeType("xs:string");

+		deviceManufacturerCA.setCustomAttributeName("prDMr");

 		deviceManufacturerCA.setCustomAttributeValue("Orange");

 		flexContainer.getCustomAttributes().add(deviceManufacturerCA);

 

 		CustomAttribute protocolCA = new CustomAttribute();

-		protocolCA.setCustomAttributeName("propProtocol");

-		protocolCA.setCustomAttributeType("xs:string");

+		protocolCA.setCustomAttributeName("proPl");

 		protocolCA.setCustomAttributeValue("ZigBee");

 		flexContainer.getCustomAttributes().add(protocolCA);

 

 		CustomAttribute deviceModelCA = new CustomAttribute();

-		deviceModelCA.setCustomAttributeName("propDeviceModelName");

-		deviceModelCA.setCustomAttributeType("xs:string");

+		deviceModelCA.setCustomAttributeName("pDMNe");

 		deviceModelCA.setCustomAttributeValue("Model1");

 		flexContainer.getCustomAttributes().add(deviceModelCA);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

-		FlexContainer createdFlexContainer = null;

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

+		DeviceLightFlexContainer createdFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testCreateAndRetrieveLightDevice", Status.KO,

 					"unable to create LightDevice FlexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			createdFlexContainer = (FlexContainer) response.getContent();

+			createdFlexContainer = (DeviceLightFlexContainer) response.getContent();

 

 			if (!flexContainerName.equals(createdFlexContainer.getName())) {

 				createTestReport("testCreateAndRetrieveLightDevice", Status.KO,

@@ -103,7 +98,7 @@
 					"unable to retrieve LightDevice FlexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			DeviceLightFlexContainer retrievedFlexContainer = (DeviceLightFlexContainer) response.getContent();

 			try {

 				checkFlexContainer(createdFlexContainer, retrievedFlexContainer);

 			} catch (Exception e) {

@@ -122,43 +117,38 @@
 		String flexContainerName = "LightDeviceFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.device.devicelight");

+		DeviceLightFlexContainer flexContainer = new DeviceLightFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("OntologyRef");

 

 		CustomAttribute serialNumberCA = new CustomAttribute();

-		serialNumberCA.setCustomAttributeName("propDeviceSerialNum");

-		serialNumberCA.setCustomAttributeType("xs:string");

+		serialNumberCA.setCustomAttributeName("pDSNm");

 		serialNumberCA.setCustomAttributeValue("sn1");

 		flexContainer.getCustomAttributes().add(serialNumberCA);

 

 		CustomAttribute locationCA = new CustomAttribute();

-		locationCA.setCustomAttributeName("propLocation");

-		locationCA.setCustomAttributeType("xs:string");

+		locationCA.setCustomAttributeName("proLn");

 		locationCA.setCustomAttributeValue("kitchen");

 		flexContainer.getCustomAttributes().add(locationCA);

 

 		CustomAttribute deviceManufacturerCA = new CustomAttribute();

-		deviceManufacturerCA.setCustomAttributeName("propDeviceManufacturer");

-		deviceManufacturerCA.setCustomAttributeType("xs:string");

+		deviceManufacturerCA.setCustomAttributeName("prDMr");

 		deviceManufacturerCA.setCustomAttributeValue("Orange");

 		flexContainer.getCustomAttributes().add(deviceManufacturerCA);

 

 		CustomAttribute protocolCA = new CustomAttribute();

-		protocolCA.setCustomAttributeName("propProtocol");

-		protocolCA.setCustomAttributeType("xs:string");

+		protocolCA.setCustomAttributeName("proPl");

 		protocolCA.setCustomAttributeValue("ZigBee");

 		flexContainer.getCustomAttributes().add(protocolCA);

 

 		CustomAttribute deviceModelCA = new CustomAttribute();

-		deviceModelCA.setCustomAttributeName("propDeviceModelName");

-		deviceModelCA.setCustomAttributeType("xs:string");

+		deviceModelCA.setCustomAttributeName("pDMNe");

 		deviceModelCA.setCustomAttributeValue("Model1");

 		flexContainer.getCustomAttributes().add(deviceModelCA);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testDeleteLightDeviceFlexContainer", Status.KO,

diff --git a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/LightFlexContainerTest.java b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/LightFlexContainerTest.java
index e13146b..b9dfe29 100644
--- a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/LightFlexContainerTest.java
+++ b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/LightFlexContainerTest.java
@@ -10,8 +10,8 @@
 import org.eclipse.om2m.commons.constants.Constants;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceLightFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.testsuite.flexcontainer.TestReport.Status;

 

@@ -32,38 +32,33 @@
 		String flexContainerName = "LightFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.light");

+		DeviceLightFlexContainer flexContainer = new DeviceLightFlexContainer();

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("Orange");

 

 		CustomAttribute illuminanceLevelCustomAttribute = new CustomAttribute();

 		illuminanceLevelCustomAttribute.setCustomAttributeName("illuminanceLevel");

-		illuminanceLevelCustomAttribute.setCustomAttributeType("xs:integer");

 		illuminanceLevelCustomAttribute.setCustomAttributeValue("90");

 		flexContainer.getCustomAttributes().add(illuminanceLevelCustomAttribute);

 

 		CustomAttribute illuminanceStepLevelCustomAttribute = new CustomAttribute();

 		illuminanceStepLevelCustomAttribute.setCustomAttributeName("illuminanceStepLevel");

-		illuminanceStepLevelCustomAttribute.setCustomAttributeType("xs:integer");

 		illuminanceStepLevelCustomAttribute.setCustomAttributeValue("1");

 		flexContainer.getCustomAttributes().add(illuminanceStepLevelCustomAttribute);

 

 		CustomAttribute modeCustomAttribute = new CustomAttribute();

 		modeCustomAttribute.setCustomAttributeName("mode");

-		modeCustomAttribute.setCustomAttributeType("xs:string");

 		modeCustomAttribute.setCustomAttributeValue("normal");

 		flexContainer.getCustomAttributes().add(modeCustomAttribute);

 

 		CustomAttribute rgbColorSettingCustomAttribute = new CustomAttribute();

 		rgbColorSettingCustomAttribute.setCustomAttributeName("rgbColorSetting");

-		rgbColorSettingCustomAttribute.setCustomAttributeType("xs:integer");

 		rgbColorSettingCustomAttribute.setCustomAttributeValue(new Integer(0x222222).toString());

 		flexContainer.getCustomAttributes().add(rgbColorSettingCustomAttribute);

 

 		// send CREATE request

 		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

-		FlexContainer createdFlexContainer = null;

+		DeviceLightFlexContainer createdFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testCreateAndRetrieveLightFlexContainer", Status.KO,

@@ -71,7 +66,7 @@
 			return;

 		} else {

 			// OK

-			createdFlexContainer = (FlexContainer) response.getContent();

+			createdFlexContainer = (DeviceLightFlexContainer) response.getContent();

 

 			if (!createdFlexContainer.getName().equals(flexContainerName)) {

 				createTestReport("testCreateAndRetrieveLightFlexContainer", Status.KO,

@@ -123,7 +118,7 @@
 			return;

 		} else {

 			// OK

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			DeviceLightFlexContainer retrievedFlexContainer = (DeviceLightFlexContainer) response.getContent();

 			try {

 				checkFlexContainer(createdFlexContainer, retrievedFlexContainer);

 			} catch (Exception e) {

@@ -142,32 +137,27 @@
 		String flexContainerName = "LightFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.light");

+		DeviceLightFlexContainer flexContainer = new DeviceLightFlexContainer();

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("Orange");

 

 		CustomAttribute illuminanceLevelCustomAttribute = new CustomAttribute();

 		illuminanceLevelCustomAttribute.setCustomAttributeName("illuminanceLevel");

-		illuminanceLevelCustomAttribute.setCustomAttributeType("xs:integer");

 		illuminanceLevelCustomAttribute.setCustomAttributeValue("90");

 		flexContainer.getCustomAttributes().add(illuminanceLevelCustomAttribute);

 

 		CustomAttribute illuminanceStepLevelCustomAttribute = new CustomAttribute();

 		illuminanceStepLevelCustomAttribute.setCustomAttributeName("illuminanceStepLevel");

-		illuminanceStepLevelCustomAttribute.setCustomAttributeType("xs:integer");

 		illuminanceStepLevelCustomAttribute.setCustomAttributeValue("1");

 		flexContainer.getCustomAttributes().add(illuminanceStepLevelCustomAttribute);

 

 		CustomAttribute modeCustomAttribute = new CustomAttribute();

 		modeCustomAttribute.setCustomAttributeName("mode");

-		modeCustomAttribute.setCustomAttributeType("xs:string");

 		modeCustomAttribute.setCustomAttributeValue("normal");

 		flexContainer.getCustomAttributes().add(modeCustomAttribute);

 

 		CustomAttribute rgbColorSettingCustomAttribute = new CustomAttribute();

 		rgbColorSettingCustomAttribute.setCustomAttributeName("rgbColorSetting");

-		rgbColorSettingCustomAttribute.setCustomAttributeType("xs:integer");

 		rgbColorSettingCustomAttribute.setCustomAttributeValue(new Integer(0x222222).toString());

 		flexContainer.getCustomAttributes().add(rgbColorSettingCustomAttribute);

 

@@ -208,52 +198,46 @@
 		String flexContainerName = "LightFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.light");

+		DeviceLightFlexContainer flexContainer = new DeviceLightFlexContainer();

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("Orange");

 

 		CustomAttribute illuminanceLevelCustomAttribute = new CustomAttribute();

 		illuminanceLevelCustomAttribute.setCustomAttributeName("illuminanceLevel");

-		illuminanceLevelCustomAttribute.setCustomAttributeType("xs:integer");

 		illuminanceLevelCustomAttribute.setCustomAttributeValue("90");

 		flexContainer.getCustomAttributes().add(illuminanceLevelCustomAttribute);

 

 		CustomAttribute illuminanceStepLevelCustomAttribute = new CustomAttribute();

 		illuminanceStepLevelCustomAttribute.setCustomAttributeName("illuminanceStepLevel");

-		illuminanceStepLevelCustomAttribute.setCustomAttributeType("xs:integer");

 		illuminanceStepLevelCustomAttribute.setCustomAttributeValue("1");

 		flexContainer.getCustomAttributes().add(illuminanceStepLevelCustomAttribute);

 

 		CustomAttribute modeCustomAttribute = new CustomAttribute();

 		modeCustomAttribute.setCustomAttributeName("mode");

-		modeCustomAttribute.setCustomAttributeType("xs:string");

 		modeCustomAttribute.setCustomAttributeValue("normal");

 		flexContainer.getCustomAttributes().add(modeCustomAttribute);

 

 		CustomAttribute rgbColorSettingCustomAttribute = new CustomAttribute();

 		rgbColorSettingCustomAttribute.setCustomAttributeName("rgbColorSetting");

-		rgbColorSettingCustomAttribute.setCustomAttributeType("xs:integer");

 		rgbColorSettingCustomAttribute.setCustomAttributeValue(new Integer(0x222222).toString());

 		flexContainer.getCustomAttributes().add(rgbColorSettingCustomAttribute);

 

 		// send CREATE request

 		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

-		FlexContainer createdFlexContainer = null;

+		DeviceLightFlexContainer createdFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testUpdateLightFlexContainer", Status.KO,

 					"unable to create LightFlexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			createdFlexContainer = (FlexContainer) response.getContent();

+			createdFlexContainer = (DeviceLightFlexContainer) response.getContent();

 		}

 

 		// prepare a FlexContainer for update

-		FlexContainer toBeUpdated = new FlexContainer();

+		DeviceLightFlexContainer toBeUpdated = new DeviceLightFlexContainer();

 		CustomAttribute illuminanceToBeUpdated = new CustomAttribute();

 		illuminanceToBeUpdated.setCustomAttributeName("illuminanceLevel");

-		illuminanceToBeUpdated.setCustomAttributeType("xs:integer");

 		illuminanceToBeUpdated.setCustomAttributeValue("85");

 		toBeUpdated.getCustomAttributes().add(illuminanceToBeUpdated);

 

@@ -266,7 +250,7 @@
 			return;

 		} else {

 			// OK

-			FlexContainer updatedFlexContainer = (FlexContainer) response.getContent();

+			DeviceLightFlexContainer updatedFlexContainer = (DeviceLightFlexContainer) response.getContent();

 			if (updatedFlexContainer.getCustomAttributes().size() != 1) {

 				createTestReport("testUpdateLightFlexContainer", Status.KO, "expecting 1 CustomAttribute, found "

 						+ updatedFlexContainer.getCustomAttributes().size() + " CustomAttribute", null);

@@ -293,7 +277,7 @@
 			return;

 		} else {

 			// OK

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			DeviceLightFlexContainer retrievedFlexContainer = (DeviceLightFlexContainer) response.getContent();

 			createdFlexContainer.getCustomAttribute("illuminanceLevel").setCustomAttributeValue("85");

 			try {

 				checkFlexContainer(createdFlexContainer, retrievedFlexContainer);

diff --git a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/LocationFlexContainerTest.java b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/LocationFlexContainerTest.java
index 258502f..9a4142d 100644
--- a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/LocationFlexContainerTest.java
+++ b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/LocationFlexContainerTest.java
@@ -16,9 +16,9 @@
 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.Container;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.RequestPrimitive;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.BinarySwitchFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.testsuite.flexcontainer.TestReport.Status;

 

@@ -46,16 +46,16 @@
 	public void testUnderFlexContainer() {

 		

 		// create a FlexContainer

-		FlexContainer parentFlexContainer = new FlexContainer();

-		parentFlexContainer.setContainerDefinition("org.onem2m.home.moduleclass.binaryswitch");

+		BinarySwitchFlexContainer parentFlexContainer = new BinarySwitchFlexContainer();

+		String parentFlexContainerName = "parentFlexContainer_" + System.currentTimeMillis();

+		parentFlexContainer.setName(parentFlexContainerName);

 		CustomAttribute ca = new CustomAttribute();

-		ca.setCustomAttributeName("powerState");

-		ca.setCustomAttributeType("xs:boolean");

+		ca.setCustomAttributeName("powSe");

 		ca.setCustomAttributeValue("true");

 		parentFlexContainer.getCustomAttributes().add(ca);

 		

-		String parentFlexContainerName = "parentFlexContainer_" + System.currentTimeMillis();

-		sendCreateFlexContainerRequest(parentFlexContainer, "/" + Constants.CSE_ID + "/" + Constants.CSE_NAME, parentFlexContainerName);

+		

+		sendCreateFlexContainerRequest(parentFlexContainer, "/" + Constants.CSE_ID + "/" + Constants.CSE_NAME, Constants.ADMIN_REQUESTING_ENTITY);

 		

 		genericTest("/" + Constants.CSE_ID + "/" + Constants.CSE_NAME + "/" + parentFlexContainerName, "testUnderFlexContainer");

 	

@@ -63,12 +63,15 @@
 

 	public void testUnderContainer() {

 		

+		String parentContainerName = "parentContainerName_" + System.currentTimeMillis();

+		

 		// Container

 		Container container = new Container();

 		container.setOntologyRef("OrangeOntology");

+		container.setName(parentContainerName);

 

 		String baseParentContainerLocation = "/" + Constants.CSE_ID + "/" + Constants.CSE_NAME;

-		String parentContainerName = "parentContainerName_" + System.currentTimeMillis();

+		

 		

 		

 		RequestPrimitive request = new RequestPrimitive();

@@ -78,7 +81,6 @@
 		request.setResourceType(BigInteger.valueOf(ResourceType.CONTAINER));

 		request.setRequestContentType(MimeMediaType.OBJ);

 		request.setReturnContentType(MimeMediaType.OBJ);

-		request.setName(parentContainerName);

 		request.setOperation(Operation.CREATE);

 		ResponsePrimitive response = getCseService().doRequest(request);

 		

@@ -90,27 +92,26 @@
 	private void genericTest(String location, String methodName) {

 

 		// set a new flexContainer

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.binaryswitch");

+		BinarySwitchFlexContainer flexContainer = new BinarySwitchFlexContainer();

 		CustomAttribute ca = new CustomAttribute();

-		ca.setCustomAttributeName("powerState");

-		ca.setCustomAttributeType("xs:boolean");

+		ca.setCustomAttributeName("powSe");

 		ca.setCustomAttributeValue("true");

 		flexContainer.getCustomAttributes().add(ca);

 

 		String flexContainerName = "FLEXCONTAINER_" + System.currentTimeMillis();

+		flexContainer.setName(flexContainerName);

 		

 		String baseLocation =  location;

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 		

-		FlexContainer createdFlexContainer = null;

+		BinarySwitchFlexContainer createdFlexContainer = null;

 

 		// send create request

 		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation,

-				flexContainerName);

+				Constants.ADMIN_REQUESTING_ENTITY);

 		if (response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// OK

-			createdFlexContainer = (FlexContainer) response.getContent();

+			createdFlexContainer = (BinarySwitchFlexContainer) response.getContent();

 			try {

 				checkFlexContainerOntologyRef(flexContainer, createdFlexContainer);

 				checkFlexContainerCustomAttribute(flexContainer, createdFlexContainer);

@@ -136,7 +137,7 @@
 		response = sendRetrieveRequest(flexContainerLocation);

 		if (response.getResponseStatusCode().equals(ResponseStatusCode.OK)) {

 			// OK

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			BinarySwitchFlexContainer retrievedFlexContainer = (BinarySwitchFlexContainer) response.getContent();

 			try {

 				checkFlexContainer(createdFlexContainer, retrievedFlexContainer);

 			} catch (Exception e) {

diff --git a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/RunModeFlexContainerTest.java b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/RunModeFlexContainerTest.java
index 8fb7bab..e31b4a2 100644
--- a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/RunModeFlexContainerTest.java
+++ b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/RunModeFlexContainerTest.java
@@ -10,9 +10,8 @@
 import org.eclipse.om2m.commons.constants.Constants;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

-import org.eclipse.om2m.commons.resource.RequestPrimitive;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.RunModeFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.testsuite.flexcontainer.TestReport.Status;

 

@@ -32,26 +31,24 @@
 		String flexContainerName = "RunModeFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.runmode");

+		RunModeFlexContainer flexContainer = new RunModeFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("OrangeOntology");

 

 		CustomAttribute operationModeCustomAttribute = new CustomAttribute();

-		operationModeCustomAttribute.setCustomAttributeName("operationMode");

-		operationModeCustomAttribute.setCustomAttributeType("xs:enum");

+		operationModeCustomAttribute.setCustomAttributeName("opeMe");

 		operationModeCustomAttribute.setCustomAttributeValue("ON");

 		flexContainer.getCustomAttributes().add(operationModeCustomAttribute);

 

 		CustomAttribute supportedModesCustomAttribute = new CustomAttribute();

-		supportedModesCustomAttribute.setCustomAttributeName("supportedModes");

-		supportedModesCustomAttribute.setCustomAttributeType("xs:enum");

+		supportedModesCustomAttribute.setCustomAttributeName("supMs");

 		supportedModesCustomAttribute.setCustomAttributeValue("ON,OFF,UNKNOWN");

 		flexContainer.getCustomAttributes().add(supportedModesCustomAttribute);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

-		FlexContainer createdFlexContainer = null;

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

+		RunModeFlexContainer createdFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testCreateAndRetrieveRunModeFlexContainer", Status.KO,

@@ -59,7 +56,7 @@
 			return;

 		} else {

 			// OK

-			createdFlexContainer = (FlexContainer) response.getContent();

+			createdFlexContainer = (RunModeFlexContainer) response.getContent();

 

 			if (!flexContainerName.equals(createdFlexContainer.getName())) {

 				createTestReport("testCreateAndRetrieveRunModeFlexContainer", Status.KO,

@@ -120,7 +117,7 @@
 					null);

 		} else {

 			// OK

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			RunModeFlexContainer retrievedFlexContainer = (RunModeFlexContainer) response.getContent();

 			try {

 				checkFlexContainer(createdFlexContainer, retrievedFlexContainer);

 			} catch (Exception e) {

@@ -140,26 +137,24 @@
 		String flexContainerName = "RunModeFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.runmode");

+		RunModeFlexContainer flexContainer = new RunModeFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("OrangeOntology");

 

 		CustomAttribute operationModeCustomAttribute = new CustomAttribute();

-		operationModeCustomAttribute.setCustomAttributeName("operationMode");

-		operationModeCustomAttribute.setCustomAttributeType("xs:enum");

+		operationModeCustomAttribute.setCustomAttributeName("opeMe");

 		operationModeCustomAttribute.setCustomAttributeValue("ON");

 		flexContainer.getCustomAttributes().add(operationModeCustomAttribute);

 

 		CustomAttribute supportedModesCustomAttribute = new CustomAttribute();

-		supportedModesCustomAttribute.setCustomAttributeName("supportedModes");

-		supportedModesCustomAttribute.setCustomAttributeType("xs:enum");

+		supportedModesCustomAttribute.setCustomAttributeName("supMs");

 		supportedModesCustomAttribute.setCustomAttributeValue("ON,OFF,UNKNOWN");

 		flexContainer.getCustomAttributes().add(supportedModesCustomAttribute);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

-		FlexContainer createdFlexContainer = null;

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

+		RunModeFlexContainer createdFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testUpdateRunModeFlexContainer", Status.KO,

@@ -168,17 +163,15 @@
 		} 

 

 		// update Flexcontainer

-		FlexContainer toBeUpdated = new FlexContainer();

-		toBeUpdated.setContainerDefinition("org.onem2m.home.moduleclass.runmode");

+		RunModeFlexContainer toBeUpdated = new RunModeFlexContainer();

 

 		CustomAttribute operationModeToBeUpdated = new CustomAttribute();

 		operationModeToBeUpdated.setCustomAttributeValue("OFF");

-		operationModeToBeUpdated.setCustomAttributeName("operationMode");

-		operationModeToBeUpdated.setCustomAttributeType("xs:enum");

+		operationModeToBeUpdated.setCustomAttributeName("opeMe");

 		toBeUpdated.getCustomAttributes().add(operationModeToBeUpdated);

 

 		response = sendUpdateFlexContainerRequest(flexContainerLocation, toBeUpdated);

-		FlexContainer updatedFlexContainer = null;

+		RunModeFlexContainer updatedFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.UPDATED)) {

 			// KO

 			createTestReport(

@@ -188,7 +181,7 @@
 			return;

 		} else {

 			

-			updatedFlexContainer = (FlexContainer) response.getContent();

+			updatedFlexContainer = (RunModeFlexContainer) response.getContent();

 			if (updatedFlexContainer.getCustomAttributes().size() != 1) {

 				createTestReport("testUpdateRunModeFlexContainer", Status.KO,

 						"expecting 1 custom attribute, found " + updatedFlexContainer.getCustomAttributes().size(),

@@ -196,10 +189,10 @@
 				return;

 			}

 			

-			if (!updatedFlexContainer.getCustomAttribute("operationMode").getCustomAttributeValue().equals("OFF")) {

+			if (!updatedFlexContainer.getCustomAttribute("opeMe").getCustomAttributeValue().equals("OFF")) {

 				createTestReport("testUpdateRunModeFlexContainer", Status.KO,

 						"invalid operationMode customAttribute value (expected: OFF, received: "

-								+ updatedFlexContainer.getCustomAttribute("operationMode").getCustomAttributeValue()

+								+ updatedFlexContainer.getCustomAttribute("opeMe").getCustomAttributeValue()

 								+ ")",

 						null);

 				return;

@@ -219,7 +212,7 @@
 			return;

 		} else {

 			// OK

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			RunModeFlexContainer retrievedFlexContainer = (RunModeFlexContainer) response.getContent();

 			if (retrievedFlexContainer.getCustomAttributes().size() != 2) {

 				createTestReport("testUpdateRunModeFlexContainer", Status.KO,

 						"expecting 2 custom attribute, found " + updatedFlexContainer.getCustomAttributes().size(),

@@ -227,19 +220,19 @@
 				return;

 			}

 			

-			if (!retrievedFlexContainer.getCustomAttribute("operationMode").getCustomAttributeValue().equals("OFF")) {

+			if (!retrievedFlexContainer.getCustomAttribute("opeMe").getCustomAttributeValue().equals("OFF")) {

 				createTestReport("testUpdateRunModeFlexContainer", Status.KO,

 						"invalid operationMode customAttribute value (expected: OFF, received: "

-								+ retrievedFlexContainer.getCustomAttribute("operationMode").getCustomAttributeValue()

+								+ retrievedFlexContainer.getCustomAttribute("opeMe").getCustomAttributeValue()

 								+ ")",

 						null);

 				return;

 			}

 			

-			if (!retrievedFlexContainer.getCustomAttribute("supportedModes").getCustomAttributeValue().equals("ON,OFF,UNKNOWN")) {

+			if (!retrievedFlexContainer.getCustomAttribute("supMs").getCustomAttributeValue().equals("ON,OFF,UNKNOWN")) {

 				createTestReport("testUpdateRunModeFlexContainer", Status.KO,

 						"invalid supportedModes customAttribute value (expected: ON,OFF,UNKNOWN, received: "

-								+ retrievedFlexContainer.getCustomAttribute("supportedModes").getCustomAttributeValue()

+								+ retrievedFlexContainer.getCustomAttribute("supMs").getCustomAttributeValue()

 								+ ")",

 						null);

 				return;

@@ -255,26 +248,24 @@
 		String flexContainerName = "RunModeFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.runmode");

+		RunModeFlexContainer flexContainer = new RunModeFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("OrangeOntology");

 

 		CustomAttribute operationModeCustomAttribute = new CustomAttribute();

-		operationModeCustomAttribute.setCustomAttributeName("operationMode");

-		operationModeCustomAttribute.setCustomAttributeType("xs:enum");

+		operationModeCustomAttribute.setCustomAttributeName("opeMe");

 		operationModeCustomAttribute.setCustomAttributeValue("ON");

 		flexContainer.getCustomAttributes().add(operationModeCustomAttribute);

 

 		CustomAttribute supportedModesCustomAttribute = new CustomAttribute();

-		supportedModesCustomAttribute.setCustomAttributeName("supportedModes");

-		supportedModesCustomAttribute.setCustomAttributeType("xs:enum");

+		supportedModesCustomAttribute.setCustomAttributeName("supMs");

 		supportedModesCustomAttribute.setCustomAttributeValue("ON,OFF,UNKNOWN");

 		flexContainer.getCustomAttributes().add(supportedModesCustomAttribute);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

-		FlexContainer createdFlexContainer = null;

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

+		RunModeFlexContainer createdFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testDeleteRunModeFlexContainer", Status.KO,

diff --git a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/SmartElectricMeterFlexContainerTest.java b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/SmartElectricMeterFlexContainerTest.java
index e16a138..23588fe 100644
--- a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/SmartElectricMeterFlexContainerTest.java
+++ b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/SmartElectricMeterFlexContainerTest.java
@@ -10,8 +10,8 @@
 import org.eclipse.om2m.commons.constants.Constants;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceSmartElectricMeterFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.testsuite.flexcontainer.TestReport.Status;

 

@@ -31,57 +31,51 @@
 		String flexContainerName = "SmartElectricMeterFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.device.devicesmartelectricmeter");

+		DeviceSmartElectricMeterFlexContainer flexContainer = new DeviceSmartElectricMeterFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("OntologyRef");

 

 		CustomAttribute serialNumberCA = new CustomAttribute();

-		serialNumberCA.setCustomAttributeName("propDeviceSerialNum");

-		serialNumberCA.setCustomAttributeType("xs:string");

+		serialNumberCA.setCustomAttributeName("pDSNm");

 		serialNumberCA.setCustomAttributeValue("sn1");

 		flexContainer.getCustomAttributes().add(serialNumberCA);

 

 		CustomAttribute locationCA = new CustomAttribute();

-		locationCA.setCustomAttributeName("propLocation");

-		locationCA.setCustomAttributeType("xs:string");

+		locationCA.setCustomAttributeName("proLn");

 		locationCA.setCustomAttributeValue("kitchen");

 		flexContainer.getCustomAttributes().add(locationCA);

 

 		CustomAttribute deviceManufacturerCA = new CustomAttribute();

-		deviceManufacturerCA.setCustomAttributeName("propDeviceManufacturer");

-		deviceManufacturerCA.setCustomAttributeType("xs:string");

+		deviceManufacturerCA.setCustomAttributeName("prDMr");

 		deviceManufacturerCA.setCustomAttributeValue("Orange");

 		flexContainer.getCustomAttributes().add(deviceManufacturerCA);

 

 		CustomAttribute protocolCA = new CustomAttribute();

-		protocolCA.setCustomAttributeName("propProtocol");

-		protocolCA.setCustomAttributeType("xs:string");

+		protocolCA.setCustomAttributeName("proPl");

 		protocolCA.setCustomAttributeValue("ZigBee");

 		flexContainer.getCustomAttributes().add(protocolCA);

 

 		CustomAttribute deviceModelCA = new CustomAttribute();

-		deviceModelCA.setCustomAttributeName("propDeviceModelName");

-		deviceModelCA.setCustomAttributeType("xs:string");

+		deviceModelCA.setCustomAttributeName("pDMNe");

 		deviceModelCA.setCustomAttributeValue("Model1");

 		flexContainer.getCustomAttributes().add(deviceModelCA);

 

 		CustomAttribute measuringScopeCA = new CustomAttribute();

-		measuringScopeCA.setCustomAttributeName("propMeasuringScope");

-		measuringScopeCA.setCustomAttributeType("xs:string");

+		measuringScopeCA.setCustomAttributeName("meaSe");

 		measuringScopeCA.setCustomAttributeValue("Room");

 		flexContainer.getCustomAttributes().add(measuringScopeCA);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

-		FlexContainer createdFlexContainer = null;

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

+		DeviceSmartElectricMeterFlexContainer createdFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testCreateAndRetrieveSmartElectricMeterFlexContainer", Status.KO,

 					"unable to create SmartElectricMeter FlexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			createdFlexContainer = (FlexContainer) response.getContent();

+			createdFlexContainer = (DeviceSmartElectricMeterFlexContainer) response.getContent();

 

 			if (!flexContainerName.equals(createdFlexContainer.getName())) {

 				createTestReport("testCreateAndRetrieveSmartElectricMeterFlexContainer", Status.KO,

@@ -109,7 +103,7 @@
 					"unable to retrieve SmartElectricMeter FlexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			DeviceSmartElectricMeterFlexContainer retrievedFlexContainer = (DeviceSmartElectricMeterFlexContainer) response.getContent();

 			try {

 				checkFlexContainer(createdFlexContainer, retrievedFlexContainer);

 			} catch (Exception e) {

@@ -127,50 +121,44 @@
 		String flexContainerName = "SmartElectricMeterFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.device.devicesmartelectricmeter");

+		DeviceSmartElectricMeterFlexContainer flexContainer = new DeviceSmartElectricMeterFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("OntologyRef");

 

 		CustomAttribute serialNumberCA = new CustomAttribute();

-		serialNumberCA.setCustomAttributeName("propDeviceSerialNum");

-		serialNumberCA.setCustomAttributeType("xs:string");

+		serialNumberCA.setCustomAttributeName("pDSNm");

 		serialNumberCA.setCustomAttributeValue("sn1");

 		flexContainer.getCustomAttributes().add(serialNumberCA);

 

 		CustomAttribute locationCA = new CustomAttribute();

-		locationCA.setCustomAttributeName("propLocation");

-		locationCA.setCustomAttributeType("xs:string");

+		locationCA.setCustomAttributeName("proLn");

 		locationCA.setCustomAttributeValue("kitchen");

 		flexContainer.getCustomAttributes().add(locationCA);

 

 		CustomAttribute deviceManufacturerCA = new CustomAttribute();

-		deviceManufacturerCA.setCustomAttributeName("propDeviceManufacturer");

-		deviceManufacturerCA.setCustomAttributeType("xs:string");

+		deviceManufacturerCA.setCustomAttributeName("prDMr");

 		deviceManufacturerCA.setCustomAttributeValue("Orange");

 		flexContainer.getCustomAttributes().add(deviceManufacturerCA);

 

 		CustomAttribute protocolCA = new CustomAttribute();

-		protocolCA.setCustomAttributeName("propProtocol");

-		protocolCA.setCustomAttributeType("xs:string");

+		protocolCA.setCustomAttributeName("proPl");

 		protocolCA.setCustomAttributeValue("ZigBee");

 		flexContainer.getCustomAttributes().add(protocolCA);

 

 		CustomAttribute deviceModelCA = new CustomAttribute();

-		deviceModelCA.setCustomAttributeName("propDeviceModelName");

-		deviceModelCA.setCustomAttributeType("xs:string");

+		deviceModelCA.setCustomAttributeName("pDMNe");

 		deviceModelCA.setCustomAttributeValue("Model1");

 		flexContainer.getCustomAttributes().add(deviceModelCA);

 

 		CustomAttribute measuringScopeCA = new CustomAttribute();

-		measuringScopeCA.setCustomAttributeName("propMeasuringScope");

-		measuringScopeCA.setCustomAttributeType("xs:string");

+		measuringScopeCA.setCustomAttributeName("meaSe");

 		measuringScopeCA.setCustomAttributeValue("Room");

 		flexContainer.getCustomAttributes().add(measuringScopeCA);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

-		FlexContainer createdFlexContainer = null;

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

+		DeviceSmartElectricMeterFlexContainer createdFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testDeleteSmartElectricMeterFlexContainer", Status.KO,

diff --git a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/SmokeDetectorFlexContainerTest.java b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/SmokeDetectorFlexContainerTest.java
index 1d226de..ef9919c 100644
--- a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/SmokeDetectorFlexContainerTest.java
+++ b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/SmokeDetectorFlexContainerTest.java
@@ -10,8 +10,8 @@
 import org.eclipse.om2m.commons.constants.Constants;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceSmokeDetectorFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.testsuite.flexcontainer.TestReport.Status;

 

@@ -31,51 +31,46 @@
 		String flexContainerName = "SmokeDetectorFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.device.devicesmokedetector");

+		DeviceSmokeDetectorFlexContainer flexContainer = new DeviceSmokeDetectorFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("OntologyRef");

 

 		CustomAttribute serialNumberCA = new CustomAttribute();

-		serialNumberCA.setCustomAttributeName("propDeviceSerialNum");

-		serialNumberCA.setCustomAttributeType("xs:string");

+		serialNumberCA.setCustomAttributeName("pDSNm");

 		serialNumberCA.setCustomAttributeValue("sn1");

 		flexContainer.getCustomAttributes().add(serialNumberCA);

 

 		CustomAttribute locationCA = new CustomAttribute();

-		locationCA.setCustomAttributeName("propLocation");

-		locationCA.setCustomAttributeType("xs:string");

+		locationCA.setCustomAttributeName("proLn");

 		locationCA.setCustomAttributeValue("kitchen");

 		flexContainer.getCustomAttributes().add(locationCA);

 

 		CustomAttribute deviceManufacturerCA = new CustomAttribute();

-		deviceManufacturerCA.setCustomAttributeName("propDeviceManufacturer");

-		deviceManufacturerCA.setCustomAttributeType("xs:string");

+		deviceManufacturerCA.setCustomAttributeName("prDMr");

 		deviceManufacturerCA.setCustomAttributeValue("Orange");

 		flexContainer.getCustomAttributes().add(deviceManufacturerCA);

 

 		CustomAttribute protocolCA = new CustomAttribute();

-		protocolCA.setCustomAttributeName("propProtocol");

-		protocolCA.setCustomAttributeType("xs:string");

+		protocolCA.setCustomAttributeName("proPl");

 		protocolCA.setCustomAttributeValue("ZigBee");

 		flexContainer.getCustomAttributes().add(protocolCA);

 

 		CustomAttribute deviceModelCA = new CustomAttribute();

-		deviceModelCA.setCustomAttributeName("propDeviceModelName");

-		deviceModelCA.setCustomAttributeType("xs:string");

+		deviceModelCA.setCustomAttributeName("pDMNe");

 		deviceModelCA.setCustomAttributeValue("Model1");

 		flexContainer.getCustomAttributes().add(deviceModelCA);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

-		FlexContainer createdFlexContainer = null;

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

+		DeviceSmokeDetectorFlexContainer createdFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testCreateAndRetrieveSmokeDetectorFlexContainer", Status.KO,

 					"unable to create SmokeDetector FlexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			createdFlexContainer = (FlexContainer) response.getContent();

+			createdFlexContainer = (DeviceSmokeDetectorFlexContainer) response.getContent();

 

 			if (!flexContainerName.equals(createdFlexContainer.getName())) {

 				createTestReport("testCreateAndRetrieveSmokeDetectorFlexContainer", Status.KO,

@@ -103,7 +98,7 @@
 					"unable to retrieve SmokeDetector FlexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			DeviceSmokeDetectorFlexContainer retrievedFlexContainer = (DeviceSmokeDetectorFlexContainer) response.getContent();

 			try {

 				checkFlexContainer(createdFlexContainer, retrievedFlexContainer);

 			} catch (Exception e) {

@@ -122,43 +117,38 @@
 		String flexContainerName = "SmokeDetectorFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.device.devicesmokedetector");

+		DeviceSmokeDetectorFlexContainer flexContainer = new DeviceSmokeDetectorFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("OntologyRef");

 

 		CustomAttribute serialNumberCA = new CustomAttribute();

-		serialNumberCA.setCustomAttributeName("propDeviceSerialNum");

-		serialNumberCA.setCustomAttributeType("xs:string");

+		serialNumberCA.setCustomAttributeName("pDSNm");

 		serialNumberCA.setCustomAttributeValue("sn1");

 		flexContainer.getCustomAttributes().add(serialNumberCA);

 

 		CustomAttribute locationCA = new CustomAttribute();

-		locationCA.setCustomAttributeName("propLocation");

-		locationCA.setCustomAttributeType("xs:string");

+		locationCA.setCustomAttributeName("proLn");

 		locationCA.setCustomAttributeValue("kitchen");

 		flexContainer.getCustomAttributes().add(locationCA);

 

 		CustomAttribute deviceManufacturerCA = new CustomAttribute();

-		deviceManufacturerCA.setCustomAttributeName("propDeviceManufacturer");

-		deviceManufacturerCA.setCustomAttributeType("xs:string");

+		deviceManufacturerCA.setCustomAttributeName("prDMr");

 		deviceManufacturerCA.setCustomAttributeValue("Orange");

 		flexContainer.getCustomAttributes().add(deviceManufacturerCA);

 

 		CustomAttribute protocolCA = new CustomAttribute();

-		protocolCA.setCustomAttributeName("propProtocol");

-		protocolCA.setCustomAttributeType("xs:string");

+		protocolCA.setCustomAttributeName("proPl");

 		protocolCA.setCustomAttributeValue("ZigBee");

 		flexContainer.getCustomAttributes().add(protocolCA);

 

 		CustomAttribute deviceModelCA = new CustomAttribute();

-		deviceModelCA.setCustomAttributeName("propDeviceModelName");

-		deviceModelCA.setCustomAttributeType("xs:string");

+		deviceModelCA.setCustomAttributeName("pDMNe");

 		deviceModelCA.setCustomAttributeValue("Model1");

 		flexContainer.getCustomAttributes().add(deviceModelCA);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testDeleteSmokeDetectorFlexContainer", Status.KO,

diff --git a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/SubscriptionTest.java b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/SubscriptionTest.java
index 743997e..99ccffe 100644
--- a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/SubscriptionTest.java
+++ b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/SubscriptionTest.java
@@ -12,17 +12,14 @@
 

 import org.eclipse.om2m.commons.constants.Constants;

 import org.eclipse.om2m.commons.constants.NotificationContentType;

-import org.eclipse.om2m.commons.constants.ResourceStatus;

 import org.eclipse.om2m.commons.constants.ResourceType;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.ChildResourceRef;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.EventNotificationCriteria;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.Notification;

-import org.eclipse.om2m.commons.resource.Resource;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

 import org.eclipse.om2m.commons.resource.Subscription;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.BinarySwitchFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.datamapping.service.DataMapperService;

 import org.eclipse.om2m.testsuite.flexcontainer.TestReport.Status;

@@ -75,9 +72,9 @@
 		}

 

 		// create a FlexContainer

-		FlexContainer flexContainer = null;

+		BinarySwitchFlexContainer flexContainer = null;

 		try {

-			flexContainer = createFlexContainer();

+			flexContainer = createBinarySwitchFlexContainer();

 		} catch (Exception e) {

 			createTestReport("testCreateSubscription", Status.KO, e.getMessage(), e);

 			return;

@@ -85,24 +82,25 @@
 		// here flexContainer has been successfully created

 

 		// add a subscription

+		String subscriptionName = "subscription_" + System.currentTimeMillis();

 		Subscription subscription = new Subscription();

 		subscription.getNotificationURI().add(subscriptionServlet.getServletUrl());

 		subscription.setSubscriberURI(subscriptionServlet.getServletUrl());

 		subscription.setNotificationContentType(NotificationContentType.MODIFIED_ATTRIBUTES);

-

+		subscription.setName(subscriptionName);

+		

 		String flexContainerLocation = "/" + Constants.CSE_ID + "/" + Constants.CSE_NAME + "/"

 				+ flexContainer.getName();

-		String subscriptionName = "subscription_" + System.currentTimeMillis();

+		

 

-		ResponsePrimitive response = sendCreateSubscriptionRequest(subscription, flexContainerLocation,

-				subscriptionName);

+		ResponsePrimitive response = sendCreateSubscriptionRequest(subscription, flexContainerLocation, dataMapperService.getServiceDataType());

 		Subscription returnedSubscription = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testCreateSubscription", Status.KO, "unable to create the subscription", null);

 			return;

 		} else {

-			returnedSubscription = (Subscription) response.getContent();

+			returnedSubscription = (Subscription) dataMapperService.stringToObj((String) response.getContent());

 

 			if (!returnedSubscription.getNotificationURI().contains(subscriptionServlet.getServletUrl())) {

 				createTestReport("testCreateSubscription", Status.KO, "invalid notification URI", null);

@@ -135,7 +133,7 @@
 		response = sendRetrieveRequest(flexContainerLocation);

 		if (response.getResponseStatusCode().equals(ResponseStatusCode.OK)) {

 			// OK

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			BinarySwitchFlexContainer retrievedFlexContainer = (BinarySwitchFlexContainer) response.getContent();

 			List<ChildResourceRef> childs = retrievedFlexContainer.getChildResource();

 

 			if ((childs != null) && (!childs.isEmpty())) {

@@ -168,11 +166,10 @@
 		}

 

 		// update the value of the custom attribute

-		FlexContainer toBeUpdated = new FlexContainer();

+		BinarySwitchFlexContainer toBeUpdated = new BinarySwitchFlexContainer();

 		CustomAttribute ca = new CustomAttribute();

-		ca.setCustomAttributeName("powerState");

+		ca.setCustomAttributeName("powSe");

 		ca.setCustomAttributeValue("false");

-		ca.setCustomAttributeType("xs:boolean");

 		toBeUpdated.getCustomAttributes().add(ca);

 		response = sendUpdateFlexContainerRequest(flexContainerLocation, toBeUpdated);

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.UPDATED)) {

@@ -190,10 +187,10 @@
 			// check received notification

 			// power state should be false

 

-			FlexContainer notifiedFlexContainer = (FlexContainer) notification.getNotificationEvent()

+			BinarySwitchFlexContainer notifiedFlexContainer = (BinarySwitchFlexContainer) notification.getNotificationEvent()

 					.getRepresentation().getResource();

 

-			ca = notifiedFlexContainer.getCustomAttribute("powerState");

+			ca = notifiedFlexContainer.getCustomAttribute("powSe");

 			if (ca != null) {

 				if (!ca.getCustomAttributeValue().equals("false")) {

 					createTestReport("testCreateSubscription", Status.KO, "CustomAttribute powerState value is wrong",

@@ -223,9 +220,9 @@
 		}

 

 		// create a FlexContainer

-		FlexContainer flexContainer = null;

+		BinarySwitchFlexContainer flexContainer = null;

 		try {

-			flexContainer = createFlexContainer();

+			flexContainer = createBinarySwitchFlexContainer();

 		} catch (Exception e) {

 			createTestReport("testCreateSubscription", Status.KO, e.getMessage(), e);

 			return;

@@ -233,25 +230,26 @@
 		// here flexContainer has been successfully created

 

 		// add a subscription

+		String subscriptionName = "subscription_" + System.currentTimeMillis();

 		Subscription subscription = new Subscription();

 		subscription.getNotificationURI().add(subscriptionServlet.getServletUrl());

 		subscription.setSubscriberURI(subscriptionServlet.getServletUrl());

 		subscription.setNotificationContentType(NotificationContentType.MODIFIED_ATTRIBUTES);

-

+		subscription.setName(subscriptionName);

+		

 		String flexContainerLocation = "/" + Constants.CSE_ID + "/" + Constants.CSE_NAME + "/"

 				+ flexContainer.getName();

-		String subscriptionName = "subscription_" + System.currentTimeMillis();

+		

 		String subscriptionLocation = flexContainerLocation + "/" + subscriptionName;

 

-		ResponsePrimitive response = sendCreateSubscriptionRequest(subscription, flexContainerLocation,

-				subscriptionName);

+		ResponsePrimitive response = sendCreateSubscriptionRequest(subscription, flexContainerLocation, dataMapperService.getServiceDataType());

 		Subscription returnedSubscription = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testCreateSubscription", Status.KO, "unable to create the subscription", null);

 			return;

 		} else {

-			returnedSubscription = (Subscription) response.getContent();

+			returnedSubscription = (Subscription) dataMapperService.stringToObj((String) response.getContent());

 

 			if (!returnedSubscription.getNotificationURI().contains(subscriptionServlet.getServletUrl())) {

 				createTestReport("testCreateSubscription", Status.KO, "invalid notification URI", null);

@@ -316,11 +314,10 @@
 

 		// update the flexContainer value

 		// update the value of the custom attribute

-		FlexContainer toBeUpdated = new FlexContainer();

+		BinarySwitchFlexContainer toBeUpdated = new BinarySwitchFlexContainer();

 		CustomAttribute ca = new CustomAttribute();

-		ca.setCustomAttributeName("powerState");

+		ca.setCustomAttributeName("powSe");

 		ca.setCustomAttributeValue("false");

-		ca.setCustomAttributeType("xs:boolean");

 		toBeUpdated.getCustomAttributes().add(ca);

 		response = sendUpdateFlexContainerRequest(flexContainerLocation, toBeUpdated);

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.UPDATED)) {

@@ -353,9 +350,9 @@
 		}

 

 		// create a FlexContainer

-		FlexContainer flexContainer = null;

+		BinarySwitchFlexContainer flexContainer = null;

 		try {

-			flexContainer = createFlexContainer();

+			flexContainer = createBinarySwitchFlexContainer();

 		} catch (Exception e) {

 			createTestReport("testUpdateSubscription", Status.KO, e.getMessage(), e);

 			return;

@@ -363,25 +360,26 @@
 		// here flexContainer has been successfully created

 

 		// add a subscription

+		String subscriptionName = "subscription_" + System.currentTimeMillis();

 		Subscription subscription = new Subscription();

 		subscription.getNotificationURI().add(subscriptionServlet.getServletUrl());

 		subscription.setSubscriberURI(subscriptionServlet.getServletUrl());

 		subscription.setNotificationContentType(NotificationContentType.MODIFIED_ATTRIBUTES);

+		subscription.setName(subscriptionName);

 

 		String flexContainerLocation = "/" + Constants.CSE_ID + "/" + Constants.CSE_NAME + "/"

 				+ flexContainer.getName();

-		String subscriptionName = "subscription_" + System.currentTimeMillis();

+		

 		String subscriptionLocation = flexContainerLocation + "/" + subscriptionName;

 

-		ResponsePrimitive response = sendCreateSubscriptionRequest(subscription, flexContainerLocation,

-				subscriptionName);

+		ResponsePrimitive response = sendCreateSubscriptionRequest(subscription, flexContainerLocation, dataMapperService.getServiceDataType());

 		Subscription returnedSubscription = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testUpdateSubscription", Status.KO, "unable to create the subscription", null);

 			return;

 		} else {

-			returnedSubscription = (Subscription) response.getContent();

+			returnedSubscription = (Subscription) dataMapperService.stringToObj((String) response.getContent());

 

 			if (!returnedSubscription.getNotificationURI().contains(subscriptionServlet.getServletUrl())) {

 				createTestReport("testUpdateSubscription", Status.KO, "invalid notification URI", null);

@@ -411,11 +409,10 @@
 		}

 

 		// update the value of the custom attribute

-		FlexContainer toBeUpdated = new FlexContainer();

+		BinarySwitchFlexContainer toBeUpdated = new BinarySwitchFlexContainer();

 		CustomAttribute ca = new CustomAttribute();

-		ca.setCustomAttributeName("powerState");

+		ca.setCustomAttributeName("powSe");

 		ca.setCustomAttributeValue("false");

-		ca.setCustomAttributeType("xs:boolean");

 		toBeUpdated.getCustomAttributes().add(ca);

 		response = sendUpdateFlexContainerRequest(flexContainerLocation, toBeUpdated);

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.UPDATED)) {

@@ -433,10 +430,10 @@
 			// check received notification

 			// power state should be false

 

-			FlexContainer notifiedFlexContainer = (FlexContainer) notification.getNotificationEvent()

+			BinarySwitchFlexContainer notifiedFlexContainer = (BinarySwitchFlexContainer) notification.getNotificationEvent()

 					.getRepresentation().getResource();

 

-			ca = notifiedFlexContainer.getCustomAttribute("powerState");

+			ca = notifiedFlexContainer.getCustomAttribute("powSe");

 			if (ca != null) {

 				if (!ca.getCustomAttributeValue().equals("false")) {

 					createTestReport("testUpdateSubscription", Status.KO, "CustomAttribute powerState value is wrong",

@@ -463,6 +460,7 @@
 		} catch (NamespaceException e) {

 			createTestReport("testUpdateSubscription", Status.KO, "unable to register servlet for notification", e);

 		}

+		subscription.setName(null);

 		subscription.getNotificationURI().clear();

 		subscription.getNotificationURI().add(servlet2.getServletUrl());

 		subscription.setSubscriberURI(null);

@@ -481,11 +479,10 @@
 

 		// send an update of the FlexContainer

 		// update the value of the custom attribut

-		toBeUpdated = new FlexContainer();

+		toBeUpdated = new BinarySwitchFlexContainer();

 		ca = new CustomAttribute();

-		ca.setCustomAttributeName("powerState");

+		ca.setCustomAttributeName("powSe");

 		ca.setCustomAttributeValue("false");

-		ca.setCustomAttributeType("xs:boolean");

 		toBeUpdated.getCustomAttributes().add(ca);

 		response = sendUpdateFlexContainerRequest(flexContainerLocation, toBeUpdated);

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.UPDATED)) {

@@ -503,10 +500,10 @@
 			// check received notification

 			// power state should be false

 

-			FlexContainer notifiedFlexContainer = (FlexContainer) notification.getNotificationEvent()

+			BinarySwitchFlexContainer notifiedFlexContainer = (BinarySwitchFlexContainer) notification.getNotificationEvent()

 					.getRepresentation().getResource();

 

-			ca = notifiedFlexContainer.getCustomAttribute("powerState");

+			ca = notifiedFlexContainer.getCustomAttribute("powSe");

 			if (ca != null) {

 				if (!ca.getCustomAttributeValue().equals("false")) {

 					createTestReport("testUpdateSubscription", Status.KO, "CustomAttribute powerState value is wrong",

@@ -536,19 +533,18 @@
 		createTestReport("testUpdateSubscription", Status.OK, null, null);

 	}

 

-	private FlexContainer createFlexContainer() throws Exception {

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.binaryswitch");

+	private BinarySwitchFlexContainer createBinarySwitchFlexContainer() throws Exception {

+		BinarySwitchFlexContainer flexContainer = new BinarySwitchFlexContainer();

+		flexContainer.setName("FlexContainer_" + System.currentTimeMillis());

 		CustomAttribute ca = new CustomAttribute();

-		ca.setCustomAttributeName("powerState");

-		ca.setCustomAttributeType("xs:boolean");

+		ca.setCustomAttributeName("powSe");

 		ca.setCustomAttributeValue("true");

 		flexContainer.getCustomAttributes().add(ca);

 

 		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer,

-				"/" + Constants.CSE_ID + "/" + Constants.CSE_NAME, "FlexContainer_" + System.currentTimeMillis());

+				"/" + Constants.CSE_ID + "/" + Constants.CSE_NAME, Constants.ADMIN_REQUESTING_ENTITY);

 		if (response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

-			return (FlexContainer) response.getContent();

+			return (BinarySwitchFlexContainer) response.getContent();

 		} else {

 			// KO

 			throw new Exception(

diff --git a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/WarningDeviceFlexContainerTest.java b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/WarningDeviceFlexContainerTest.java
index f221acf..a396b29 100644
--- a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/WarningDeviceFlexContainerTest.java
+++ b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/WarningDeviceFlexContainerTest.java
@@ -10,8 +10,8 @@
 import org.eclipse.om2m.commons.constants.Constants;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceWarningDeviceFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.testsuite.flexcontainer.TestReport.Status;

 

@@ -31,51 +31,46 @@
 		String flexContainerName = "SirenFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.device.devicewarningdevice");

+		DeviceWarningDeviceFlexContainer flexContainer = new DeviceWarningDeviceFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("OntologyRef");

 

 		CustomAttribute serialNumberCA = new CustomAttribute();

-		serialNumberCA.setCustomAttributeName("propDeviceSerialNum");

-		serialNumberCA.setCustomAttributeType("xs:string");

+		serialNumberCA.setCustomAttributeName("pDSNm");

 		serialNumberCA.setCustomAttributeValue("sn1");

 		flexContainer.getCustomAttributes().add(serialNumberCA);

 

 		CustomAttribute locationCA = new CustomAttribute();

-		locationCA.setCustomAttributeName("propLocation");

-		locationCA.setCustomAttributeType("xs:string");

+		locationCA.setCustomAttributeName("proLn");

 		locationCA.setCustomAttributeValue("kitchen");

 		flexContainer.getCustomAttributes().add(locationCA);

 

 		CustomAttribute deviceManufacturerCA = new CustomAttribute();

-		deviceManufacturerCA.setCustomAttributeName("propDeviceManufacturer");

-		deviceManufacturerCA.setCustomAttributeType("xs:string");

+		deviceManufacturerCA.setCustomAttributeName("prDMr");

 		deviceManufacturerCA.setCustomAttributeValue("Orange");

 		flexContainer.getCustomAttributes().add(deviceManufacturerCA);

 

 		CustomAttribute protocolCA = new CustomAttribute();

-		protocolCA.setCustomAttributeName("propProtocol");

-		protocolCA.setCustomAttributeType("xs:string");

+		protocolCA.setCustomAttributeName("proPl");

 		protocolCA.setCustomAttributeValue("ZigBee");

 		flexContainer.getCustomAttributes().add(protocolCA);

 

 		CustomAttribute deviceModelCA = new CustomAttribute();

-		deviceModelCA.setCustomAttributeName("propDeviceModelName");

-		deviceModelCA.setCustomAttributeType("xs:string");

+		deviceModelCA.setCustomAttributeName("pDMNe");

 		deviceModelCA.setCustomAttributeValue("Model1");

 		flexContainer.getCustomAttributes().add(deviceModelCA);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

-		FlexContainer createdFlexContainer = null;

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

+		DeviceWarningDeviceFlexContainer createdFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testCreateAndRetrieveWarningDeviceFlexContainer", Status.KO,

 					"unable to create WarningDevice FlexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			createdFlexContainer = (FlexContainer) response.getContent();

+			createdFlexContainer = (DeviceWarningDeviceFlexContainer) response.getContent();

 

 			if (!flexContainerName.equals(createdFlexContainer.getName())) {

 				createTestReport("testCreateAndRetrieveWarningDeviceFlexContainer", Status.KO,

@@ -103,7 +98,7 @@
 					"unable to retrieve Warning Device FlexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			DeviceWarningDeviceFlexContainer retrievedFlexContainer = (DeviceWarningDeviceFlexContainer) response.getContent();

 			try {

 				checkFlexContainer(createdFlexContainer, retrievedFlexContainer);

 			} catch (Exception e) {

@@ -122,43 +117,38 @@
 		String flexContainerName = "WarningDeviceFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.device.devicewarningdevice");

+		DeviceWarningDeviceFlexContainer flexContainer = new DeviceWarningDeviceFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("OntologyRef");

 

 		CustomAttribute serialNumberCA = new CustomAttribute();

-		serialNumberCA.setCustomAttributeName("propDeviceSerialNum");

-		serialNumberCA.setCustomAttributeType("xs:string");

+		serialNumberCA.setCustomAttributeName("pDSNm");

 		serialNumberCA.setCustomAttributeValue("sn1");

 		flexContainer.getCustomAttributes().add(serialNumberCA);

 

 		CustomAttribute locationCA = new CustomAttribute();

-		locationCA.setCustomAttributeName("propLocation");

-		locationCA.setCustomAttributeType("xs:string");

+		locationCA.setCustomAttributeName("proLn");

 		locationCA.setCustomAttributeValue("kitchen");

 		flexContainer.getCustomAttributes().add(locationCA);

 

 		CustomAttribute deviceManufacturerCA = new CustomAttribute();

-		deviceManufacturerCA.setCustomAttributeName("propDeviceManufacturer");

-		deviceManufacturerCA.setCustomAttributeType("xs:string");

+		deviceManufacturerCA.setCustomAttributeName("prDMr");

 		deviceManufacturerCA.setCustomAttributeValue("Orange");

 		flexContainer.getCustomAttributes().add(deviceManufacturerCA);

 

 		CustomAttribute protocolCA = new CustomAttribute();

-		protocolCA.setCustomAttributeName("propProtocol");

-		protocolCA.setCustomAttributeType("xs:string");

+		protocolCA.setCustomAttributeName("proPl");

 		protocolCA.setCustomAttributeValue("ZigBee");

 		flexContainer.getCustomAttributes().add(protocolCA);

 

 		CustomAttribute deviceModelCA = new CustomAttribute();

-		deviceModelCA.setCustomAttributeName("propDeviceModelName");

-		deviceModelCA.setCustomAttributeType("xs:string");

+		deviceModelCA.setCustomAttributeName("pDMNe");

 		deviceModelCA.setCustomAttributeValue("Model1");

 		flexContainer.getCustomAttributes().add(deviceModelCA);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testDeleteWarningDeviceFlexContainer", Status.KO,

diff --git a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/WaterSensorFlexContainerTest.java b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/WaterSensorFlexContainerTest.java
index 62a1707..b91bd7e 100644
--- a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/WaterSensorFlexContainerTest.java
+++ b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/WaterSensorFlexContainerTest.java
@@ -10,8 +10,8 @@
 import org.eclipse.om2m.commons.constants.Constants;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.WaterSensorFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.testsuite.flexcontainer.TestReport.Status;

 

@@ -32,27 +32,26 @@
 		String flexContainerName = "WaterSensorFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.watersensor");

+		WaterSensorFlexContainer flexContainer = new WaterSensorFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("OntologyOrange");

 

 		CustomAttribute alarmCustomAttribute = new CustomAttribute();

 		alarmCustomAttribute.setCustomAttributeName("alarm");

-		alarmCustomAttribute.setCustomAttributeType("xs:boolean");

 		alarmCustomAttribute.setCustomAttributeValue("true");

 		flexContainer.getCustomAttributes().add(alarmCustomAttribute);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

-		FlexContainer createdFlexContainer = null;

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

+		WaterSensorFlexContainer createdFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testCreateAndRetrieveWaterSensorFlexContainer", Status.KO,

 					"unable to create WaterSensor flexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			createdFlexContainer = (FlexContainer) response.getContent();

+			createdFlexContainer = (WaterSensorFlexContainer) response.getContent();

 

 			if (!flexContainerName.equals(createdFlexContainer.getName())) {

 				createTestReport("testCreateAndRetrieveWaterSensorFlexContainer", Status.KO,

@@ -80,7 +79,7 @@
 					"unable to retrieve WaterSensor flexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			WaterSensorFlexContainer retrievedFlexContainer = (WaterSensorFlexContainer) response.getContent();

 			try {

 				checkFlexContainer(createdFlexContainer, retrievedFlexContainer);

 			} catch (Exception e) {

@@ -98,19 +97,18 @@
 		String flexContainerName = "WaterSensorFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.watersensor");

+		WaterSensorFlexContainer flexContainer = new WaterSensorFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("OntologyOrange");

 

 		CustomAttribute alarmCustomAttribute = new CustomAttribute();

 		alarmCustomAttribute.setCustomAttributeName("alarm");

-		alarmCustomAttribute.setCustomAttributeType("xs:boolean");

 		alarmCustomAttribute.setCustomAttributeValue("true");

 		flexContainer.getCustomAttributes().add(alarmCustomAttribute);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testDeleteWaterSensorFlexContainer", Status.KO,

@@ -146,34 +144,32 @@
 		String flexContainerName = "WaterSensorFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.moduleclass.watersensor");

+		WaterSensorFlexContainer flexContainer = new WaterSensorFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("OntologyOrange");

 

 		CustomAttribute alarmCustomAttribute = new CustomAttribute();

 		alarmCustomAttribute.setCustomAttributeName("alarm");

-		alarmCustomAttribute.setCustomAttributeType("xs:boolean");

 		alarmCustomAttribute.setCustomAttributeValue("true");

 		flexContainer.getCustomAttributes().add(alarmCustomAttribute);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

-		FlexContainer createdFlexContainer = null;

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

+		WaterSensorFlexContainer createdFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testUpdateWaterSensorFlexContainer", Status.KO,

 					"unable to create WaterSensor flexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			createdFlexContainer = (FlexContainer) response.getContent();

+			createdFlexContainer = (WaterSensorFlexContainer) response.getContent();

 		}

 

 		// prepare UPDATE request

-		FlexContainer toBeUpdated = new FlexContainer();

+		WaterSensorFlexContainer toBeUpdated = new WaterSensorFlexContainer();

 		CustomAttribute alarmToBeUpdated = new CustomAttribute();

 		alarmToBeUpdated.setCustomAttributeName("alarm");

-		alarmToBeUpdated.setCustomAttributeType("xs:boolean");

 		alarmToBeUpdated.setCustomAttributeValue("false");

 		toBeUpdated.getCustomAttributes().add(alarmToBeUpdated);

 

@@ -185,7 +181,7 @@
 					"unable to update WaterSensor flexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			FlexContainer updatedFlexContainer = (FlexContainer) response.getContent();

+			WaterSensorFlexContainer updatedFlexContainer = (WaterSensorFlexContainer) response.getContent();

 

 			if (updatedFlexContainer.getCustomAttributes().size() != 1) {

 				createTestReport("testUpdateWaterSensorFlexContainer", Status.KO, "Expecting 1 customAttribute, found "

@@ -212,7 +208,7 @@
 					"unable to retrieve WaterSensor flexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			WaterSensorFlexContainer retrievedFlexContainer = (WaterSensorFlexContainer) response.getContent();

 			

 			// apply update on createdFlexContainer

 			createdFlexContainer.getCustomAttribute("alarm").setCustomAttributeValue("false");

diff --git a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/WaterValveFlexContainerTest.java b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/WaterValveFlexContainerTest.java
index 6bfe873..c99e30a 100644
--- a/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/WaterValveFlexContainerTest.java
+++ b/org.eclipse.om2m.testsuite.flexcontainer/src/main/java/org/eclipse/om2m/testsuite/flexcontainer/WaterValveFlexContainerTest.java
@@ -10,8 +10,8 @@
 import org.eclipse.om2m.commons.constants.Constants;

 import org.eclipse.om2m.commons.constants.ResponseStatusCode;

 import org.eclipse.om2m.commons.resource.CustomAttribute;

-import org.eclipse.om2m.commons.resource.FlexContainer;

 import org.eclipse.om2m.commons.resource.ResponsePrimitive;

+import org.eclipse.om2m.commons.resource.flexcontainerspec.DeviceWaterValveFlexContainer;

 import org.eclipse.om2m.core.service.CseService;

 import org.eclipse.om2m.testsuite.flexcontainer.TestReport.Status;

 

@@ -31,51 +31,46 @@
 		String flexContainerName = "WaterValveFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.device.devicewatervalve");

+		DeviceWaterValveFlexContainer  flexContainer = new DeviceWaterValveFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("OntologyRef");

 

 		CustomAttribute serialNumberCA = new CustomAttribute();

-		serialNumberCA.setCustomAttributeName("propDeviceSerialNum");

-		serialNumberCA.setCustomAttributeType("xs:string");

+		serialNumberCA.setCustomAttributeName("pDSNm");

 		serialNumberCA.setCustomAttributeValue("sn1");

 		flexContainer.getCustomAttributes().add(serialNumberCA);

 

 		CustomAttribute locationCA = new CustomAttribute();

-		locationCA.setCustomAttributeName("propLocation");

-		locationCA.setCustomAttributeType("xs:string");

+		locationCA.setCustomAttributeName("proLn");

 		locationCA.setCustomAttributeValue("kitchen");

 		flexContainer.getCustomAttributes().add(locationCA);

 

 		CustomAttribute deviceManufacturerCA = new CustomAttribute();

-		deviceManufacturerCA.setCustomAttributeName("propDeviceManufacturer");

-		deviceManufacturerCA.setCustomAttributeType("xs:string");

+		deviceManufacturerCA.setCustomAttributeName("prDMr");

 		deviceManufacturerCA.setCustomAttributeValue("Orange");

 		flexContainer.getCustomAttributes().add(deviceManufacturerCA);

 

 		CustomAttribute protocolCA = new CustomAttribute();

-		protocolCA.setCustomAttributeName("propProtocol");

-		protocolCA.setCustomAttributeType("xs:string");

+		protocolCA.setCustomAttributeName("proPl");

 		protocolCA.setCustomAttributeValue("ZigBee");

 		flexContainer.getCustomAttributes().add(protocolCA);

 

 		CustomAttribute deviceModelCA = new CustomAttribute();

-		deviceModelCA.setCustomAttributeName("propDeviceModelName");

-		deviceModelCA.setCustomAttributeType("xs:string");

+		deviceModelCA.setCustomAttributeName("pDMNe");

 		deviceModelCA.setCustomAttributeValue("Model1");

 		flexContainer.getCustomAttributes().add(deviceModelCA);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

-		FlexContainer createdFlexContainer = null;

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

+		DeviceWaterValveFlexContainer createdFlexContainer = null;

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testCreateAndRetrieveWaterValveFlexContainer", Status.KO,

 					"unable to create WaterValve FlexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			createdFlexContainer = (FlexContainer) response.getContent();

+			createdFlexContainer = (DeviceWaterValveFlexContainer) response.getContent();

 

 			if (!flexContainerName.equals(createdFlexContainer.getName())) {

 				createTestReport("testCreateAndRetrieveWaterValveFlexContainer", Status.KO,

@@ -103,7 +98,7 @@
 					"unable to retrieve WaterValve FlexContainer:" + response.getContent(), null);

 			return;

 		} else {

-			FlexContainer retrievedFlexContainer = (FlexContainer) response.getContent();

+			DeviceWaterValveFlexContainer retrievedFlexContainer = (DeviceWaterValveFlexContainer) response.getContent();

 			try {

 				checkFlexContainer(createdFlexContainer, retrievedFlexContainer);

 			} catch (Exception e) {

@@ -122,43 +117,38 @@
 		String flexContainerName = "WaterValveFlexContainer_" + System.currentTimeMillis();

 		String flexContainerLocation = baseLocation + "/" + flexContainerName;

 

-		FlexContainer flexContainer = new FlexContainer();

-		flexContainer.setContainerDefinition("org.onem2m.home.device.devicewatervalve");

+		DeviceWaterValveFlexContainer flexContainer = new DeviceWaterValveFlexContainer();

+		flexContainer.setName(flexContainerName);

 		flexContainer.setCreator("Greg");

 		flexContainer.setOntologyRef("OntologyRef");

 

 		CustomAttribute serialNumberCA = new CustomAttribute();

-		serialNumberCA.setCustomAttributeName("propDeviceSerialNum");

-		serialNumberCA.setCustomAttributeType("xs:string");

+		serialNumberCA.setCustomAttributeName("pDSNm");

 		serialNumberCA.setCustomAttributeValue("sn1");

 		flexContainer.getCustomAttributes().add(serialNumberCA);

 

 		CustomAttribute locationCA = new CustomAttribute();

-		locationCA.setCustomAttributeName("propLocation");

-		locationCA.setCustomAttributeType("xs:string");

+		locationCA.setCustomAttributeName("proLn");

 		locationCA.setCustomAttributeValue("kitchen");

 		flexContainer.getCustomAttributes().add(locationCA);

 

 		CustomAttribute deviceManufacturerCA = new CustomAttribute();

-		deviceManufacturerCA.setCustomAttributeName("propDeviceManufacturer");

-		deviceManufacturerCA.setCustomAttributeType("xs:string");

+		deviceManufacturerCA.setCustomAttributeName("prDMr");

 		deviceManufacturerCA.setCustomAttributeValue("Orange");

 		flexContainer.getCustomAttributes().add(deviceManufacturerCA);

 

 		CustomAttribute protocolCA = new CustomAttribute();

-		protocolCA.setCustomAttributeName("propProtocol");

-		protocolCA.setCustomAttributeType("xs:string");

+		protocolCA.setCustomAttributeName("proPl");

 		protocolCA.setCustomAttributeValue("ZigBee");

 		flexContainer.getCustomAttributes().add(protocolCA);

 

 		CustomAttribute deviceModelCA = new CustomAttribute();

-		deviceModelCA.setCustomAttributeName("propDeviceModelName");

-		deviceModelCA.setCustomAttributeType("xs:string");

+		deviceModelCA.setCustomAttributeName("pDMNe");

 		deviceModelCA.setCustomAttributeValue("Model1");

 		flexContainer.getCustomAttributes().add(deviceModelCA);

 

 		// send CREATE request

-		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, flexContainerName);

+		ResponsePrimitive response = sendCreateFlexContainerRequest(flexContainer, baseLocation, Constants.ADMIN_REQUESTING_ENTITY);

 		if (!response.getResponseStatusCode().equals(ResponseStatusCode.CREATED)) {

 			// KO

 			createTestReport("testDeleteWaterValveFlexContainer", Status.KO,

diff --git a/org.eclipse.om2m.webapp.resourcesbrowser.json/src/main/resources/webapps/favicon.ico b/org.eclipse.om2m.webapp.resourcesbrowser.json/src/main/resources/webapps/favicon.ico
new file mode 100644
index 0000000..6e3991f
--- /dev/null
+++ b/org.eclipse.om2m.webapp.resourcesbrowser.json/src/main/resources/webapps/favicon.ico
Binary files differ
diff --git a/org.eclipse.om2m.webapp.resourcesbrowser.json/src/main/resources/webapps/index.html b/org.eclipse.om2m.webapp.resourcesbrowser.json/src/main/resources/webapps/index.html
index ff8e33d..5a16857 100644
--- a/org.eclipse.om2m.webapp.resourcesbrowser.json/src/main/resources/webapps/index.html
+++ b/org.eclipse.om2m.webapp.resourcesbrowser.json/src/main/resources/webapps/index.html
@@ -34,6 +34,7 @@
         <link rel="stylesheet" type="text/css" href="om2m.css">

         <script type="text/javascript" src="jquery-1.10.2.min.js"></script>

         <script type="text/javascript" src="om2m.js"></script>

+        <link rel="icon" type="image/png" href="favicon.ico" />

     </head>

 

 <body>

diff --git a/org.eclipse.om2m.webapp.resourcesbrowser.json/src/main/resources/webapps/om2m.js b/org.eclipse.om2m.webapp.resourcesbrowser.json/src/main/resources/webapps/om2m.js
index 84945f9..9a3b96f 100644
--- a/org.eclipse.om2m.webapp.resourcesbrowser.json/src/main/resources/webapps/om2m.js
+++ b/org.eclipse.om2m.webapp.resourcesbrowser.json/src/main/resources/webapps/om2m.js
@@ -67,7 +67,7 @@
         type: "GET",
         beforeSend: function(){},
         dataType: "json",
-        url: context + targetId + "?rcn=5",
+        url: context + targetId + "?rcn=5&lvl=1",
         headers : {"X-M2M-Origin" : make_base_auth(username, password), "Accept":"application/json"},
         success: function(response){
             $("#login").hide();
@@ -81,14 +81,14 @@
 
             for(var resourceName in response){
                 var resource = response[resourceName];
-                if(resourceName == "cb"){
+                if(resourceName == "m2m:cb"){
                     $("#resources").html("<li onclick=get('"+targetId+"')>"+resource['rn']+"<ul id="+encodeId(targetId)+"></ul></li>");
                 }
-                for (var attribute in response[resourceName]){
+                for (var attribute in resource){
                     if(attribute == "ch"){
                         for (var index in resource[attribute]){
                             var child = resource[attribute][index];
-                            $("#"+encodeId(targetId)).append("<li onclick=get('"+child["value"]+"')>"+child["rn"]+"<ul id="+encodeId(child["value"])+"></ul></li>");
+                            $("#"+encodeId(targetId)).append("<li onclick=get('"+child["val"]+"')>"+child["nm"]+"<ul id="+encodeId(child["val"])+"></ul></li>");
                         }
                         
                     } else {
@@ -99,7 +99,7 @@
                             for(var index in resource[attribute]['acr']){
                                 var acr = resource[attribute]['acr'][index] ;
                                 var acor = '<table class="bordered"><tbody>'
-                                var acors = acr['acor'].split(" ");
+                                var acors = acr['acor'];
                                 for (var indexJ in acors){
                                     acor += "<tr><td>"+ acors[indexJ] +"</td></tr>";
                                 }
@@ -110,17 +110,25 @@
                             value = table;
                         } else if (attribute == "poa"){
                             var table = '<table class="bordered"><thead><th>Point Of Access</th></thead><tbody>' ;
-                            var poas = resource[attribute].split(" ") ;
+                            var poas = resource[attribute];
                             for (var index in poas){
                                 table += '<tr><td>'+ poas[index] +'</td></tr>' 
                             }
                             table += "</tbody></table>";
                             value = table ;
+                        } else if (attribute == "srt") {
+                        	var table = '<table class="bordered"><thead><th>Supported resource types</th></thead><tbody>' ;
+                            var srts = resource[attribute];
+                            for (var index in srts){
+                                table += '<tr><td>'+ srts[index] +'</td></tr>' 
+                            }
+                            table += "</tbody></table>";
+                            value = table ;
                         } else if(resourceName == "csr" && attribute == "csi"){
                             value = '<button type="button" onClick="get(\'' + resource['csi'] +'\')">'+ resource['csi'] +'</button>';
                         } else if(attribute == "acpi"){
                             var table = "<table class='bordered'><thead><th>AccessControlPolicyIDs</th></thdead><tbody>";
-                            var acpiList = resource[attribute].split(" ");
+                            var acpiList = resource[attribute];
                             for(var index in acpiList){
                                 table += "<tr><td>" + acpiList[index] + "</td></tr>";
                             }
@@ -128,8 +136,18 @@
                             value = table;
                         } else if(attribute == "la" || attribute == "ol"){
                             value = "<button onClick=\"get('"+ resource[attribute] +"')\">"+ resource[attribute] +"</button>";
+                        } else if (attribute =="lbl") {
+	                        var lblList = resource[attribute];
+	                        value="<ul>";
+	                        for(var index in lblList) {
+	                          value+= "<li>" + lblList[index] + "</li>";
+	                        }
+	                        value += "</ul>";
                         } else {
                             value = resource[attribute];
+                            if (value instanceof Object) {
+                              value = value.val;
+                            }
                         }
 
                         if(attribute == "con"){
diff --git a/org.eclipse.om2m.webapp.resourcesbrowser.xml/src/main/resources/webapps/favicon.ico b/org.eclipse.om2m.webapp.resourcesbrowser.xml/src/main/resources/webapps/favicon.ico
new file mode 100644
index 0000000..6e3991f
--- /dev/null
+++ b/org.eclipse.om2m.webapp.resourcesbrowser.xml/src/main/resources/webapps/favicon.ico
Binary files differ
diff --git a/org.eclipse.om2m.webapp.resourcesbrowser.xml/src/main/resources/webapps/index.html b/org.eclipse.om2m.webapp.resourcesbrowser.xml/src/main/resources/webapps/index.html
index ff8e33d..5a16857 100644
--- a/org.eclipse.om2m.webapp.resourcesbrowser.xml/src/main/resources/webapps/index.html
+++ b/org.eclipse.om2m.webapp.resourcesbrowser.xml/src/main/resources/webapps/index.html
@@ -34,6 +34,7 @@
         <link rel="stylesheet" type="text/css" href="om2m.css">

         <script type="text/javascript" src="jquery-1.10.2.min.js"></script>

         <script type="text/javascript" src="om2m.js"></script>

+        <link rel="icon" type="image/png" href="favicon.ico" />

     </head>

 

 <body>

diff --git a/org.eclipse.om2m.webapp.resourcesbrowser.xml/src/main/resources/webapps/om2m.js b/org.eclipse.om2m.webapp.resourcesbrowser.xml/src/main/resources/webapps/om2m.js
index 7cbd1e0..7784985 100644
--- a/org.eclipse.om2m.webapp.resourcesbrowser.xml/src/main/resources/webapps/om2m.js
+++ b/org.eclipse.om2m.webapp.resourcesbrowser.xml/src/main/resources/webapps/om2m.js
@@ -62,7 +62,7 @@
         type: "GET",
         beforeSend: function() {},
         dataType: "xml",
-        url: context + targetId + "?rcn=5",
+        url: context + targetId + "?rcn=5&lvl=1",
         headers: {
             "X-M2M-Origin": make_base_auth(username, password),
             "Accept": "application/xml"
@@ -93,7 +93,7 @@
 
                 if (attribute.localName == "ch") {
                     // If it is a child resource (ch) add it to the resource tree
-                    $("#" + encodeId(targetId)).append("<li onclick=get('" + attribute.textContent + "')>" + $(attribute).attr('rn') + "<ul id=" + encodeId(attribute.textContent) + "></ul></li>");
+                    $("#" + encodeId(targetId)).append("<li onclick=get('" + attribute.textContent + "')>" + $(attribute).attr('nm') + "<ul id=" + encodeId(attribute.textContent) + "></ul></li>");
                 } else {
                     // Handle other attributes
                     var value;
diff --git a/pom.xml b/pom.xml
index a4fd697..acd3cbc 100644
--- a/pom.xml
+++ b/pom.xml
@@ -147,6 +147,7 @@
 		<module>org.eclipse.om2m.ipe.sdt</module>
 		<module>org.eclipse.om2m.ipe.sample.sdt</module>
 		<module>org.eclipse.om2m.ipe.sdt.testsuite</module>
+		<module>org.eclipse.om2m.sdt.comparator.xml</module>   
 		<module>org.eclipse.om2m.site.asn-cse</module>
 		<module>org.eclipse.om2m.site.in-cse</module>
 		<module>org.eclipse.om2m.site.mn-cse</module>