function leavingDialog(n){var t=Ext.create("NPS.DataStore.Window.LeavingDialog",{leavingurl:n});t.execute()}function externalTabOpeningDialog(n){var t=Ext.create("NPS.DataStore.Window.ExternalTabDialog",{leavingurl:n});t.execute()}Ext.define("NPS.DataStore.Models.KeyValuePair",{extend:"Ext.data.Model",fields:[{name:"Key",type:"string"},{name:"Value",type:"string"}]});Ext.define("NPS.DataStore.Models.KeyValueLookup",{extend:"Ext.data.Model",fields:[{name:"Key",type:"int"},{name:"Value",type:"string"}]});Ext.define("NPS.DataStore.Models.DataStoreDate",{extend:"Ext.data.Model",identifier:"negative",fields:[{name:"Date",type:"date",dateFormat:"MS"},{name:"Precision",type:"string"}]});Ext.define("NPS.DataStore.Models.DataStoreUnit",{extend:"Ext.data.Model",fields:[{name:"Code",type:"string"},{name:"Name",type:"string"}]});Ext.define("NPS.DataStore.Models.UnitsGeographical",{extend:"Ext.data.Model",fields:[{name:"Code",type:"string"},{name:"FullName",type:"string"},{name:"Status",type:"string"}],id:"Code"});Ext.define("NPS.DataStore.Models.UnitsContentProducer",{extend:"Ext.data.Model",fields:[{name:"Code",type:"string"},{name:"FullName",type:"string"}],id:"Code"});Ext.define("NPS.DataStore.Models.FileAndLink",{extend:"Ext.data.Model",fields:[{name:"Key",type:"string"},{name:"Value",type:"string"},{name:"Type",type:"int"}]});Ext.define("NPS.DataStore.Models.BBoxGeographical",{extend:"Ext.data.Model",identifier:"negative",fields:[{name:"Id",type:"int"},{name:"Description",type:"string"},{name:"WKT",type:"string"}],idProperty:"Id"});Ext.define("NPS.DataStore.Models.Taxonomy.Category",{extend:"Ext.data.Model",fields:[{name:"Code",type:"string"},{name:"Name",type:"string"},{name:"DisplayOrder",type:"int",sortType:"asInt"}],idProperty:"Code"});Ext.define("NPS.DataStore.Models.Taxonomy.NameSearchCriteria",{extend:"Ext.data.Model",fields:[{name:"CategoryCode",type:"int"},{name:"SearchIn",type:"int"},{name:"Criteria",type:"string"},{name:"TaxonCodes",type:"string",sortType:"asInt"}]});Ext.define("NPS.DataStore.Models.Taxonomy.TaxonResult",{extend:"Ext.data.Model",fields:[{name:"TaxonCode",type:"string",sortType:"asInt"},{name:"SciName",type:"string"},{name:"Rank",type:"string"},{name:"Kingdom",type:"string"},{name:"Vocabulary",type:"string"},{name:"Order",type:"string"},{name:"Family",type:"string"},{name:"SciWAuthority",type:"string"},{name:"CommonNames",type:"string"},{name:"SourceName",type:"string"},{name:"ExternalCode",type:"string"},{name:"ExternalCodeName",type:"string"}],idProperty:"TaxonCode"});Ext.define("NPS.DataStore.Models.Taxonomy.ReportedTaxonResult",{extend:"Ext.data.Model",fields:[{name:"ReportedTaxonId",type:"int"},{name:"SourceName",type:"string"},{name:"TaxonId",type:"string"},{name:"Kingdom",type:"string"},{name:"Phylum",type:"string"},{name:"Class",type:"string"},{name:"Order",type:"string"},{name:"Family",type:"string"},{name:"Genus",type:"string"},{name:"Subspecies",type:"string"},{name:"Rank",type:"string"},{name:"SciName",type:"string"},{name:"CommonNames",type:"string"}],idProperty:"ReportedTaxonId"});Ext.define("NPS.DataStore.Models.MethodResult",{extend:"Ext.data.Model",fields:[{name:"Id",type:"int"},{name:"SortOrder",type:"int"},{name:"Paragraph",type:"string"}],idProperty:"Id"});Ext.define("NPS.DataStore.Models.Reference.Permissions",{extend:"Ext.data.Model",identifier:"negative",fields:[{name:"ReferenceId",type:"string"},{name:"UseConstraints",type:"string"},{name:"IsInternal",type:"bool"},{name:"FileAccess",type:"string"},{name:"Sensitivity",type:"string"},{name:"Copyrights",type:"string"},{name:"Proprietary",type:"string"},{name:"Quality",type:"string"},{name:"AllowDataStewardsEdit",type:"string"}],hasMany:[{model:"NPS.DataStore.Models.DataStoreUser",name:"Owners"},{model:"NPS.DataStore.Models.DataStoreUser",name:"UsersWithFileAccess"},{model:"NPS.DataStore.Models.Reference.SensitivityDetails",name:"SensitivityDetails"}],idProperty:"ReferenceId"});Ext.define("NPS.DataStore.Models.SubjectCategory",{extend:"Ext.data.Model",identifier:"negative",fields:[{name:"SubjectCategoryId",type:"int"},{name:"Name",type:"string"},{name:"Inactive",type:"bool"},{name:"SortOrder",type:"int"}],idProperty:"SubjectCategoryId"});Ext.define("NPS.DataStore.Models.Profile.SubjectCategory",{extend:"Ext.data.Model",identifier:"negative",fields:[{name:"Tag",type:"string"}],sorters:[{property:"Tag",direction:"ASC"}]});Ext.define("NPS.DataStore.Models.SubjectCategoryTag",{extend:"Ext.data.Model",identifier:"negative",fields:[{name:"Id",type:"int"},{name:"SubjectCategoryId",type:"int"},{name:"Tag",type:"string"},{name:"TermCode",type:"string"},{name:"URI",type:"string"},{name:"TermVocabularyCombined",type:"string"},{name:"Inactive",type:"bool"},{name:"SortOrder",type:"int"}],idProperty:"Id"});Ext.define("NPS.DataStore.Models.Reference.SubjectKeywords",{extend:"Ext.data.Model",identifier:"negative",fields:[{name:"Keywords",type:"string"}]});Ext.define("NPS.DataStore.Models.LinkedSubjectCategory",{extend:"Ext.data.Model",identifier:"negative",fields:[{name:"Id",type:"int"},{name:"Tag",type:"string"},{name:"Vocabulary",type:"string"},{name:"Term",type:"string"},{name:"ParentSort",type:"int"},{name:"TagSort",type:"int"}],idProperty:"Id"});Ext.define("NPS.DataStore.Models.DataStoreUser",{extend:"Ext.data.Model",identifier:"negative",fields:[{name:"UserCode",type:"string"},{name:"FirstName",type:"string"},{name:"LastName",type:"string"},{name:"Email",type:"string"},{name:"DisplayValue",type:"string"}],idProperty:"UserCode"});Ext.define("NPS.DataStore.Models.DataStoreContact",{extend:"Ext.data.Model",fields:[{name:"ContactId",type:"int"},{name:"Affiliation",type:"string"},{name:"DisplayOrder",type:"int"},{name:"FirstName",type:"string"},{name:"IsCorporate",type:"boolean"},{name:"IsNps",type:"boolean"},{name:"IsReadOnly",type:"bool"},{name:"MiddleName",type:"string"},{name:"ORCID",type:"string"},{name:"Prefix",type:"string"},{name:"PrimaryName",type:"string"},{name:"Suffix",type:"string"},{name:"UserName",type:"string"}],idProperty:"ContactId",tryEncodeValue:function(n){if(n===null||n===undefined)return"";let t=this.get(n);return t===null||t===undefined||t.length==0?"":" "+Ext.htmlEncode(t)},buildDisplayName:function(n){let t=this.tryEncodeValue("FirstName")+this.tryEncodeValue("MiddleName")+this.tryEncodeValue("PrimaryName")+this.tryEncodeValue("Suffix")+n+this.tryEncodeValue("Prefix")+this.tryEncodeValue("Affiliation");return Ext.String.trim(t)}});Ext.define("NPS.DataStore.Models.Reference.Core",{extend:"Ext.data.Model",identifier:"negative",fields:[{name:"ReferenceId",type:"string"},{name:"TypeId",type:"string"},{name:"TypeName",type:"string"},{name:"IsLegacy",type:"bool"},{name:"IsActive",type:"bool"},{name:"IsDraft",type:"bool"},{name:"IsInternal",type:"bool"},{name:"IsUserManagedAncestry",type:"bool"},{name:"Linkability",type:"bool"},{name:"Lifecycle",type:"string"},{name:"Visibility",type:"string"},{name:"DisplayCitation",type:"string"},{name:"Title",type:"string"},{name:"IsAgencyOriginated",type:"int",allowNull:!0},{name:"Description",type:"string"},{name:"DataRequirementSummary",type:"string"},{name:"FilesAndLinksHelpText",type:"string"},{name:"MiscCode",type:"string"},{name:"Location",type:"string"},{name:"Size1",type:"string"},{name:"Size2",type:"string"},{name:"Size3",type:"string"},{name:"Purpose",type:"string"},{name:"Publisher",type:"string"},{name:"TableOfContents",type:"string"},{name:"Notes",type:"string"},{name:"DateRange",type:"string"},{name:"MeetingPlace",type:"string"},{name:"Volume",type:"string"},{name:"Issue",type:"string"},{name:"Edition",type:"string"},{name:"PageRange",type:"string"},{name:"Version",type:"string"},{name:"IsLegacy",type:"string"},{name:"DigitalObjectIdentifier",type:"string"},{name:"DoiEstablishmentMethod",type:"string"},{name:"DoiIdentifierPrefix",type:"string"},{name:"PpId",type:"string"},{name:"PpTitle",type:"string"},{name:"PpDateRange",type:"string"},{name:"PpEdition",type:"string"},{name:"PpIssue",type:"string"},{name:"PpLocation",type:"string"},{name:"PpMeetingPlace",type:"string"},{name:"PpMiscCode",type:"string"},{name:"PpPageRange",type:"string"},{name:"PpVolume",type:"string"},{name:"PpPublisher",type:"string"},{name:"PpSize1",type:"string"},{name:"PpSize2",type:"string"},{name:"PpSize3",type:"string"},{name:"GpId",type:"int"},{name:"GpTitle",type:"string"},{name:"GpPublisher",type:"string"},{name:"Contacts1"},{name:"Contacts2"},{name:"Contacts3"},{name:"PpContacts1"},{name:"PpContacts2"},{name:"PpContacts3"},{name:"DateOfIssue"},{name:"ContentBeginDate"},{name:"ContentEndDate"},{name:"PpDateOfIssue"},{name:"PpContentBeginDate"},{name:"MetadataStandardID",type:"int",allowNull:!0},{name:"MetadataStandardURL",type:"string"},{name:"LicenseTypeID",type:"int",allowNull:!0},{name:"LicenseTypeName",type:"string"},{name:"LicenseTypeURL",type:"string"},{name:"ExtractedDate",type:"date",dateFormat:"MS",allowNull:!0},{name:"ExtractedBy",type:"string"},{name:"ExtractedFileId",type:"int",allowNull:!0},{name:"ExternalSourceXmlId",type:"int",allowNull:!0},{name:"DateOfIssueDate",type:"date",dateFormat:"MS"},{name:"ContentBeginDateDate",type:"date",dateFormat:"MS"},{name:"ContentEndDateDate",type:"date",dateFormat:"MS"},{name:"ParentDateOfIssueDate",type:"date",dateFormat:"MS"},{name:"ParentContentBeginDate",type:"date",dateFormat:"MS"}],idProperty:"ReferenceId"});Ext.define("NPS.DataStore.Models.Reference.SensitivityDetails",{extend:"Ext.data.Model",fields:[{name:"Name",type:"string"}],idProperty:"Name"});Ext.create("Ext.data.Store",{storeId:"sensitivityDetailsStoreId",model:"NPS.DataStore.Models.Reference.SensitivityDetails"});Ext.define("NPS.DataStore.Models.Reference.Statistical",{extend:"Ext.data.Model",identifier:"negative",fields:[{name:"ReferenceId",type:"string"},{name:"LastUpdated",type:"date",dateFormat:"MS"},{name:"UpdatedBy",type:"string"},{name:"CreatedBy",type:"string"},{name:"DateCreated",type:"date",dateFormat:"MS"},{name:"Visibility",type:"string"},{name:"CoreBiblioId",type:"int"}],idProperty:"ReferenceId"});Ext.define("NPS.DataStore.Models.BaseReferenceModel",{extend:"Ext.data.Model",identifier:"negative",fields:[{name:"Accessible",type:"bool"},{name:"Code",type:"int"},{name:"Comment",type:"string"},{name:"Contacts",type:"string"},{name:"DateOfIssue",type:"date",dateFormat:"MS"},{name:"DisplayCitation",type:"string"},{name:"Downloadability",type:"string"},{name:"FileCount",type:"int"},{name:"Id",type:"int"},{name:"Lifecycle",type:"string"},{name:"MarkedDuplicateBy",type:"string"},{name:"MarkedDuplicateDate",type:"date",dateFormat:"MS"},{name:"NewestVersion",type:"int"},{name:"ReferenceGroupType",type:"string"},{name:"SortOrder",type:"int"},{name:"Title",type:"string"},{name:"Type",type:"string"},{name:"TypeName",type:"string"},{name:"Visibility",type:"string"}],idProperty:"Id"});Ext.define("NPS.DataStore.Models.CollectionSearchRow",{extend:"Ext.data.Model",identifier:"negative",fields:[{name:"Id",type:"int"},{name:"Title",type:"string"},{name:"Description",type:"string"},{name:"Owners",type:"int"}],idProperty:"Id"});Ext.define("NPS.DataStore.Models.SavedSearchSearchRow",{extend:"Ext.data.Model",identifier:"negative",fields:[{name:"Id",type:"int"},{name:"IsSeriesSearch",type:"bool"},{name:"Title",type:"string"},{name:"Description",type:"string"},{name:"Owners",type:"int"}],idProperty:"Id"});Ext.define("NPS.DataStore.Models.SavedSearch",{extend:"Ext.data.Model",identifier:"negative",fields:[{name:"Id",type:"int"},{name:"Title",type:"string"},{name:"Description",type:"string"},{name:"SearchMarkup",type:"string"}],idProperty:"Id"});Ext.define("NPS.DataStore.Models.ReviewReference",{extend:"Ext.data.Model",identifier:"negative",fields:[{name:"Id",type:"string"},{name:"Approved",type:"bool"},{name:"Denied",type:"bool"},{name:"Status",type:"string"},{name:"UnitCode",type:"string"},{name:"UnitName",type:"string"},{name:"Title",type:"string"},{name:"DisplayCitation",type:"string"},{name:"Downloadability",type:"string"},{name:"Visibility",type:"string"}],idProperty:"Id"});Ext.define("NPS.DataStore.Models.PocManagementSummaryRow",{extend:"Ext.data.Model",identifier:"negative",fields:[{name:"Id",type:"int"},{name:"UnitCode",type:"string"},{name:"UnitName",type:"string"},{name:"UserCode",type:"string"},{name:"Name",type:"string"},{name:"Email",type:"string"}],idProperty:"Id"});Ext.define("NPS.DataStore.Models.Partner",{extend:"Ext.data.Model",identifier:"negative",fields:[{name:"Id",type:"int"},{name:"UnitCode",type:"string"},{name:"UnitName",type:"string"},{name:"UserCode",type:"string"},{name:"FirstName",type:"string"},{name:"LastName",type:"string"},{name:"Email",type:"string"},{name:"SponsoredBy",type:"string"},{name:"SponsoredByDisplay",type:"string"},{name:"PermissionStatus",type:"string"},{name:"ExpDate",type:"date",dateFormat:"MS"},{name:"WorksFor",type:"string"},{name:"WorksForDisplay",type:"string"},{name:"Notes",type:"string"}],idProperty:"Id"});Ext.define("NPS.DataStore.Models.User",{extend:"Ext.data.Model",fields:[{name:"FirstName",type:"string"},{name:"LastName",type:"string"},{name:"UserCode",type:"string"}],idProperty:"UserCode"});Ext.define("NPS.DataStore.Models.DigitalResources",{extend:"Ext.data.Model",identifier:"negative",fields:[{name:"Id",type:"int"},{name:"HoldingType"},{name:"Url",type:"string"},{name:"Description",type:"string"},{name:"DisplayOrder",type:"int",sortType:"asInt"},{name:"Accessibility",type:"string"},{name:"FileManagerId",type:"int"},{name:"MimeType",type:"string"},{name:"FileSize",type:"float"},{name:"FileDescription",type:"string"},{name:"QueueForServices",type:"bool"},{name:"ServiceTemplate",type:"string"},{name:"LastVerified",type:"date",dateFormat:"MS"},{name:"WebServiceType",type:"string"},{name:"Is508Compliant",type:"bool"}],idProperty:"Id"});Ext.define("NPS.DataStore.Models.DigitalResourcesWithCheck",{extend:"NPS.DataStore.Models.DigitalResources",fields:[{name:"IsChecked",type:"bool"}]});Ext.onReady(function(){Ext.define("NPS.Common.Controls.DataStore.HeaderWidget",{extend:"Ext.Container",constructor:function(n){n=n||{};n.prepend=n.prepend+" - ";n.renderTo=n.renderTo||"theTitle";n.headerText=n.headerText||"";n.headerCls=n.bodyText?n.headerCls||"infoHeaderCss":n.headerCls||"infoHeaderNoBodyCss";n.bodyText=n.bodyText||"";n.bodyCls=n.bodyCls||"infoBodyCss";n.helpIcon=n.helpIcon||"../../Images/Icons/Question.png";n.helpUrl=n.helpUrl||"";n.helpIconCls="headerWidgetIcon";n.imgCls="infoHeaderImg";n.imgText=n.imgText||"";n.scaleImg=n.scaleImg!==null?n.scaleImg:!1;n.collapsed=n.collapsed!==null?n.collapsed:!0;this._c=n.collapsed;this.insertDOM.call(this,n);document.title=n.prepend+n.headerText;Ext.apply(this,{})},insertDOM:function(n){const f=n.helpIcon;let u="";n.img&&(u=$("<img alt='header widget image'><\/img>").attr({src:n.img,alt:n.imgText}).addClass(n.imgCls).css({float:"left","margin-right":"10px"}),n.scaleImg&&u.attr({height:"40",width:"40"}));let t;if(n.bodyText){const i=this;t=n.collapsed?$("<h2><\/h2>").text(n.headerText+" »"):$("<h2><\/h2>").text(n.headerText);t.click(function(){$(`#${n.id}_bodyPart`).toggle("fast");i._c?t.text(n.headerText):t.text(n.headerText+" »");i._c=!i._c})}else t=$("<h2><\/h2>").text(n.headerText);const i=$("<div><\/div>").addClass(n.headerCls).append(u);if(n.helpUrl){const t=$("<img alt='help icon image'><\/img>").attr({src:f,alt:"Get Help on this page",id:n.id+"_imgHelp"}).addClass(n.helpIconCls).click(function(){const t=n.helpUrl;window.open(t,"_blank")});i.append(t)}i.append(t);n.img?i.css("line-height","40px"):i.css("margin-left","10px");const e=$(`#${n.renderTo}`).append(i);let r;n.bodyText&&(r=$("<div><\/div>").attr("id",n.id+"_bodyPart").addClass(n.bodyCls).html(n.bodyText),n.collapsed&&r.css("display","none"));r&&e.append(r)},setTitle:function(n){$("#theTitle h2").html(n);document.title=config.prepend+n}});Ext.define("NPS.DataStore.Controls.DataStoreHeaderWidget",{extend:"NPS.Common.Controls.DataStore.HeaderWidget",constructor:function(n){n.prepend="DataStore ";this.callParent(arguments)}});Ext.define("NPS.DataStore.DatePicker",{extend:"Ext.form.FieldContainer",xtype:"npsdatepicker",layout:{type:"table",columns:5},constructor:function(n){Ext.apply(this,{defaults:{margin:"0 5 0 5",labelAlign:"right",msgTarget:"side",labelClsExtra:"plainLabel",labelSeparator:"",labelWidth:100},items:[{xtype:"combobox",margin:0,itemId:"precisionComboItemId",width:120,store:n.store,editable:!1,displayField:"Value",value:"YYYYMMDD",valueField:"Key",queryMode:"local",setVisibility:function(){const n=this.getValue();n==="YYYYMMDD"?(this.up().down("#monthComboItemId").setVisible(!1),this.up().down("#yearFieldItemId").setVisible(!1),this.up().down("#dateFieldItemId").setVisible(!0)):n==="YYYYMM"?(this.up().down("#monthComboItemId").setVisible(!0),this.up().down("#yearFieldItemId").setVisible(!0),this.up().down("#dateFieldItemId").setVisible(!1)):(this.up().down("#monthComboItemId").setVisible(!1),this.up().down("#yearFieldItemId").setVisible(!0),this.up().down("#dateFieldItemId").setVisible(!1))},listeners:{afterrender:function(n){n.setVisibility()},select:function(n){n.setVisibility()},blur:function(n){n.up("npsdatepicker").validate()}}},{xtype:"combobox",itemId:"monthComboItemId",labelWidth:30,width:120,store:Ext.create("Ext.data.Store",{model:"NPS.DataStore.Models.KeyValuePair",data:[["1","January"],["2","February"],["3","March"],["4","April"],["5","May"],["6","June"],["7","July"],["8","August"],["9","September"],["10","October"],["11","November"],["12","December"]]}),displayField:"Value",editable:!0,forceSelection:!1,allowBlank:n.allowBlank,valueField:"Key",queryMode:"local",labelClsExtra:"plainLabel",labelSeparator:"",emptyText:"Select...",fieldLabel:"Month",listeners:{change:function(n){n.getValue()===null&&n.reset()},blur:function(n){n.up("npsdatepicker").validate()}}},{xtype:"numberfield",itemId:"yearFieldItemId",labelWidth:20,width:70,allowDecimals:!1,allowBlank:n.allowBlank,hideTrigger:!0,emptyText:"yyyy",fieldLabel:"Year",minvalue:1e3,maxValue:9999,autoStripChars:!0,labelClsExtra:"plainLabel",labelSeparator:"",listeners:{blur:function(n){n.up("npsdatepicker").validate()}}},{xtype:"datefield",allowBlank:n.allowBlank,emptyText:"mm/dd/yyyy",itemId:"dateFieldItemId",width:100,listeners:{blur:function(n){n.up("npsdatepicker").validate()}}},{xtype:"label",text:"You need to provide a valid date.",style:{color:"#e60000",fontSize:"11px"},hidden:!0}],markInvalid:function(n){n&&this.items.get(4).setText(n);this.items.get(4).show();for(let n=2;n<4;n++)try{this.items.get(n).markInvalid("invalid")}catch(t){}}});this.callParent(arguments);this.getValue=function(){const r=this.down("#precisionComboItemId").getValue(),f=this.down("#monthComboItemId").getValue(),i=this.down("#dateFieldItemId").getValue(),u=this.down("#yearFieldItemId").getValue();let t;const n=Ext.create("NPS.DataStore.Models.DataStoreDate",{});n.set("Precision",r);switch(r){case"Exact Date":t=!i;break;case"YYYYMMDD":t=!i;break;case"YYYYMM":t=!f&&!u;break;default:t=!u}if(!t){switch(r){case"Exact Date":n.set("Date",i);break;case"YYYYMMDD":n.set("Date",i);break;case"YYYYMM":n.set("Date",new Date(this.down("#yearFieldItemId").getValue(),this.down("#monthComboItemId").getValue()-1,1));break;default:n.set("Date",new Date(this.down("#yearFieldItemId").getValue(),0,1))}return n}};this.setValue=function(n){let i=null;n&&(i=n.data?n.data:n);let t=null,r="";const u=this.down("#precisionComboItemId");if(i!==null&&i!==undefined&&i.Date&&(i.Date!==undefined?(n&&n.Precision?r=n.Precision:r.trim().length===0&&(r="YYYYMMDD"),t=i.Date,u.select(r)):i.Date instanceof Date&&!isNaN(i.Date.valueOf())&&(n&&n.Precision!==undefined&&(r=n.Precision),n.data&&n.data.Precision!==undefined?r=n.data.Precision:r.trim().length===0&&(r="YYYYMMDD"),t=i.Date,u.select(r)),u.fireEvent("select",u)),t)try{let i=new Date(parseInt(t.substr(6))),n=NPS.DataStore.util.ignoreTimeZone(new Date(i));this.down("#dateFieldItemId").setValue(n);const r=this.down("#monthComboItemId").store.findRecord("Key",n.getMonth()+1);this.down("#monthComboItemId").select(r);let u=n.getFullYear();this.down("#yearFieldItemId").setValue(u)}catch(e){var f=function(n){return new Date(parseFloat(n.slice(6,19))).toLocaleString()};if(Ext.isDate(t)===!1){let n=f(t),i=n.split(",");t=new Date(i)}this.down("#dateFieldItemId").setValue(t);const n=this.down("#monthComboItemId").store.findRecord("Key",t.getMonth()+1);this.down("#monthComboItemId").select(n);this.down("#yearFieldItemId").setValue(t.getFullYear())}};this.reset=function(){const n={};n.Precision="YYYYMMDD";n.Date=null;this.setValue(n)};this.validate=function(){if(n.allowBlank===!0)return!0;const u=this.down("#precisionComboItemId").getValue(),f=this.down("#monthComboItemId").getValue(),e=this.down("#monthComboItemId"),t=this.down("#dateFieldItemId"),r=this.down("#yearFieldItemId"),i=this.down("#yearFieldItemId").getValue();switch(u){case"YYYYMMDD":return t?t.value===null||t.value===undefined?(t.markInvalid("A valid date is required."),!1):!0:!0;case"Exact Date":return t&&t.value?!0:(t.markInvalid("A valid date is required."),!1);case"YYYYMM":return f?i?!0:(r.markInvalid("Year is required for a valid date"),!1):(e.markInvalid("Month is required for a valid date"),!1);default:if(i)return/^\d{4}$/.test(i)?!0:(r.markInvalid("Year is required for a valid date"),!1);return!1}};this.isValid=function(){return this.validate()}}});Ext.define("Owners",{extend:"Ext.form.FieldContainer",xtype:"recordowners",constructor:function(n){var t,i;n.popupTitle===undefined&&(n.popupTitle="Add an Owner");n.isRequired===undefined&&(n.isRequired=!1);t="No Owners Found";n.emptyTextMsg&&n.emptyTextMsg.length>0&&(t=n.emptyTextMsg);i=function(t,i){Ext.create("Ext.window.Window",{title:n.popupTitle,modal:!0,resizable:!1,constrain:!0,closeAction:"destroy",defaultFocus:"#NPSUsersItemId",items:[{xtype:"form",bodyPadding:5,defaults:{labelSeparator:"",labelClsExtra:"plainLabel",labelAlign:"right",labelWidth:100},items:[{xtype:"combobox",itemId:"NPSUsersItemId",store:Ext.create("Ext.data.Store",{model:"NPS.DataStore.Models.DataStoreUser",proxy:{type:"ajax",actionMethods:{read:"POST"},url:t}}),fieldLabel:"* User",width:500,queryMode:"remote",minChars:3,queryDelay:1e3,displayField:"DisplayValue",valueField:"UserCode",emptyText:"Begin typing a name...",forceSelection:!0,selectOnFocus:!0,allowBlank:!1,typeAhead:!0,autoSelect:!1,listeners:{select:function(n,t){this.up("form").loadRecord(t)}}},{xtype:"displayfield",fieldLabel:"Email",name:"Email"},{xtype:"displayfield",fieldLabel:"First Name",name:"FirstName"},{xtype:"displayfield",fieldLabel:"Last Name",name:"LastName"},{xtype:"displayfield",fieldLabel:"User Code",name:"UserCode"}],buttons:[{text:"Close",width:80,handler:function(){this.up("window").destroy()}},"->",{cls:"mainActionButton",formBind:!0,tooltip:"Save and add another owner, popup is cleared after saving.",text:"Add",width:80,handler:function(){const n=this.up("form");if(!n.isValid()){Ext.Msg.alert("Invalid","The form is invalid. Errors are marked in red.&nbsp;");return}n.addOwnerToGrid(i);n.getForm().reset();n.down("#NPSUsersItemId").focus()}}],addOwnerToGrid:function(n){const t=this.getRecord();this.updateRecord(t);const i=n.store,r=i.findRecord("UserCode",t.data.UserCode,0,!1,!1,!0);if(r!==null){Ext.Msg.alert("Duplicate","This user is already in the list&nbsp;");return}t.dirty=!0;i.add(t);n.up().isValid();i.sync()}}]}).show()};Ext.apply(this,{items:[{xtype:"label",itemId:"noOwnerError",text:"You need to provide at least one person",style:{color:"#e60000",fontSize:"11px"},hidden:!0},{xtype:"grid",store:n.ownerStore,viewConfig:{deferEmptyText:!1,emptyText:t,enableTextSelection:!0},defaults:{overflowX:"auto",overflowY:"auto"},tbar:["->",{xtype:"button",text:"Add",disabled:n.readOnly,menu:new Ext.menu.Menu({items:[{xtype:"label",html:"<b>Actions<\/b>",cls:"plainLabel",margin:"0 0 5 5"},{text:"NPS Individual",tooltip:"Add a NPS individual as an owner",hidden:n.npsUserLookupUrl===null||n.npsUserLookupUrl===undefined||n.npsUserLookupUrl==="",handler:function(){const t=this.up("grid");i(n.npsUserLookupUrl,t)}},{text:"Partner",tooltip:"Add a Partner as an owner",hidden:n.partnerLookupUrl===null||n.partnerLookupUrl===undefined||n.partnerLookupUrl==="",handler:function(){const t=this.up("grid");i(n.partnerLookupUrl,t)}}]})}],columns:{defaults:{sortable:!1,hidden:!1,hideable:!0,resizable:!0},items:[{xtype:"actioncolumn",width:22,align:"center",menuDisabled:!0,draggable:!1,hideable:!1,resizable:!1,items:[{icon:Nps.icons.remove,tooltip:"Delete individual from list?",handler:function(t,i){if(t.store.data.length===1&&n.isRequired){Ext.Msg.alert("Warning","The last owner cannot be removed.<\/br>Please add a new owner first.&nbsp;");return}Ext.MessageBox.confirm("Confirm delete","Are you sure you want to delete this individual from the list? <\/br><\/br>",function(n){n==="yes"&&(t.store.removeAt(i),t.store.sync())})},isDisabled:function(){return n.readOnly}}]},{text:"Name",dataIndex:"LastName",flex:2,renderer:NPS.DataStore.util.Format.qtipFormattedNameRenderer()},{text:"User Code",dataIndex:"UserCode",flex:3,renderer:NPS.DataStore.util.Format.qtipRenderer()},{text:"Email",dataIndex:"Email",flex:3,renderer:NPS.DataStore.util.Format.qtipRenderer()}]}}],isValid:function(){if(!n.isRequired)return!0;const t=this.down("grid");if(t.el===undefined)return!0;const i=this.down("#noOwnerError");if(i.hide(),t.el.removeCls("GridValidationError"),t.store.data.length===0){i.show();t.el.addCls("GridValidationError");const n=t.findParentBy(function(n){return n.ownerCt&&n.ownerCt.isXType("tabpanel")});return n!==undefined&&n!==null&&n.tab.el.addCls("TabValidationError"),!1}return!0}});this.callParent(arguments)}});Ext.define("NPS.AjaxErrorHandler",{singleton:!0,createResponse:function(n){let t={};try{if(n.responseText&&n.responseText!=="")try{t=Ext.JSON.decode(n.responseText)}catch(i){t.Details&&(t.Details=`The server responded with a non JSON string: ${n.responseText}`);t.details&&(t.details=`The server responded with a non JSON string: ${n.responseText}`)}else n.status===0?t.Details=" Connection failed. Could not reach the server or the application is unavailable.":n.readyState===0&&(t.Details?t.Details="Connection failed. Could not reach the server":t.details&&(t.details="Connection failed. Could not reach the server"))}catch(i){}return t},buildErrorMessage:function(n,t,i,r,u,f){var o,s,h,c;let e="-";if(t.Details?e=t.Details:t.details&&(e=t.details),o="-",t.ErrorId?o=t.ErrorId:t.errorId&&(o=t.errorId),s="-",t.statusCode?s=t.statusCode:t.StatusCode&&(s=t.StatusCode),h="-",i?h=i:r.statusText&&(h=r.statusText),r&&r.responseText)try{const i=Ext.decode(r.responseText),n=i.details.split(":");let t=0;n&&n.length===2&&(t=1);e=n[t]}catch(l){}c=n||"There was an UN-handled error. If the error persists, contact an Administrator.";f===!0&&(c=c+" "+e);Ext.create("NPS.DataStore.Controls.AjaxErrorPopup",{extraMessage:c,message:e,statusCode:s,statusText:h,timeout:status&&status==="408"?!0:!1,errorId:o,target:u}).show().center()},forExtProxy:function(n,t,i,r){i.responseText===""&&i.responseXML===null&&i.status===0&&i.statusText===""||this.buildErrorMessage(n,this.createResponse(i),i.statusText,i,r,!1)},forExtProxyMsgPassThr:function(n,t,i,r){i.responseText===""&&i.responseXML===null&&i.status===0&&i.statusText===""||this.buildErrorMessage(n,this.createResponse(i),i.statusText,i,r,!0)},forJQuery:function(n,t,i,r,u){this.buildErrorMessage(n,this.createResponse(t),r,t,u,!1)}});Ext.define("NPS.DataStore.Controls.AjaxErrorPopup",{extend:"Ext.window.Window",xtype:"AjaxErrorPopup",constructor:function(n){n.extraMessage=n.extraMessage||"There has been an error processing your request.";n.timeout=n.timeout||!1;const t=$("<ul/>");$("<li/>").text(`Message: ${n.message}`).appendTo(t);$("<li/>").text(`Error Id: ${n.errorId}`).appendTo(t);$("<li/>").text(`StatusCode: ${n.statusCode}`).appendTo(t);$("<li/>").text(`HTTP status: ${n.statusText}`).appendTo(t);$("<li/>").text(`Timed out?: ${n.timeout}`).appendTo(t);$("<li/>").text(`Target URL: ${n.target}`).appendTo(t);Ext.apply(this,{title:n.title||"Error",id:"errorWindowId",resizable:n.resizable||!1,modal:!0,constrain:!0,bodyPadding:20,width:n.width||450,minHeight:250,items:[{xtype:"fieldcontainer",items:[{xtype:"image",src:Nps.icons.error,width:24,margin:"-15 0 20 0"},{xtype:"label",text:n.extraMessage,margin:"15 0 20 0"}]},{xtype:"fieldset",margin:"20 0 0 0",hidden:!0,collapsible:!0,collapsed:!1,title:"Details",items:[{xtype:"label",style:"font-size: .9em",margin:"20 0 0 0",hidden:!1,id:"errorDetailsId",html:t.html()}],toggleVisibility:function(){this.hidden?this.show():this.hide()}}],listeners:{show:function(n){const t=new Ext.util.KeyMap({target:"errorWindowId",binding:[{key:"d",alt:!0,shift:!0,fn:function(){n.down("fieldset").toggleVisibility()}}]})}}});this.callParent(arguments)}});Ext.define("NPS.DataStore.Reference.Collection.Window",{extend:"Ext.window.Window",xtype:"referencecollectionwindow",modal:!0,constrain:!0,resizable:!1,closeAction:"destroy",defaultFocus:"#collectionComboItemId",constructor:function(n){const t=n.isFromProfile||null;Ext.apply(this,{title:n.referenceCount>1?n.referenceCount+" References selected":n.referenceCount+" Reference selected",items:[{xtype:"form",bodyPadding:5,defaults:{labelSeparator:"",labelClsExtra:"plainLabel",labelAlign:"right",labelWidth:100},items:[{xtype:"radio",boxLabel:t===null?"Add selected Reference(s) to an existing Collection":"Add this Reference to an existing Collection",name:"Action",checked:!0,inputValue:1,listeners:{change:function(n,t){const i=this.up("window").down("form");i.down("#collectionComboItemId").setVisible(t);i.down("#collectionNameItemId").setVisible(!t);i.down("#collectionComboItemId").allowBlank=!t;i.down("#collectionNameItemId").allowBlank=t;i.down("#collectionNameItemId").reset("")}}},{xtype:"combobox",itemId:"collectionComboItemId",name:"Collection",store:"collectionStore",fieldLabel:"* Collection",queryMode:"remote",minChars:3,queryDelay:1e3,displayField:"Title",valueField:"Id",emptyText:"Begin typing a name...",forceSelection:!0,selectOnFocus:!0,allowBlank:!1,typeAhead:!0,autoSelect:!1,margin:"0 0 20 0",width:500},{xtype:"radio",boxLabel:t===null?"Create a new Collection and add selected References to it":"Create a new Collection and add this Reference to it",name:"Action",inputValue:2,listeners:{change:function(n,t){const i=this.up("window").down("form");i.down("#collectionComboItemId").setVisible(!t);i.down("#collectionNameItemId").setVisible(t);i.down("#collectionComboItemId").allowBlank=t;i.down("#collectionNameItemId").allowBlank=!t;i.down("#collectionComboItemId").reset("")}}},{xtype:"textfield",vtype:"encodeValidate",itemId:"collectionNameItemId",name:"Title",fieldLabel:"Name",emptyText:"Enter the name of your new Collection",hidden:!0,allowBlank:!0,width:500}],buttons:[{text:"Cancel",width:70,handler:function(){this.up("window").close()}},"->",{text:"Submit",width:70,cls:"mainActionButton",formBind:!0,listeners:{enable:function(n){n.addCls("mainActionButton")},disable:function(n){n.removeCls("mainActionButton")}},handler:function(){const r=this.up("form");if(r.isValid()){var t=r.getValues(),i=Ext.getStore("collectionStore");if(i.clearFilter(),t.Action===2&&i.find("Title",t.Title,0,!1,!1,!0)!==-1){Ext.Msg.alert("Duplicate Title","You already have a Collection with this Title&nbsp;");return}NPS.Common.Utils.showLoadMask("Adding Reference(s) to Collection, Please Wait...");const u=this;Ext.Ajax.request({url:n.saveUpdateCollection,timeout:_ajaxTimeout,method:"POST",params:{collectionId:t.Collection,collectionName:t.Title,recordData:n.recordData},success:function(r){if(t.Action===2){const t=Ext.decode(r.responseText),f=Ext.create("NPS.DataStore.Models.CollectionSearchRow",{Id:t.Id,Title:t.Title});i.add(f);Ext.Msg.show({title:"Go to Collection",msg:`Your Collection ID is ${t.Id}<br><br>Click Yes to open the Collection Profile page at<br>${window.location.origin}${n.collectionProfileUrl}/${t.Id}<br><br>Click No to close this window`,closable:!1,buttons:Ext.Msg.YESNO,fn:function(i){i==="yes"&&window.open(n.collectionProfileUrl+"/"+t.Id);u.up("window").close()},icon:Ext.Msg.QUESTION})}else Ext.Msg.show({title:"Go to Collection",msg:`Your Collection ID is ${t.Collection}<br><br>Click Yes to open the Collection Profile page at<br>${window.location.origin}${n.collectionProfileUrl}/${t.Collection}<br><br>Click No to close this window`,closable:!1,buttons:Ext.Msg.YESNO,fn:function(i){i==="yes"&&window.open(n.collectionProfileUrl+"/"+t.Collection);u.up("window").close()},icon:Ext.Msg.QUESTION});NPS.Common.Utils.hideLoadMask()},failure:function(){NPS.Common.Utils.hideLoadMask()}})}}}]}]});this.callParent(arguments)}})});var NPSDataStoreReferenceCoreModel={modelSerialize:function(n){n.SelfFieldInfo=Ext.Array.toValueMap(n.SelfFieldInfoInternal,"Name");n.ParentFieldInfoInternal&&(n.ParentFieldInfo=Ext.Array.toValueMap(n.ParentFieldInfoInternal,"Name"));for(let t in n.SelfFieldInfo)n.SelfFieldInfo.hasOwnProperty(t)&&(n.SelfFieldInfo[t].controlId=n.SelfFieldInfo[t].Name.trim()+"Id",n.SelfFieldInfo[t].controlItemId=n.SelfFieldInfo[t].Name.trim()+"ItemId",n.SelfFieldInfo[t].Name=n.SelfFieldInfo[t].Name.trim());for(let t in n.ParentFieldInfo)n.ParentFieldInfo.hasOwnProperty(t)&&(n.ParentFieldInfo[t].controlId=`Pp${n.ParentFieldInfo[t].Name.trim()}Id`,n.ParentFieldInfo[t].controlItemId=`Pp${n.ParentFieldInfo[t].Name.trim()}ItemId`,n.ParentFieldInfo[t].Name=`Pp${n.ParentFieldInfo[t].Name.trim()}`);return n}};Ext.define("NPS.DataStore.Reference.DupInformation.Window",{extend:"Ext.window.Window",modal:!0,constrain:!0,resizable:!1,closeAction:"destroy",constructor:function(){Ext.apply(this,{title:"Why is the By or For NPS Important?",width:525,items:[{xtype:"form",bodyPadding:5,defaults:{labelSeparator:"",labelClsExtra:"plainLabel",labelAlign:"right",labelWidth:100},items:[{xtype:"displayfield",value:"The DataStore team will be developing a records retention process for DataStore content.<br><br>The criteria for a DataStore reference to be harvested for record retention are:<br>• The field Created By or For the NPS is marked “Yes”<br>• At least one digital file is associated with the reference<br>• There is a reference Title<br>• There is one or more associated Unit Codes<br>• The reference status has been Active at one point in the reference lifecycle<br>• The Date Published or Content Begin Date is greater than 5 years<br><br>All record security levels, sensitivity designations, and FOIA exemptions would be maintained and adhered to during and after any transfer.<br><br>These procedures are still being developed and are not yet active. DataStore users will be notified and given additional details before an implementation date. If you have questions, please send them to NRSS_DataStore@nps.gov. "}],buttons:["->",{text:"OK",cls:"defaultActionButton",width:70,handler:function(){this.up("window").close()}}]}]});this.callParent(arguments)}});Ext.define("NPS.DataStore.Reference.ContentProdcure.Window",{extend:"Ext.window.Window",modal:!0,constrain:!0,resizable:!1,closeAction:"destroy",constructor:function(){Ext.apply(this,{title:"",width:525,items:[{xtype:"form",bodyPadding:5,defaults:{labelSeparator:"",labelClsExtra:"plainLabel",labelAlign:"right",labelWidth:100},items:[{xtype:"displayfield",value:"Producing Unit Links – The unit(s) most directly involved in creating the reference content and responsible for it as a product. Another way of considering this field is which unit or office should be contacted if there is a question about the product? This is applicable only to content created by or for the NPS.<\/ br>"}],buttons:["->",{text:"OK",cls:"defaultActionButton",width:70,handler:function(){this.up("window").close()}}]}]});this.callParent(arguments)}});Ext.define("NPS.DataStore.Reference.UnitLinks.Window",{extend:"Ext.window.Window",modal:!0,constrain:!0,resizable:!1,closeAction:"destroy",constructor:function(){Ext.apply(this,{title:"",width:525,items:[{xtype:"form",bodyPadding:5,defaults:{labelSeparator:"",labelClsExtra:"plainLabel",labelAlign:"right",labelWidth:100},items:[{xtype:"displayfield",value:"Content Unit Links – The units(s) that are relevant to the reference content. Another way of considering this field is which units are explicitly mentioned in the reference content or need to be connected to the reference for discoverability reasons?"}],buttons:["->",{text:"OK",cls:"defaultActionButton",width:70,handler:function(){this.up("window").close()}}]}]});this.callParent(arguments)}});Ext.define("NPS.DataStore.Reference.DoiPopup.Window",{extend:"Ext.window.Window",modal:!0,constrain:!0,resizable:!1,closeAction:"destroy",constructor:function(){Ext.apply(this,{title:"Digital Object Identifier",width:500,items:[{xtype:"form",bodyPadding:5,defaults:{labelSeparator:"",labelClsExtra:"plainLabel",labelAlign:"right",labelWidth:100},items:[{xtype:"displayfield",value:"A Digital Object Identifier (DOI) is an alphanumeric string assigned to uniquely identify an object and to provide it with a permanent web address. If the reference you are describing has a DOI, you can enter it here or generate a new one directly through DataStore. Any references with DOIs registered by the NPS will have their ‘Core’ and ‘Files and Links’ tabs locked down upon Activation. <br><br>NPS DOI naming patterns are:<ul><li>Documents and reports: 10.36967/ReferenceCode<\/li><li>Datasets and scripts: 10.57830/ReferenceCode<\/li><\/ul><br><br>For questions, contact NRSS_DataStore@nps.gov."}],buttons:["->",{text:"OK",cls:"defaultActionButton",width:70,handler:function(){this.up("window").close()}}]}]});this.callParent(arguments)}});Ext.define("NPS.DataStore.Controls.BasePagination.Store",{extend:"Ext.data.Store",alias:"basepaginationstore",constructor:function(n){const t=n.pageSize||100;Ext.apply(this,{pageSize:t,simpleSortMode:!0,proxy:n.proxy||{type:"ajax",url:n.storeUrl,reader:{type:"json",root:"Results",totalProperty:"TotalCount",successProperty:"success"},listeners:{exception:function(){NPS.Common.Utils.hideLoadMask()}}}});this.callParent(arguments);this.addListener("beforeload",function(){return!0})}});Ext.define("NPS.DataStore.Window.LeavingDialog",{extend:"Ext.Window",alias:"leavingdialog",layout:"form",resizable:!1,width:500,height:200,closeAction:"destroy",autoScroll:!1,title:"Leaving NPS",modal:!0,constructor:function(n){this.initConfig(n);this.callParent(arguments);var t='<b>You are exiting the National Park Service website.<\/b><br/><br/>THANK YOU FOR VISITING OUR SITE.<\/br><p>You will be directed to the following website, which may have privacy policies that are different from the National Park Service (in <span id="urlcountdown">5<\/span> seconds):<br/><br/><a href="'+n.leavingurl+'" target="_blank;">'+n.leavingurl+"<\/a><\/p><br/><p>We hope your visit was informative and enjoyable.<\/p>";this.down("#controlHtml").setHtml(t)},buttons:[{text:"Cancel",handler:function(){this.up("window").close()}}],items:[{xtype:"container",width:450,autoScroll:!1,layout:{type:"vbox",align:"center"},style:{padding:"10px"},items:[{xtype:"label",itemId:"controlHtml",width:440}]}],execute:function(){var n=this,t=(new Date).getTime();n.interval=setInterval(function(){var r=(new Date).getTime(),u=r-t,i=Math.floor(u%6e4/1e3);document.getElementById("urlcountdown").innerHTML=5-i;i>=5&&(clearInterval(n.interval),window.open(n.leavingurl,"_blank"),n.close())});n.center();n.show()},listeners:{close:function(n){n.interval&&clearInterval(n.interval)},destroy:function(n){n.interval&&clearInterval(n.interval)}}});Ext.define("NPS.DataStore.Window.ExternalTabDialog",{extend:"NPS.DataStore.Window.LeavingDialog",alias:"externaltab",constructor:function(n){this.initConfig(n);this.callParent(arguments);var t='<b>Your browser will open a new tab that is not a National Park Service website.<\/b><br/><br/><p>The tab will be directed to the following website, which may have privacy policies that are different from the National Park Service (in <span id="urlcountdown">5<\/span> seconds):<br/><br/><a href="'+n.leavingurl+'" target="_blank;">'+n.leavingurl+"<\/a><\/p><br/>";this.down("#controlHtml").setHtml(t)},execute:function(){var n=this,t=(new Date).getTime();n.interval=setInterval(function(){var r=(new Date).getTime(),u=r-t,i=Math.floor(u%6e4/1e3);document.getElementById("urlcountdown").innerHTML=5-i;i>=5&&(clearInterval(n.interval),window.open(n.leavingurl,"_blank"),n.close())});n.center();n.show()}});$(document).on("click","a[href]",function(n){var r=$(this).attr("href"),i=new URL(r,window.location.origin),t={protocol:i.protocol,hostname:i.hostname,pathname:i.pathname,search:i.search,hash:i.hash,params:new URLSearchParams(i.search)};if(t.hostname.endsWith(".gov")||t.hostname.endsWith(".doi.net")||t.hostname.endsWith(".mil")||t.hostname.endsWith(".si.edu")||t.hostname.endsWith(".fed.us")){console.log("Gov site clicked:",r);console.log("URL hostname:",t.hostname);return}if(!t.hostname.startsWith("javascript:")&&!t.hostname.startsWith("#")){let u=$(n.target);n.preventDefault();console.log("External link clicked:",r);console.log("URL hostname:",t.hostname);(tergetElement="_blank")?externalTabOpeningDialog(i):leavingDialog(i)}})