1import{Ge as ut,Ke as mt,Td as D,ec as Xe,hf as pt,je as dt,kb as Ze,p as Ye,qb as Qe}from"./chunk-HIVZMOGT.js";import{A as ct,B as lt,e as ae,l as Je,m as v,n as et,o as tt,r as it,s as rt,t as nt,x as ot,y as at,z as st}from"./chunk-UKNSY7J4.js";import{Aa as De,Ab as g,Bb as I,C as E,E as z,Fb as ze,G as be,Gb as Re,H as X,Hb as Pe,I as ve,Ia as s,Ib as Be,Ic as He,Jb as K,Kb as w,Lb as je,Lc as Ke,Mb as c,Nb as ne,Ob as Ue,P as Ce,Pc as $e,Q as ye,R as V,S as Ee,Sa as W,T as we,Ta as S,Tc as qe,Uc as Ge,Wa as xe,X as _,Y as O,Ya as ie,Yb as oe,Za as re,Zb as Ve,_ as k,aa as l,c as he,cc as We,f as ge,fa as Te,ga as Ae,ha as J,ia as Me,ka as Oe,kb as F,l as A,la as Se,m as Q,mb as m,nb as p,oa as f,qb as Ne,r as M,ra as ee,rb as ke,s as fe,sb as b,sc as $,tb as o,ua as te,ub as a,v as _e,vb as y,ya as Fe,yb as H,za as Ie,zb as Le}from"./chunk-L45A6KDO.js";import{e as Z}from"./chunk-6MDQTQU3.js";var se;try{se=typeof Intl<"u"&&Intl.v8BreakIterator}catch{se=!1}var q=(()=>{class t{_platformId=l(Fe);isBrowser=this._platformId?$e(this._platformId):typeof document=="object"&&!!document;EDGE=this.isBrowser&&/(edge)/i.test(navigator.userAgent);TRIDENT=this.isBrowser&&/(msie|trident)/i.test(navigator.userAgent);BLINK=this.isBrowser&&!!(window.chrome||se)&&typeof CSS<"u"&&!this.EDGE&&!this.TRIDENT;WEBKIT=this.isBrowser&&/AppleWebKit/i.test(navigator.userAgent)&&!this.BLINK&&!this.EDGE&&!this.TRIDENT;IOS=this.isBrowser&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!("MSStream"in window);FIREFOX=this.isBrowser&&/(firefox|minefield)/i.test(navigator.userAgent);ANDROID=this.isBrowser&&/android/i.test(navigator.userAgent)&&!this.TRIDENT;SAFARI=this.isBrowser&&/safari/i.test(navigator.userAgent)&&this.WEBKIT;constructor(){}static \u0275fac=function(i){return new(i||t)};static \u0275prov=_({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function ce(t){return Array.isArray(t)?t:[t]}var ht=new Set,x,G=(()=>{class t{_platform=l(q);_nonce=l(De,{optional:!0});_matchMedia;constructor(){this._matchMedia=this._platform.isBrowser&&window.matchMedia?window.matchMedia.bind(window):Tt}matchMedia(e){return(this._platform.WEBKIT||this._platform.BLINK)&&wt(e,this._nonce),this._matchMedia(e)}static \u0275fac=function(i){return new(i||t)};static \u0275prov=_({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function wt(t,d){if(!ht.has(t))try{x||(x=document.createElement("style"),d&&x.setAttribute("nonce",d),x.setAttribute("type","text/css"),document.head.appendChild(x)),x.sheet&&(x.sheet.insertRule(`@media ${t} {body{ }}`,0),ht.add(t))}catch(e){console.error(e)}}function Tt(t){return{matches:t==="all"||t==="",media:t,addListener:()=>{},removeListener:()=>{}}}var le=(()=>{class t{_mediaMatcher=l(G);_zone=l(re);_queries=new Map;_destroySubject=new ge;constructor(){}ngOnDestroy(){this._destroySubject.next(),this._destroySubject.complete()}isMatched(e){return gt(ce(e)).some(r=>this._registerQuery(r).mql.matches)}observe(e){let r=gt(ce(e)).map(u=>this._registerQuery(u).observable),n=fe(r);return n=_e(n.pipe(be(1)),n.pipe(Ce(1),z(0))),n.pipe(M(u=>{let h={matches:!1,breakpoints:{}};return u.forEach(({matches:C,query:N})=>{h.matches=h.matches||C,h.breakpoints[N]=C}),h}))}_registerQuery(e){if(this._queries.has(e))return this._queries.get(e);let i=this._mediaMatcher.matchMedia(e),n={observable:new he(u=>{let h=C=>this._zone.run(()=>u.next(C));return i.addListener(h),()=>{i.removeListener(h)}}).pipe(ye(i),M(({matches:u})=>({query:e,matches:u})),Ee(this._destroySubject)),mql:i};return this._queries.set(e,n),n}static \u0275fac=function(i){return new(i||t)};static \u0275prov=_({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();function gt(t){return t.map(d=>d.split(",")).reduce((d,e)=>d.concat(e)).map(d=>d.trim())}var At=new k("MATERIAL_ANIMATIONS");function ft(){return l(At,{optional:!0})?.animationsDisabled||l(Ie,{optional:!0})==="NoopAnimations"?!0:l(G).matchMedia("(prefers-reduced-motion)").matches}var T=function(t){return t[t.NONE=0]="NONE",t[t.BLACK_ON_WHITE=1]="BLACK_ON_WHITE",t[t.WHITE_ON_BLACK=2]="WHITE_ON_BLACK",t}(T||{}
1),_t="cdk-high-contrast-black-on-white",bt="cdk-high-contrast-white-on-black",de="cdk-high-contrast-active",ue=(()=>{class t{_platform=l(q);_hasCheckedHighContrastMode;_document=l(Oe);_breakpointSubscription;constructor(){this._breakpointSubscription=l(le).observe("(forced-colors: active)").subscribe(()=>{this._hasCheckedHighContrastMode&&(this._hasCheckedHighContrastMode=!1,this._applyBodyHighContrastModeCssClasses())})}getHighContrastMode(){if(!this._platform.isBrowser)return T.NONE;let e=this._document.createElement("div");e.style.backgroundColor="rgb(1,2,3)",e.style.position="absolute",this._document.body.appendChild(e);let i=this._document.defaultView||window,r=i&&i.getComputedStyle?i.getComputedStyle(e):null,n=(r&&r.backgroundColor||"").replace(/ /g,"");switch(e.remove(),n){case"rgb(0,0,0)":case"rgb(45,50,54)":case"rgb(32,32,32)":return T.WHITE_ON_BLACK;case"rgb(255,255,255)":case"rgb(255,250,239)":return T.BLACK_ON_WHITE}return T.NONE}ngOnDestroy(){this._breakpointSubscription.unsubscribe()}_applyBodyHighContrastModeCssClasses(){if(!this._hasCheckedHighContrastMode&&this._platform.isBrowser&&this._document.body){let e=this._document.body.classList;e.remove(de,_t,bt),this._hasCheckedHighContrastMode=!0;let i=this.getHighContrastMode();i===T.BLACK_ON_WHITE?e.add(de,_t):i===T.WHITE_ON_BLACK&&e.add(de,bt)}}static \u0275fac=function(i){return new(i||t)};static \u0275prov=_({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})();var me=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=S({type:t});static \u0275inj=O({})}return t})();var vt=(()=>{class t{constructor(){l(ue)._applyBodyHighContrastModeCssClasses()}static \u0275fac=function(i){return new(i||t)};static \u0275mod=S({type:t});static \u0275inj=O({imports:[me,me]})}return t})();var Ot=["determinateSpinner"];function St(t,d){if(t&1&&(J(),o(0,"svg",11),y(1,"circle",12),a()),t&2){let e=I();F("viewBox",e._viewBox()),s(),K("stroke-dasharray",e._strokeCircumference(),"px")("stroke-dashoffset",e._strokeCircumference()/2,"px")("stroke-width",e._circleStrokeWidth(),"%"),F("r",e._circleRadius())}}var Ft=new k("mat-progress-spinner-default-options",{providedIn:"root",factory:It});function It(){return{diameter:Ct}}var Ct=100,Dt=10,yt=(()=>{class t{_elementRef=l(te);_noopAnimations;get color(){return this._color||this._defaultColor}set color(e){this._color=e}_color;_defaultColor="primary";_determinateCircle;constructor(){let e=l(Ft);this._noopAnimations=ft()&&!!e&&!e._forceAnimations,this.mode=this._elementRef.nativeElement.nodeName.toLowerCase()==="mat-spinner"?"indeterminate":"determinate",e&&(e.color&&(this.color=this._defaultColor=e.color),e.diameter&&(this.diameter=e.diameter),e.strokeWidth&&(this.strokeWidth=e.strokeWidth))}mode;get value(){return this.mode==="determinate"?this._value:0}set value(e){this._value=Math.max(0,Math.min(100,e||0))}_value=0;get diameter(){return this._diameter}set diameter(e){this._diameter=e||0}_diameter=Ct;get strokeWidth(){return this._strokeWidth??this.diameter/10}set strokeWidth(e){this._strokeWidth=e||0}_strokeWidth;_circleRadius(){return(this.diameter-Dt)/2}_viewBox(){let e=this._circleRadius()*2+this.strokeWidth;return`0 0 ${e} ${e}`}_strokeCircumference(){return 2*Math.PI*this._circleRadius()}_strokeDashOffset(){return this.mode==="determinate"?this._strokeCircumference()*(100-this._value)/100:null}_circleStrokeWidth(){return this.strokeWidth/this.diameter*100}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=W({type:t,selectors:[["mat-progress-spinner"],["mat-spinner"]],viewQuery:function(i,r){if(i&1&&ze(Ot,5),i&2){let n;Re(n=Pe())&&(r._determinateCircle=n.first)}},hostAttrs:["role","progressbar","tabindex","-1",1,"mat-mdc-progress-spinner","mdc-circular-progress"],hostVars:18,hostBindings:function(i,r){i&2&&(F("aria-valuemin",0)("aria-valuemax",100)("aria-valuenow",r.mode==="determinate"?r.value:null)("mode",r.mode),je("mat-"+r.color),K("width",r.diameter,"px")("height",r.diameter,"px")("--mat-progress-spinner-size",r.diameter+"px")("--mat-progress-spinner-active-indicator-width",r.diameter+"px"),w("_mat-animation-noopable",r._noopAnimations)("mdc-circular-progress--indeterminate",r.mode==="indeterminate"))},inputs:{color:"color",mode:"mode",value:[2,"value","value",$],diameter:[2,"diameter","diameter",$],strokeWidth:[2,"strokeWidth","strokeWidth",$]},exportAs:["matProgressSpinner"],decls:14,vars:11,consts:[["circle",""],["determinateSpinner",""],["aria-hidden","true",1,"mdc-circular-progress__determinate-container"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__determinate-circle-graphic"],["cx","50%","cy","50%",1,"mdc-circular-progress__determinate-circle"],["aria-hidden","true",1,"mdc-circular-progress__indeterminate-container"],[1,"mdc-circular-progress__spinner-layer"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-left"],[3,"ngTemplateOutlet"],[1,"mdc-circular-progress__gap-patch"],[1,"mdc-circular-progress__circle-clipper","mdc-circular-progress__circle-right"],["xmlns","http://www.w3.org/2000/svg","focusable","false",1,"mdc-circular-progress__indeterminate-circle-graphic"],["cx","50%","cy","50%"]],template:function(i,r){if(i&1&&(xe(0,St,2,8,"ng-template",null,0,We),o(2,"div",2,1),J(),o(4,"svg",3),y(5,"circle",4),a()(),Me(),o(6,"div",5)(7,"div",6)(8,"div",7),H(9,8),a(),o(10,"div",9),H(11,8),a(),o(12,"div",10),H(13,8),a()()()),i&2){let n=Be(1);s(4),F("viewBox",r._viewBox()),s(),K("stroke-dasharray",r._strokeCircumference(),"px")("stroke-dashoffset",r._strokeDashOffset(),"px")("stroke-width",r._circleStrokeWidth(),"%"),F("r",r._circleRadius()),s(4),b("ngTemplateOutlet",n),s(2),b("ngTemplateOutlet",n),s(2),b("ngTemplateOutlet",n)}},dependencies:[He],styles:[`.mat-mdc-progress-spinner{display:block;overflow:hidden;line-height:0;position:relative;direction:ltr;transition:opacity 250ms cubic-bezier(0.4, 0, 0.6, 1)}.mat-mdc-progress-spinner circle{stroke-width:var(--mat-progress-spinner-active-indicator-width, 4px)}.mat-mdc-progress-spinner._mat-animation-noopable,.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__determinate-circle{transition:none !important}.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-circle-graphic,.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__spinner-layer,.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-container{animation:none !important}.mat-mdc-progress-spinner._mat-animation-noopable .mdc-circular-progress__indeterminate-container circle{stroke-dasharray:0 !important}@media(forced-colors: active){.mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic,.mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle{stroke:currentColor;stroke:CanvasText}}.mdc-circular-progress__determinate-container,.mdc-circular-progress__indeterminate-circle-graphic,.mdc-circular-progress__indeterminate-container,.mdc-circular-progress__spinner-layer{position:absolute;width:100%;height:100%}.mdc-circular-progress__determinate-container{transform:rotate(-90deg)}.mdc-circular-progress--indeterminate .mdc-circular-progress__determinate-container{opacity:0}
1.mdc-circular-progress__indeterminate-container{font-size:0;letter-spacing:0;white-space:nowrap;opacity:0}.mdc-circular-progress--indeterminate .mdc-circular-progress__indeterminate-container{opacity:1;animation:mdc-circular-progress-container-rotate 1568.2352941176ms linear infinite}.mdc-circular-progress__determinate-circle-graphic,.mdc-circular-progress__indeterminate-circle-graphic{fill:rgba(0,0,0,0)}.mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle,.mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic{stroke:var(--mat-progress-spinner-active-indicator-color, var(--mat-sys-primary))}@media(forced-colors: active){.mat-mdc-progress-spinner .mdc-circular-progress__determinate-circle,.mat-mdc-progress-spinner .mdc-circular-progress__indeterminate-circle-graphic{stroke:CanvasText}}.mdc-circular-progress__determinate-circle{transition:stroke-dashoffset 500ms cubic-bezier(0, 0, 0.2, 1)}.mdc-circular-progress__gap-patch{position:absolute;top:0;left:47.5%;box-sizing:border-box;width:5%;height:100%;overflow:hidden}.mdc-circular-progress__gap-patch .mdc-circular-progress__indeterminate-circle-graphic{left:-900%;width:2000%;transform:rotate(180deg)}.mdc-circular-progress__circle-clipper .mdc-circular-progress__indeterminate-circle-graphic{width:200%}.mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic{left:-100%}.mdc-circular-progress--indeterminate .mdc-circular-progress__circle-left .mdc-circular-progress__indeterminate-circle-graphic{animation:mdc-circular-progress-left-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.mdc-circular-progress--indeterminate .mdc-circular-progress__circle-right .mdc-circular-progress__indeterminate-circle-graphic{animation:mdc-circular-progress-right-spin 1333ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}.mdc-circular-progress__circle-clipper{display:inline-flex;position:relative;width:50%;height:100%;overflow:hidden}.mdc-circular-progress--indeterminate .mdc-circular-progress__spinner-layer{animation:mdc-circular-progress-spinner-layer-rotate 5332ms cubic-bezier(0.4, 0, 0.2, 1) infinite both}@keyframes mdc-circular-progress-container-rotate{to{transform:rotate(360deg)}}@keyframes mdc-circular-progress-spinner-layer-rotate{12.5%{transform:rotate(135deg)}25%{transform:rotate(270deg)}37.5%{transform:rotate(405deg)}50%{transform:rotate(540deg)}62.5%{transform:rotate(675deg)}75%{transform:rotate(810deg)}87.5%{transform:rotate(945deg)}100%{transform:rotate(1080deg)}}@keyframes mdc-circular-progress-left-spin{from{transform:rotate(265deg)}50%{transform:rotate(130deg)}to{transform:rotate(265deg)}}@keyframes mdc-circular-progress-right-spin{from{transform:rotate(-265deg)}50%{transform:rotate(-130deg)}to{transform:rotate(-265deg)}} 2`],encapsulation:2,changeDetection:0})}return t})();var Et=(()=>{class t{static \u0275fac=function(i){return new(i||t)};static \u0275mod=S({type:t});static \u0275inj=O({imports:[vt]})}return t})();var Nt=()=>({maxSizeInMB:2}),kt=(t,d)=>d.display_name;function Lt(t,d){if(t&1&&(o(0,"p",8),c(1),a()),t&2){let e=I();s(),ne(e.logoError())}}function zt(t,d){t&1&&(o(0,"p",8),c(1,"Organization logo is required"),a())}function Rt(t,d){t&1&&(o(0,"p",8),c(1,"Organization name is required"),a())}function Pt(t,d){t&1&&(o(0,"p",8),c(1,"Minimum 3 characters required"),a())}function Bt(t,d){t&1&&(o(0,"p",8),c(1,"Website is required"),a())}function jt(t,d){t&1&&(o(0,"p",8),c(1,"Please enter a valid URL"),a())}function Ut(t,d){t&1&&y(0,"mat-spinner",17)}function Vt(t,d){t&1&&y(0,"ng-icon",18)}function Wt(t,d){t&1&&(o(0,"div",28),y(1,"mat-spinner",17),o(2,"span"),c(3,"Searching locations..."),a()())}function Ht(t,d){if(t&1){let e=Le();o(0,"div",30),g("mousedown",function(){let r=Te(e).$implicit,n=I(3);return Ae(n.onLocationItemClick(r))}),y(1,"ng-icon",31),o(2,"span",32),c(3),a()()}if(t&2){let e=d.$implicit;s(3),ne(e.display_name)}}function Kt(t,d){if(t&1&&Ne(0,Ht,4,1,"div",29,kt),t&2){let e=I(2);ke(e.locationSuggestions())}}function $t(t,d){if(t&1&&(o(0,"div",20),m(1,Wt,4,0,"div",28)(2,Kt,2,0),a()),t&2){let e=I();s(),p(e.isSearchingLocation()?1:2)}}function qt(t,d){t&1&&(o(0,"p",8),c(1,"Location is required"),a())}function Gt(t,d){t&1&&(o(0,"p",8),c(1,"Tagline is required"),a())}function Yt(t,d){t&1&&(o(0,"p",8),c(1,"Minimum 3 characters required"),a())}var Zt=(()=>{class t{http=l(ae);createOrganization(e){let i={title:e.title,tagline:e.tagline};return e.website&&(i.website=e.website),e.description&&(i.desc=e.description),e.location&&(i.location=e.location),e.logo&&(i.logo=e.logo),this.http.post(D("/api/v2/organizations/"),i,{withCredentials:!0}).pipe(E(this.handleError))}uploadLogo(e,i){let r=new FormData;return r.append("pk",String(e)),r.append("type","logo"),r.append("file",i),this.http.post(D("/api/v2/organizations_media_upload/"),r,{withCredentials:!0}).pipe(E(this.handleError))}checkOrganizationAvailability(e){let i=this.generateSlug(e);return this.http.get(D(`/api/v2/organizations/check-slug/${i}/`)).pipe(M(r=>!r.exists),E(()=>Q(()=>new Error("Failed to check organization availability"))))}getOrganizationBySlug(e){return this.http.get(D(`/api/v2/organizations/${e}/`)).pipe(E(this.handleError))}generateSlug(e){return e.toLowerCase().trim().replace(/[^a-z0-9\s-]/g,"").replace(/\s+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")}validateOrganizationName(e){let i=[];return!e||!e.trim()?i.push("Organization name is required"):(e.length<3&&i.push("Organization name must be at least 3 characters"),e.length>100&&i.push("Organization name cannot exceed 100 characters"),/^[a-zA-Z0-9\s\-&.,()]+$/.test(e)||i.push("Organization name contains invali
2d characters")),{isValid:i.length===0,errors:i}}validateWebsite(e){let i=[];if(e&&e.trim())try{let r=new URL(e.startsWith("http")?e:`https://${e}`);["http:","https:"].includes(r.protocol)||i.push("Website must use HTTP or HTTPS protocol")}catch{i.push("Please enter a valid website URL")}return{isValid:i.length===0,errors:i}}validateTagline(e){let i=[];return e&&e.length>200&&i.push("Tagline cannot exceed 200 characters"),{isValid:i.length===0,errors:i}}validateDescription(e){let i=[];return e&&e.length>1e3&&i.push("Description cannot exceed 1000 characters"),{isValid:i.length===0,errors:i}}formatWebsiteUrl(e){return e?!e.startsWith("http://")&&!e.startsWith("https://")?`https://${e}`:e:""}handleError(e){let i="An unexpected error occurred";return e.error?typeof e.error=="string"?i=e.error:e.error.message?i=e.error.message:e.error.name?i=`Organization name "${e.error.name[0]}"`:e.error.non_field_errors&&(i=e.error.non_field_errors[0]):e.message&&(i=e.message),Q(()=>new Error(i))}static \u0275fac=function(i){return new(i||t)};static \u0275prov=_({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),Qt=(()=>{class t{http=l(ae);isSearching=f(!1);searchError=f(null);suggestions=f([]);searchLocations(e){return!e||e.trim().length<2?A([]):this.searchInternalLocations(e).pipe(M(i=>i.slice(0,10)),E(()=>A([])))}searchInternalLocations(e){return this.http.get(D(`/api/v2/cities/?name=${encodeURIComponent(e)}`),{withCredentials:!0}).pipe(M(i=>this.mapCityResults(i||[])),E(()=>A([])))}mapCityResults(e){return e.map(i=>{let r=i.province?.name||void 0,n=i.province?.country||void 0,u=n?this.getCountryName(n):void 0,h=this.formatLocationDisplay(i.name,void 0,r,u);return{id:i.id,display_name:h,city:i.name,state:r,country:u,lat:i.lat,lon:i.long,isInternal:!0}})}getCountryName(e){return{US:"United States",CA:"Canada",GB:"United Kingdom",AU:"Australia",IN:"India",NZ:"New Zealand",DE:"Germany",FR:"France",IT:"Italy",ES:"Spain",JP:"Japan",CN:"China",BR:"Brazil",MX:"Mexico",AR:"Argentina",ZA:"South Africa",NG:"Nigeria",KE:"Kenya",EG:"Egypt",AE:"United Arab Emirates",SG:"Singapore",MY:"Malaysia",TH:"Thailand",ID:"Indonesia",PH:"Philippines",VN:"Vietnam",KR:"South Korea",RU:"Russia",NL:"Netherlands",BE:"Belgium",SE:"Sweden",NO:"Norway",DK:"Denmark",FI:"Finland",CH:"Switzerland",AT:"Austria",PL:"Poland",PT:"Portugal",IE:"Ireland",GR:"Greece"}[e]||e}formatLocationDisplay(e,i,r,n){let u=[e];return i&&i!==e&&u.push(i),r&&u.push(r),n&&u.push(n),u.join(", ")}createLocation(e){let i={name:e.city||this.extractCityFromDisplay(e.display_name),city:e.city,state:e.state,country:e.country,latitude:e.lat?parseFloat(e.lat):void 0,longitude:e.lon?parseFloat(e.lon):void 0};return this.http.post(D("/api/v2/locations/"),i,{withCredentials:!0}).pipe(E(r=>{throw new Error("Failed to create location")}))}extractCityFromDisplay(e){return e.split(", ")[0]||e}validateLocation(e){let i=[];return e?(!e.display_name||e.display_name.trim().length<2)&&i.push("Location name is too short"):i.push("Please select a location"),{isValid:i.length===0,errors:i}}getLocationValue(e){return e?e.isInternal?e.id:e.display_name:null}clearSearch(){this.suggestions.set([]),this.searchError.set(null),this.isSearching.set(!1)}createSearchObservable(e){return e.pipe(z(300),X(),V(i=>this.searchLocations(i)))}get searching(){return this.isSearching.asReadonly()}get error(){return this.searchError.asReadonly()}get locationSuggestions(){return this.suggestions.asReadonly()}setSearching(e){this.isSearching.set(e)}setError(e){this.searchError.set(e)}static \u0275fac=function(i){return new(i||t)};static \u0275prov=_({token:t,factory:t.\u0275fac,providedIn:"root"})}return t})(),fr=(()=>{class t{fb=l(st);toastService=l(dt);organizationApiService=l(Zt);locationSearchService=l(Qt);isOpen=!1;organizationName="";modalClose=new ie;organizationCreated=new ie;organizationForm;selectedFile=f(null);logoPreview=f(null);logoError=f("");isUploadingLogo=f(!1);isCreating=f(!1);nameFocused=!1;taglineFocused=!1;descFocused=!1;websiteFocused=!1;locationFocused=!1;showLocationDropdown=!1;isFormSubmitted=!1;locationSuggestions=f([]);isSearchingLocation=f(!1);selectedLocation=null;destroyRef=l(Se);
2urlValidationRegex=/(^|\s)((https?:\/\/)?[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?)/gi;ngOnInit(){this.initializeForm()}ngOnChanges(e){e.isOpen?.currentValue&&!e.isOpen?.previousValue&&this.resetForm()}initializeForm(){this.organizationForm=this.fb.group({title:[this.organizationName||"",[v.required,v.minLength(3)]],tagline:["",[v.required,v.minLength(3),v.maxLength(160)]],desc:["",[v.minLength(3)]],website:["",[v.required,v.pattern(this.urlValidationRegex)]],location:["",[v.required]]}),this.organizationForm.get("location").valueChanges.pipe(z(300),X(),Ye(this.destroyRef),V(e=>typeof e=="object"&&e!==null?(this.locationSuggestions.set([]),this.isSearchingLocation.set(!1),A([])):typeof e=="string"&&e.trim().length>2?A(null).pipe(we(()=>this.isSearchingLocation.set(!0)),V(()=>this.locationSearchService.searchLocations(e.trim())),ve(()=>this.isSearchingLocation.set(!1))):(this.isSearchingLocation.set(!1),this.locationSuggestions.set([]),A([])))).subscribe(e=>{e&&this.locationSuggestions.set(e)})}resetForm(){this.organizationForm&&this.organizationForm.reset({title:this.organizationName||"",tagline:"",desc:"",website:"",location:""}),this.selectedFile.set(null),this.logoPreview.set(null),this.logoError.set(""),this.isFormSubmitted=!1,this.selectedLocation=null}onLogoSelected(e){this.selectedFile.set(e.file),this.logoPreview.set(e.preview),this.logoError.set("")}onLogoRemoved(){this.selectedFile.set(null),this.logoPreview.set(null),this.logoError.set("")}onLogoUploadError(e){this.logoError.set(e),this.selectedFile.set(null),this.logoPreview.set(null)}isSubmitting(){return this.isCreating()}onSubmit(){return Z(this,null,function*(){this.isFormSubmitted=!0,this.organizationForm.valid&&this.selectedFile()&&(yield this.createOrganization())})}createOrganization(){return Z(this,null,function*(){this.isCreating.set(!0);try{let e={title:this.organizationForm.get("title")?.value,tagline:this.organizationForm.get("tagline")?.value,desc:this.organizationForm.get("desc")?.value||"",website:this.organizationForm.get("website")?.value,location:this.locationSearchService.getLocationValue(this.selectedLocation)},i=yield this.organizationApiService.createOrganization(e).toPromise(),r=this.selectedFile();if(r&&i?.id){this.isUploadingLogo.set(!0);try{let n=yield this.organizationApiService.uploadLogo(i.id,r).toProm
2ise();n?.logo&&(i.logo=n.logo)}catch{this.toastService.show("Organization created, but the logo upload failed. You can add it from Manage.","warning")}finally{this.isUploadingLogo.set(!1)}}this.toastService.show(i?.message||"Organization created successfully!","success"),this.organizationCreated.emit({organization:i}),this.modalClose.emit()}catch(e){this.isUploadingLogo.set(!1),this.toastService.show(e.message||"Failed to create organization","error")}finally{this.isCreating.set(!1)}})}onCancel(){this.modalClose.emit()}displayLocation(e){if(typeof e=="string")return e;if(!e)return"";if(e.city&&e.country)return`${e.city}, ${e.state?e.state+", ":""}${e.country}`;let i=e.display_name;if(i.length>80){let r=i.split(",");if(r.length>3)return`${r[0].trim()}, ${r[1].trim()}, ${r[r.length-1].trim()}`}return i}onLocationFocus(){this.locationFocused=!0,this.showLocationDropdown=!0}onLocationBlur(){this.locationFocused=!1,setTimeout(()=>{this.showLocationDropdown=!1},200)}onLocationItemClick(e){this.selectedLocation=e,this.organizationForm.get("location")?.setValue(e.display_name),this.showLocationDropdown=!1,this.locationSuggestions.set([])}static \u0275fac=function(i){return new(i||t)};static \u0275cmp=W({type:t,selectors:[["uni-create-organization-dialog"]],inputs:{isOpen:"isOpen",organizationName:"organizationName"},outputs:{modalClose:"modalClose",organizationCreated:"organizationCreated"},features:[oe([qe({matBusiness:Ze,matClose:Qe,matLocationOn:Xe})]),ee],decls:71,vars:46,consts:[["icon","matBusiness","size","md",3,"modalClose","isOpen","title","subtitle","closeOnBackdrop","closeOnEscape"],["modal
2-body",""],[1,"organization-form",3,"ngSubmit","formGroup"],[1,"logo-upload-section"],[1,"form-label"],[1,"required"],["variant","sm",3,"fileSelected","deleteRequested","validationFailed","imageUrl","disabled","hasError","isUploading","showDeleteButton","config"],[1,"form-helper"],[1,"error-message"],[1,"form-fields"],[1,"form-group"],[1,"input-wrapper"],["type","text","formControlName","title","placeholder","Enter organization name","required","",1,"form-input",3,"focus","blur"],[1,"input-prefix"],["name","matBusiness","size","16"],["type","url","formControlName","website","placeholder","https://example.com","required","",1,"form-input","with-prefix",3,"focus","blur"],[1,"input-wrapper","location-input-wrapper"],["diameter","16"],["name","matLocationOn","size","16"],["type","text","formControlName","location","placeholder","Search for city, country...","autocomplete","off","required","",1,"form-input","with-prefix",3,"focus","blur"],[1,"location-dropdown"],["type","text","formControlName","tagline","placeholder","A short, memorable phrase","maxlength","160","required","",1,"form-input",3,"focus","blur"],[1,"optional"],[1,"input-wrapper","textarea-wrapper"],["formControlName","desc","placeholder","What does your organization do?","rows","2",1,"form-input","form-textarea",3,"focus","blur"],["modal-footer","",1,"form-actions"],["variant","outline","size","md",3,"onClick","disabled"],["variant","solid","size","md",3,"onClick","disabled","loading"],[1,"location-dropdown-item","disabled"],[1,"location-dropdown-item"],[1,"location-dropdown-item",3,"mousedown"],["name","matLocationOn","size","16",1,"location-icon"],[1,"location-text"]],template:function(i,r){if(i&1&&(o(0,"uni-modal",0),g("modalClose",function(){return r.onCancel()}),o(1,"div",1)(2,"form",2),g("ngSubmit",function(){return r.onSubmit()}),o(3,"div",3)(4,"label",4),c(5,"Organization Logo "),o(6,"span",5),c(7,"*"),a()(),o(8,"uni-logo-upload",6),g("fileSelected",function(u){return r.onLogoSelected(u)})("deleteRequested",function(){return r.onLogoRemoved()})("validationFailed",function(u){return r.onLogoUploadError(u)}),a(),o(9,"p",7),c(10,"JPG, PNG, SVG \u2022 Max 2MB"),a(),m(11,Lt,2,1,"p",8),m(12,zt,2,0,"p",8),a(),o(13,"div",9)(14,"div",10)(15,"label",4),c(16,"Organization Name "),o(17,"span",5),c(18,"*"),a()(),o(19,"div",11)(20,"input",12),g("focus",function(){return r.nameFocused=!0})("blur",function(){return r.nameFocused=!1}),a()(),m(21,Rt,2,0,"p",8),m(22,Pt,2,0,"p",8),a(),o(23,"div",10)(24,"label",4),c(25,"Website "),o(26,"span",5),c(27,"*"),a()(),o(28,"div",11)(29,"div",13),y(30,"ng-icon",14),a(),o(31,"input",15),g("focus",function(){return r.websiteFocused=!0})("blur",function(){return r.websiteFocused=!1}),a()(),m(32,Bt,2,0,"p",8),m(33,jt,2,0,"p",8),a(),o(34,"div",10)(35,"label",4),c(36,"Location "),o(37,"span",5),c(38,"*"),a()(),o(39,"div",16)(40,"div",13),m(41,Ut,1,0,"mat-spinner",17)(42,Vt,1,0,"ng-icon",18),a(),o(43,"input",19),g("focus",function(){return r.onLocationFocus()})("blur",function(){return r.onLocationBlur()}),a(),m(44,$t,3,1,"div",20),a(),m(45,qt,2,0,"p",8),a(),o(46,"div",10)(47,"label",4),c(48,"Tagline "),o(49,"span",5),c(50,"*"),a()(),o(51,"div",11)(52,"input",21),g("focus",function(){return r.taglineFocused=!0})("blur",function(){return r.taglineFocused=!1}),a()(),m(53,Gt,2,0,"p",8),m(54,Yt,2,0,"p",8),o(55,"p",7),c(56),a()(),o(57,"div",10)(58,"label",4),c(59,"Description "),o(60,"span",22),c(61,"(optional)"),a()(),o(62,"div",23)(63,"textarea",24),g("focus",function(){return r.descFocused=!0})("blur",function(){return r.descFocused=!1}),a()(),o(64,"p",7),c(65,"Brief description of your organization"),a()()()()(),o(66,"div",25)(67,"uni-button",26),g("onClick",function(){return r.onCancel()}),c(68," Cancel "),a(),o(69,"uni-button",27),g("onClick",function(){return r.onSubmit()}),c(70," Save Organization "),a()()()),i&2){let n,u,h,C,N,pe,R,P,B,j,U,Y;b("isOpen",r.isOpen)("title","Create New Organization")("subtitle","Add your organization details to get started")("closeOnBackdrop",!r.isCreating())("closeOnEscape",!r.isCreating()),s(2),b("formGroup",r.organizationForm),s(6),b("imageUrl",r.logoPreview()||void 0)("disabled",r.isSubmitting())("hasError",r.isFormSubmitted&&!r.selectedFile())("isUploading",r.isUploadingLogo())("showDeleteButton",!0)("config",Ve(45,Nt)),s(3),p(r.logoError()?11:-1),s(),p(r.isFormSubmitted&&!r.selectedFile()&&!r.logoError()?12:-1),s(7),w("focused",r.nameFocused)("has-error",((n=r.organizationForm.get("title"))==null?null:n.invalid)&&
2((n=r.organizationForm.get("title"))==null?null:n.touched)),s(2),p((u=r.organizationForm.get("title"))!=null&&u.hasError("required")&&((u=r.organizationForm.get("title"))!=null&&u.touched)?21:-1),s(),p((h=r.organizationForm.get("title"))!=null&&h.hasError("minlength")?22:-1),s(6),w("focused",r.websiteFocused)("has-error",((C=r.organizationForm.get("website"))==null?null:C.invalid)&&((C=r.organizationForm.get("website"))==null?null:C.touched)),s(4),p((N=r.organizationForm.get("website"))!=null&&N.hasError("required")&&((N=r.organizationForm.get("website"))!=null&&N.touched)?32:-1),s(),p((pe=r.organizationForm.get("website"))!=null&&pe.hasError("pattern")?33:-1),s(6),w("focused",r.locationFocused)("has-error",((R=r.organizationForm.get("location"))==null?null:R.invalid)&&((R=r.organizationForm.get("location"))==null?null:R.touched)),s(2),p(r.isSearchingLocation()?41:42),s(3),p(r.showLocationDropdown&&(r.locationSuggestions().length>0||r.isSearchingLocation())?44:-1),s(),p((P=r.organizationForm.get("location"))!=null&&P.hasError("required")&&((P=r.organizationForm.get("location"))!=null&&P.touched)?45:-1),s(6),w("focused",r.taglineFocused)("has-error",((B=r.organizationForm.get("tagline"))==null?null:B.invalid)&&((B=r.organizationForm.get("tagline"))==null?null:B.touched)),s(2),p((j=r.organizationForm.get("tagline"))!=null&&j.hasError("required")&&((j=r.organizationForm.get("tagline"))!=null&&j.touched)?53:-1),s(),p((U=r.organizationForm.get("tagline"))!=null&&U.hasError("minlength")&&((U=r.organizationForm.get("tagline"))!=null&&U.touched)?54:-1),s(2),Ue("",((Y=r.organizationForm.get("tagline"))==null||Y.value==null?null:Y.value.length)||0,"/160 characters"),s(6),w("focused",r.descFocused),s(5),b("disabled",r.isCreating()),s(2),b("disabled",!r.organizationForm.valid||!r.selectedFile())("loading",r.isCreating())}},dependencies:[Ke,ct,it,Je,et,tt,ot,at,lt,rt,nt,Et,yt,Ge,pt,mt,ut],styles:['@charset "UTF-8";.organization-form[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--spacing-lg)}.logo-upload-section[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--spacing-sm);align-items:flex-start;padding-bottom:var(--spacing-md);border-bottom:var(--border-width-thin) solid var(--border);margin-bottom:var(--spacing-sm)}.form-fields[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--size-5)}.form-group[_ngcontent-%COMP%]{display:flex;flex-direction:column;gap:var(--size-1-5)}.form-label[_ngcontent-%COMP%]{font-size:var(--font-size-sm);font-weight:var(--font-weight-medium);color:var(--text-primary)}.required[_ngcontent-%COMP%]{color:var(--error-500);margin-left:var(--size-1)}.optional[_ngcontent-%COMP%]{color:var(--text-tertiary);font-size:var(--font-size-sm);margin-left:var(--spacing-xs)}.form-helper[_ngcontent-%COMP%]{font-size:var(--font-size-xs);color:var(--text-secondary);margin:0}.input-wrapper[_ngcontent-%COMP%]{position:relative;border:var(--border-width-thin) solid var(--border);border-radius:var(--radius-lg);background:var(--surface);transition:all var(--duration-fast) var(--easing-out);overflow:hidden}.input-wrapper[_ngcontent-%COMP%]:hover{border-color:var(--border)}.input-wrapper.focused[_ngcontent-%COMP%]{border-color:var(--primary-500);box-shadow:0 0 0 var(--focus-ring-width) var(--primary-alpha-20)}.input-wrapper.has-error[_ngcontent-%COMP%]{border-color:var(--error-500)}.input-wrapper.textarea-wrapper[_ngcontent-%COMP%]{min-height:var(--size-25)}.form-input[_ngcontent-%COMP%]{width:100%;padding:var(--size-2-5) calc(var(--size-3) + var(--size-1));border:none;background:transparent;color:var(--text-primary);font-size:var(--font-size-base);font-family:inherit;outline:none}.form-input[_ngcontent-%COMP%]::placeholder{color:var(--text-tertiary)}.form-input.with-prefix[_ngcontent-%COMP%]{padding-left:var(--size-11)}.form-textarea[_ngcontent-%COMP%]{resize:vertical;min-height:var(--size-15)}.input-prefix[_ngcontent-%COMP%]{position:absolute;left:var(--spacing-md);top:50%;transform:translateY(-50%);color:var(--text-tertiary);pointer-events:none}.error-message[_ngcontent-%COMP%]{color:var(--error-500);font-size:var(--font-size-xs);margin:0;display:flex;align-items:center;gap:var(--size-1)}.form-actions[_ngcontent-%COMP%]{display:flex;gap:var(--spacing-md);justify-content:flex-end}@media (max-width: 767.98px){.organization-form[_ngcontent-%COMP%], .form-fields[_ngcontent-%COMP%]{gap:var(--spacing-md)}}.location-input-wrapper[_ngcontent-%COMP%]{position:relative;overflow:visible!important}.location-dropdown[_ngcontent-%COMP%]{position:absolute;top:100%;left:0;right:0;background:var(--surface);border:var(--border-width-thin) solid var(--border);border-radius:var(--radius-lg);box-shadow:var(--shadow-lg);max-height:250px;overflow-y:auto;z-index:var(--z-critical-modal);margin-top:var(--size-1)}.location-dropdown-item[_ngcontent-%COMP%]{display:flex;align-items:center;gap:var(--spacing-sm);padding:var(--spacing-sm) var(--spacing-md);
2cursor:pointer;transition:background-color var(--duration-fast) var(--easing-out);border-bottom:var(--border-width-thin) solid var(--border)}.location-dropdown-item[_ngcontent-%COMP%]:last-child{border-bottom:none}.location-dropdown-item[_ngcontent-%COMP%]:hover{background:var(--bg-secondary)}.location-dropdown-item.disabled[_ngcontent-%COMP%]{cursor:default;opacity:.7}.location-dropdown-item.disabled[_ngcontent-%COMP%]:hover{background:transparent}.location-dropdown-item[_ngcontent-%COMP%] .location-icon[_ngcontent-%COMP%]{color:var(--primary-500);flex-shrink:0}.location-dropdown-item[_ngcontent-%COMP%] .location-text[_ngcontent-%COMP%]{flex:1;font-size:var(--font-size-sm);color:var(--text-primary)}.location-dropdown-item[_ngcontent-%COMP%] .location-text[_ngcontent-%COMP%]{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}'],changeDetection:0})}return t})();export{fr as CreateOrganizationDialogComponent};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.