@dialstack/sdk-react 3.9.0 → 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- import e,{useState as n,useEffect as o,memo as a,useRef as t,useMemo as l,useCallback as r,useId as i,useImperativeHandle as d}from"react";import{Handle as s,Position as c,getStraightPath as u,getSmoothStepPath as p,BaseEdge as f,ReactFlowProvider as g,useReactFlow as b,useUpdateNodeInternals as m,useNodesState as v,useEdgesState as h,applyNodeChanges as _,MarkerType as x,ReactFlow as y,ConnectionLineType as w,Background as k,Controls as E}from"@xyflow/react";import{useDialstackComponents as N,useReportComponent as C}from"@dialstack/sdk-react";import O from"dagre";import{Command as L}from"cmdk";import{parsePhoneNumberFromString as z,AsYouType as S}from"libphonenumber-js";import{createPortal as R}from"react-dom";function j(e,n,o,a){return new(o||(o=Promise))(function(t,l){function r(e){try{d(a.next(e))}catch(e){l(e)}}function i(e){try{d(a.throw(e))}catch(e){l(e)}}function d(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o(function(e){e(n)})).then(r,i)}d((a=a.apply(e,n||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const T="smoothstep";function A(e,n){var o,a;return null!==(a=null===(o=e.visibleExits)||void 0===o?void 0:o.call(e,n))&&void 0!==a?a:e.exits}const I=({icon:n,label:o,timeout:a,subtitle:t})=>e.createElement("div",{className:"ds-dial-plan-node__header"},e.createElement("div",{className:"ds-dial-plan-node__icon"},n),e.createElement("span",{className:"ds-dial-plan-node__type-label"},o,void 0!==a&&e.createElement("span",{style:{textTransform:"none"}}," (",a,"s)")),t&&e.createElement("span",{className:"ds-dial-plan-node__name"},t)),F=({id:n,label:o})=>e.createElement("div",{className:"ds-dial-plan-node__exit-row"},e.createElement("span",{className:"ds-dial-plan-node__exit-label"},o),e.createElement(s,{type:"source",position:c.Right,id:n,className:"ds-dial-plan-handle ds-dial-plan-handle--next"})),D=({exits:n,locale:o})=>0===n.length?null:e.createElement(e.Fragment,null,n.map(n=>e.createElement(F,{key:n.id,id:n.id,label:n.localeExitKey&&(null==o?void 0:o.exits[n.localeExitKey])||n.label})));function M(e,n){const o=e,a=(null==o?void 0:o[n])||(null==o?void 0:o[`${n}_id`]);return"string"==typeof a?a:""}function P(e,n){return{[e]:n,[`${e}_id`]:n}}function $(e,n){return e.startsWith("user_")?n.targetTypes.user:e.startsWith("rg_")?n.targetTypes.ringGroup:e.startsWith("dp_")?n.targetTypes.dialPlan:e.startsWith("qu_")?n.targetTypes.queue:e.startsWith("va_")?n.targetTypes.voiceApp:e.startsWith("svm_")?n.targetTypes.sharedVoicemail:n.nodeTypes.internalDial}function H(e){var n;return null!==(n=null==e?void 0:e.startsWith("dp_"))&&void 0!==n&&n}function K(e,n,o){const a=n.users.get(e),t=(null==a?void 0:a.name)||(null==a?void 0:a.email);return t&&(null==a?void 0:a.extension_number)?`${t} (${o.combobox.extensionLabel} ${a.extension_number})`:t}const B=({resourceId:n,onOpenResource:o,label:a})=>e.createElement("button",{type:"button",className:"ds-dial-plan-config-field__open-link",onClick:()=>o(n)},e.createElement("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polyline",{points:"15 3 21 3 21 9"}),e.createElement("polyline",{points:"9 21 3 21 3 15"}),e.createElement("line",{x1:"21",y1:"3",x2:"14",y2:"10"}),e.createElement("line",{x1:"3",y1:"21",x2:"10",y2:"14"})),a),V=({groups:a,value:r,loading:i=!1,placeholder:d="Search…",onSelect:s,onCreateResource:c,selectLabel:u="— Select —",noResultsLabel:p="No results found",loadingLabel:f="Loading…",createNewPrefix:g="+ Create new…",extensionLabel:b="Ext."})=>{const[m,v]=n(!1),[h,_]=n(""),x=t(null);o(()=>{var e;if(!m)return;const n=null===(e=x.current)||void 0===e?void 0:e.getRootNode(),o=n instanceof ShadowRoot||n instanceof Document?n:document,a=e=>function(e){"Escape"===e.key&&(v(!1),_(""))}(e),t=e=>function(e){x.current&&!x.current.contains(e.target)&&(v(!1),_(""))}(e);return o.addEventListener("keydown",a),o.addEventListener("mousedown",t),()=>{o.removeEventListener("keydown",a),o.removeEventListener("mousedown",t)}},[m]);const y=l(()=>{if(!r)return"";for(const e of a){const n=e.items.find(e=>e.id===r);if(n)return n.extension_number?`${n.name} (${b} ${n.extension_number})`:n.name}return""},[r,a,b]);if(!m)return e.createElement("button",{type:"button",className:"ds-resource-combobox__trigger",onClick:()=>v(!0)},e.createElement("span",{className:y?"":"ds-resource-combobox__trigger-placeholder"},y||u),e.createElement("svg",{className:"ds-resource-combobox__trigger-chevron",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polyline",{points:"6 9 12 15 18 9"})));const w=a.some(e=>e.items.length>0);return e.createElement("div",{ref:x},e.createElement(L,{className:"ds-resource-combobox",shouldFilter:!0,loop:!0},e.createElement(L.Input,{className:"ds-resource-combobox__input",placeholder:d,value:h,onValueChange:_,autoFocus:!0}),e.createElement(L.List,{className:"ds-resource-combobox__list"},e.createElement(L.Empty,{className:"ds-resource-combobox__empty"},p),a.map(n=>e.createElement(L.Group,{key:n.label,heading:n.label,className:"ds-resource-combobox__group"},n.items.map(o=>{var a;return e.createElement(L.Item,{key:o.id,value:`${o.name} ${null!==(a=o.extension_number)&&void 0!==a?a:""} ${n.label} ${o.id}`,className:"ds-resource-combobox__item"+(o.id===r?" ds-resource-combobox__item--selected":""),onSelect:()=>{return e=o.id,n=o.extension_number?`${o.name} (${b} ${o.extension_number})`:o.name,s(e,n),v(!1),void _("");var e,n}},e.createElement("span",{className:"ds-resource-combobox__name"},o.name),o.extension_number&&e.createElement("span",{className:"ds-resource-combobox__ext"},"(",b," ",o.extension_number,")"),e.createElement("span",{className:"ds-resource-combobox__check"},o.id===r?"✓":""))}),c&&n.type&&e.createElement(L.Item,{forceMount:!0,value:`create new ${n.label}`,className:"ds-resource-combobox__create",onSelect:()=>function(e){return j(this,void 0,void 0,function*(){if(!c)return;const n=yield c(e);n&&(s(n.id,n.extension_number?`${n.name} (${b} ${n.extension_number})`:n.name),v(!1),_(""))})}(n.type)},g))),!w&&!h&&i&&e.createElement("div",{className:"ds-resource-combobox__empty"},f))))},W=({label:n,htmlFor:o,action:a,children:t})=>e.createElement("div",{className:"ds-dial-plan-config-field"},a?e.createElement("div",{className:"ds-dial-plan-config-field__header"},e.createElement("label",{className:"ds-dial-plan-config-field__label",htmlFor:o},n),a):e.createElement("label",{className:"ds-dial-plan-config-field__label",htmlFor:o},n),t);function U(e,a,t,i){const[d,s]=n([]),[c,u]=n(!0),p=l(()=>JSON.stringify(e),[e]),f=r(()=>Promise.all(e.map(e=>a(e.type,e.options))).then(n=>{s(e.map((e,o)=>{var a,t;return{label:null!==(a=null==i?void 0:i.resourceGroups[e.labelKey])&&void 0!==a?a:e.fallback,type:e.type,items:null!==(t=n[o])&&void 0!==t?t:[]}}))}).catch(()=>{}).finally(()=>u(!1)),[a,i,p]);o(()=>{f()},[f]);const g=r(n=>j(this,void 0,void 0,function*(){var o;if(!t)return;const a=null===(o=e.find(e=>e.type===n))||void 0===o?void 0:o.options,l=yield t(n,a);return l&&(yield f()),l}),[t,f,p]);return{groups:d,loading:c,handleCreateResource:t?g:void 0}}const q=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("circle",{cx:"12",cy:"12",r:"10"}),e.createElement("polyline",{points:"12 6 12 12 16 14"})),G=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})),Y=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),e.createElement("circle",{cx:"9",cy:"7",r:"4"}),e.createElement("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),e.createElement("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})),X=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polyline",{points:"23 7 23 1 17 1"}),e.createElement("line",{x1:"16",y1:"8",x2:"23",y2:"1"}),e.createElement("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})),Z=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("circle",{cx:"5.5",cy:"11.5",r:"4.5"}),e.createElement("circle",{cx:"18.5",cy:"11.5",r:"4.5"}),e.createElement("line",{x1:"5.5",y1:"16",x2:"18.5",y2:"16"})),Q=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M12 8V4H8"}),e.createElement("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),e.createElement("path",{d:"M2 14h2"}),e.createElement("path",{d:"M20 14h2"}),e.createElement("path",{d:"M15 13v2"}),e.createElement("path",{d:"M9 13v2"})),J=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("rect",{x:"3",y:"3",width:"7",height:"7"}),e.createElement("rect",{x:"14",y:"3",width:"7",height:"7"}),e.createElement("rect",{x:"3",y:"14",width:"7",height:"7"}),e.createElement("rect",{x:"14",y:"14",width:"7",height:"7"})),ee=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"}),e.createElement("line",{x1:"23",y1:"1",x2:"1",y2:"23"})),ne=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),e.createElement("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),e.createElement("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})),oe={type:"schedule",flowType:"schedule",localeKey:"schedule",label:"Schedule",description:"Route calls by schedule",color:"#0ea5e9",exits:[{id:"open",label:"Open",configKey:"open",localeExitKey:"open"},{id:"closed",label:"Closed",configKey:"closed",localeExitKey:"closed"},{id:"holiday",label:"Holiday",configKey:"holiday",localeExitKey:"holiday"}],configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,onOpenResource:l,locale:r})=>{var i,d,s,c,u;const{groups:p,loading:f,handleCreateResource:g}=U([{type:"schedule",labelKey:"schedules",fallback:"Schedules"}],a,t,r),b=M(n,"schedule"),m=void 0!==n.holiday;return e.createElement(e.Fragment,null,e.createElement(W,{label:null!==(i=null==r?void 0:r.configLabels.schedule)&&void 0!==i?i:"Schedule"},e.createElement(V,{groups:p,value:b,loading:f,placeholder:null!==(d=null==r?void 0:r.configLabels.searchSchedules)&&void 0!==d?d:"Search schedules…",onSelect:(e,n)=>o(P("schedule",e),{scheduleName:n}),onCreateResource:g,selectLabel:null==r?void 0:r.combobox.select,noResultsLabel:null==r?void 0:r.combobox.noResults,loadingLabel:null==r?void 0:r.combobox.loading,createNewPrefix:null==r?void 0:r.combobox.createNew,extensionLabel:null==r?void 0:r.combobox.extensionLabel}),b&&l&&e.createElement(B,{resourceId:b,onOpenResource:l,label:null!==(s=null==r?void 0:r.configLabels.openInNewTab)&&void 0!==s?s:"Open target details"})),e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("label",{className:"ds-dial-plan-config-field__checkbox"},e.createElement("input",{type:"checkbox",checked:m,onChange:e=>{return n=e.target.checked,o({holiday:n?null:void 0},{holidayEnabled:n});var n}}),e.createElement("span",null,null!==(c=null==r?void 0:r.configLabels.routeHolidaySeparately)&&void 0!==c?c:"Route holidays separately")),e.createElement("p",{className:"ds-dial-plan-config-field__hint"},null!==(u=null==r?void 0:r.configLabels.routeHolidaySeparatelyHint)&&void 0!==u?u:"When on, holidays route to a dedicated branch you wire below. Otherwise holidays follow the Closed exit.")))},defaultConfig:{schedule:"",schedule_id:""},icon:q,renderNode:(n,o)=>{const a=n.locale,t=o.exits.slice(0,n.holidayEnabled?3:2);return e.createElement(e.Fragment,null,e.createElement(I,{icon:o.icon,label:n.label,subtitle:n.scheduleName}),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(D,{exits:t,locale:a})))},toFlowNode:e=>{const n=e;return{label:"Schedule",scheduleId:M(n.config,"schedule"),holidayEnabled:void 0!==n.config.holiday,originalNode:n}},collectResourceIds:(e,n)=>{const o=M(e,"schedule");o&&n.addSchedule(o)},enrichNode:(e,n,o)=>{const a=n.schedules.get(e.scheduleId);return Object.assign(Object.assign({},e),{scheduleName:null==a?void 0:a.name,locale:o})},onConfigChange:(e,n,o)=>{"holiday"in n&&void 0===n.holiday&&(o.setEdges(n=>{const a=n.filter(n=>!(n.source===e&&"holiday"===n.sourceHandle));return a.length!==n.length&&o.updateDirty(o.nodesRef.current,a),a}),requestAnimationFrame(()=>o.updateNodeInternals(e)))},serializeConfig:(e,n,o)=>{var a;return(null===(a=e.data)||void 0===a?void 0:a.holidayEnabled)&&void 0===o.holiday?Object.assign(Object.assign({},o),{holiday:null}):o}},ae=({value:n,min:o,max:a,disabled:t=!1,onChange:l,locale:r})=>{var i;return e.createElement(W,{label:null!==(i=null==r?void 0:r.configLabels.timeout)&&void 0!==i?i:"Timeout (seconds)"},e.createElement("input",{className:"ds-dial-plan-config-field__input",type:"number",min:o,max:a,value:n,disabled:t,onChange:e=>l(Math.min(a,Math.max(o,Number(e.target.value)||o)))}))},te={type:"ring_all_users",flowType:"ringAllUsers",localeKey:"ringAllUsers",label:"Ring All",description:"Ring all account users",color:"#f59e0b",exits:[{id:"next",label:"Timeout",configKey:"next",localeExitKey:"timeout"}],configPanel:({config:n,onConfigChange:o,locale:a})=>{var t;const l=null!==(t=n.timeout)&&void 0!==t?t:24;return e.createElement(ae,{value:l,min:1,max:300,onChange:e=>o({timeout:e}),locale:a})},defaultConfig:{timeout:24},icon:Y,renderNode:(n,o)=>e.createElement(e.Fragment,null,e.createElement(I,{icon:o.icon,label:n.label,timeout:n.timeout}),o.exits.length>0&&e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(D,{exits:o.exits,locale:n.locale}))),toFlowNode:e=>{const n=e;return{label:"Ring All",timeout:n.config.timeout,originalNode:n}}};function le({label:n,value:o,options:a,onChange:t,hint:l}){return e.createElement(W,{label:n},e.createElement("div",{className:"ds-dial-plan-config-field__segmented",role:"radiogroup","aria-label":n},a.map(n=>{const a=n.value===o;return e.createElement("button",{key:n.value,type:"button",role:"radio","aria-checked":a,className:"ds-dial-plan-config-field__segmented-option"+(a?" ds-dial-plan-config-field__segmented-option--active":""),onClick:()=>{a||t(n.value)}},n.label)})),l&&e.createElement("p",{className:"ds-dial-plan-config-field__hint"},l))}const re={type:"internal_dial",flowType:"internalDial",localeKey:"internalDial",label:"Internal Extension",description:"Ring a user, group, or plan",color:"#22c55e",exits:[{id:"next",label:"Timeout",configKey:"next",localeExitKey:"timeout"}],configPanel:({nodeId:n,config:o,nodeData:a,onConfigChange:l,listResources:r,onCreateResource:i,onOpenResource:d,locale:s})=>{var c,u,p,f,g,b,m,v;const{groups:h,loading:_,handleCreateResource:x}=U([{type:"user",labelKey:"users",fallback:"Users"},{type:"ring_group",labelKey:"ringGroups",fallback:"Ring Groups"},{type:"queue",labelKey:"queues",fallback:"Queues"},{type:"dial_plan",labelKey:"dialPlans",fallback:"Dial Plans"}],r,i,s),y=M(o,"target"),w=null!==(c=o.timeout)&&void 0!==c?c:30,k=null!==(u=o.timeout_override)&&void 0!==u&&u,E=k?1:0,N=!0===(null==a?void 0:a.timeoutInert),C=t(null);return e.createElement(e.Fragment,null,e.createElement(W,{label:null!==(p=null==s?void 0:s.configLabels.target)&&void 0!==p?p:"Target"},e.createElement(V,{groups:h,value:y,loading:_,placeholder:null!==(f=null==s?void 0:s.configLabels.searchTargets)&&void 0!==f?f:"Search targets…",onSelect:(e,n)=>l(P("target",e),{targetName:n}),onCreateResource:x,selectLabel:null==s?void 0:s.combobox.select,noResultsLabel:null==s?void 0:s.combobox.noResults,loadingLabel:null==s?void 0:s.combobox.loading,createNewPrefix:null==s?void 0:s.combobox.createNew,extensionLabel:null==s?void 0:s.combobox.extensionLabel}),y&&d&&e.createElement(B,{resourceId:y,onOpenResource:d,label:null!==(g=null==s?void 0:s.configLabels.openInNewTab)&&void 0!==g?g:"Open target details"})),!H(y)&&e.createElement(e.Fragment,null,e.createElement(le,{label:null!==(b=null==s?void 0:s.configLabels.timeoutOverride)&&void 0!==b?b:"Override resource timeout",value:k?"on":"off",options:[{value:"off",label:null!==(m=null==s?void 0:s.configLabels.timeoutOverrideOff)&&void 0!==m?m:"Off"},{value:"on",label:null!==(v=null==s?void 0:s.configLabels.timeoutOverrideOn)&&void 0!==v?v:"On"}],onChange:e=>{if("on"===e)return C.current=0===w?{nodeId:n,timeout:0}:null,void l(0===w?{timeout_override:!0,timeout:1}:{timeout_override:!0});const o=C.current,a=o&&o.nodeId===n?o.timeout:void 0;C.current=null,l(void 0===a?{timeout_override:!1}:{timeout_override:!1,timeout:a})}}),e.createElement(ae,{value:w,min:E,max:300,disabled:N,onChange:e=>{C.current=null,l({timeout:e})},locale:s})))},defaultConfig:{target:"",target_id:"",timeout:30,timeout_override:!0},icon:G,renderNode:(n,o)=>{const a=H(n.targetId);return e.createElement(e.Fragment,null,e.createElement(I,{icon:o.icon,label:n.label,timeout:a||n.timeoutInert?void 0:n.timeout,subtitle:n.targetName}),!a&&e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(D,{exits:o.exits,locale:n.locale})))},toFlowNode:e=>{var n;const o=e;return{label:"Internal Extension",targetId:M(o.config,"target"),timeout:o.config.timeout,timeoutOverride:null!==(n=o.config.timeout_override)&&void 0!==n&&n,originalNode:o}},visibleExits:e=>H(M(e,"target"))?[]:re.exits,collectResourceIds:(e,n)=>{const o=M(e,"target");o&&n.addTarget(o)},enrichNode:(e,n,o)=>{const a=e.targetId,t=K(a,n,o),l=$(a,o),r=e.timeout,i=!e.timeoutOverride&&0!==r&&function(e,n){var o;return void 0!==(null===(o=n.users.get(e))||void 0===o?void 0:o.timeout_seconds)}(a,n),d=e.timeoutOverride?function(e,n,o){var a;if(0===n)return 0;const t=null===(a=o.users.get(e))||void 0===a?void 0:a.timeout_seconds;return void 0===n?t:e.startsWith("user_")&&void 0!==t?Math.min(n,t):n}(a,r,n):r;return Object.assign(Object.assign({},e),{targetName:t,targetType:l,timeout:d,timeoutInert:i,locale:o})}};function ie(e){if(!e)return"";const n=z(e);if(!n)return e;return"US"===n.country||"1"===n.countryCallingCode?n.formatNational():n.formatInternational()}const de=e=>e.startsWith("+")?"+"+e.slice(1).replace(/\D/g,""):e.replace(/\D/g,""),se={type:"external_dial",flowType:"externalDial",localeKey:"externalDial",label:"External Number",description:"Ring an external phone number",color:"#f43f5e",exits:[{id:"next",label:"Timeout",configKey:"next",localeExitKey:"timeout"}],configPanel:({nodeId:a,config:t,onConfigChange:l,onInvalidDraftChange:d,locale:s})=>{var c,u,p,f,g;const b=null!==(c=t.phone_number)&&void 0!==c?c:"",m=null!==(u=t.timeout)&&void 0!==u?u:60,[v,h]=n(ie(b)),[_,x]=n(null),y=i(),w=`${y}-phone`,k=`${y}-error`,[E,N]=n({nodeId:a,e164:b});E.nodeId===a&&E.e164===b||(N({nodeId:a,e164:b}),h(ie(b)),x(null)),o(()=>(null==d||d(null!==_),()=>null==d?void 0:d(!1)),[_,d]);const C=null!==(p=null==s?void 0:s.configLabels.phoneNumberInvalid)&&void 0!==p?p:"Enter a valid phone number, for example (415) 555-1234.",O=r(e=>{const n=de(e.target.value);h(n?new S("US").input(n):""),x(null);const o=(e=>{const n=e?z(e,"US"):null;return(null==n?void 0:n.isValid())?n.number:null})(n);o?l({phone_number:o}):n||l({phone_number:""})},[l]),L=r(()=>{const e=de(v);if(!e)return x(null),void l({phone_number:""});const n=z(e,"US");if(null==n?void 0:n.isValid()){const e="US"===n.country||"1"===n.countryCallingCode;return h(e?n.formatNational():n.formatInternational()),x(null),void l({phone_number:n.number})}x(C)},[v,C,l]),R=r(()=>{h(""),x(null),l({phone_number:""})},[l]);return e.createElement(e.Fragment,null,e.createElement(ae,{value:m,min:1,max:120,onChange:e=>l({timeout:e}),locale:s}),e.createElement(W,{label:null!==(f=null==s?void 0:s.configLabels.phoneNumber)&&void 0!==f?f:"Phone Number",htmlFor:w},e.createElement("div",{className:"ds-dial-plan-config-field__input-wrapper"},e.createElement("input",{id:w,className:"ds-dial-plan-config-field__input",type:"tel",placeholder:"+1 415 555 1234",value:v,onChange:O,onBlur:L,"aria-invalid":!!_||void 0,"aria-describedby":_?k:void 0}),v&&e.createElement("button",{type:"button",className:"ds-dial-plan-config-field__clear",onClick:R,"aria-label":null!==(g=null==s?void 0:s.configLabels.clearPhoneNumber)&&void 0!==g?g:"Clear phone number"},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none"},e.createElement("path",{d:"M10.5 3.5L3.5 10.5M3.5 3.5l7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})))),_&&e.createElement("p",{className:"ds-dial-plan-config-field__error",id:k,role:"alert"},_)))},defaultConfig:{phone_number:"",timeout:60},icon:X,renderNode:(n,o)=>e.createElement(e.Fragment,null,e.createElement(I,{icon:o.icon,label:n.label,timeout:n.timeout,subtitle:n.phoneNumber}),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(D,{exits:o.exits,locale:n.locale}))),toFlowNode:e=>{const n=e;return{label:"External Number",phoneNumber:ie(n.config.phone_number),timeout:n.config.timeout,originalNode:n}}},ce={type:"voice_app",flowType:"voiceApp",localeKey:"voiceApp",label:"Voice App",description:"Route to a voice application",color:"#6366f1",exits:[{id:"next",label:"Timeout",configKey:"next",localeExitKey:"timeout"}],configPanel:({config:n,onConfigChange:a,listResources:t,onCreateResource:l,onOpenResource:r,locale:i})=>{var d,s,c,u,p,f,g,b,m;const v=M(n,"voice_app"),h=null!==(d=n.mode)&&void 0!==d?d:"control",{groups:_,handleCreateResource:x}=U([{type:"voice_app",labelKey:"voiceApps",fallback:"Voice Apps",options:{notifyEligible:"notify"===h}}],t,l,i);return o(()=>{var e,n;if("notify"!==h||!v)return;const o=null!==(n=null===(e=_[0])||void 0===e?void 0:e.items)&&void 0!==n?n:[];if(0===o.length)return;o.some(e=>e.id===v)||a(P("voice_app",""),{voiceAppName:void 0})},[h,v,_,a]),e.createElement(e.Fragment,null,e.createElement(W,{label:null!==(s=null==i?void 0:i.configLabels.target)&&void 0!==s?s:"Target"},e.createElement(V,{groups:_,value:v,placeholder:null!==(c=null==i?void 0:i.configLabels.searchTargets)&&void 0!==c?c:"Search targets…",onSelect:(e,n)=>a(P("voice_app",e),{voiceAppName:n}),onCreateResource:x,selectLabel:null==i?void 0:i.combobox.select,noResultsLabel:null==i?void 0:i.combobox.noResults,loadingLabel:null==i?void 0:i.combobox.loading,createNewPrefix:null==i?void 0:i.combobox.createNew,extensionLabel:null==i?void 0:i.combobox.extensionLabel}),v&&r&&e.createElement(B,{resourceId:v,onOpenResource:r,label:null!==(u=null==i?void 0:i.configLabels.openInNewTab)&&void 0!==u?u:"Open target details"})),e.createElement(le,{label:null!==(p=null==i?void 0:i.configLabels.mode)&&void 0!==p?p:"Mode",value:h,options:[{value:"control",label:null!==(f=null==i?void 0:i.voiceAppMode.control)&&void 0!==f?f:"Control"},{value:"notify",label:null!==(g=null==i?void 0:i.voiceAppMode.notify)&&void 0!==g?g:"Notify"}],onChange:e=>a({mode:e}),hint:"notify"===h?null!==(b=null==i?void 0:i.voiceAppMode.notifyHint)&&void 0!==b?b:"Notifies the voice app of the call in the background. The dial plan keeps routing via Next without waiting.":null!==(m=null==i?void 0:i.voiceAppMode.controlHint)&&void 0!==m?m:"Hands the call off to the voice app, which takes over the conversation."}))},defaultConfig:{voice_app:"",voice_app_id:"",mode:"control"},icon:Q,renderNode:(n,o)=>{var a,t,l,r;const i=n.locale,d="notify"===n.mode,s=d?null!==(a=null==i?void 0:i.voiceAppMode.notifyBadge)&&void 0!==a?a:"Notify mode":null!==(t=null==i?void 0:i.voiceAppMode.controlBadge)&&void 0!==t?t:"Control mode",c=d?null!==(l=null==i?void 0:i.exits.next)&&void 0!==l?l:"Next":null!==(r=null==i?void 0:i.exits.timeout)&&void 0!==r?r:"Timeout";return e.createElement(e.Fragment,null,e.createElement(I,{icon:o.icon,label:n.label,subtitle:n.voiceAppName}),e.createElement("span",{className:"ds-dial-plan-node__badge"},s),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(F,{id:"next",label:c})))},toFlowNode:e=>{var n;const o=e;return{label:"Voice App",voiceAppId:M(o.config,"voice_app"),mode:null!==(n=o.config.mode)&&void 0!==n?n:"control",originalNode:o}},normalizeFromAlias:e=>{const n=e.config,o=M(n,"target"),a=n.next;return Object.assign(Object.assign({},e),{type:"voice_app",config:Object.assign(Object.assign(Object.assign({},P("voice_app",o)),{mode:"control"}),void 0!==a?{next:a}:{})})},collectResourceIds:(e,n)=>{const o=M(e,"voice_app");o&&n.addTarget(o)},enrichNode:(e,n,o)=>{const a=e.voiceAppId,t=a?K(a,n,o):void 0;return Object.assign(Object.assign({},e),{voiceAppName:t,locale:o})}},ue={type:"voicemail",apiType:"internal_dial",flowType:"voicemail",localeKey:"voicemail",label:"Voicemail",description:"Send to voicemail",color:"#8b5cf6",exits:[],configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,onOpenResource:l,locale:r})=>{var i,d,s;const{groups:c,loading:u,handleCreateResource:p}=U([{type:"user",labelKey:"users",fallback:"Users"},{type:"shared_voicemail",labelKey:"sharedVoicemails",fallback:"Shared Voicemails"}],a,t,r),f=M(n,"target");return e.createElement(W,{label:null!==(i=null==r?void 0:r.configLabels.target)&&void 0!==i?i:"Target"},e.createElement(V,{groups:c,value:f,loading:u,placeholder:null!==(d=null==r?void 0:r.configLabels.searchTargets)&&void 0!==d?d:"Search targets…",onSelect:(e,n)=>o(Object.assign(Object.assign({},P("target",e)),{timeout:0}),{targetName:n}),onCreateResource:p,selectLabel:null==r?void 0:r.combobox.select,noResultsLabel:null==r?void 0:r.combobox.noResults,loadingLabel:null==r?void 0:r.combobox.loading,createNewPrefix:null==r?void 0:r.combobox.createNew,extensionLabel:null==r?void 0:r.combobox.extensionLabel}),f&&l&&e.createElement(B,{resourceId:f,onOpenResource:l,label:null!==(s=null==r?void 0:r.configLabels.openInNewTab)&&void 0!==s?s:"Open target details"}))},defaultConfig:{target:"",target_id:"",timeout:0},icon:Z,renderNode:(n,o)=>e.createElement(I,{icon:o.icon,label:n.label,subtitle:n.targetName}),toFlowNode:e=>{const n=e;return{label:"Voicemail",targetId:M(n.config,"target"),timeout:0,originalNode:n}},collectResourceIds:(e,n)=>{const o=M(e,"target");o&&n.addTarget(o)},enrichNode:(e,n,o)=>{const a=e.targetId,t=K(a,n,o),l=$(a,o);return Object.assign(Object.assign({},e),{targetName:t,targetType:l,locale:o})}},pe=["1","2","3","4","5","6","7","8","9","0","*","#"];function fe(e){return"*"===e?"digit_star":"#"===e?"digit_hash":`digit_${e}`}const ge=[{id:"timeout",label:"Timeout",configKey:"timeout_next_node",localeExitKey:"timeout"},{id:"invalid",label:"Invalid",configKey:"invalid_next_node",localeExitKey:"invalid"}],be={type:"menu",flowType:"menu",localeKey:"menu",label:"IVR Menu",description:"Play prompt and route by keypress",color:"#ec4899",exits:[...ge],allowSelfLoop:!0,configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,locale:l})=>{var r,i,d,s,c,u,p,f,g;const{groups:b,loading:m,handleCreateResource:v}=U([{type:"audio_clip",labelKey:"audioClips",fallback:"Audio Clips"}],a,t,l),h=M(n,"prompt_clip"),_=null!==(r=n.timeout)&&void 0!==r?r:5,x=null!==(i=n.options)&&void 0!==i?i:[{digit:"1"}],y=null!==(d=n.extension_entry_enabled)&&void 0!==d&&d,w=new Set(x.map(e=>e.digit));return e.createElement(e.Fragment,null,e.createElement(W,{label:null!==(s=null==l?void 0:l.configLabels.promptClip)&&void 0!==s?s:"Prompt"},e.createElement(V,{groups:b,value:h,loading:m,placeholder:null!==(c=null==l?void 0:l.configLabels.search)&&void 0!==c?c:"Search...",onSelect:(e,n)=>o(P("prompt_clip",e),{promptClipName:n}),onCreateResource:v,selectLabel:null==l?void 0:l.combobox.select,noResultsLabel:null==l?void 0:l.combobox.noResults,loadingLabel:null==l?void 0:l.combobox.loading,createNewPrefix:null==l?void 0:l.combobox.createNew})),e.createElement(ae,{value:_,min:1,max:30,onChange:e=>o({timeout:e}),locale:l}),e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("label",{className:"ds-dial-plan-config-field__checkbox"},e.createElement("input",{type:"checkbox",checked:y,onChange:e=>o({extension_entry_enabled:e.target.checked})}),e.createElement("span",null,null!==(u=null==l?void 0:l.configLabels.extensionEntry)&&void 0!==u?u:"Allow extension dialing")),e.createElement("p",{className:"ds-dial-plan-config-field__hint"},null!==(p=null==l?void 0:l.configLabels.extensionEntryHint)&&void 0!==p?p:"When on, callers can key an extension instead of choosing an option.")),e.createElement(W,{label:null!==(f=null==l?void 0:l.configLabels.options)&&void 0!==f?f:"Options",action:e.createElement("button",{type:"button",className:"ds-dial-plan-menu-options__add",onClick:function(){const e=pe.find(e=>!w.has(e));e&&o({options:[...x,{digit:e}]})},disabled:x.length>=12},"+ ",null!==(g=null==l?void 0:l.configLabels.addOption)&&void 0!==g?g:"Add")},e.createElement("div",{className:"ds-dial-plan-menu-options"},x.map((n,a)=>{var t,r,i,d,s,c;return e.createElement("div",{key:a,className:"ds-dial-plan-menu-options__card"},e.createElement("div",{className:"ds-dial-plan-menu-options__field ds-dial-plan-menu-options__field--label"},e.createElement("span",{className:"ds-dial-plan-menu-options__field-label"},null!==(t=null==l?void 0:l.configLabels.optionLabel)&&void 0!==t?t:"Label"," ",e.createElement("span",{className:"ds-dial-plan-menu-options__field-hint"},"(optional)")),e.createElement("input",{type:"text",className:"ds-dial-plan-config-field__input",value:null!==(r=n.label)&&void 0!==r?r:"",maxLength:20,placeholder:null!==(i=null==l?void 0:l.configLabels.optionLabelPlaceholder)&&void 0!==i?i:"e.g. Sales",onChange:e=>{return n=a,t=e.target.value,void o({options:x.map((e,o)=>{if(o!==n)return e;const a=Object.assign({},e);return t?a.label=t:delete a.label,a})});var n,t}})),e.createElement("div",{className:"ds-dial-plan-menu-options__field ds-dial-plan-menu-options__field--digit"},e.createElement("span",{className:"ds-dial-plan-menu-options__field-label"},null!==(d=null==l?void 0:l.configLabels.digit)&&void 0!==d?d:"Digit"),e.createElement("select",{className:"ds-dial-plan-config-field__input",value:n.digit,onChange:e=>{return n=a,t=e.target.value,void o({options:x.map((e,o)=>o===n?Object.assign(Object.assign({},e),{digit:t}):e)});var n,t}},pe.filter(e=>e===n.digit||!w.has(e)).map(n=>e.createElement("option",{key:n,value:n},"*"===n?"✱":n)))),e.createElement("button",{type:"button",className:"ds-dial-plan-menu-options__remove",onClick:()=>{return e=a,void o({options:x.filter((n,o)=>o!==e)});var e},title:null!==(s=null==l?void 0:l.configLabels.removeOption)&&void 0!==s?s:"Remove","aria-label":null!==(c=null==l?void 0:l.configLabels.removeOption)&&void 0!==c?c:"Remove"},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))))}))))},defaultConfig:{prompt_clip:"",prompt_clip_id:"",timeout:5,options:[{digit:"1"}],extension_entry_enabled:!1},icon:J,renderNode:(n,o)=>{var a;const t=null!==(a=n.options)&&void 0!==a?a:[],l=n.locale;return e.createElement(e.Fragment,null,e.createElement(I,{icon:o.icon,label:n.label,timeout:n.timeout,subtitle:n.promptClipName}),e.createElement("div",{className:"ds-dial-plan-node__exits"},t.map(n=>{const o="*"===n.digit?"✱":n.digit,a=n.label?`${n.label} — ${o}`:o;return e.createElement(F,{key:n.digit,id:fe(n.digit),label:a})}),e.createElement(D,{exits:o.exits,locale:l})))},toFlowNode:e=>{const n=e;return{label:"IVR Menu",promptClipId:M(n.config,"prompt_clip"),timeout:n.config.timeout,options:n.config.options,originalNode:n}},createEdgesForNode:(e,n)=>{const o=e,a=[];o.config.timeout_next_node&&n.has(o.config.timeout_next_node)&&a.push({id:`${o.id}-timeout->${o.config.timeout_next_node}`,source:o.id,target:o.config.timeout_next_node,sourceHandle:"timeout",type:T}),o.config.invalid_next_node&&n.has(o.config.invalid_next_node)&&a.push({id:`${o.id}-invalid->${o.config.invalid_next_node}`,source:o.id,target:o.config.invalid_next_node,sourceHandle:"invalid",type:T});for(const e of o.config.options)if(e.next_node&&n.has(e.next_node)){const n=fe(e.digit);a.push({id:`${o.id}-${n}->${e.next_node}`,source:o.id,target:e.next_node,sourceHandle:n,type:T})}return a},collectResourceIds:(e,n)=>{const o=M(e,"prompt_clip");o&&n.addAudioClip(o)},enrichNode:(e,n,o)=>{const a=n.audioClips.get(e.promptClipId);return Object.assign(Object.assign({},e),{promptClipName:null==a?void 0:a.name,locale:o})},resolveExitLabel:e=>{const n=function(e){if("digit_star"===e)return"*";if("digit_hash"===e)return"#";const n=e.match(/^digit_(\d)$/);return null==n?void 0:n[1]}(e);if(n)return"*"===n?"✱":n},onConfigChange:(e,n,o)=>{var a,t;if(!n.options)return;const l=n.options,r=new Set(l.map(e=>fe(e.digit)));for(const e of ge)r.add(e.id);const i=o.nodesRef.current.find(n=>n.id===e),d=null!==(t=null===(a=null==i?void 0:i.data)||void 0===a?void 0:a.options)&&void 0!==t?t:[],s=new Map;if(d.length===l.length)for(let e=0;e<l.length;e++){const n=fe(d[e].digit),o=fe(l[e].digit);n!==o&&s.set(n,o)}o.setEdges(n=>{const a=n.map(n=>{if(n.source!==e||!n.sourceHandle)return n;const o=s.get(n.sourceHandle);return o?Object.assign(Object.assign({},n),{sourceHandle:o,id:`${e}-${o}->${n.target}`}):n}).filter(n=>n.source!==e||!n.sourceHandle||r.has(n.sourceHandle));return(a.length!==n.length||s.size>0)&&o.updateDirty(o.nodesRef.current,a),a}),requestAnimationFrame(()=>o.updateNodeInternals(e))},serializeConfig:(e,n,o)=>{var a;const t=(null!==(a=o.options)&&void 0!==a?a:[]).map(o=>{const a=fe(o.digit),t=n.find(n=>n.source===e.id&&n.sourceHandle===a),l={digit:o.digit};return o.label&&(l.label=o.label),t&&(l.next_node=t.target),l});return Object.assign(Object.assign({},o),{options:t})}},me={type:"audio_clip",flowType:"audioClip",localeKey:"audioClip",label:"Audio Clip",description:"Play an audio clip",color:"#14b8a6",exits:[{id:"next",label:"Next",configKey:"next",localeExitKey:"next"}],configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,locale:l})=>{var r,i;const{groups:d,loading:s,handleCreateResource:c}=U([{type:"audio_clip",labelKey:"audioClips",fallback:"Audio Clips"}],a,t,l),u=M(n,"clip");return e.createElement(W,{label:null!==(r=null==l?void 0:l.configLabels.audioClip)&&void 0!==r?r:"Audio Clip"},e.createElement(V,{groups:d,value:u,loading:s,placeholder:null!==(i=null==l?void 0:l.configLabels.search)&&void 0!==i?i:"Search...",onSelect:(e,n)=>o(P("clip",e),{clipName:n}),onCreateResource:c,selectLabel:null==l?void 0:l.combobox.select,noResultsLabel:null==l?void 0:l.combobox.noResults,loadingLabel:null==l?void 0:l.combobox.loading,createNewPrefix:null==l?void 0:l.combobox.createNew}))},defaultConfig:{clip:"",clip_id:""},icon:ne,renderNode:(n,o)=>e.createElement(e.Fragment,null,e.createElement(I,{icon:o.icon,label:n.label,subtitle:n.clipName}),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(D,{exits:o.exits,locale:n.locale}))),toFlowNode:e=>{const n=e;return{label:"Audio Clip",clipId:M(n.config,"clip"),originalNode:n}},normalizeFromAlias:e=>Object.assign(Object.assign({},e),{type:"audio_clip"}),collectResourceIds:(e,n)=>{const o=M(e,"clip");o&&n.addAudioClip(o)},enrichNode:(e,n,o)=>{const a=n.audioClips.get(e.clipId);return Object.assign(Object.assign({},e),{clipName:null==a?void 0:a.name,locale:o})}},ve={type:"hang_up",flowType:"hangUp",localeKey:"hangUp",label:"Hang Up",description:"End the call",color:"#ef4444",exits:[],configPanel:({locale:n})=>{var o;return e.createElement("div",{className:"ds-dial-plan-config-panel__note"},null!==(o=null==n?void 0:n.nodeDescriptions.hangUp)&&void 0!==o?o:"End the call")},defaultConfig:{},icon:ee,renderNode:(n,o)=>e.createElement(I,{icon:o.icon,label:n.label}),toFlowNode:e=>({label:"Hang Up",originalNode:e}),enrichNode:(e,n,o)=>Object.assign(Object.assign({},e),{label:o.nodeTypes.hangUp,locale:o})},he=new class{constructor(){this.byType=new Map,this.byFlowType=new Map,this.legacyTypeAliases=new Map}register(e){this.byType.set(e.type,e),this.byFlowType.set(e.flowType,e)}registerAlias(e,n){this.legacyTypeAliases.set(e,n)}get(e){return this.byType.get(e)}resolveType(e){var n;let o=this.byType.get(e.type);if(!o){const n=this.legacyTypeAliases.get(e.type);n&&(o=this.byType.get(n))}return(null==o?void 0:o.resolveAlias)&&null!==(n=o.resolveAlias(e))&&void 0!==n?n:o}getByFlowType(e){return this.byFlowType.get(e)}getAll(){return Array.from(this.byType.values())}getNodeTypesMap(){const e={};for(const n of this.byType.values())e[n.flowType]=n.component;return e}createEdgesForNode(e,n){const o=this.resolveType(e);if(!o)return[];if(o.createEdgesForNode)return o.createEdgesForNode(e,n);const a=e.config,t=[];for(const l of A(o,a)){const o=a[l.configKey];o&&n.has(o)&&t.push({id:`${e.id}-${l.id}->${o}`,source:e.id,target:o,sourceHandle:l.id,type:T})}return t}},_e=(xe=he,a(function({data:n,selected:o,type:a}){const t=xe.getByFlowType(null!=a?a:"");if(!t)return null;const l=t.renderNode(n,t),r=t.type.replace(/_/g,"-");return e.createElement("div",{className:`ds-dial-plan-node ds-dial-plan-node--themed ds-dial-plan-node--${r} ${o?"ds-dial-plan-node--selected":""}`,style:{"--node-color":t.color}},e.createElement(s,{type:"target",position:c.Left,className:"ds-dial-plan-handle"}),l)}));var xe;const ye=[oe,te,re,se,ce,ue,be,me,ve];for(const e of ye)he.register(Object.assign(Object.assign({},e),{component:_e}));const we=he.get("internal_dial");we&&(we.resolveAlias=e=>{const n=e.config,o=M(n,"target");return o.startsWith("svm_")||0===n.timeout&&!n.next&&!H(o)?he.get("voicemail"):o.startsWith("va_")?he.get("voice_app"):void 0}),he.registerAlias("sound_clip","audio_clip");const ke="__start__";function Ee(e,n=he){var o;const a=[],t=[],l=new Map;for(const n of e.nodes)l.set(n.id,n);const r={id:ke,type:"start",position:{x:0,y:0},data:{label:"Start"}};a.push(r),e.entry_node&&l.has(e.entry_node)&&t.push({id:`${ke}->${e.entry_node}`,source:ke,target:e.entry_node,type:T});for(const r of e.nodes){const e=n.resolveType(r),i=null!==(o=r.position)&&void 0!==o?o:{x:0,y:0},d=e&&e.type!==r.type&&e.normalizeFromAlias?e.normalizeFromAlias(r):r;if(e){const n=e.toFlowNode(d),o={id:r.id,type:e.flowType,position:i,data:n};a.push(o)}else a.push({id:r.id,type:"default",position:i,data:{label:r.id,originalNode:r}});const s=n.createEdgesForNode(d,l);t.push(...s)}return e.nodes.some(e=>!e.position)?Oe(a,t):{nodes:a,edges:t}}function Ne(e,n,o){var a,t,l,r;const i=n.find(e=>e.source===ke),d=null!==(a=null==i?void 0:i.target)&&void 0!==a?a:"",s=[];for(const a of e){if(a.id===ke)continue;const e=o.getByFlowType(null!==(t=a.type)&&void 0!==t?t:"");if(!e||!(null===(l=a.data)||void 0===l?void 0:l.originalNode))continue;const i=a.data.originalNode,d=Object.assign({},i.config);for(const n of e.exits)d[n.configKey]=void 0;const c=A(e,d);for(const e of n){if(e.source!==a.id)continue;const n=c.find(n=>n.id===e.sourceHandle);n&&(d[n.configKey]=e.target)}const u=e.serializeConfig?e.serializeConfig(a,n,d):d;s.push({id:a.id,type:null!==(r=e.apiType)&&void 0!==r?r:i.type,position:a.position,config:u})}return{entry_node:d,nodes:s}}function Ce(e){var n,o,a;if((null===(n=e.measured)||void 0===n?void 0:n.width)&&(null===(o=e.measured)||void 0===o?void 0:o.height))return{width:e.measured.width,height:e.measured.height};if("start"===e.type)return{width:60,height:60};if("schedule"===e.type)return{width:180,height:140};if("menu"===e.type){const n=e.data.options;return{width:180,height:60+28*((null!==(a=null==n?void 0:n.length)&&void 0!==a?a:1)+2)}}return{width:180,height:80}}function Oe(e,n){var o;const a=new O.graphlib.Graph;a.setGraph({rankdir:"LR",nodesep:60,ranksep:80,marginx:40,marginy:40}),a.setDefaultEdgeLabel(()=>({}));for(const n of e){const{width:e,height:o}=Ce(n);a.setNode(n.id,{width:e,height:o})}for(const e of n)a.setEdge(e.source,e.target);O.layout(a);const t=new Map;for(const n of e){const e=a.node(n.id),{width:o,height:l}=Ce(n);t.set(n.id,{x:Math.round(e.x-o/2),y:Math.round(e.y-l/2)})}const l=new Map;for(const e of n){const n=l.get(e.source);n?n.push(e.target):l.set(e.source,[e.target])}const r=e=>{var n;const o=new Set([e]),a=[e];for(;a.length>0;){const e=a.shift();for(const t of null!==(n=l.get(e))&&void 0!==n?n:[])o.has(t)||(o.add(t),a.push(t))}return o};for(const a of e){const e=he.getByFlowType(null!==(o=a.type)&&void 0!==o?o:"");if(!e||e.exits.length<2)continue;const l=[];for(const o of e.exits){const e=n.find(e=>e.source===a.id&&e.sourceHandle===o.id);e&&l.push(e.target)}if(l.length<2)continue;const i=l[0],d=l[1],s=t.get(i),c=t.get(d);if(!s||!c)continue;if(s.y<=c.y)continue;const u=r(i),p=r(d);if([...u].some(e=>p.has(e)))continue;const f=s.y-c.y;for(const e of u){const n=t.get(e);n&&(n.y-=f)}for(const e of p){const n=t.get(e);n&&(n.y+=f)}}const i=e.find(e=>e.id===ke),d=t.get(ke),s=i&&d?i.position.x-d.x:0,c=i&&d?i.position.y-d.y:0;return{nodes:e.map(e=>{const n=t.get(e.id);return Object.assign(Object.assign({},e),{position:{x:n.x+s,y:n.y+c}})}),edges:n}}function Le(e,n,o,a){const t=he.getByFlowType(e),l=t?ye.find(e=>{var n;return e.type===(null!==(n=t.apiType)&&void 0!==n?n:t.type)}):null;return(null==l?void 0:l.enrichNode)?l.enrichNode(n,o,a):n}const ze=a(function({data:n}){return e.createElement("div",{className:"ds-dial-plan-node ds-dial-plan-node--start"},e.createElement("div",{className:"ds-dial-plan-node__content"},e.createElement("span",{className:"ds-dial-plan-node__label"},n.label)),e.createElement(s,{type:"source",position:c.Right,className:"ds-dial-plan-handle"}))}),Se=({registry:n,onAddNode:o,locale:a})=>{const t=n.getAll();return e.createElement("div",{className:"ds-dial-plan-node-library"},t.map(n=>{var t,l;const r=null!==(t=null==a?void 0:a.nodeTypes[n.localeKey])&&void 0!==t?t:n.label,i=null!==(l=null==a?void 0:a.nodeDescriptions[n.localeKey])&&void 0!==l?l:n.description;return e.createElement("div",{key:n.type,className:`ds-dial-plan-node-library__item ds-dial-plan-node-library__item--${n.type}`,style:{"--node-color":n.color},draggable:!0,onClick:()=>o(n.type),onDragStart:e=>{const o=e.currentTarget.getBoundingClientRect(),a=(e.clientX-o.left)/o.width,t=(e.clientY-o.top)/o.height;e.dataTransfer.setData("application/reactflow",n.type),e.dataTransfer.setData("application/reactflow-grab-frac",`${a},${t}`),e.dataTransfer.effectAllowed="move"},title:i},e.createElement("span",{className:"ds-dial-plan-node-library__item-icon"},n.icon),e.createElement("span",{className:"ds-dial-plan-node-library__item-label"},r))}))},Re=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polyline",{points:"3 6 5 6 21 6"}),e.createElement("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})),je=({node:n,registration:a,onConfigChange:l,onInvalidDraftChange:r,onDelete:i,onClose:d,listResources:s,onCreateResource:c,onOpenResource:u,locale:p})=>{var f,g,b;const m=t(null);o(()=>{var e;const n=null===(e=m.current)||void 0===e?void 0:e.getRootNode(),o=n instanceof ShadowRoot||n instanceof Document?n:document,a=e=>function(e){"Escape"===e.key&&d()}(e);return o.addEventListener("keydown",a),()=>o.removeEventListener("keydown",a)},[d]);const v=n.data.originalNode,h=null!==(f=null==v?void 0:v.config)&&void 0!==f?f:{},_=a.configPanel;return e.createElement("div",{ref:m,className:"ds-dial-plan-config-panel"},e.createElement("div",{className:"ds-dial-plan-config-panel__header"},e.createElement("span",{className:"ds-dial-plan-config-panel__header-icon"},a.icon),e.createElement("span",{className:"ds-dial-plan-config-panel__header-label"},a.label),e.createElement("button",{type:"button",className:"ds-dial-plan-config-panel__delete",onClick:()=>{i(n.id),d()},title:null!==(g=null==p?void 0:p.panel.delete_)&&void 0!==g?g:"Delete"},Re),e.createElement("button",{className:"ds-dial-plan-config-panel__close",onClick:d,title:null!==(b=null==p?void 0:p.panel.close)&&void 0!==b?b:"Close",type:"button"},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})))),e.createElement("div",{className:"ds-dial-plan-config-panel__body"},e.createElement(_,{nodeId:n.id,onInvalidDraftChange:r,config:h,nodeData:n.data,onConfigChange:(e,o)=>l(n.id,e,o),listResources:s,onCreateResource:c,onOpenResource:u,locale:p})))},Te=a(function({onAutoLayout:n,onSave:o,isDirty:a,hasInvalidDraft:t,locale:l}){var r;const i=null!==(r=null==l?void 0:l.toolbar)&&void 0!==r?r:{autoLayout:"Auto Layout",save:"Save"};return e.createElement("div",{className:"ds-dial-plan-editor-toolbar"},e.createElement("button",{className:"ds-dial-plan-editor-toolbar__button",onClick:n,title:i.autoLayout,type:"button"},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},e.createElement("rect",{x:"3",y:"3",width:"7",height:"7"}),e.createElement("rect",{x:"14",y:"3",width:"7",height:"7"}),e.createElement("rect",{x:"14",y:"14",width:"7",height:"7"}),e.createElement("line",{x1:"6.5",y1:"10",x2:"6.5",y2:"17"}),e.createElement("line",{x1:"6.5",y1:"17",x2:"14",y2:"17.5"})),e.createElement("span",null,i.autoLayout)),o&&e.createElement("button",{className:"ds-dial-plan-editor-toolbar__button",onClick:o,title:i.save,type:"button",disabled:!a||t},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},e.createElement("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),e.createElement("polyline",{points:"17 21 17 13 7 13 7 21"}),e.createElement("polyline",{points:"7 3 7 8 15 8"})),e.createElement("span",null,i.save)))});var Ae;const Ie=!("undefined"==typeof window||void 0===window.document||"function"!=typeof HTMLElement.prototype.attachShadow||"undefined"==typeof navigator||/jsdom/i.test(null!==(Ae=navigator.userAgent)&&void 0!==Ae?Ae:"")||"undefined"!=typeof window&&"__STORYBOOK_PREVIEW__"in window),Fe=({children:a,stylesheets:l,className:i,style:d})=>{const[s,c]=n(null),u=t(null),p=r(e=>{var n;if(u.current=e,!Ie||!e)return;const o=null!==(n=e.shadowRoot)&&void 0!==n?n:e.attachShadow({mode:"open"});c(o)},[]);o(()=>{Ie&&u.current&&function(e,n){const o=e.shadowRoot;o&&(o.adoptedStyleSheets=n.map(e=>{const n=new CSSStyleSheet;return n.replaceSync(e),n}))}(u.current,l)},[l]);const f=t(null);return o(()=>{if(!Ie&&0!==l.length)return f.current||(f.current=document.createElement("style"),document.head.appendChild(f.current)),f.current.textContent=l.join("\n"),()=>{f.current&&(f.current.remove(),f.current=null)}},[l]),Ie?e.createElement("div",{ref:p,className:i,style:d},s&&R(a,s)):e.createElement("div",{className:i,style:d},a)},De={nodeTypes:{start:"Start",schedule:"Schedule",internalDial:"Internal Extension",voicemail:"Voicemail",externalDial:"External Number",ringAllUsers:"Ring All Users",voiceApp:"Voice App",menu:"IVR Menu",audioClip:"Audio Clip",hangUp:"Hang Up"},exits:{open:"Open",closed:"Closed",holiday:"Holiday",next:"Next",timeout:"Timeout",invalid:"Invalid"},nodeDescriptions:{schedule:"Route calls by schedule",internalDial:"Ring a user, group, or plan",voicemail:"Send to voicemail",ringAllUsers:"Ring all users",externalDial:"Ring an external phone number",voiceApp:"Route to a voice application",menu:"Play prompt and route by keypress",audioClip:"Play an audio clip",hangUp:"End the call"},targetTypes:{user:"User",ringGroup:"Ring Group",dialPlan:"Dial Plan",queue:"Queue",voiceApp:"Voice App",sharedVoicemail:"Shared Voicemail"},resourceGroups:{users:"Users",ringGroups:"Ring Groups",dialPlans:"Dial Plans",queues:"Queues",voiceApps:"Voice Apps",sharedVoicemails:"Shared Voicemails",schedules:"Schedules",audioClips:"Audio Clips"},configLabels:{timeout:"Timeout (seconds)",target:"Target",schedule:"Schedule",search:"Search...",searchTargets:"Search targets...",searchSchedules:"Search schedules...",openInNewTab:"Open target details",promptClip:"Prompt",audioClip:"Audio Clip",digit:"Digit",options:"Options",addOption:"Add Option",removeOption:"Remove",optionLabel:"Label",optionLabelPlaceholder:"e.g. Sales",routeHolidaySeparately:"Route holidays separately",routeHolidaySeparatelyHint:"When on, holidays route to a dedicated branch you wire below. Otherwise holidays follow the Closed exit.",mode:"Mode",phoneNumber:"Phone Number",phoneNumberInvalid:"Enter a valid phone number, for example (415) 555-1234.",clearPhoneNumber:"Clear phone number",timeoutOverride:"Override resource timeout",timeoutOverrideOn:"On",timeoutOverrideOff:"Off",extensionEntry:"Allow extension dialing",extensionEntryHint:"When on, callers can key an extension instead of choosing an option."},voiceAppMode:{control:"Control",notify:"Notify",controlBadge:"Control mode",notifyBadge:"Notify mode",controlHint:"Hands the call off to the voice app, which takes over the conversation.",notifyHint:"Notifies the voice app of the call in the background. The dial plan keeps routing via Next without waiting."},toolbar:{autoLayout:"Auto Layout",save:"Save"},panel:{delete_:"Delete",close:"Close",connection:"Connection",from:"From",exit:"Exit",to:"To"},combobox:{select:"— Select —",search:"Search...",noResults:"No results found",loading:"Loading...",createNew:"+ Create new...",extensionLabel:"Ext.",noName:"(No name)"},status:{loading:"Loading dial plan...",loadError:"Failed to load dial plan",notFound:"No dial plan found",saveError:"Failed to save dial plan",newDialPlan:"New Dial Plan"}},Me={schedule:"A schedule must be selected in the Schedule node",schedule_id:"A schedule must be selected in the Schedule node",target:"A target must be selected in the Internal Extension node",target_id:"A target must be selected in the Internal Extension node",prompt_clip:"A prompt must be selected in the IVR Menu node",prompt_clip_id:"A prompt must be selected in the IVR Menu node",clip:"An audio clip must be selected in the Audio Clip node",clip_id:"An audio clip must be selected in the Audio Clip node",voice_app:"A voice app must be selected in the Voice App node",voice_app_id:"A voice app must be selected in the Voice App node",phone_number:"Enter a valid US phone number in the External Number node"},Pe={schedule:"Schedule",internal_dial:"Internal Extension",ring_all_users:"Ring All",external_dial:"External Number"};const $e={view:{editable:!1,interactive:!0,showChrome:!0},edit:{editable:!0,interactive:!0,showChrome:!0},preview:{editable:!1,interactive:!1,showChrome:!1}},He={id:"",name:"New Dial Plan",entry_node:"",nodes:[],created_at:"",updated_at:""},Ke=Object.assign({start:ze},he.getNodeTypesMap()),Be={[T]:n=>{const{sourceX:o,sourceY:a,targetX:t,targetY:l,sourcePosition:r,targetPosition:i,markerEnd:d,style:s}=n,c=Math.abs(a-l),[g]=c<=1?u({sourceX:o,sourceY:a,targetX:t,targetY:l}):p({sourceX:o,sourceY:a,targetX:t,targetY:l,sourcePosition:r,targetPosition:i,borderRadius:8});return e.createElement(f,{path:g,markerEnd:d,style:s})}};function Ve(e,n,o){return j(this,void 0,void 0,function*(){var a;const t=new Set,l=new Set,r=new Set,i=e=>!(null==o?void 0:o.only)||o.only.has(e);for(const n of e.nodes){const e=he.resolveType(n),o=e?ye.find(n=>{var o;return n.type===(null!==(o=e.apiType)&&void 0!==o?o:e.type)}):null;null===(a=null==o?void 0:o.collectResourceIds)||void 0===a||a.call(o,n.config,{addSchedule:e=>{i(e)&&t.add(e)},addTarget:e=>{i(e)&&l.add(e)},addAudioClip:e=>{i(e)&&r.add(e)}})}const d=r.size>0?n.audioClips.list().catch(()=>[]):Promise.resolve([]),[s,c,...u]=yield Promise.all([Promise.all(Array.from(t).map(e=>j(this,void 0,void 0,function*(){try{return yield n.schedules.retrieve(e)}catch(e){return null}}))),d,...Array.from(l).map(e=>j(this,void 0,void 0,function*(){var a,t;const l=yield n.resolveRoutingTarget(e,o);return l?{id:l.id,name:l.name||l.id,extension_number:null!==(a=l.extension_number)&&void 0!==a?a:void 0,timeout_seconds:null!==(t=l.timeout_seconds)&&void 0!==t?t:void 0}:null}))]),p=new Map,f=new Map,g=new Map;for(const e of s)e&&p.set(e.id,e);for(const e of u)e&&f.set(e.id,e);for(const e of c)g.set(e.id,e);return{schedules:p,users:f,audioClips:g}})}const We=e.forwardRef(function({dialPlanId:a,mode:l="view",locale:i=De,onNodeClick:s,onLoaderStart:c,onLoaderEnd:u,onLoadError:p,onSave:f,onDirtyChange:g,onError:C,className:O,style:L,onCreateResource:z,onOpenResource:S},R){var I;const{editable:F,interactive:D,showChrome:P}=$e[l],{dialstack:H}=N(),K=b(),B=m(),[V,W]=n(!F||!!a),[U,q]=n(null),[G,Y]=v([]),[X,Z,Q]=h([]),[J,ee]=n(null),[ne,oe]=n(null),[ae,te]=n(!1),[le,re]=n(!1);o(()=>{var e,n;null===(n=(e=ge.current).onDirtyChange)||void 0===n||n.call(e,ae)},[ae]);const[ie,de]=n(null),[se,ce]=n(0),ue=t(null),pe=t(G),fe=t(X);pe.current=G,fe.current=X;const ge=t({onLoaderStart:c,onLoaderEnd:u,onLoadError:p,onError:C,onSave:f,onDirtyChange:g});ge.current={onLoaderStart:c,onLoaderEnd:u,onLoadError:p,onError:C,onSave:f,onDirtyChange:g};const be=t(null),me=t({schedules:new Map,users:new Map,audioClips:new Map}),ve=t(!1);o(()=>{let e=!1;return function(){j(this,void 0,void 0,function*(){var n,o,t,l,r,d,s,c;if(F&&!a){const{nodes:n,edges:o}=Ee(Object.assign(Object.assign({},He),{name:i.status.newDialPlan}),he);return void(e||(Y(n),Z(o),be.current={nodes:n,edges:o},W(!1)))}W(!0),q(null),null===(o=(n=ge.current).onLoaderStart)||void 0===o||o.call(n);try{const n=yield H.dialPlans.retrieve(a);if(e)return;const o=yield Ve(n,H);if(e)return;me.current=o;const{nodes:r,edges:d}=Ee(n,he),s=function(e,n,o){return e.map(e=>{var a;const t=he.getByFlowType(null!==(a=e.type)&&void 0!==a?a:""),l=t?ye.find(e=>{var n;return e.type===(null!==(n=t.apiType)&&void 0!==n?n:t.type)}):null;return(null==l?void 0:l.enrichNode)?Object.assign(Object.assign({},e),{data:l.enrichNode(e.data,n,o)}):Object.assign(Object.assign({},e),{data:Object.assign(Object.assign({},e.data),{locale:o})})})}(r,o,i);Y(s),Z(d),be.current={nodes:s,edges:d},de({id:n.id,name:n.name}),W(!1),null===(l=(t=ge.current).onLoaderEnd)||void 0===l||l.call(t,n)}catch(n){if(!e){const e=n instanceof Error?n:new Error(String(n));q(e),W(!1),null===(d=(r=ge.current).onLoadError)||void 0===d||d.call(r,e),null===(c=(s=ge.current).onError)||void 0===c||c.call(s,e)}}})}(),()=>{e=!0}},[H,a,Y,Z]);const _e=r((e,n)=>{if(!be.current)return;const o=(e,n)=>JSON.stringify({nodes:e.map(e=>({id:e.id,data:e.data,position:e.position})),edges:n.map(e=>({id:e.id,source:e.source,target:e.target,sourceHandle:e.sourceHandle}))}),a=o(be.current.nodes,be.current.edges)!==o(e,n);te(a)},[]);o(()=>{ve.current&&(ve.current=!1,_e(G,X))},[G,X,_e]);const xe=r(e=>{Q(e),e.some(e=>"remove"===e.type)&&queueMicrotask(()=>_e(pe.current,fe.current))},[Q,_e]),we=r(e=>{const n=pe.current.filter(n=>n.id!==e).map(n=>{var o;const a=null===(o=n.data)||void 0===o?void 0:o.originalNode;if(!a)return n;const t=a.config;if(!t)return n;const l=Object.assign({},t);let r=!1;for(const n of Object.keys(l))l[n]===e&&(l[n]=void 0,r=!0);return r?Object.assign(Object.assign({},n),{data:Object.assign(Object.assign({},n.data),{originalNode:Object.assign(Object.assign({},a),{config:l})})}):n}),o=fe.current.filter(n=>n.source!==e&&n.target!==e);Y(n),Z(o),_e(n,o),J===e&&ee(null)},[Y,Z,J,_e]),ke=r(e=>{const n=new Set(e.filter(e=>"remove"===e.type&&"id"in e&&"__start__"!==e.id).map(e=>"id"in e?e.id:""));if(n.size>0){const e=pe.current.filter(e=>!n.has(e.id)).map(e=>{var o;const a=null===(o=e.data)||void 0===o?void 0:o.originalNode;if(!a)return e;const t=a.config;if(!t)return e;const l=Object.assign({},t);let r=!1;for(const e of Object.keys(l))"string"==typeof l[e]&&n.has(l[e])&&(l[e]=void 0,r=!0);return r?Object.assign(Object.assign({},e),{data:Object.assign(Object.assign({},e.data),{originalNode:Object.assign(Object.assign({},a),{config:l})})}):e}),o=fe.current.filter(e=>!n.has(e.source)&&!n.has(e.target));Y(e),Z(o),_e(e,o),J&&n.has(J)&&ee(null)}const o=e.filter(e=>"remove"!==e.type&&!("position"===e.type&&"id"in e&&"__start__"===e.id));0!==o.length&&(o.some(e=>"position"===e.type&&!e.dragging)&&(ve.current=!0),Y(e=>_(o,e)))},[Y,Z,_e,J]),Ce=r((e,n,o)=>{var a,t;const l=he.get(e);if(!l)return;const r=`${e}_${crypto.randomUUID().replace(/-/g,"").slice(0,12)}`;let i=n;if(!i){const e=null===(a=ue.current)||void 0===a?void 0:a.getBoundingClientRect(),n=e?e.left+e.width/2:400,o=e?e.top+e.height/2:300;i=K.screenToFlowPosition({x:n,y:o})}const d={id:r,type:null!==(t=l.apiType)&&void 0!==t?t:e,config:Object.assign({},l.defaultConfig)},s=l.toFlowNode(d),c={id:r,type:l.flowType,position:i,data:s,selected:!0};if(Y(e=>{const n=e.map(e=>e.selected?Object.assign(Object.assign({},e),{selected:!1}):e);return n.push(c),_e(n,fe.current),n}),ee(r),o){const e=i;requestAnimationFrame(()=>{var n;const a=null===(n=ue.current)||void 0===n?void 0:n.querySelector(`[data-id="${CSS.escape(r)}"]`);if(!a)return;const t=a.offsetWidth,l=a.offsetHeight;t&&l&&Y(n=>n.map(n=>n.id===r?Object.assign(Object.assign({},n),{position:{x:e.x-o.x*t,y:e.y-o.y*l}}):n))})}},[K,Y,_e]),ze=r(e=>{e.preventDefault();const n=e.dataTransfer.getData("application/reactflow");if(!n)return;const[o,a]=e.dataTransfer.getData("application/reactflow-grab-frac").split(","),t={x:Number(o),y:Number(a)},l=K.screenToFlowPosition({x:e.clientX,y:e.clientY});Ce(n,l,t)},[K,Ce]),Ae=r(e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"},[]),Ie=r(e=>{var n,o,a;const t={id:`${e.source}-${null!==(n=e.sourceHandle)&&void 0!==n?n:""}->${e.target}`,source:e.source,target:e.target,sourceHandle:null!==(o=e.sourceHandle)&&void 0!==o?o:void 0,targetHandle:null!==(a=e.targetHandle)&&void 0!==a?a:void 0,type:T,markerEnd:{type:x.ArrowClosed,width:12,height:12,color:"#94a3b8"}};Z(n=>{const o=n.filter(n=>{var o,a;return!(n.source===e.source&&(null!==(o=n.sourceHandle)&&void 0!==o?o:null)===(null!==(a=e.sourceHandle)&&void 0!==a?a:null))}),a=[...o,t];return _e(pe.current,a),a})},[Z,_e]),Fe=r((e,n)=>{Z(o=>{var a,t,l;const r=o.filter(o=>{var a,t;return o.id!==e.id&&!(o.source===n.source&&(null!==(a=o.sourceHandle)&&void 0!==a?a:null)===(null!==(t=n.sourceHandle)&&void 0!==t?t:null))}),i=[...r,{id:`${n.source}-${null!==(a=n.sourceHandle)&&void 0!==a?a:""}->${n.target}`,source:n.source,target:n.target,sourceHandle:null!==(t=n.sourceHandle)&&void 0!==t?t:void 0,targetHandle:null!==(l=n.targetHandle)&&void 0!==l?l:void 0,type:T,markerEnd:{type:x.ArrowClosed,width:12,height:12,color:"#94a3b8"}}];return _e(pe.current,i),i})},[Z,_e]),We=r(e=>{var n;if(!e.source||!e.target||e.source!==e.target)return!0;const o=pe.current.find(n=>n.id===e.source),a=he.getByFlowType(null!==(n=null==o?void 0:o.type)&&void 0!==n?n:"");return!0===(null==a?void 0:a.allowSelfLoop)},[pe]),Ue=r((e,n,o)=>{var a,t;Y(a=>{const t=a.map(a=>{var t;if(a.id!==e)return a;const l=function({flowType:e,data:n,configUpdates:o,displayUpdates:a,maps:t,locale:l}){const r=n.originalNode;if(!r)return null;const i=Object.assign(Object.assign({},r),{config:Object.assign(Object.assign({},r.config),o)}),d=he.getByFlowType(e),s=d?d.toFlowNode(i):Object.assign(Object.assign({},n),{originalNode:i}),c=M(o,"target")||void 0,u=c?$(c,l):void 0,p=d?ye.find(e=>{var n;return e.type===(null!==(n=d.apiType)&&void 0!==n?n:d.type)}):null,f=Object.assign(Object.assign({},n),s),g=(null==p?void 0:p.enrichNode)?p.enrichNode(f,t,l):f;return Object.assign(Object.assign(Object.assign({},g),a),u&&{targetType:u})}({flowType:null!==(t=a.type)&&void 0!==t?t:"",data:a.data,configUpdates:n,displayUpdates:o,maps:me.current,locale:i});return l?Object.assign(Object.assign({},a),{data:l}):a});return _e(t,fe.current),t});const l=pe.current.find(n=>n.id===e),r=he.getByFlowType(null!==(a=null==l?void 0:l.type)&&void 0!==a?a:"");if(r){const o=null==l?void 0:l.data.originalNode,a=function(e,n){const o=A(e,n);return new Set(e.exits.filter(e=>!o.includes(e)).map(e=>e.id))}(r,Object.assign(Object.assign({},null==o?void 0:o.config),n));a.size>0&&Z(n=>{const o=n.filter(n=>{var o;return!(n.source===e&&a.has(null!==(o=n.sourceHandle)&&void 0!==o?o:""))});return o.length===n.length?n:(_e(pe.current,o),o)})}const d=r?ye.find(e=>{var n;return e.type===(null!==(n=r.apiType)&&void 0!==n?n:r.type)}):null;null===(t=null==d?void 0:d.onConfigChange)||void 0===t||t.call(d,e,n,{setEdges:Z,updateNodeInternals:B,nodesRef:pe,updateDirty:_e});const s=M(n,"target");s&&requestAnimationFrame(()=>B(e)),s&&!me.current.users.has(s)&&H.resolveRoutingTarget(s).then(n=>{var o,a;n&&(me.current.users.set(s,{id:n.id,name:n.name||n.id,extension_number:null!==(o=n.extension_number)&&void 0!==o?o:void 0,timeout_seconds:null!==(a=n.timeout_seconds)&&void 0!==a?a:void 0}),Y(n=>n.map(n=>{var o;return n.id===e?Object.assign(Object.assign({},n),{data:Le(null!==(o=n.type)&&void 0!==o?o:"",n.data,me.current,i)}):n})))})},[H,Y,Z,_e,B]),qe=r(()=>{const{nodes:e,edges:n}=Oe(G,X);Y(e),Z(n),_e(e,n),requestAnimationFrame(()=>K.fitView({padding:.2}))},[G,X,Y,Z,_e,K]),Ge=r((e,n)=>j(this,void 0,void 0,function*(){var o;try{const t={expand:["extensions"]};switch(e){case"schedule":return yield H.schedules.list();case"user":return(yield H.users.list(t)).map(e=>{var n,o,a;return{id:e.id,name:e.name||i.combobox.noName,extension_number:null===(a=null===(o=null===(n=e.extensions)||void 0===n?void 0:n.data)||void 0===o?void 0:o[0])||void 0===a?void 0:a.number}});case"ring_group":return yield H.ringGroups.list(t);case"queue":return yield H.queues.list({expand:t.expand});case"dial_plan":{const e=yield H.dialPlans.list(t),n=null!==(o=null==ie?void 0:ie.id)&&void 0!==o?o:a;return e.filter(e=>e.id!==n)}case"voice_app":{const e=yield H.voiceApps.list(t);if(!(null==n?void 0:n.notifyEligible))return e;try{const n=yield H.aiAgents.list({limit:100}),o=new Set(n.map(e=>e.voice_app_id));return e.filter(e=>!o.has(e.id))}catch(n){return e}}case"shared_voicemail":return yield H.sharedVoicemailBoxes.list();case"audio_clip":return yield H.audioClips.list();default:return[]}}catch(e){return[]}}),[H,a,ie,i,se]),Ye=r(e=>j(this,void 0,void 0,function*(){const n=(e,n)=>Ne(e,n,he).nodes,o=be.current,a=[...n(pe.current,fe.current),...o?n(o.nodes,o.edges):[]],t=yield Ve({nodes:a},H,{refresh:!0,only:e?new Set(e):void 0}),l=me.current,r={schedules:new Map([...l.schedules,...t.schedules]),users:new Map([...l.users,...t.users]),audioClips:new Map([...l.audioClips,...t.audioClips])};me.current=r;const d=e=>e.map(e=>{var n;return Object.assign(Object.assign({},e),{data:Le(null!==(n=e.type)&&void 0!==n?n:"",e.data,r,i)})}),s=be.current;s&&(be.current=Object.assign(Object.assign({},s),{nodes:d(s.nodes)})),Y(e=>d(e)),ce(e=>e+1)}),[H,Y]),Xe=r(()=>j(this,void 0,void 0,function*(){var e,n,o,t,l,r;try{const l=pe.current,r=fe.current,d=Ne(l,r,he),s=a?yield H.dialPlans.update(a,d):yield H.dialPlans.create(Object.assign({name:i.status.newDialPlan},d));be.current={nodes:[...l],edges:[...r]},te(!1),null===(n=(e=ge.current).onDirtyChange)||void 0===n||n.call(e,!1),null===(t=(o=ge.current).onSave)||void 0===t||t.call(o,s)}catch(e){const n=e instanceof Error?e:new Error(String(e)),o=n.message.includes("/nodes/")?Ne(pe.current,fe.current,he):null;if(o){const e=n.message.match(/^\/nodes\/(\d+)\//);if(null==e?void 0:e[1]){const n=o.nodes[parseInt(e[1],10)];n&&ee(n.id)}}throw null===(r=(l=ge.current).onError)||void 0===r||r.call(l,new Error(function(e,n){var o,a,t;if(e.startsWith("voice_app notify mode is not supported on AI agent voice apps"))return"A Voice App used in Notify mode is backed by a Managed VoiceAI agent. Managed VoiceAI voice apps must use Control mode.";const l=e.indexOf(": "),r=l>0&&e.startsWith("/")?e.slice(0,l):"",i=l>0?e.slice(l+2):e,d=r.split("/").filter(Boolean);if("entry_node"===d[0])return"The Start node must be connected to another node";if("nodes"===d[0]&&i.includes("minItems"))return"The dial plan must have at least one node";if("nodes"===d[0]&&"config"===d[2]&&d[3]){const e=d[3];if(Me[e])return Me[e];const l=parseInt(null!==(o=d[1])&&void 0!==o?o:"",10),r=isNaN(l)||null===(a=null==n?void 0:n[l])||void 0===a?void 0:a.type,i=r?null!==(t=Pe[r])&&void 0!==t?t:r:void 0;return i?`Invalid ${e.replace(/_/g," ")} in the ${i} node`:`Invalid ${e.replace(/_/g," ")}`}return r?i:e}(n.message,null==o?void 0:o.nodes))),e}}),[H,a]);d(R,()=>({save:Xe,refreshResources:Ye}),[Xe,Ye]);const Ze=r((e,n)=>{"__start__"!==n.id&&(ee(n.id),oe(null))},[]),Qe=r((e,n)=>{oe(n.id),ee(null)},[]),Je=r(e=>{const n=fe.current.filter(n=>n.id!==e);Z(n),_e(pe.current,n),oe(null)},[Z,_e]),en=r(()=>{ee(null),oe(null)},[]),nn=r((e,n)=>{var o;if(!s)return;if("__start__"===n.id)return;const a=null===(o=n.data)||void 0===o?void 0:o.originalNode;a&&s(n.id,a)},[s]),on=J?G.find(e=>e.id===J):null,an=on?he.getByFlowType(null!==(I=on.type)&&void 0!==I?I:""):null,tn=ne?X.find(e=>e.id===ne):null,ln=!(!on||!an)||!!tn;if(V)return e.createElement("div",{className:`ds-dial-plan-viewer ds-dial-plan-viewer--loading ${O||""}`,style:L},e.createElement("div",{className:"ds-dial-plan-viewer__loading"},e.createElement("div",{className:"ds-dial-plan-viewer__spinner"}),e.createElement("span",null,i.status.loading)));if(U)return e.createElement("div",{className:`ds-dial-plan-viewer ds-dial-plan-viewer--error ${O||""}`,style:L},e.createElement("div",{className:"ds-dial-plan-viewer__error"},e.createElement("span",null,i.status.loadError),e.createElement("span",{className:"ds-dial-plan-viewer__error-message"},U.message)));if(!F&&0===G.length)return e.createElement("div",{className:`ds-dial-plan-viewer ds-dial-plan-viewer--empty ${O||""}`,style:L},e.createElement("div",{className:"ds-dial-plan-viewer__empty"},e.createElement("span",null,i.status.notFound)));const rn=e.createElement(y,{nodes:G,edges:X,nodeTypes:Ke,edgeTypes:Be,onNodesChange:F?ke:void 0,onEdgesChange:F?xe:void 0,onConnect:F?Ie:void 0,onReconnect:F?Fe:void 0,onEdgeClick:F?Qe:void 0,isValidConnection:F?We:void 0,edgesReconnectable:F,onNodeClick:F?Ze:s?nn:void 0,onPaneClick:F?en:void 0,nodesDraggable:F,nodesConnectable:F,elementsSelectable:F,selectionOnDrag:!1,selectNodesOnDrag:!1,panOnDrag:D,panOnScroll:!1,zoomOnScroll:D,zoomOnPinch:D,zoomOnDoubleClick:D,preventScrolling:D,connectionLineType:w.SmoothStep,selectionKeyCode:null,multiSelectionKeyCode:null,deleteKeyCode:F?["Backspace","Delete"]:null,fitView:!0,fitViewOptions:{padding:D?.2:.15,minZoom:D?.5:0,maxZoom:1.5},minZoom:D?.3:0,maxZoom:2,defaultEdgeOptions:{type:T,animated:!1,markerEnd:{type:x.ArrowClosed,width:12,height:12,color:"#94a3b8"}},proOptions:{hideAttribution:!0}},P&&e.createElement(k,{gap:20,size:1}),P&&e.createElement(E,{showInteractive:!1}),F&&e.createElement(Te,{onAutoLayout:qe,onSave:()=>{Xe().catch(()=>{})},isDirty:ae,hasInvalidDraft:le}));return e.createElement("div",{className:`ds-dial-plan-editor ${"preview"===l?"ds-dial-plan-editor--preview":""} ${O||""}`,style:L},F&&e.createElement("div",{className:"ds-dial-plan-node-library-wrapper"},e.createElement(Se,{registry:he,onAddNode:Ce})),e.createElement("div",{ref:ue,className:"ds-dial-plan-editor__canvas",onDrop:F?ze:void 0,onDragOver:F?Ae:void 0},rn),F&&e.createElement("div",{className:"ds-dial-plan-config-panel-wrapper"+(ln?" ds-dial-plan-config-panel-wrapper--open":"")},on&&an&&e.createElement(je,{node:on,registration:an,onConfigChange:Ue,onInvalidDraftChange:re,onDelete:we,onClose:()=>{ee(null),Y(e=>e.map(e=>e.selected?Object.assign(Object.assign({},e),{selected:!1}):e))},listResources:Ge,onCreateResource:z,onOpenResource:S,locale:i}),tn&&e.createElement("div",{className:"ds-dial-plan-config-panel"},e.createElement("div",{className:"ds-dial-plan-config-panel__header"},e.createElement("span",{className:"ds-dial-plan-config-panel__header-icon"},e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M4 8h8v8h8"}),e.createElement("polyline",{points:"17 13 20 16 17 19"}))),e.createElement("span",{className:"ds-dial-plan-config-panel__header-label"},i.panel.connection),e.createElement("button",{type:"button",className:"ds-dial-plan-config-panel__delete",onClick:()=>Je(tn.id),title:i.panel.delete_},Re),e.createElement("button",{type:"button",className:"ds-dial-plan-config-panel__close",onClick:()=>{oe(null),Z(e=>e.map(e=>e.selected?Object.assign(Object.assign({},e),{selected:!1}):e))},title:i.panel.close},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})))),e.createElement("div",{className:"ds-dial-plan-config-panel__body"},e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("span",{className:"ds-dial-plan-config-field__label"},i.panel.from),e.createElement("span",{className:"ds-dial-plan-edge-panel__value"},(()=>{var e,n,o;const a=G.find(e=>e.id===tn.source),t=a?he.getByFlowType(null!==(e=a.type)&&void 0!==e?e:""):null,l=null!==(o=null!==(n=null==t?void 0:t.label)&&void 0!==n?n:null==a?void 0:a.type)&&void 0!==o?o:tn.source;return l.charAt(0).toUpperCase()+l.slice(1)})())),tn.sourceHandle&&e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("span",{className:"ds-dial-plan-config-field__label"},i.panel.exit),e.createElement("span",{className:"ds-dial-plan-edge-panel__value"},(()=>{var e,n,o,a,t;const l=tn.sourceHandle,r=G.find(e=>e.id===tn.source),i=r?he.getByFlowType(null!==(e=r.type)&&void 0!==e?e:""):null,d=i?ye.find(e=>{var n;return e.type===(null!==(n=i.apiType)&&void 0!==n?n:i.type)}):null;return null!==(t=null!==(o=null===(n=null==d?void 0:d.resolveExitLabel)||void 0===n?void 0:n.call(d,l))&&void 0!==o?o:null===(a=null==i?void 0:i.exits.find(e=>e.id===l))||void 0===a?void 0:a.label)&&void 0!==t?t:l})())),e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("span",{className:"ds-dial-plan-config-field__label"},i.panel.to),e.createElement("span",{className:"ds-dial-plan-edge-panel__value"},(()=>{var e,n,o;const a=G.find(e=>e.id===tn.target),t=a?he.getByFlowType(null!==(e=a.type)&&void 0!==e?e:""):null,l=null!==(o=null!==(n=null==t?void 0:t.label)&&void 0!==n?n:null==a?void 0:a.type)&&void 0!==o?o:tn.target;return l.charAt(0).toUpperCase()+l.slice(1)})()))))))}),Ue=["/* this gets exported as style.css and can be used for the default theming */\n/* these are the necessary styles for React/Svelte Flow, they get used by base.css and style.css */\n.react-flow {\n direction: ltr;\n\n --xy-edge-stroke-default: #b1b1b7;\n --xy-edge-stroke-width-default: 1;\n --xy-edge-stroke-selected-default: #555;\n\n --xy-connectionline-stroke-default: #b1b1b7;\n --xy-connectionline-stroke-width-default: 1;\n\n --xy-attribution-background-color-default: rgba(255, 255, 255, 0.5);\n\n --xy-minimap-background-color-default: #fff;\n --xy-minimap-mask-background-color-default: rgba(240, 240, 240, 0.6);\n --xy-minimap-mask-stroke-color-default: transparent;\n --xy-minimap-mask-stroke-width-default: 1;\n --xy-minimap-node-background-color-default: #e2e2e2;\n --xy-minimap-node-stroke-color-default: transparent;\n --xy-minimap-node-stroke-width-default: 2;\n\n --xy-background-color-default: transparent;\n --xy-background-pattern-dots-color-default: #91919a;\n --xy-background-pattern-lines-color-default: #eee;\n --xy-background-pattern-cross-color-default: #e2e2e2;\n background-color: var(--xy-background-color, var(--xy-background-color-default));\n --xy-node-color-default: inherit;\n --xy-node-border-default: 1px solid #1a192b;\n --xy-node-background-color-default: #fff;\n --xy-node-group-background-color-default: rgba(240, 240, 240, 0.25);\n --xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, 0.08);\n --xy-node-boxshadow-selected-default: 0 0 0 0.5px #1a192b;\n --xy-node-border-radius-default: 3px;\n\n --xy-handle-background-color-default: #1a192b;\n --xy-handle-border-color-default: #fff;\n\n --xy-selection-background-color-default: rgba(0, 89, 220, 0.08);\n --xy-selection-border-default: 1px dotted rgba(0, 89, 220, 0.8);\n\n --xy-controls-button-background-color-default: #fefefe;\n --xy-controls-button-background-color-hover-default: #f4f4f4;\n --xy-controls-button-color-default: inherit;\n --xy-controls-button-color-hover-default: inherit;\n --xy-controls-button-border-color-default: #eee;\n --xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, 0.08);\n\n --xy-edge-label-background-color-default: #ffffff;\n --xy-edge-label-color-default: inherit;\n --xy-resize-background-color-default: #3367d9;\n}\n.react-flow.dark {\n --xy-edge-stroke-default: #3e3e3e;\n --xy-edge-stroke-width-default: 1;\n --xy-edge-stroke-selected-default: #727272;\n\n --xy-connectionline-stroke-default: #b1b1b7;\n --xy-connectionline-stroke-width-default: 1;\n\n --xy-attribution-background-color-default: rgba(150, 150, 150, 0.25);\n\n --xy-minimap-background-color-default: #141414;\n --xy-minimap-mask-background-color-default: rgba(60, 60, 60, 0.6);\n --xy-minimap-mask-stroke-color-default: transparent;\n --xy-minimap-mask-stroke-width-default: 1;\n --xy-minimap-node-background-color-default: #2b2b2b;\n --xy-minimap-node-stroke-color-default: transparent;\n --xy-minimap-node-stroke-width-default: 2;\n\n --xy-background-color-default: #141414;\n --xy-background-pattern-dots-color-default: #555;\n --xy-background-pattern-lines-color-default: #333;\n --xy-background-pattern-cross-color-default: #333;\n --xy-node-color-default: #f8f8f8;\n --xy-node-border-default: 1px solid #3c3c3c;\n --xy-node-background-color-default: #1e1e1e;\n --xy-node-group-background-color-default: rgba(240, 240, 240, 0.25);\n --xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, 0.08);\n --xy-node-boxshadow-selected-default: 0 0 0 0.5px #999;\n\n --xy-handle-background-color-default: #bebebe;\n --xy-handle-border-color-default: #1e1e1e;\n\n --xy-selection-background-color-default: rgba(200, 200, 220, 0.08);\n --xy-selection-border-default: 1px dotted rgba(200, 200, 220, 0.8);\n\n --xy-controls-button-background-color-default: #2b2b2b;\n --xy-controls-button-background-color-hover-default: #3e3e3e;\n --xy-controls-button-color-default: #f8f8f8;\n --xy-controls-button-color-hover-default: #fff;\n --xy-controls-button-border-color-default: #5b5b5b;\n --xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, 0.08);\n\n --xy-edge-label-background-color-default: #141414;\n --xy-edge-label-color-default: #f8f8f8;\n}\n.react-flow__background {\n background-color: var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));\n pointer-events: none;\n z-index: -1;\n}\n.react-flow__container {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n}\n.react-flow__pane {\n z-index: 1;\n touch-action: none;\n}\n.react-flow__pane.draggable {\n cursor: grab;\n }\n.react-flow__pane.dragging {\n cursor: grabbing;\n }\n.react-flow__pane.selection {\n cursor: pointer;\n }\n.react-flow__viewport {\n transform-origin: 0 0;\n z-index: 2;\n pointer-events: none;\n}\n.react-flow__renderer {\n z-index: 4;\n}\n.react-flow__selection {\n z-index: 6;\n}\n.react-flow__nodesselection-rect:focus,\n.react-flow__nodesselection-rect:focus-visible {\n outline: none;\n}\n.react-flow__edge-path {\n stroke: var(--xy-edge-stroke, var(--xy-edge-stroke-default));\n stroke-width: var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));\n fill: none;\n}\n.react-flow__connection-path {\n stroke: var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));\n stroke-width: var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));\n fill: none;\n}\n.react-flow .react-flow__edges {\n position: absolute;\n}\n.react-flow .react-flow__edges svg {\n overflow: visible;\n position: absolute;\n pointer-events: none;\n }\n.react-flow__edge {\n pointer-events: visibleStroke;\n}\n.react-flow__edge.selectable {\n cursor: pointer;\n }\n.react-flow__edge.animated path {\n stroke-dasharray: 5;\n animation: dashdraw 0.5s linear infinite;\n }\n.react-flow__edge.animated path.react-flow__edge-interaction {\n stroke-dasharray: none;\n animation: none;\n }\n.react-flow__edge.inactive {\n pointer-events: none;\n }\n.react-flow__edge.selected,\n .react-flow__edge:focus,\n .react-flow__edge:focus-visible {\n outline: none;\n }\n.react-flow__edge.selected .react-flow__edge-path,\n .react-flow__edge.selectable:focus .react-flow__edge-path,\n .react-flow__edge.selectable:focus-visible .react-flow__edge-path {\n stroke: var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default));\n }\n.react-flow__edge-textwrapper {\n pointer-events: all;\n }\n.react-flow__edge .react-flow__edge-text {\n pointer-events: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n }\n/* Arrowhead marker styles - use CSS custom properties as default */\n.react-flow__arrowhead polyline {\n stroke: var(--xy-edge-stroke, var(--xy-edge-stroke-default));\n}\n.react-flow__arrowhead polyline.arrowclosed {\n fill: var(--xy-edge-stroke, var(--xy-edge-stroke-default));\n}\n.react-flow__connection {\n pointer-events: none;\n}\n.react-flow__connection .animated {\n stroke-dasharray: 5;\n animation: dashdraw 0.5s linear infinite;\n }\nsvg.react-flow__connectionline {\n z-index: 1001;\n overflow: visible;\n position: absolute;\n}\n.react-flow__nodes {\n pointer-events: none;\n transform-origin: 0 0;\n}\n.react-flow__node {\n position: absolute;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n pointer-events: all;\n transform-origin: 0 0;\n box-sizing: border-box;\n cursor: default;\n}\n.react-flow__node.selectable {\n cursor: pointer;\n }\n.react-flow__node.draggable {\n cursor: grab;\n pointer-events: all;\n }\n.react-flow__node.draggable.dragging {\n cursor: grabbing;\n }\n.react-flow__nodesselection {\n z-index: 3;\n transform-origin: left top;\n pointer-events: none;\n}\n.react-flow__nodesselection-rect {\n position: absolute;\n pointer-events: all;\n cursor: grab;\n }\n.react-flow__handle {\n position: absolute;\n pointer-events: none;\n min-width: 5px;\n min-height: 5px;\n width: 6px;\n height: 6px;\n background-color: var(--xy-handle-background-color, var(--xy-handle-background-color-default));\n border: 1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));\n border-radius: 100%;\n}\n.react-flow__handle.connectingfrom {\n pointer-events: all;\n }\n.react-flow__handle.connectionindicator {\n pointer-events: all;\n cursor: crosshair;\n }\n.react-flow__handle-bottom {\n top: auto;\n left: 50%;\n bottom: 0;\n transform: translate(-50%, 50%);\n }\n.react-flow__handle-top {\n top: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n.react-flow__handle-left {\n top: 50%;\n left: 0;\n transform: translate(-50%, -50%);\n }\n.react-flow__handle-right {\n top: 50%;\n right: 0;\n transform: translate(50%, -50%);\n }\n.react-flow__edgeupdater {\n cursor: move;\n pointer-events: all;\n}\n.react-flow__pane.selection .react-flow__panel {\n pointer-events: none;\n}\n.react-flow__panel {\n position: absolute;\n z-index: 5;\n margin: 15px;\n}\n.react-flow__panel.top {\n top: 0;\n }\n.react-flow__panel.bottom {\n bottom: 0;\n }\n.react-flow__panel.top.center, .react-flow__panel.bottom.center {\n left: 50%;\n transform: translateX(-15px) translateX(-50%);\n }\n.react-flow__panel.left {\n left: 0;\n }\n.react-flow__panel.right {\n right: 0;\n }\n.react-flow__panel.left.center, .react-flow__panel.right.center {\n top: 50%;\n transform: translateY(-15px) translateY(-50%);\n }\n.react-flow__attribution {\n font-size: 10px;\n background: var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));\n padding: 2px 3px;\n margin: 0;\n}\n.react-flow__attribution a {\n text-decoration: none;\n color: #999;\n }\n@keyframes dashdraw {\n from {\n stroke-dashoffset: 10;\n }\n}\n.react-flow__edgelabel-renderer {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n left: 0;\n top: 0;\n}\n.react-flow__viewport-portal {\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n.react-flow__minimap {\n background: var(\n --xy-minimap-background-color-props,\n var(--xy-minimap-background-color, var(--xy-minimap-background-color-default))\n );\n}\n.react-flow__minimap-svg {\n display: block;\n }\n.react-flow__minimap-mask {\n fill: var(\n --xy-minimap-mask-background-color-props,\n var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default))\n );\n stroke: var(\n --xy-minimap-mask-stroke-color-props,\n var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default))\n );\n stroke-width: var(\n --xy-minimap-mask-stroke-width-props,\n var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default))\n );\n }\n.react-flow__minimap-node {\n fill: var(\n --xy-minimap-node-background-color-props,\n var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default))\n );\n stroke: var(\n --xy-minimap-node-stroke-color-props,\n var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default))\n );\n stroke-width: var(\n --xy-minimap-node-stroke-width-props,\n var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default))\n );\n }\n.react-flow__background-pattern.dots {\n fill: var(\n --xy-background-pattern-color-props,\n var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default))\n );\n }\n.react-flow__background-pattern.lines {\n stroke: var(\n --xy-background-pattern-color-props,\n var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default))\n );\n }\n.react-flow__background-pattern.cross {\n stroke: var(\n --xy-background-pattern-color-props,\n var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default))\n );\n }\n.react-flow__controls {\n display: flex;\n flex-direction: column;\n box-shadow: var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default));\n}\n.react-flow__controls.horizontal {\n flex-direction: row;\n }\n.react-flow__controls-button {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 26px;\n width: 26px;\n padding: 4px;\n border: none;\n background: var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));\n border-bottom: 1px solid\n var(\n --xy-controls-button-border-color-props,\n var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default))\n );\n color: var(\n --xy-controls-button-color-props,\n var(--xy-controls-button-color, var(--xy-controls-button-color-default))\n );\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n }\n.react-flow__controls-button svg {\n width: 100%;\n max-width: 12px;\n max-height: 12px;\n fill: currentColor;\n }\n.react-flow__edge.updating .react-flow__edge-path {\n stroke: #777;\n }\n.react-flow__edge-text {\n font-size: 10px;\n }\n.react-flow__node.selectable:focus,\n .react-flow__node.selectable:focus-visible {\n outline: none;\n }\n.react-flow__node-input,\n.react-flow__node-default,\n.react-flow__node-output,\n.react-flow__node-group {\n padding: 10px;\n border-radius: var(--xy-node-border-radius, var(--xy-node-border-radius-default));\n width: 150px;\n font-size: 12px;\n color: var(--xy-node-color, var(--xy-node-color-default));\n text-align: center;\n border: var(--xy-node-border, var(--xy-node-border-default));\n background-color: var(--xy-node-background-color, var(--xy-node-background-color-default));\n}\n.react-flow__node-input.selectable:hover, .react-flow__node-default.selectable:hover, .react-flow__node-output.selectable:hover, .react-flow__node-group.selectable:hover {\n box-shadow: var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default));\n }\n.react-flow__node-input.selectable.selected,\n .react-flow__node-input.selectable:focus,\n .react-flow__node-input.selectable:focus-visible,\n .react-flow__node-default.selectable.selected,\n .react-flow__node-default.selectable:focus,\n .react-flow__node-default.selectable:focus-visible,\n .react-flow__node-output.selectable.selected,\n .react-flow__node-output.selectable:focus,\n .react-flow__node-output.selectable:focus-visible,\n .react-flow__node-group.selectable.selected,\n .react-flow__node-group.selectable:focus,\n .react-flow__node-group.selectable:focus-visible {\n box-shadow: var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default));\n }\n.react-flow__node-group {\n background-color: var(--xy-node-group-background-color, var(--xy-node-group-background-color-default));\n}\n.react-flow__nodesselection-rect,\n.react-flow__selection {\n background: var(--xy-selection-background-color, var(--xy-selection-background-color-default));\n border: var(--xy-selection-border, var(--xy-selection-border-default));\n}\n.react-flow__nodesselection-rect:focus,\n .react-flow__nodesselection-rect:focus-visible,\n .react-flow__selection:focus,\n .react-flow__selection:focus-visible {\n outline: none;\n }\n.react-flow__controls-button:hover {\n background: var(\n --xy-controls-button-background-color-hover-props,\n var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default))\n );\n color: var(\n --xy-controls-button-color-hover-props,\n var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default))\n );\n }\n.react-flow__controls-button:disabled {\n pointer-events: none;\n }\n.react-flow__controls-button:disabled svg {\n fill-opacity: 0.4;\n }\n.react-flow__controls-button:last-child {\n border-bottom: none;\n }\n.react-flow__controls.horizontal .react-flow__controls-button {\n border-bottom: none;\n border-right: 1px solid\n var(\n --xy-controls-button-border-color-props,\n var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default))\n );\n }\n.react-flow__controls.horizontal .react-flow__controls-button:last-child {\n border-right: none;\n }\n.react-flow__resize-control {\n position: absolute;\n}\n.react-flow__resize-control.left,\n.react-flow__resize-control.right {\n cursor: ew-resize;\n}\n.react-flow__resize-control.top,\n.react-flow__resize-control.bottom {\n cursor: ns-resize;\n}\n.react-flow__resize-control.top.left,\n.react-flow__resize-control.bottom.right {\n cursor: nwse-resize;\n}\n.react-flow__resize-control.bottom.left,\n.react-flow__resize-control.top.right {\n cursor: nesw-resize;\n}\n/* handle styles */\n.react-flow__resize-control.handle {\n width: 5px;\n height: 5px;\n border: 1px solid #fff;\n border-radius: 1px;\n background-color: var(--xy-resize-background-color, var(--xy-resize-background-color-default));\n translate: -50% -50%;\n}\n.react-flow__resize-control.handle.left {\n left: 0;\n top: 50%;\n}\n.react-flow__resize-control.handle.right {\n left: 100%;\n top: 50%;\n}\n.react-flow__resize-control.handle.top {\n left: 50%;\n top: 0;\n}\n.react-flow__resize-control.handle.bottom {\n left: 50%;\n top: 100%;\n}\n.react-flow__resize-control.handle.top.left {\n left: 0;\n}\n.react-flow__resize-control.handle.bottom.left {\n left: 0;\n}\n.react-flow__resize-control.handle.top.right {\n left: 100%;\n}\n.react-flow__resize-control.handle.bottom.right {\n left: 100%;\n}\n/* line styles */\n.react-flow__resize-control.line {\n border-color: var(--xy-resize-background-color, var(--xy-resize-background-color-default));\n border-width: 0;\n border-style: solid;\n}\n.react-flow__resize-control.line.left,\n.react-flow__resize-control.line.right {\n width: 1px;\n transform: translate(-50%, 0);\n top: 0;\n height: 100%;\n}\n.react-flow__resize-control.line.left {\n left: 0;\n border-left-width: 1px;\n}\n.react-flow__resize-control.line.right {\n left: 100%;\n border-right-width: 1px;\n}\n.react-flow__resize-control.line.top,\n.react-flow__resize-control.line.bottom {\n height: 1px;\n transform: translate(0, -50%);\n left: 0;\n width: 100%;\n}\n.react-flow__resize-control.line.top {\n top: 0;\n border-top-width: 1px;\n}\n.react-flow__resize-control.line.bottom {\n border-bottom-width: 1px;\n top: 100%;\n}\n.react-flow__edge-textbg {\n fill: var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default));\n}\n.react-flow__edge-text {\n fill: var(--xy-edge-label-color, var(--xy-edge-label-color-default));\n}\n",'\n/* ============================================================================\n Shadow DOM Reset\n ============================================================================ */\n\n:host {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n}\n\n*, *::before, *::after {\n box-sizing: border-box;\n}\n\n/* ============================================================================\n Container\n ============================================================================ */\n\n.ds-dial-plan-viewer {\n width: 100%;\n height: 100%;\n background: var(--ds-color-background, #ffffff);\n border-radius: var(--ds-border-radius, 8px);\n overflow: hidden;\n}\n\n/* ============================================================================\n Base Node Styles\n ============================================================================ */\n\n.ds-dial-plan-node {\n padding: 12px 16px;\n border-radius: var(--ds-border-radius, 8px);\n border: 2px solid var(--ds-color-border, #e2e8f0);\n background: var(--ds-color-background, #ffffff);\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n transition: border-color 0.15s ease, box-shadow 0.15s ease, outline-color 0.15s ease;\n min-width: 140px;\n outline: 3px solid transparent;\n outline-offset: 2px;\n}\n\n.ds-dial-plan-node--selected {\n border-color: var(--ds-color-primary, #3b82f6);\n outline-color: var(--ds-color-primary, #3b82f6);\n box-shadow: 0 0 16px 2px rgba(59, 130, 246, 0.4), 0 4px 12px rgba(59, 130, 246, 0.2);\n}\n\n.ds-dial-plan-node__content,\n.ds-dial-plan-node__header {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n}\n\n.ds-dial-plan-node__icon {\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-dial-plan-node__label {\n font-weight: 600;\n color: var(--ds-color-text, #1e293b);\n text-align: center;\n}\n\n.ds-dial-plan-node__type-label {\n font-size: var(--ds-font-size-xs, 12px);\n font-weight: 500;\n color: var(--ds-color-text-secondary, #64748b);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n}\n\n.ds-dial-plan-node__name {\n font-weight: 600;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text, #1e293b);\n text-align: center;\n}\n\n.ds-dial-plan-node__type {\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-dial-plan-node__exits {\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin-top: 12px;\n padding-top: 10px;\n border-top: 1px solid var(--ds-color-border, #e2e8f0);\n}\n\n.ds-dial-plan-node__exit-row {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 8px;\n position: relative;\n}\n\n.ds-dial-plan-node__exit-label {\n font-size: 11px;\n color: var(--ds-color-text-secondary, #64748b);\n white-space: nowrap;\n}\n\n/* Position handles at the right edge of exit rows */\n.ds-dial-plan-node__exit-row .ds-dial-plan-handle {\n position: absolute;\n right: -16px;\n}\n\n/* ============================================================================\n Start Node\n ============================================================================ */\n\n.ds-dial-plan-node--start {\n background: var(--ds-color-primary, #3b82f6);\n border-color: var(--ds-color-primary, #3b82f6);\n border-radius: 50%;\n width: 60px;\n height: 60px;\n min-width: auto;\n padding: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.ds-dial-plan-node--start .ds-dial-plan-node__content {\n flex-direction: row;\n}\n\n.ds-dial-plan-node--start .ds-dial-plan-node__label {\n color: #ffffff;\n font-size: var(--ds-font-size-sm, 14px);\n}\n\n/* ============================================================================\n Node color theming (driven by --node-color CSS variable from registration)\n ============================================================================ */\n\n.ds-dial-plan-node--themed {\n border-color: var(--node-color);\n background: color-mix(in srgb, var(--node-color) 8%, white);\n}\n\n.ds-dial-plan-node--themed .ds-dial-plan-node__icon {\n color: var(--node-color);\n}\n\n.ds-dial-plan-node--themed.ds-dial-plan-node--selected {\n border-color: var(--node-color);\n outline-color: var(--node-color);\n box-shadow: 0 0 16px 2px color-mix(in srgb, var(--node-color) 40%, transparent),\n 0 4px 12px color-mix(in srgb, var(--node-color) 20%, transparent);\n}\n\n/* ============================================================================\n Per-type node colors (override --themed fallback with hand-crafted gradients)\n ============================================================================ */\n\n.ds-dial-plan-node--schedule {\n background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);\n border-color: var(--ds-color-info, #0ea5e9);\n min-height: 80px;\n}\n.ds-dial-plan-node--schedule .ds-dial-plan-node__icon { color: var(--ds-color-info, #0ea5e9); }\n.ds-dial-plan-node--schedule.ds-dial-plan-node--selected {\n border-color: var(--ds-color-info, #0ea5e9);\n outline-color: var(--ds-color-info, #0ea5e9);\n box-shadow: 0 0 16px 2px rgba(14, 165, 233, 0.4), 0 4px 12px rgba(14, 165, 233, 0.2);\n}\n\n.ds-dial-plan-node--internal-dial {\n background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);\n border-color: var(--ds-color-success, #22c55e);\n}\n.ds-dial-plan-node--internal-dial .ds-dial-plan-node__icon { color: var(--ds-color-success, #22c55e); }\n.ds-dial-plan-node--internal-dial.ds-dial-plan-node--selected {\n border-color: var(--ds-color-success, #22c55e);\n outline-color: var(--ds-color-success, #22c55e);\n box-shadow: 0 0 16px 2px rgba(34, 197, 94, 0.4), 0 4px 12px rgba(34, 197, 94, 0.2);\n}\n\n.ds-dial-plan-node--voicemail {\n background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);\n border-color: var(--ds-color-purple, #a855f7);\n}\n.ds-dial-plan-node--voicemail .ds-dial-plan-node__icon { color: var(--ds-color-purple, #a855f7); }\n.ds-dial-plan-node--voicemail.ds-dial-plan-node--selected {\n border-color: var(--ds-color-purple, #a855f7);\n outline-color: var(--ds-color-purple, #a855f7);\n box-shadow: 0 0 16px 2px rgba(168, 85, 247, 0.4), 0 4px 12px rgba(168, 85, 247, 0.2);\n}\n\n.ds-dial-plan-node--ring-all-users {\n background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);\n border-color: var(--ds-color-warning, #f59e0b);\n}\n.ds-dial-plan-node--ring-all-users .ds-dial-plan-node__icon { color: var(--ds-color-warning, #f59e0b); }\n.ds-dial-plan-node--ring-all-users.ds-dial-plan-node--selected {\n border-color: var(--ds-color-warning, #f59e0b);\n outline-color: var(--ds-color-warning, #f59e0b);\n box-shadow: 0 0 16px 2px rgba(245, 158, 11, 0.4), 0 4px 12px rgba(245, 158, 11, 0.2);\n}\n\n.ds-dial-plan-node--external-dial {\n background: linear-gradient(135deg, #fff1f2 0%, #fecdd3 100%);\n border-color: var(--ds-color-rose, #f43f5e);\n}\n.ds-dial-plan-node--external-dial .ds-dial-plan-node__icon { color: var(--ds-color-rose, #f43f5e); }\n.ds-dial-plan-node--external-dial.ds-dial-plan-node--selected {\n border-color: var(--ds-color-rose, #f43f5e);\n outline-color: var(--ds-color-rose, #f43f5e);\n box-shadow: 0 0 16px 2px rgba(244, 63, 94, 0.4), 0 4px 12px rgba(244, 63, 94, 0.2);\n}\n\n.ds-dial-plan-node--voice-app {\n border: 2px solid transparent;\n background:\n linear-gradient(135deg, #c7d2fe 0%, #ddd6fe 40%, #bae6fd 100%) padding-box,\n linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box;\n position: relative;\n transition: box-shadow 0.15s ease;\n}\n.ds-dial-plan-node--voice-app .ds-dial-plan-node__icon { color: #4f46e5; }\n.ds-dial-plan-node--voice-app.ds-dial-plan-node--selected {\n border-color: transparent;\n outline: none;\n box-shadow: 0 0 16px 2px rgba(99, 102, 241, 0.4), 0 4px 12px rgba(56, 189, 248, 0.2);\n}\n.ds-dial-plan-node--voice-app::after {\n content: \'\';\n position: absolute;\n inset: -7px;\n border-radius: calc(var(--ds-border-radius, 8px) + 5px);\n border: 3px solid transparent;\n background: linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box;\n -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);\n -webkit-mask-composite: xor;\n mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);\n mask-composite: exclude;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.15s ease;\n z-index: -1;\n}\n.ds-dial-plan-node--voice-app.ds-dial-plan-node--selected::after { opacity: 1; }\n\n.ds-dial-plan-node--menu {\n background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);\n border-color: #ec4899;\n}\n.ds-dial-plan-node--menu .ds-dial-plan-node__icon { color: #ec4899; }\n.ds-dial-plan-node--menu.ds-dial-plan-node--selected {\n border-color: #ec4899;\n outline-color: #ec4899;\n box-shadow: 0 0 16px 2px rgba(236, 72, 153, 0.4), 0 4px 12px rgba(236, 72, 153, 0.2);\n}\n\n.ds-dial-plan-node--audio-clip {\n background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);\n border-color: #14b8a6;\n}\n.ds-dial-plan-node--audio-clip .ds-dial-plan-node__icon { color: #14b8a6; }\n.ds-dial-plan-node--audio-clip.ds-dial-plan-node--selected {\n border-color: #14b8a6;\n outline-color: #14b8a6;\n box-shadow: 0 0 16px 2px rgba(20, 184, 166, 0.4), 0 4px 12px rgba(20, 184, 166, 0.2);\n}\n\n/* ============================================================================\n Menu Config Panel — Options List\n ============================================================================ */\n\n.ds-dial-plan-config-field__header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 6px;\n}\n\n.ds-dial-plan-config-field__header .ds-dial-plan-config-field__label {\n margin: 0;\n}\n\n.ds-dial-plan-menu-options {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.ds-dial-plan-menu-options__card {\n display: flex;\n align-items: flex-end;\n gap: 6px;\n}\n\n.ds-dial-plan-menu-options__field {\n display: flex;\n flex-direction: column;\n gap: 4px;\n min-width: 0;\n}\n\n.ds-dial-plan-menu-options__field--digit {\n flex: 0 0 64px;\n}\n\n.ds-dial-plan-menu-options__field--label {\n flex: 1;\n}\n\n.ds-dial-plan-menu-options__field-label {\n font-size: 10px;\n font-weight: 600;\n letter-spacing: 0.05em;\n text-transform: uppercase;\n color: var(--ds-color-text-muted, #94a3b8);\n}\n\n.ds-dial-plan-menu-options__field-hint {\n font-weight: 400;\n text-transform: none;\n letter-spacing: 0;\n opacity: 0.8;\n}\n\n.ds-dial-plan-menu-options__remove {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border: none;\n background: none;\n color: var(--ds-color-text-muted, #94a3b8);\n cursor: pointer;\n border-radius: 4px;\n flex-shrink: 0;\n}\n\n.ds-dial-plan-menu-options__remove:hover {\n color: var(--ds-color-danger, #ef4444);\n background: rgba(239, 68, 68, 0.1);\n}\n\n.ds-dial-plan-menu-options__add {\n padding: 3px 10px;\n border: 1px solid var(--ds-color-primary, #6366f1);\n background: none;\n color: var(--ds-color-primary, #6366f1);\n cursor: pointer;\n border-radius: 4px;\n font-size: 11px;\n font-weight: 500;\n white-space: nowrap;\n}\n\n.ds-dial-plan-menu-options__add:hover:not(:disabled) {\n background: var(--ds-color-primary, #6366f1);\n color: #ffffff;\n}\n\n.ds-dial-plan-menu-options__add:disabled {\n opacity: 0.4;\n cursor: default;\n}\n\n/* ============================================================================\n Handles\n ============================================================================ */\n\n.ds-dial-plan-handle {\n width: 10px;\n height: 10px;\n background: var(--ds-color-border, #e2e8f0);\n border: 2px solid var(--ds-color-background, #ffffff);\n}\n\n.ds-dial-plan-handle--next {\n background: var(--ds-color-text-secondary, #64748b);\n}\n\n/* ============================================================================\n React Flow Overrides (both viewer and editor)\n ============================================================================ */\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge-path {\n stroke: var(--ds-color-border, #94a3b8);\n stroke-width: 2;\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge.selected .react-flow__edge-path {\n stroke: var(--ds-color-primary, #3b82f6);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge-text {\n font-size: var(--ds-font-size-xs, 12px);\n fill: var(--ds-color-text-secondary, #64748b);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__background {\n background-color: var(--ds-color-background, #ffffff);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__minimap {\n background: var(--ds-color-background, #ffffff);\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls {\n border-radius: var(--ds-border-radius, 8px);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls-button {\n background: var(--ds-color-background, #ffffff);\n border-color: var(--ds-color-border, #e2e8f0);\n color: var(--ds-color-text, #1e293b);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls-button:hover {\n background: var(--ds-color-background-hover, #f8fafc);\n}\n\n/* ============================================================================\n Loading, Error, and Empty States\n ============================================================================ */\n\n.ds-dial-plan-viewer--loading,\n.ds-dial-plan-viewer--error,\n.ds-dial-plan-viewer--empty {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.ds-dial-plan-viewer__loading,\n.ds-dial-plan-viewer__error,\n.ds-dial-plan-viewer__empty {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 12px;\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-dial-plan-viewer__spinner {\n width: 32px;\n height: 32px;\n border: 3px solid var(--ds-color-border, #e2e8f0);\n border-top-color: var(--ds-color-primary, #3b82f6);\n border-radius: 50%;\n animation: ds-dial-plan-spin 0.8s linear infinite;\n}\n\n@keyframes ds-dial-plan-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n.ds-dial-plan-viewer__error {\n color: var(--ds-color-danger, #ef4444);\n}\n\n.ds-dial-plan-viewer__error-message {\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-text-secondary, #64748b);\n max-width: 300px;\n text-align: center;\n}\n\n/* ============================================================================\n Config Panel\n ============================================================================ */\n\n.ds-dial-plan-config-panel {\n width: 260px;\n height: 100%;\n background: var(--ds-color-background, #ffffff);\n border-left: 1px solid var(--ds-color-border, #e2e8f0);\n display: flex;\n flex-direction: column;\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n overflow-y: auto;\n}\n\n.ds-dial-plan-config-panel__header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 16px;\n border-bottom: 1px solid var(--ds-color-border, #e2e8f0);\n}\n\n.ds-dial-plan-config-panel__header-icon {\n color: var(--ds-color-text-secondary, #64748b);\n display: flex;\n align-items: center;\n}\n\n.ds-dial-plan-config-panel__header-label {\n flex: 1;\n font-weight: 600;\n color: var(--ds-color-text, #1e293b);\n}\n\n.ds-dial-plan-config-panel__delete {\n color: var(--ds-color-danger, #ef4444);\n background: none;\n border: none;\n padding: 2px;\n cursor: pointer;\n display: flex;\n align-items: center;\n}\n\n.ds-dial-plan-config-panel__delete:hover {\n color: #dc2626;\n}\n\n.ds-dial-plan-config-panel__close {\n background: none;\n border: none;\n color: var(--ds-color-text-secondary, #64748b);\n cursor: pointer;\n padding: 2px;\n display: flex;\n align-items: center;\n}\n\n.ds-dial-plan-config-panel__close:hover {\n color: var(--ds-color-text, #1e293b);\n}\n\n.ds-dial-plan-config-panel__body {\n padding: 16px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n\n.ds-dial-plan-config-field {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n.ds-dial-plan-config-field__label {\n font-size: var(--ds-font-size-xs, 12px);\n font-weight: 500;\n color: var(--ds-color-text-secondary, #64748b);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n}\n\n.ds-dial-plan-config-field__select,\n.ds-dial-plan-config-field__input {\n width: 100%;\n padding: 6px 8px;\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n background: var(--ds-color-background, #ffffff);\n color: var(--ds-color-text, #1e293b);\n font-size: var(--ds-font-size-sm, 14px);\n font-family: inherit;\n outline: none;\n box-sizing: border-box;\n}\n\n.ds-dial-plan-config-field__checkbox {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text, #1e293b);\n cursor: pointer;\n}\n\n.ds-dial-plan-config-field__hint {\n margin: 4px 0 0;\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-text-secondary, #64748b);\n line-height: 1.4;\n}\n\n.ds-dial-plan-config-field__error {\n margin: 4px 0 0;\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-danger, #ef4444);\n line-height: 1.4;\n}\n\n.ds-dial-plan-config-field__input[aria-invalid=\'true\'] {\n border-color: var(--ds-color-danger, #ef4444);\n}\n\n.ds-dial-plan-edge-panel__value {\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text, #1e293b);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-edge-panel__value {\n color: #e2e8f0;\n}\n\n.ds-dial-plan-config-field__open-link {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n background: none;\n border: none;\n padding: 0;\n margin-top: 4px;\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-primary, #3b82f6);\n cursor: pointer;\n font-family: inherit;\n}\n\n.ds-dial-plan-config-field__open-link:hover {\n text-decoration: underline;\n}\n\n.ds-dial-plan-config-field__select:focus,\n.ds-dial-plan-config-field__input:focus {\n border-color: var(--ds-color-primary, #3b82f6);\n box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);\n}\n\n.ds-dial-plan-config-field__input:disabled {\n background: #f1f5f9;\n color: var(--ds-color-text-secondary, #64748b);\n cursor: not-allowed;\n opacity: 0.7;\n}\n\n.ds-dial-plan-config-field__input-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n}\n\n.ds-dial-plan-config-field__input-wrapper .ds-dial-plan-config-field__input {\n padding-right: 28px;\n}\n\n.ds-dial-plan-config-field__clear {\n position: absolute;\n right: 6px;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n padding: 0;\n border: none;\n border-radius: 50%;\n background: transparent;\n color: var(--ds-color-text-secondary, #64748b);\n cursor: pointer;\n}\n\n.ds-dial-plan-config-field__clear:hover {\n background: var(--ds-color-border, #e2e8f0);\n color: var(--ds-color-text, #1e293b);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__clear:hover {\n background: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n.ds-dial-plan-config-field__segmented {\n display: flex;\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n overflow: hidden;\n background: var(--ds-color-background, #ffffff);\n}\n\n.ds-dial-plan-config-field__segmented-option {\n flex: 1;\n padding: 6px 8px;\n border: none;\n background: transparent;\n color: var(--ds-color-text-secondary, #64748b);\n font-size: var(--ds-font-size-sm, 14px);\n font-family: inherit;\n cursor: pointer;\n}\n\n.ds-dial-plan-config-field__segmented-option + .ds-dial-plan-config-field__segmented-option {\n border-left: 1px solid var(--ds-color-border, #e2e8f0);\n}\n\n.ds-dial-plan-config-field__segmented-option--active {\n background: var(--ds-color-primary, #3b82f6);\n color: #ffffff;\n font-weight: 500;\n}\n\n.ds-dial-plan-config-field__hint {\n margin: 4px 0 0;\n font-size: var(--ds-font-size-xs, 11px);\n line-height: 1.4;\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-dial-plan-node__badge {\n display: block;\n width: fit-content;\n margin: 4px auto 0;\n padding: 2px 8px;\n border-radius: 999px;\n background: var(--ds-color-muted, #eef2ff);\n color: var(--ds-color-text-secondary, #64748b);\n font-size: var(--ds-font-size-xs, 11px);\n font-weight: 500;\n letter-spacing: 0.3px;\n text-align: center;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__badge {\n background: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n/* ============================================================================\n Resource Combobox\n ============================================================================ */\n\n.ds-resource-combobox {\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n background: var(--ds-color-background, #ffffff);\n overflow: hidden;\n}\n\n.ds-resource-combobox__trigger {\n width: 100%;\n padding: 6px 8px;\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n background: var(--ds-color-background, #ffffff);\n color: var(--ds-color-text, #1e293b);\n font-size: var(--ds-font-size-sm, 14px);\n font-family: inherit;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n text-align: left;\n}\n\n.ds-resource-combobox__trigger:hover {\n border-color: var(--ds-color-primary, #3b82f6);\n}\n\n.ds-resource-combobox__trigger-placeholder {\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-resource-combobox__trigger-chevron {\n color: var(--ds-color-text-secondary, #64748b);\n opacity: 0.5;\n flex-shrink: 0;\n}\n\n.ds-resource-combobox__input {\n width: 100%;\n padding: 8px 10px;\n border: none;\n border-bottom: 1px solid var(--ds-color-border, #e2e8f0);\n background: transparent;\n color: var(--ds-color-text, #1e293b);\n font-size: var(--ds-font-size-sm, 14px);\n font-family: inherit;\n outline: none;\n box-sizing: border-box;\n}\n\n.ds-resource-combobox__input::placeholder {\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-resource-combobox__list {\n max-height: 400px;\n overflow-y: auto;\n padding: 4px 0;\n}\n\n.ds-resource-combobox__group [cmdk-group-heading] {\n padding: 6px 10px 2px;\n font-size: var(--ds-font-size-xs, 12px);\n font-weight: 500;\n color: var(--ds-color-text-secondary, #64748b);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n}\n\n.ds-resource-combobox__item {\n padding: 6px 10px;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text, #1e293b);\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n border-radius: 0;\n}\n\n.ds-resource-combobox__item[data-selected="true"] {\n background: var(--ds-color-primary, #3b82f6);\n color: #ffffff;\n}\n\n.ds-resource-combobox__item--selected {\n font-weight: 500;\n}\n\n.ds-resource-combobox__name {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.ds-resource-combobox__ext {\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-text-secondary, #64748b);\n margin-left: auto;\n padding-left: 8px;\n white-space: nowrap;\n flex-shrink: 0;\n}\n\n.ds-resource-combobox__check {\n font-size: 12px;\n opacity: 0.7;\n width: 16px;\n text-align: center;\n flex-shrink: 0;\n}\n\n.ds-resource-combobox__create {\n padding: 6px 10px;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-primary, #3b82f6);\n cursor: pointer;\n font-style: italic;\n}\n\n.ds-resource-combobox__create[data-selected="true"] {\n background: var(--ds-color-primary, #3b82f6);\n color: #ffffff;\n}\n\n.ds-resource-combobox__empty {\n padding: 12px 10px;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text-secondary, #64748b);\n text-align: center;\n}\n\n/* ============================================================================\n Dark Mode\n Activated by .dark class on an ancestor (Tailwind / next-themes convention)\n or data-theme="dark" attribute.\n ============================================================================ */\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-viewer,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor {\n background: #1a1a2e;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node {\n background: #1e1e32;\n border-color: rgba(255, 255, 255, 0.1);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__label,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__name {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__icon,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__type-label,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__type,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__exit-label {\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__exits {\n border-top-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--themed {\n background: color-mix(in srgb, var(--node-color) 20%, #1a1a2e);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--schedule {\n background: linear-gradient(135deg, #0c2d48 0%, #0a3761 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--internal-dial {\n background: linear-gradient(135deg, #052e16 0%, #064e3b 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--voicemail {\n background: linear-gradient(135deg, #2e1065 0%, #3b0764 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--ring-all-users {\n background: linear-gradient(135deg, #451a03 0%, #78350f 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--external-dial {\n background: linear-gradient(135deg, #4c0519 0%, #881337 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--voice-app {\n background:\n linear-gradient(135deg, #252262 0%, #3b1d7e 40%, #0c3a5e 100%) padding-box,\n linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box;\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--menu {\n background: linear-gradient(135deg, #500724 0%, #831843 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--audio-clip {\n background: linear-gradient(135deg, #042f2e 0%, #115e59 100%);\n}\n\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-handle {\n border-color: #1e1e32;\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__background {\n background-color: #1a1a2e;\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge-path {\n stroke: rgba(255, 255, 255, 0.2);\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge-text {\n fill: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__minimap {\n background: #1e1e32;\n border-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls {\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls-button {\n background: #1e1e32;\n border-color: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls-button:hover {\n background: #2a2a45;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-viewer__loading,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-viewer__empty {\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-viewer__spinner {\n border-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel {\n background: #1e1e32;\n border-left-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel__header {\n border-bottom-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel__header-label {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel__close {\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel__close:hover {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__label {\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__checkbox {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__select,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__input {\n background: #12122a;\n border-color: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__input:disabled {\n background: #1e1e38;\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox__trigger {\n background: #12122a;\n border-color: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox {\n border-color: rgba(255, 255, 255, 0.1);\n background: #12122a;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox__input {\n color: #e2e8f0;\n border-bottom-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox__item {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox__item--selected {\n color: #e2e8f0;\n}\n\n/* Node Library */\n\n.ds-dial-plan-node-library {\n width: 200px;\n height: 100%;\n background: var(--ds-color-background, #ffffff);\n border-right: 1px solid var(--ds-color-border, #e2e8f0);\n display: flex;\n flex-direction: column;\n gap: 10px;\n padding: 12px;\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n overflow-y: auto;\n}\n\n.ds-dial-plan-node-library__item {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n padding: 10px 12px;\n border-radius: var(--ds-border-radius, 8px);\n border: 2px solid var(--node-color, var(--ds-color-border, #e2e8f0));\n background: color-mix(in srgb, var(--node-color, #ffffff) 10%, white);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n cursor: grab;\n transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;\n}\n\n.ds-dial-plan-node-library__item:hover {\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);\n transform: translateY(-1px);\n}\n\n.ds-dial-plan-node-library__item:active {\n cursor: grabbing;\n transform: scale(0.97);\n}\n\n/* Per-type library item colors */\n.ds-dial-plan-node-library__item--schedule { background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%); border-color: var(--ds-color-info, #0ea5e9); }\n.ds-dial-plan-node-library__item--internal_dial { background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%); border-color: var(--ds-color-success, #22c55e); }\n.ds-dial-plan-node-library__item--voicemail { background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%); border-color: var(--ds-color-purple, #a855f7); }\n.ds-dial-plan-node-library__item--ring_all_users { background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%); border-color: var(--ds-color-warning, #f59e0b); }\n.ds-dial-plan-node-library__item--external_dial { background: linear-gradient(135deg, #fff1f2 0%, #fecdd3 100%); border-color: var(--ds-color-rose, #f43f5e); }\n.ds-dial-plan-node-library__item--voice_app,\n.ds-dial-plan-node-library__item--voice_app:hover {\n border: 2px solid transparent;\n background: linear-gradient(135deg, #c7d2fe 0%, #ddd6fe 40%, #bae6fd 100%) padding-box, linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box;\n}\n.ds-dial-plan-node-library__item--menu { background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%); border-color: #ec4899; }\n.ds-dial-plan-node-library__item--audio_clip { background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%); border-color: #14b8a6; }\n\n.ds-dial-plan-node-library__item-icon {\n display: flex;\n align-items: center;\n color: var(--node-color);\n}\n.ds-dial-plan-node-library__item--schedule .ds-dial-plan-node-library__item-icon { color: var(--ds-color-info, #0ea5e9); }\n.ds-dial-plan-node-library__item--internal_dial .ds-dial-plan-node-library__item-icon { color: var(--ds-color-success, #22c55e); }\n.ds-dial-plan-node-library__item--voicemail .ds-dial-plan-node-library__item-icon { color: var(--ds-color-purple, #a855f7); }\n.ds-dial-plan-node-library__item--ring_all_users .ds-dial-plan-node-library__item-icon { color: var(--ds-color-warning, #f59e0b); }\n.ds-dial-plan-node-library__item--external_dial .ds-dial-plan-node-library__item-icon { color: var(--ds-color-rose, #f43f5e); }\n.ds-dial-plan-node-library__item--voice_app .ds-dial-plan-node-library__item-icon { color: #4f46e5; }\n.ds-dial-plan-node-library__item--menu .ds-dial-plan-node-library__item-icon { color: #ec4899; }\n.ds-dial-plan-node-library__item--audio_clip .ds-dial-plan-node-library__item-icon { color: #14b8a6; }\n\n.ds-dial-plan-node-library__item-label {\n font-size: var(--ds-font-size-xs, 12px);\n font-weight: 600;\n color: var(--ds-color-text, #1e293b);\n text-align: center;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library {\n background: #1e1e32;\n border-right-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item {\n background: color-mix(in srgb, var(--node-color, #1e1e32) 20%, #1e1e32);\n border-color: rgba(255, 255, 255, 0.1);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--schedule { background: linear-gradient(135deg, #0c2d48 0%, #0a3761 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--internal_dial { background: linear-gradient(135deg, #052e16 0%, #064e3b 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--voicemail { background: linear-gradient(135deg, #2e1065 0%, #3b0764 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--ring_all_users { background: linear-gradient(135deg, #451a03 0%, #78350f 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--external_dial { background: linear-gradient(135deg, #4c0519 0%, #881337 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--voice_app { background: linear-gradient(135deg, #252262 0%, #3b1d7e 40%, #0c3a5e 100%) padding-box, linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box; }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--menu { background: linear-gradient(135deg, #500724 0%, #831843 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--audio_clip { background: linear-gradient(135deg, #042f2e 0%, #115e59 100%); }\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item-label {\n color: #e2e8f0;\n}\n\n/* ============================================================================\n Editor Toolbar\n ============================================================================ */\n\n.ds-dial-plan-editor-toolbar {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: 10;\n display: flex;\n gap: 8px;\n}\n\n.ds-dial-plan-editor-toolbar__button {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 8px 12px;\n background: var(--ds-color-background, #ffffff);\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n color: var(--ds-color-text, #1e293b);\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n font-weight: 500;\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n.ds-dial-plan-editor-toolbar__button:hover {\n background: var(--ds-color-background-hover, #f1f5f9);\n border-color: var(--ds-color-border, #cbd5e1);\n}\n\n.ds-dial-plan-editor-toolbar__button:active {\n transform: scale(0.98);\n}\n\n.ds-dial-plan-editor-toolbar__button:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n}\n\n.ds-dial-plan-editor-toolbar__button:disabled:hover {\n background: var(--ds-color-background, #ffffff);\n border-color: var(--ds-color-border, #e2e8f0);\n}\n\n.ds-dial-plan-editor-toolbar__button svg {\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor-toolbar__button {\n background: #1e293b;\n border-color: #334155;\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor-toolbar__button:hover {\n background: #334155;\n border-color: #475569;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor-toolbar__button:disabled:hover {\n background: #1e293b;\n border-color: #334155;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor-toolbar__button svg {\n color: #cbd5e1;\n}\n\n/* Editor Layout */\n\n.ds-dial-plan-editor {\n display: flex;\n width: 100%;\n height: 100%;\n flex: 1;\n min-height: 400px;\n background: var(--ds-color-background, #ffffff);\n overflow: hidden;\n}\n\n.ds-dial-plan-editor--preview {\n min-height: 0;\n}\n\n.ds-dial-plan-editor__canvas {\n flex: 1;\n position: relative;\n}\n\n/* Node Library wrapper */\n\n.ds-dial-plan-node-library-wrapper {\n width: 200px;\n flex-shrink: 0;\n align-self: stretch;\n overflow: hidden;\n}\n\n/* Config panel wrapper (slide-in animation) */\n\n.ds-dial-plan-config-panel-wrapper {\n width: 0;\n flex-shrink: 0;\n align-self: stretch;\n overflow: hidden;\n transition: width 0.2s ease;\n}\n\n.ds-dial-plan-config-panel-wrapper--open {\n width: 260px;\n}\n\n\n'],qe=e.forwardRef((a,t)=>{var l;const{dialstack:r}=N();C("dial-plan");const i=function(e){const[a,t]=n(()=>e.getAppearance());return o(()=>{if("undefined"==typeof document)return;const n=document.createElement("div"),o=e=>{const n=e.detail;t(null==n?void 0:n.appearance)};return n.addEventListener("dialstack-appearance-update",o),e.addAppearanceTarget(n),()=>{e.removeAppearanceTarget(n),n.removeEventListener("dialstack-appearance-update",o)}},[e]),a}(r),d="dark"===(null==i?void 0:i.theme)?"dark":"light",s=null!==(l=a.theme)&&void 0!==l?l:d;return e.createElement(Fe,{stylesheets:Ue,className:a.className,style:Object.assign({width:"100%",height:"100%",flex:1,minHeight:0},a.style)},e.createElement("div",{"data-theme":s,style:{display:"flex",flexDirection:"column",flex:1,minHeight:0}},e.createElement(g,null,e.createElement(We,Object.assign({ref:t},a)))))});qe.displayName="DialPlan";export{qe as DialPlan};
1
+ import e,{useState as n,useEffect as o,memo as a,useRef as t,useMemo as l,useCallback as r,useId as i,useImperativeHandle as d}from"react";import{Handle as s,Position as c,getStraightPath as u,getSmoothStepPath as p,BaseEdge as f,ReactFlowProvider as g,useReactFlow as b,useUpdateNodeInternals as m,useNodesState as v,useEdgesState as h,applyNodeChanges as _,MarkerType as x,ReactFlow as y,ConnectionLineType as w,Background as k,Controls as E}from"@xyflow/react";import{useDialstackComponents as N,useReportComponent as C}from"@dialstack/sdk-react";import L from"dagre";import{Command as O}from"cmdk";import{parsePhoneNumberFromString as z,AsYouType as S}from"libphonenumber-js";import{createPortal as R}from"react-dom";function j(e,n,o,a){return new(o||(o=Promise))(function(t,l){function r(e){try{d(a.next(e))}catch(e){l(e)}}function i(e){try{d(a.throw(e))}catch(e){l(e)}}function d(e){var n;e.done?t(e.value):(n=e.value,n instanceof o?n:new o(function(e){e(n)})).then(r,i)}d((a=a.apply(e,n||[])).next())})}"function"==typeof SuppressedError&&SuppressedError;const T="smoothstep";function A(e,n){var o,a;return null!==(a=null===(o=e.visibleExits)||void 0===o?void 0:o.call(e,n))&&void 0!==a?a:e.exits}const I=({icon:n,label:o,timeout:a,subtitle:t})=>e.createElement("div",{className:"ds-dial-plan-node__header"},e.createElement("div",{className:"ds-dial-plan-node__icon"},n),e.createElement("span",{className:"ds-dial-plan-node__type-label"},o,void 0!==a&&e.createElement("span",{style:{textTransform:"none"}}," (",a,"s)")),t&&e.createElement("span",{className:"ds-dial-plan-node__name"},t)),F=({id:n,label:o})=>e.createElement("div",{className:"ds-dial-plan-node__exit-row"},e.createElement("span",{className:"ds-dial-plan-node__exit-label"},o),e.createElement(s,{type:"source",position:c.Right,id:n,className:"ds-dial-plan-handle ds-dial-plan-handle--next"})),D=({exits:n,locale:o})=>0===n.length?null:e.createElement(e.Fragment,null,n.map(n=>e.createElement(F,{key:n.id,id:n.id,label:n.localeExitKey&&(null==o?void 0:o.exits[n.localeExitKey])||n.label})));function P(e,n){const o=e,a=(null==o?void 0:o[n])||(null==o?void 0:o[`${n}_id`]);return"string"==typeof a?a:""}function M(e,n){return{[e]:n,[`${e}_id`]:n}}function $(e,n){return e.startsWith("user_")?n.targetTypes.user:e.startsWith("rg_")?n.targetTypes.ringGroup:e.startsWith("dp_")?n.targetTypes.dialPlan:e.startsWith("qu_")?n.targetTypes.queue:e.startsWith("va_")?n.targetTypes.voiceApp:e.startsWith("svm_")?n.targetTypes.sharedVoicemail:n.nodeTypes.internalDial}function H(e){var n;return null!==(n=null==e?void 0:e.startsWith("dp_"))&&void 0!==n&&n}function K(e,n,o){const a=n.users.get(e),t=(null==a?void 0:a.name)||(null==a?void 0:a.email);return t&&(null==a?void 0:a.extension_number)?`${t} (${o.combobox.extensionLabel} ${a.extension_number})`:t}const B=({resourceId:n,onOpenResource:o,label:a})=>e.createElement("button",{type:"button",className:"ds-dial-plan-config-field__open-link",onClick:()=>o(n)},e.createElement("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polyline",{points:"15 3 21 3 21 9"}),e.createElement("polyline",{points:"9 21 3 21 3 15"}),e.createElement("line",{x1:"21",y1:"3",x2:"14",y2:"10"}),e.createElement("line",{x1:"3",y1:"21",x2:"10",y2:"14"})),a),V=({groups:a,value:r,loading:i=!1,placeholder:d="Search…",onSelect:s,onCreateResource:c,selectLabel:u="— Select —",noResultsLabel:p="No results found",loadingLabel:f="Loading…",createNewPrefix:g="+ Create new…",extensionLabel:b="Ext."})=>{const[m,v]=n(!1),[h,_]=n(""),x=t(null);o(()=>{var e;if(!m)return;const n=null===(e=x.current)||void 0===e?void 0:e.getRootNode(),o=n instanceof ShadowRoot||n instanceof Document?n:document,a=e=>function(e){"Escape"===e.key&&(v(!1),_(""))}(e),t=e=>function(e){x.current&&!x.current.contains(e.target)&&(v(!1),_(""))}(e);return o.addEventListener("keydown",a),o.addEventListener("mousedown",t),()=>{o.removeEventListener("keydown",a),o.removeEventListener("mousedown",t)}},[m]);const y=l(()=>{if(!r)return"";for(const e of a){const n=e.items.find(e=>e.id===r);if(n)return n.extension_number?`${n.name} (${b} ${n.extension_number})`:n.name}return""},[r,a,b]);if(!m)return e.createElement("button",{type:"button",className:"ds-resource-combobox__trigger",onClick:()=>v(!0)},e.createElement("span",{className:y?"":"ds-resource-combobox__trigger-placeholder"},y||u),e.createElement("svg",{className:"ds-resource-combobox__trigger-chevron",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polyline",{points:"6 9 12 15 18 9"})));const w=a.some(e=>e.items.length>0);return e.createElement("div",{ref:x},e.createElement(O,{className:"ds-resource-combobox",shouldFilter:!0,loop:!0},e.createElement(O.Input,{className:"ds-resource-combobox__input",placeholder:d,value:h,onValueChange:_,autoFocus:!0}),e.createElement(O.List,{className:"ds-resource-combobox__list"},e.createElement(O.Empty,{className:"ds-resource-combobox__empty"},p),a.map(n=>e.createElement(O.Group,{key:n.label,heading:n.label,className:"ds-resource-combobox__group"},n.items.map(o=>{var a;return e.createElement(O.Item,{key:o.id,value:`${o.name} ${null!==(a=o.extension_number)&&void 0!==a?a:""} ${n.label} ${o.id}`,className:"ds-resource-combobox__item"+(o.id===r?" ds-resource-combobox__item--selected":""),onSelect:()=>{return e=o.id,n=o.extension_number?`${o.name} (${b} ${o.extension_number})`:o.name,s(e,n),v(!1),void _("");var e,n}},e.createElement("span",{className:"ds-resource-combobox__name"},o.name),o.extension_number&&e.createElement("span",{className:"ds-resource-combobox__ext"},"(",b," ",o.extension_number,")"),e.createElement("span",{className:"ds-resource-combobox__check"},o.id===r?"✓":""))}),c&&n.type&&e.createElement(O.Item,{forceMount:!0,value:`create new ${n.label}`,className:"ds-resource-combobox__create",onSelect:()=>function(e){return j(this,void 0,void 0,function*(){if(!c)return;const n=yield c(e);n&&(s(n.id,n.extension_number?`${n.name} (${b} ${n.extension_number})`:n.name),v(!1),_(""))})}(n.type)},g))),!w&&!h&&i&&e.createElement("div",{className:"ds-resource-combobox__empty"},f))))},W=({label:n,htmlFor:o,action:a,children:t})=>e.createElement("div",{className:"ds-dial-plan-config-field"},a?e.createElement("div",{className:"ds-dial-plan-config-field__header"},e.createElement("label",{className:"ds-dial-plan-config-field__label",htmlFor:o},n),a):e.createElement("label",{className:"ds-dial-plan-config-field__label",htmlFor:o},n),t);function U(e,a,t,i){const[d,s]=n([]),[c,u]=n(!0),p=l(()=>JSON.stringify(e),[e]),f=r(()=>Promise.all(e.map(e=>a(e.type,e.options))).then(n=>{s(e.map((e,o)=>{var a,t;return{label:null!==(a=null==i?void 0:i.resourceGroups[e.labelKey])&&void 0!==a?a:e.fallback,type:e.type,items:null!==(t=n[o])&&void 0!==t?t:[]}}))}).catch(()=>{}).finally(()=>u(!1)),[a,i,p]);o(()=>{f()},[f]);const g=r(n=>j(this,void 0,void 0,function*(){var o;if(!t)return;const a=null===(o=e.find(e=>e.type===n))||void 0===o?void 0:o.options,l=yield t(n,a);return l&&(yield f()),l}),[t,f,p]);return{groups:d,loading:c,handleCreateResource:t?g:void 0}}const q=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("circle",{cx:"12",cy:"12",r:"10"}),e.createElement("polyline",{points:"12 6 12 12 16 14"})),G=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})),Y=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"}),e.createElement("circle",{cx:"9",cy:"7",r:"4"}),e.createElement("path",{d:"M23 21v-2a4 4 0 0 0-3-3.87"}),e.createElement("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})),X=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polyline",{points:"23 7 23 1 17 1"}),e.createElement("line",{x1:"16",y1:"8",x2:"23",y2:"1"}),e.createElement("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92z"})),Z=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("circle",{cx:"5.5",cy:"11.5",r:"4.5"}),e.createElement("circle",{cx:"18.5",cy:"11.5",r:"4.5"}),e.createElement("line",{x1:"5.5",y1:"16",x2:"18.5",y2:"16"})),Q=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M12 8V4H8"}),e.createElement("rect",{width:"16",height:"12",x:"4",y:"8",rx:"2"}),e.createElement("path",{d:"M2 14h2"}),e.createElement("path",{d:"M20 14h2"}),e.createElement("path",{d:"M15 13v2"}),e.createElement("path",{d:"M9 13v2"})),J=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("rect",{x:"3",y:"3",width:"7",height:"7"}),e.createElement("rect",{x:"14",y:"3",width:"7",height:"7"}),e.createElement("rect",{x:"3",y:"14",width:"7",height:"7"}),e.createElement("rect",{x:"14",y:"14",width:"7",height:"7"})),ee=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M10.68 13.31a16 16 0 0 0 3.41 2.6l1.27-1.27a2 2 0 0 1 2.11-.45 12.84 12.84 0 0 0 2.81.7A2 2 0 0 1 22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.42 19.42 0 0 1-3.33-2.67m-2.67-3.34a19.79 19.79 0 0 1-3.07-8.63A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72 12.84 12.84 0 0 0 .7 2.81 2 2 0 0 1-.45 2.11L8.09 9.91"}),e.createElement("line",{x1:"23",y1:"1",x2:"1",y2:"23"})),ne=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polygon",{points:"11 5 6 9 2 9 2 15 6 15 11 19 11 5"}),e.createElement("path",{d:"M15.54 8.46a5 5 0 0 1 0 7.07"}),e.createElement("path",{d:"M19.07 4.93a10 10 0 0 1 0 14.14"})),oe={type:"schedule",flowType:"schedule",localeKey:"schedule",label:"Schedule",description:"Route calls by schedule",color:"#0ea5e9",exits:[{id:"open",label:"Open",configKey:"open",localeExitKey:"open"},{id:"closed",label:"Closed",configKey:"closed",localeExitKey:"closed"},{id:"holiday",label:"Holiday",configKey:"holiday",localeExitKey:"holiday"}],configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,onOpenResource:l,locale:r})=>{var i,d,s,c,u;const{groups:p,loading:f,handleCreateResource:g}=U([{type:"schedule",labelKey:"schedules",fallback:"Schedules"}],a,t,r),b=P(n,"schedule"),m=void 0!==n.holiday;return e.createElement(e.Fragment,null,e.createElement(W,{label:null!==(i=null==r?void 0:r.configLabels.schedule)&&void 0!==i?i:"Schedule"},e.createElement(V,{groups:p,value:b,loading:f,placeholder:null!==(d=null==r?void 0:r.configLabels.searchSchedules)&&void 0!==d?d:"Search schedules…",onSelect:(e,n)=>o(M("schedule",e),{scheduleName:n}),onCreateResource:g,selectLabel:null==r?void 0:r.combobox.select,noResultsLabel:null==r?void 0:r.combobox.noResults,loadingLabel:null==r?void 0:r.combobox.loading,createNewPrefix:null==r?void 0:r.combobox.createNew,extensionLabel:null==r?void 0:r.combobox.extensionLabel}),b&&l&&e.createElement(B,{resourceId:b,onOpenResource:l,label:null!==(s=null==r?void 0:r.configLabels.openInNewTab)&&void 0!==s?s:"Open target details"})),e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("label",{className:"ds-dial-plan-config-field__checkbox"},e.createElement("input",{type:"checkbox",checked:m,onChange:e=>{return n=e.target.checked,o({holiday:n?null:void 0},{holidayEnabled:n});var n}}),e.createElement("span",null,null!==(c=null==r?void 0:r.configLabels.routeHolidaySeparately)&&void 0!==c?c:"Route holidays separately")),e.createElement("p",{className:"ds-dial-plan-config-field__hint"},null!==(u=null==r?void 0:r.configLabels.routeHolidaySeparatelyHint)&&void 0!==u?u:"When on, holidays route to a dedicated branch you wire below. Otherwise holidays follow the Closed exit.")))},defaultConfig:{schedule:"",schedule_id:""},icon:q,renderNode:(n,o)=>{const a=n.locale,t=o.exits.slice(0,n.holidayEnabled?3:2);return e.createElement(e.Fragment,null,e.createElement(I,{icon:o.icon,label:n.label,subtitle:n.scheduleName}),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(D,{exits:t,locale:a})))},toFlowNode:e=>{const n=e;return{label:"Schedule",scheduleId:P(n.config,"schedule"),holidayEnabled:void 0!==n.config.holiday,originalNode:n}},collectResourceIds:(e,n)=>{const o=P(e,"schedule");o&&n.addSchedule(o)},enrichNode:(e,n,o)=>{const a=n.schedules.get(e.scheduleId);return Object.assign(Object.assign({},e),{scheduleName:null==a?void 0:a.name,locale:o})},onConfigChange:(e,n,o)=>{"holiday"in n&&void 0===n.holiday&&(o.setEdges(n=>{const a=n.filter(n=>!(n.source===e&&"holiday"===n.sourceHandle));return a.length!==n.length&&o.updateDirty(o.nodesRef.current,a),a}),requestAnimationFrame(()=>o.updateNodeInternals(e)))},serializeConfig:(e,n,o)=>{var a;return(null===(a=e.data)||void 0===a?void 0:a.holidayEnabled)&&void 0===o.holiday?Object.assign(Object.assign({},o),{holiday:null}):o}},ae=({value:n,min:o,max:a,disabled:t=!1,onChange:l,locale:r})=>{var i;return e.createElement(W,{label:null!==(i=null==r?void 0:r.configLabels.timeout)&&void 0!==i?i:"Timeout (seconds)"},e.createElement("input",{className:"ds-dial-plan-config-field__input",type:"number",min:o,max:a,value:n,disabled:t,onChange:e=>l(Math.min(a,Math.max(o,Number(e.target.value)||o)))}))},te={type:"ring_all_users",flowType:"ringAllUsers",localeKey:"ringAllUsers",label:"Ring All",description:"Ring all account users",color:"#f59e0b",exits:[{id:"next",label:"Timeout",configKey:"next",localeExitKey:"timeout"}],configPanel:({config:n,onConfigChange:o,locale:a})=>{var t;const l=null!==(t=n.timeout)&&void 0!==t?t:24;return e.createElement(ae,{value:l,min:1,max:300,onChange:e=>o({timeout:e}),locale:a})},defaultConfig:{timeout:24},icon:Y,renderNode:(n,o)=>e.createElement(e.Fragment,null,e.createElement(I,{icon:o.icon,label:n.label,timeout:n.timeout}),o.exits.length>0&&e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(D,{exits:o.exits,locale:n.locale}))),toFlowNode:e=>{const n=e;return{label:"Ring All",timeout:n.config.timeout,originalNode:n}}};function le({label:n,value:o,options:a,onChange:t,hint:l}){return e.createElement(W,{label:n},e.createElement("div",{className:"ds-dial-plan-config-field__segmented",role:"radiogroup","aria-label":n},a.map(n=>{const a=n.value===o;return e.createElement("button",{key:n.value,type:"button",role:"radio","aria-checked":a,className:"ds-dial-plan-config-field__segmented-option"+(a?" ds-dial-plan-config-field__segmented-option--active":""),onClick:()=>{a||t(n.value)}},n.label)})),l&&e.createElement("p",{className:"ds-dial-plan-config-field__hint"},l))}const re={type:"internal_dial",flowType:"internalDial",localeKey:"internalDial",label:"Internal Extension",description:"Ring a user, group, or plan",color:"#22c55e",exits:[{id:"next",label:"Timeout",configKey:"next",localeExitKey:"timeout"}],configPanel:({nodeId:n,config:o,nodeData:a,onConfigChange:l,listResources:r,onCreateResource:i,onOpenResource:d,locale:s})=>{var c,u,p,f,g,b,m,v;const{groups:h,loading:_,handleCreateResource:x}=U([{type:"user",labelKey:"users",fallback:"Users"},{type:"ring_group",labelKey:"ringGroups",fallback:"Ring Groups"},{type:"queue",labelKey:"queues",fallback:"Queues"},{type:"dial_plan",labelKey:"dialPlans",fallback:"Dial Plans"}],r,i,s),y=P(o,"target"),w=null!==(c=o.timeout)&&void 0!==c?c:30,k=null!==(u=o.timeout_override)&&void 0!==u&&u,E=k?1:0,N=!0===(null==a?void 0:a.timeoutInert),C=t(null);return e.createElement(e.Fragment,null,e.createElement(W,{label:null!==(p=null==s?void 0:s.configLabels.target)&&void 0!==p?p:"Target"},e.createElement(V,{groups:h,value:y,loading:_,placeholder:null!==(f=null==s?void 0:s.configLabels.searchTargets)&&void 0!==f?f:"Search targets…",onSelect:(e,n)=>l(M("target",e),{targetName:n}),onCreateResource:x,selectLabel:null==s?void 0:s.combobox.select,noResultsLabel:null==s?void 0:s.combobox.noResults,loadingLabel:null==s?void 0:s.combobox.loading,createNewPrefix:null==s?void 0:s.combobox.createNew,extensionLabel:null==s?void 0:s.combobox.extensionLabel}),y&&d&&e.createElement(B,{resourceId:y,onOpenResource:d,label:null!==(g=null==s?void 0:s.configLabels.openInNewTab)&&void 0!==g?g:"Open target details"})),!H(y)&&e.createElement(e.Fragment,null,e.createElement(le,{label:null!==(b=null==s?void 0:s.configLabels.timeoutOverride)&&void 0!==b?b:"Override resource timeout",value:k?"on":"off",options:[{value:"off",label:null!==(m=null==s?void 0:s.configLabels.timeoutOverrideOff)&&void 0!==m?m:"Off"},{value:"on",label:null!==(v=null==s?void 0:s.configLabels.timeoutOverrideOn)&&void 0!==v?v:"On"}],onChange:e=>{if("on"===e)return C.current=0===w?{nodeId:n,timeout:0}:null,void l(0===w?{timeout_override:!0,timeout:1}:{timeout_override:!0});const o=C.current,a=o&&o.nodeId===n?o.timeout:void 0;C.current=null,l(void 0===a?{timeout_override:!1}:{timeout_override:!1,timeout:a})}}),e.createElement(ae,{value:w,min:E,max:300,disabled:N,onChange:e=>{C.current=null,l({timeout:e})},locale:s})))},defaultConfig:{target:"",target_id:"",timeout:30,timeout_override:!0},icon:G,renderNode:(n,o)=>{const a=H(n.targetId);return e.createElement(e.Fragment,null,e.createElement(I,{icon:o.icon,label:n.label,timeout:a||n.timeoutInert?void 0:n.timeout,subtitle:n.targetName}),!a&&e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(D,{exits:o.exits,locale:n.locale})))},toFlowNode:e=>{var n;const o=e;return{label:"Internal Extension",targetId:P(o.config,"target"),timeout:o.config.timeout,timeoutOverride:null!==(n=o.config.timeout_override)&&void 0!==n&&n,originalNode:o}},visibleExits:e=>H(P(e,"target"))?[]:re.exits,collectResourceIds:(e,n)=>{const o=P(e,"target");o&&n.addTarget(o)},enrichNode:(e,n,o)=>{const a=e.targetId,t=K(a,n,o),l=$(a,o),r=e.timeout,i=!e.timeoutOverride&&0!==r&&function(e,n){var o;return void 0!==(null===(o=n.users.get(e))||void 0===o?void 0:o.timeout_seconds)}(a,n),d=e.timeoutOverride?function(e,n,o){var a;if(0===n)return 0;const t=null===(a=o.users.get(e))||void 0===a?void 0:a.timeout_seconds;return void 0===n?t:e.startsWith("user_")&&void 0!==t?Math.min(n,t):n}(a,r,n):r;return Object.assign(Object.assign({},e),{targetName:t,targetType:l,timeout:d,timeoutInert:i,locale:o})}};function ie(e){if(!e)return"";const n=z(e);if(!n)return e;return"US"===n.country||"1"===n.countryCallingCode?n.formatNational():n.formatInternational()}const de=e=>e.startsWith("+")?"+"+e.slice(1).replace(/\D/g,""):e.replace(/\D/g,""),se=({value:n,listResources:o,onSelect:a,locale:t})=>{var l,r;const{groups:i,loading:d}=U([{type:"phone_number",labelKey:"phoneNumbers",fallback:"Phone Numbers"}],o,void 0,t);return e.createElement(W,{label:null!==(l=null==t?void 0:t.configLabels.callerIdNumber)&&void 0!==l?l:"Number to show"},e.createElement(V,{groups:i,value:n,loading:d,placeholder:null!==(r=null==t?void 0:t.configLabels.searchPhoneNumbers)&&void 0!==r?r:"Search phone numbers...",onSelect:e=>a(e),selectLabel:null==t?void 0:t.combobox.select,noResultsLabel:null==t?void 0:t.combobox.noResults,loadingLabel:null==t?void 0:t.combobox.loading}))},ce={type:"external_dial",flowType:"externalDial",localeKey:"externalDial",label:"External Number",description:"Ring an external phone number",color:"#f43f5e",exits:[{id:"next",label:"Timeout",configKey:"next",localeExitKey:"timeout"}],configPanel:({nodeId:a,config:t,onConfigChange:l,onInvalidDraftChange:d,listResources:s,locale:c})=>{var u,p,f,g,b,m,v,h,_,x,y,w;const k=null!==(u=t.phone_number)&&void 0!==u?u:"",E=null!==(p=t.timeout)&&void 0!==p?p:60,N=null!==(f=t.caller_id)&&void 0!==f?f:"original",C=null!==(g=t.caller_id_did)&&void 0!==g?g:"",L="did"===N&&!C,[O,R]=n(ie(k)),[j,T]=n(null),A=i(),I=`${A}-phone`,F=`${A}-error`,[D,P]=n({nodeId:a,e164:k});D.nodeId===a&&D.e164===k||(P({nodeId:a,e164:k}),R(ie(k)),T(null)),o(()=>(null==d||d(null!==j||L),()=>null==d?void 0:d(!1)),[j,L,d]);const M=null!==(b=null==c?void 0:c.configLabels.phoneNumberInvalid)&&void 0!==b?b:"Enter a valid phone number, for example (415) 555-1234.",$=r(e=>{const n=de(e.target.value);R(n?new S("US").input(n):""),T(null);const o=(e=>{const n=e?z(e,"US"):null;return(null==n?void 0:n.isValid())?n.number:null})(n);o?l({phone_number:o}):n||l({phone_number:""})},[l]),H=r(()=>{const e=de(O);if(!e)return T(null),void l({phone_number:""});const n=z(e,"US");if(null==n?void 0:n.isValid()){const e="US"===n.country||"1"===n.countryCallingCode;return R(e?n.formatNational():n.formatInternational()),T(null),void l({phone_number:n.number})}T(M)},[O,M,l]),K=r(()=>{R(""),T(null),l({phone_number:""})},[l]);return e.createElement(e.Fragment,null,e.createElement(ae,{value:E,min:1,max:120,onChange:e=>l({timeout:e}),locale:c}),e.createElement(W,{label:null!==(m=null==c?void 0:c.configLabels.phoneNumber)&&void 0!==m?m:"Phone Number",htmlFor:I},e.createElement("div",{className:"ds-dial-plan-config-field__input-wrapper"},e.createElement("input",{id:I,className:"ds-dial-plan-config-field__input",type:"tel",placeholder:"+1 415 555 1234",value:O,onChange:$,onBlur:H,"aria-invalid":!!j||void 0,"aria-describedby":j?F:void 0}),O&&e.createElement("button",{type:"button",className:"ds-dial-plan-config-field__clear",onClick:K,"aria-label":null!==(v=null==c?void 0:c.configLabels.clearPhoneNumber)&&void 0!==v?v:"Clear phone number"},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none"},e.createElement("path",{d:"M10.5 3.5L3.5 10.5M3.5 3.5l7 7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})))),j&&e.createElement("p",{className:"ds-dial-plan-config-field__error",id:F,role:"alert"},j)),e.createElement(le,{label:null!==(h=null==c?void 0:c.configLabels.callerId)&&void 0!==h?h:"Caller ID",value:N,options:[{value:"original",label:null!==(_=null==c?void 0:c.configLabels.callerIdOriginal)&&void 0!==_?_:"Original caller"},{value:"called_number",label:null!==(x=null==c?void 0:c.configLabels.callerIdCalledNumber)&&void 0!==x?x:"Number called"},{value:"did",label:null!==(y=null==c?void 0:c.configLabels.callerIdSpecific)&&void 0!==y?y:"Specific number"}],onChange:e=>l({caller_id:"original"===e?void 0:e,caller_id_did:void 0}),hint:null!==(w=null==c?void 0:c.configLabels.callerIdHint)&&void 0!==w?w:"Show the number that was called so the person you forward to knows it's coming from your office."}),"did"===N&&e.createElement(se,{value:C,listResources:s,onSelect:e=>l({caller_id_did:e}),locale:c}))},defaultConfig:{phone_number:"",timeout:60},icon:X,renderNode:(n,o)=>e.createElement(e.Fragment,null,e.createElement(I,{icon:o.icon,label:n.label,timeout:n.timeout,subtitle:n.phoneNumber}),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(D,{exits:o.exits,locale:n.locale}))),toFlowNode:e=>{const n=e;return{label:"External Number",phoneNumber:ie(n.config.phone_number),timeout:n.config.timeout,originalNode:n}}},ue={type:"voice_app",flowType:"voiceApp",localeKey:"voiceApp",label:"Voice App",description:"Route to a voice application",color:"#6366f1",exits:[{id:"next",label:"Timeout",configKey:"next",localeExitKey:"timeout"}],configPanel:({config:n,onConfigChange:a,listResources:t,onCreateResource:l,onOpenResource:r,locale:i})=>{var d,s,c,u,p,f,g,b,m;const v=P(n,"voice_app"),h=null!==(d=n.mode)&&void 0!==d?d:"control",{groups:_,handleCreateResource:x}=U([{type:"voice_app",labelKey:"voiceApps",fallback:"Voice Apps",options:{notifyEligible:"notify"===h}}],t,l,i);return o(()=>{var e,n;if("notify"!==h||!v)return;const o=null!==(n=null===(e=_[0])||void 0===e?void 0:e.items)&&void 0!==n?n:[];if(0===o.length)return;o.some(e=>e.id===v)||a(M("voice_app",""),{voiceAppName:void 0})},[h,v,_,a]),e.createElement(e.Fragment,null,e.createElement(W,{label:null!==(s=null==i?void 0:i.configLabels.target)&&void 0!==s?s:"Target"},e.createElement(V,{groups:_,value:v,placeholder:null!==(c=null==i?void 0:i.configLabels.searchTargets)&&void 0!==c?c:"Search targets…",onSelect:(e,n)=>a(M("voice_app",e),{voiceAppName:n}),onCreateResource:x,selectLabel:null==i?void 0:i.combobox.select,noResultsLabel:null==i?void 0:i.combobox.noResults,loadingLabel:null==i?void 0:i.combobox.loading,createNewPrefix:null==i?void 0:i.combobox.createNew,extensionLabel:null==i?void 0:i.combobox.extensionLabel}),v&&r&&e.createElement(B,{resourceId:v,onOpenResource:r,label:null!==(u=null==i?void 0:i.configLabels.openInNewTab)&&void 0!==u?u:"Open target details"})),e.createElement(le,{label:null!==(p=null==i?void 0:i.configLabels.mode)&&void 0!==p?p:"Mode",value:h,options:[{value:"control",label:null!==(f=null==i?void 0:i.voiceAppMode.control)&&void 0!==f?f:"Control"},{value:"notify",label:null!==(g=null==i?void 0:i.voiceAppMode.notify)&&void 0!==g?g:"Notify"}],onChange:e=>a({mode:e}),hint:"notify"===h?null!==(b=null==i?void 0:i.voiceAppMode.notifyHint)&&void 0!==b?b:"Notifies the voice app of the call in the background. The dial plan keeps routing via Next without waiting.":null!==(m=null==i?void 0:i.voiceAppMode.controlHint)&&void 0!==m?m:"Hands the call off to the voice app, which takes over the conversation."}))},defaultConfig:{voice_app:"",voice_app_id:"",mode:"control"},icon:Q,renderNode:(n,o)=>{var a,t,l,r;const i=n.locale,d="notify"===n.mode,s=d?null!==(a=null==i?void 0:i.voiceAppMode.notifyBadge)&&void 0!==a?a:"Notify mode":null!==(t=null==i?void 0:i.voiceAppMode.controlBadge)&&void 0!==t?t:"Control mode",c=d?null!==(l=null==i?void 0:i.exits.next)&&void 0!==l?l:"Next":null!==(r=null==i?void 0:i.exits.timeout)&&void 0!==r?r:"Timeout";return e.createElement(e.Fragment,null,e.createElement(I,{icon:o.icon,label:n.label,subtitle:n.voiceAppName}),e.createElement("span",{className:"ds-dial-plan-node__badge"},s),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(F,{id:"next",label:c})))},toFlowNode:e=>{var n;const o=e;return{label:"Voice App",voiceAppId:P(o.config,"voice_app"),mode:null!==(n=o.config.mode)&&void 0!==n?n:"control",originalNode:o}},normalizeFromAlias:e=>{const n=e.config,o=P(n,"target"),a=n.next;return Object.assign(Object.assign({},e),{type:"voice_app",config:Object.assign(Object.assign(Object.assign({},M("voice_app",o)),{mode:"control"}),void 0!==a?{next:a}:{})})},collectResourceIds:(e,n)=>{const o=P(e,"voice_app");o&&n.addTarget(o)},enrichNode:(e,n,o)=>{const a=e.voiceAppId,t=a?K(a,n,o):void 0;return Object.assign(Object.assign({},e),{voiceAppName:t,locale:o})}},pe={type:"voicemail",apiType:"internal_dial",flowType:"voicemail",localeKey:"voicemail",label:"Voicemail",description:"Send to voicemail",color:"#8b5cf6",exits:[],configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,onOpenResource:l,locale:r})=>{var i,d,s;const{groups:c,loading:u,handleCreateResource:p}=U([{type:"user",labelKey:"users",fallback:"Users"},{type:"shared_voicemail",labelKey:"sharedVoicemails",fallback:"Shared Voicemails"}],a,t,r),f=P(n,"target");return e.createElement(W,{label:null!==(i=null==r?void 0:r.configLabels.target)&&void 0!==i?i:"Target"},e.createElement(V,{groups:c,value:f,loading:u,placeholder:null!==(d=null==r?void 0:r.configLabels.searchTargets)&&void 0!==d?d:"Search targets…",onSelect:(e,n)=>o(Object.assign(Object.assign({},M("target",e)),{timeout:0}),{targetName:n}),onCreateResource:p,selectLabel:null==r?void 0:r.combobox.select,noResultsLabel:null==r?void 0:r.combobox.noResults,loadingLabel:null==r?void 0:r.combobox.loading,createNewPrefix:null==r?void 0:r.combobox.createNew,extensionLabel:null==r?void 0:r.combobox.extensionLabel}),f&&l&&e.createElement(B,{resourceId:f,onOpenResource:l,label:null!==(s=null==r?void 0:r.configLabels.openInNewTab)&&void 0!==s?s:"Open target details"}))},defaultConfig:{target:"",target_id:"",timeout:0},icon:Z,renderNode:(n,o)=>e.createElement(I,{icon:o.icon,label:n.label,subtitle:n.targetName}),toFlowNode:e=>{const n=e;return{label:"Voicemail",targetId:P(n.config,"target"),timeout:0,originalNode:n}},collectResourceIds:(e,n)=>{const o=P(e,"target");o&&n.addTarget(o)},enrichNode:(e,n,o)=>{const a=e.targetId,t=K(a,n,o),l=$(a,o);return Object.assign(Object.assign({},e),{targetName:t,targetType:l,locale:o})}},fe=["1","2","3","4","5","6","7","8","9","0","*","#"];function ge(e){return"*"===e?"digit_star":"#"===e?"digit_hash":`digit_${e}`}const be=[{id:"timeout",label:"Timeout",configKey:"timeout_next_node",localeExitKey:"timeout"},{id:"invalid",label:"Invalid",configKey:"invalid_next_node",localeExitKey:"invalid"}],me={type:"menu",flowType:"menu",localeKey:"menu",label:"IVR Menu",description:"Play prompt and route by keypress",color:"#ec4899",exits:[...be],allowSelfLoop:!0,configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,locale:l})=>{var r,i,d,s,c,u,p,f,g;const{groups:b,loading:m,handleCreateResource:v}=U([{type:"audio_clip",labelKey:"audioClips",fallback:"Audio Clips"}],a,t,l),h=P(n,"prompt_clip"),_=null!==(r=n.timeout)&&void 0!==r?r:5,x=null!==(i=n.options)&&void 0!==i?i:[{digit:"1"}],y=null!==(d=n.extension_entry_enabled)&&void 0!==d&&d,w=new Set(x.map(e=>e.digit));return e.createElement(e.Fragment,null,e.createElement(W,{label:null!==(s=null==l?void 0:l.configLabels.promptClip)&&void 0!==s?s:"Prompt"},e.createElement(V,{groups:b,value:h,loading:m,placeholder:null!==(c=null==l?void 0:l.configLabels.search)&&void 0!==c?c:"Search...",onSelect:(e,n)=>o(M("prompt_clip",e),{promptClipName:n}),onCreateResource:v,selectLabel:null==l?void 0:l.combobox.select,noResultsLabel:null==l?void 0:l.combobox.noResults,loadingLabel:null==l?void 0:l.combobox.loading,createNewPrefix:null==l?void 0:l.combobox.createNew})),e.createElement(ae,{value:_,min:1,max:30,onChange:e=>o({timeout:e}),locale:l}),e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("label",{className:"ds-dial-plan-config-field__checkbox"},e.createElement("input",{type:"checkbox",checked:y,onChange:e=>o({extension_entry_enabled:e.target.checked})}),e.createElement("span",null,null!==(u=null==l?void 0:l.configLabels.extensionEntry)&&void 0!==u?u:"Allow extension dialing")),e.createElement("p",{className:"ds-dial-plan-config-field__hint"},null!==(p=null==l?void 0:l.configLabels.extensionEntryHint)&&void 0!==p?p:"When on, callers can key an extension instead of choosing an option.")),e.createElement(W,{label:null!==(f=null==l?void 0:l.configLabels.options)&&void 0!==f?f:"Options",action:e.createElement("button",{type:"button",className:"ds-dial-plan-menu-options__add",onClick:function(){const e=fe.find(e=>!w.has(e));e&&o({options:[...x,{digit:e}]})},disabled:x.length>=12},"+ ",null!==(g=null==l?void 0:l.configLabels.addOption)&&void 0!==g?g:"Add")},e.createElement("div",{className:"ds-dial-plan-menu-options"},x.map((n,a)=>{var t,r,i,d,s,c;return e.createElement("div",{key:a,className:"ds-dial-plan-menu-options__card"},e.createElement("div",{className:"ds-dial-plan-menu-options__field ds-dial-plan-menu-options__field--label"},e.createElement("span",{className:"ds-dial-plan-menu-options__field-label"},null!==(t=null==l?void 0:l.configLabels.optionLabel)&&void 0!==t?t:"Label"," ",e.createElement("span",{className:"ds-dial-plan-menu-options__field-hint"},"(optional)")),e.createElement("input",{type:"text",className:"ds-dial-plan-config-field__input",value:null!==(r=n.label)&&void 0!==r?r:"",maxLength:20,placeholder:null!==(i=null==l?void 0:l.configLabels.optionLabelPlaceholder)&&void 0!==i?i:"e.g. Sales",onChange:e=>{return n=a,t=e.target.value,void o({options:x.map((e,o)=>{if(o!==n)return e;const a=Object.assign({},e);return t?a.label=t:delete a.label,a})});var n,t}})),e.createElement("div",{className:"ds-dial-plan-menu-options__field ds-dial-plan-menu-options__field--digit"},e.createElement("span",{className:"ds-dial-plan-menu-options__field-label"},null!==(d=null==l?void 0:l.configLabels.digit)&&void 0!==d?d:"Digit"),e.createElement("select",{className:"ds-dial-plan-config-field__input",value:n.digit,onChange:e=>{return n=a,t=e.target.value,void o({options:x.map((e,o)=>o===n?Object.assign(Object.assign({},e),{digit:t}):e)});var n,t}},fe.filter(e=>e===n.digit||!w.has(e)).map(n=>e.createElement("option",{key:n,value:n},"*"===n?"✱":n)))),e.createElement("button",{type:"button",className:"ds-dial-plan-menu-options__remove",onClick:()=>{return e=a,void o({options:x.filter((n,o)=>o!==e)});var e},title:null!==(s=null==l?void 0:l.configLabels.removeOption)&&void 0!==s?s:"Remove","aria-label":null!==(c=null==l?void 0:l.configLabels.removeOption)&&void 0!==c?c:"Remove"},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"}))))}))))},defaultConfig:{prompt_clip:"",prompt_clip_id:"",timeout:5,options:[{digit:"1"}],extension_entry_enabled:!1},icon:J,renderNode:(n,o)=>{var a;const t=null!==(a=n.options)&&void 0!==a?a:[],l=n.locale;return e.createElement(e.Fragment,null,e.createElement(I,{icon:o.icon,label:n.label,timeout:n.timeout,subtitle:n.promptClipName}),e.createElement("div",{className:"ds-dial-plan-node__exits"},t.map(n=>{const o="*"===n.digit?"✱":n.digit,a=n.label?`${n.label} — ${o}`:o;return e.createElement(F,{key:n.digit,id:ge(n.digit),label:a})}),e.createElement(D,{exits:o.exits,locale:l})))},toFlowNode:e=>{const n=e;return{label:"IVR Menu",promptClipId:P(n.config,"prompt_clip"),timeout:n.config.timeout,options:n.config.options,originalNode:n}},createEdgesForNode:(e,n)=>{const o=e,a=[];o.config.timeout_next_node&&n.has(o.config.timeout_next_node)&&a.push({id:`${o.id}-timeout->${o.config.timeout_next_node}`,source:o.id,target:o.config.timeout_next_node,sourceHandle:"timeout",type:T}),o.config.invalid_next_node&&n.has(o.config.invalid_next_node)&&a.push({id:`${o.id}-invalid->${o.config.invalid_next_node}`,source:o.id,target:o.config.invalid_next_node,sourceHandle:"invalid",type:T});for(const e of o.config.options)if(e.next_node&&n.has(e.next_node)){const n=ge(e.digit);a.push({id:`${o.id}-${n}->${e.next_node}`,source:o.id,target:e.next_node,sourceHandle:n,type:T})}return a},collectResourceIds:(e,n)=>{const o=P(e,"prompt_clip");o&&n.addAudioClip(o)},enrichNode:(e,n,o)=>{const a=n.audioClips.get(e.promptClipId);return Object.assign(Object.assign({},e),{promptClipName:null==a?void 0:a.name,locale:o})},resolveExitLabel:e=>{const n=function(e){if("digit_star"===e)return"*";if("digit_hash"===e)return"#";const n=e.match(/^digit_(\d)$/);return null==n?void 0:n[1]}(e);if(n)return"*"===n?"✱":n},onConfigChange:(e,n,o)=>{var a,t;if(!n.options)return;const l=n.options,r=new Set(l.map(e=>ge(e.digit)));for(const e of be)r.add(e.id);const i=o.nodesRef.current.find(n=>n.id===e),d=null!==(t=null===(a=null==i?void 0:i.data)||void 0===a?void 0:a.options)&&void 0!==t?t:[],s=new Map;if(d.length===l.length)for(let e=0;e<l.length;e++){const n=ge(d[e].digit),o=ge(l[e].digit);n!==o&&s.set(n,o)}o.setEdges(n=>{const a=n.map(n=>{if(n.source!==e||!n.sourceHandle)return n;const o=s.get(n.sourceHandle);return o?Object.assign(Object.assign({},n),{sourceHandle:o,id:`${e}-${o}->${n.target}`}):n}).filter(n=>n.source!==e||!n.sourceHandle||r.has(n.sourceHandle));return(a.length!==n.length||s.size>0)&&o.updateDirty(o.nodesRef.current,a),a}),requestAnimationFrame(()=>o.updateNodeInternals(e))},serializeConfig:(e,n,o)=>{var a;const t=(null!==(a=o.options)&&void 0!==a?a:[]).map(o=>{const a=ge(o.digit),t=n.find(n=>n.source===e.id&&n.sourceHandle===a),l={digit:o.digit};return o.label&&(l.label=o.label),t&&(l.next_node=t.target),l});return Object.assign(Object.assign({},o),{options:t})}},ve={type:"audio_clip",flowType:"audioClip",localeKey:"audioClip",label:"Audio Clip",description:"Play an audio clip",color:"#14b8a6",exits:[{id:"next",label:"Next",configKey:"next",localeExitKey:"next"}],configPanel:({config:n,onConfigChange:o,listResources:a,onCreateResource:t,locale:l})=>{var r,i;const{groups:d,loading:s,handleCreateResource:c}=U([{type:"audio_clip",labelKey:"audioClips",fallback:"Audio Clips"}],a,t,l),u=P(n,"clip");return e.createElement(W,{label:null!==(r=null==l?void 0:l.configLabels.audioClip)&&void 0!==r?r:"Audio Clip"},e.createElement(V,{groups:d,value:u,loading:s,placeholder:null!==(i=null==l?void 0:l.configLabels.search)&&void 0!==i?i:"Search...",onSelect:(e,n)=>o(M("clip",e),{clipName:n}),onCreateResource:c,selectLabel:null==l?void 0:l.combobox.select,noResultsLabel:null==l?void 0:l.combobox.noResults,loadingLabel:null==l?void 0:l.combobox.loading,createNewPrefix:null==l?void 0:l.combobox.createNew}))},defaultConfig:{clip:"",clip_id:""},icon:ne,renderNode:(n,o)=>e.createElement(e.Fragment,null,e.createElement(I,{icon:o.icon,label:n.label,subtitle:n.clipName}),e.createElement("div",{className:"ds-dial-plan-node__exits"},e.createElement(D,{exits:o.exits,locale:n.locale}))),toFlowNode:e=>{const n=e;return{label:"Audio Clip",clipId:P(n.config,"clip"),originalNode:n}},normalizeFromAlias:e=>Object.assign(Object.assign({},e),{type:"audio_clip"}),collectResourceIds:(e,n)=>{const o=P(e,"clip");o&&n.addAudioClip(o)},enrichNode:(e,n,o)=>{const a=n.audioClips.get(e.clipId);return Object.assign(Object.assign({},e),{clipName:null==a?void 0:a.name,locale:o})}},he={type:"hang_up",flowType:"hangUp",localeKey:"hangUp",label:"Hang Up",description:"End the call",color:"#ef4444",exits:[],configPanel:({locale:n})=>{var o;return e.createElement("div",{className:"ds-dial-plan-config-panel__note"},null!==(o=null==n?void 0:n.nodeDescriptions.hangUp)&&void 0!==o?o:"End the call")},defaultConfig:{},icon:ee,renderNode:(n,o)=>e.createElement(I,{icon:o.icon,label:n.label}),toFlowNode:e=>({label:"Hang Up",originalNode:e}),enrichNode:(e,n,o)=>Object.assign(Object.assign({},e),{label:o.nodeTypes.hangUp,locale:o})},_e=new class{constructor(){this.byType=new Map,this.byFlowType=new Map,this.legacyTypeAliases=new Map}register(e){this.byType.set(e.type,e),this.byFlowType.set(e.flowType,e)}registerAlias(e,n){this.legacyTypeAliases.set(e,n)}get(e){return this.byType.get(e)}resolveType(e){var n;let o=this.byType.get(e.type);if(!o){const n=this.legacyTypeAliases.get(e.type);n&&(o=this.byType.get(n))}return(null==o?void 0:o.resolveAlias)&&null!==(n=o.resolveAlias(e))&&void 0!==n?n:o}getByFlowType(e){return this.byFlowType.get(e)}getAll(){return Array.from(this.byType.values())}getNodeTypesMap(){const e={};for(const n of this.byType.values())e[n.flowType]=n.component;return e}createEdgesForNode(e,n){const o=this.resolveType(e);if(!o)return[];if(o.createEdgesForNode)return o.createEdgesForNode(e,n);const a=e.config,t=[];for(const l of A(o,a)){const o=a[l.configKey];o&&n.has(o)&&t.push({id:`${e.id}-${l.id}->${o}`,source:e.id,target:o,sourceHandle:l.id,type:T})}return t}},xe=(ye=_e,a(function({data:n,selected:o,type:a}){const t=ye.getByFlowType(null!=a?a:"");if(!t)return null;const l=t.renderNode(n,t),r=t.type.replace(/_/g,"-");return e.createElement("div",{className:`ds-dial-plan-node ds-dial-plan-node--themed ds-dial-plan-node--${r} ${o?"ds-dial-plan-node--selected":""}`,style:{"--node-color":t.color}},e.createElement(s,{type:"target",position:c.Left,className:"ds-dial-plan-handle"}),l)}));var ye;const we=[oe,te,re,ce,ue,pe,me,ve,he];for(const e of we)_e.register(Object.assign(Object.assign({},e),{component:xe}));const ke=_e.get("internal_dial");ke&&(ke.resolveAlias=e=>{const n=e.config,o=P(n,"target");return o.startsWith("svm_")||0===n.timeout&&!n.next&&!H(o)?_e.get("voicemail"):o.startsWith("va_")?_e.get("voice_app"):void 0}),_e.registerAlias("sound_clip","audio_clip");const Ee="__start__";function Ne(e,n=_e){var o;const a=[],t=[],l=new Map;for(const n of e.nodes)l.set(n.id,n);const r={id:Ee,type:"start",position:{x:0,y:0},data:{label:"Start"}};a.push(r),e.entry_node&&l.has(e.entry_node)&&t.push({id:`${Ee}->${e.entry_node}`,source:Ee,target:e.entry_node,type:T});for(const r of e.nodes){const e=n.resolveType(r),i=null!==(o=r.position)&&void 0!==o?o:{x:0,y:0},d=e&&e.type!==r.type&&e.normalizeFromAlias?e.normalizeFromAlias(r):r;if(e){const n=e.toFlowNode(d),o={id:r.id,type:e.flowType,position:i,data:n};a.push(o)}else a.push({id:r.id,type:"default",position:i,data:{label:r.id,originalNode:r}});const s=n.createEdgesForNode(d,l);t.push(...s)}return e.nodes.some(e=>!e.position)?Oe(a,t):{nodes:a,edges:t}}function Ce(e,n,o){var a,t,l,r;const i=n.find(e=>e.source===Ee),d=null!==(a=null==i?void 0:i.target)&&void 0!==a?a:"",s=[];for(const a of e){if(a.id===Ee)continue;const e=o.getByFlowType(null!==(t=a.type)&&void 0!==t?t:"");if(!e||!(null===(l=a.data)||void 0===l?void 0:l.originalNode))continue;const i=a.data.originalNode,d=Object.assign({},i.config);for(const n of e.exits)d[n.configKey]=void 0;const c=A(e,d);for(const e of n){if(e.source!==a.id)continue;const n=c.find(n=>n.id===e.sourceHandle);n&&(d[n.configKey]=e.target)}const u=e.serializeConfig?e.serializeConfig(a,n,d):d;s.push({id:a.id,type:null!==(r=e.apiType)&&void 0!==r?r:i.type,position:a.position,config:u})}return{entry_node:d,nodes:s}}function Le(e){var n,o,a;if((null===(n=e.measured)||void 0===n?void 0:n.width)&&(null===(o=e.measured)||void 0===o?void 0:o.height))return{width:e.measured.width,height:e.measured.height};if("start"===e.type)return{width:60,height:60};if("schedule"===e.type)return{width:180,height:140};if("menu"===e.type){const n=e.data.options;return{width:180,height:60+28*((null!==(a=null==n?void 0:n.length)&&void 0!==a?a:1)+2)}}return{width:180,height:80}}function Oe(e,n){var o;const a=new L.graphlib.Graph;a.setGraph({rankdir:"LR",nodesep:60,ranksep:80,marginx:40,marginy:40}),a.setDefaultEdgeLabel(()=>({}));for(const n of e){const{width:e,height:o}=Le(n);a.setNode(n.id,{width:e,height:o})}for(const e of n)a.setEdge(e.source,e.target);L.layout(a);const t=new Map;for(const n of e){const e=a.node(n.id),{width:o,height:l}=Le(n);t.set(n.id,{x:Math.round(e.x-o/2),y:Math.round(e.y-l/2)})}const l=new Map;for(const e of n){const n=l.get(e.source);n?n.push(e.target):l.set(e.source,[e.target])}const r=e=>{var n;const o=new Set([e]),a=[e];for(;a.length>0;){const e=a.shift();for(const t of null!==(n=l.get(e))&&void 0!==n?n:[])o.has(t)||(o.add(t),a.push(t))}return o};for(const a of e){const e=_e.getByFlowType(null!==(o=a.type)&&void 0!==o?o:"");if(!e||e.exits.length<2)continue;const l=[];for(const o of e.exits){const e=n.find(e=>e.source===a.id&&e.sourceHandle===o.id);e&&l.push(e.target)}if(l.length<2)continue;const i=l[0],d=l[1],s=t.get(i),c=t.get(d);if(!s||!c)continue;if(s.y<=c.y)continue;const u=r(i),p=r(d);if([...u].some(e=>p.has(e)))continue;const f=s.y-c.y;for(const e of u){const n=t.get(e);n&&(n.y-=f)}for(const e of p){const n=t.get(e);n&&(n.y+=f)}}const i=e.find(e=>e.id===Ee),d=t.get(Ee),s=i&&d?i.position.x-d.x:0,c=i&&d?i.position.y-d.y:0;return{nodes:e.map(e=>{const n=t.get(e.id);return Object.assign(Object.assign({},e),{position:{x:n.x+s,y:n.y+c}})}),edges:n}}function ze(e,n,o,a){const t=_e.getByFlowType(e),l=t?we.find(e=>{var n;return e.type===(null!==(n=t.apiType)&&void 0!==n?n:t.type)}):null;return(null==l?void 0:l.enrichNode)?l.enrichNode(n,o,a):n}const Se=a(function({data:n}){return e.createElement("div",{className:"ds-dial-plan-node ds-dial-plan-node--start"},e.createElement("div",{className:"ds-dial-plan-node__content"},e.createElement("span",{className:"ds-dial-plan-node__label"},n.label)),e.createElement(s,{type:"source",position:c.Right,className:"ds-dial-plan-handle"}))}),Re=({registry:n,onAddNode:o,locale:a})=>{const t=n.getAll();return e.createElement("div",{className:"ds-dial-plan-node-library"},t.map(n=>{var t,l;const r=null!==(t=null==a?void 0:a.nodeTypes[n.localeKey])&&void 0!==t?t:n.label,i=null!==(l=null==a?void 0:a.nodeDescriptions[n.localeKey])&&void 0!==l?l:n.description;return e.createElement("div",{key:n.type,className:`ds-dial-plan-node-library__item ds-dial-plan-node-library__item--${n.type}`,style:{"--node-color":n.color},draggable:!0,onClick:()=>o(n.type),onDragStart:e=>{const o=e.currentTarget.getBoundingClientRect(),a=(e.clientX-o.left)/o.width,t=(e.clientY-o.top)/o.height;e.dataTransfer.setData("application/reactflow",n.type),e.dataTransfer.setData("application/reactflow-grab-frac",`${a},${t}`),e.dataTransfer.effectAllowed="move"},title:i},e.createElement("span",{className:"ds-dial-plan-node-library__item-icon"},n.icon),e.createElement("span",{className:"ds-dial-plan-node-library__item-label"},r))}))},je=e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("polyline",{points:"3 6 5 6 21 6"}),e.createElement("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})),Te=({node:n,registration:a,onConfigChange:l,onInvalidDraftChange:r,onDelete:i,onClose:d,listResources:s,onCreateResource:c,onOpenResource:u,locale:p})=>{var f,g,b;const m=t(null);o(()=>{var e;const n=null===(e=m.current)||void 0===e?void 0:e.getRootNode(),o=n instanceof ShadowRoot||n instanceof Document?n:document,a=e=>function(e){"Escape"===e.key&&d()}(e);return o.addEventListener("keydown",a),()=>o.removeEventListener("keydown",a)},[d]);const v=n.data.originalNode,h=null!==(f=null==v?void 0:v.config)&&void 0!==f?f:{},_=a.configPanel;return e.createElement("div",{ref:m,className:"ds-dial-plan-config-panel"},e.createElement("div",{className:"ds-dial-plan-config-panel__header"},e.createElement("span",{className:"ds-dial-plan-config-panel__header-icon"},a.icon),e.createElement("span",{className:"ds-dial-plan-config-panel__header-label"},a.label),e.createElement("button",{type:"button",className:"ds-dial-plan-config-panel__delete",onClick:()=>{i(n.id),d()},title:null!==(g=null==p?void 0:p.panel.delete_)&&void 0!==g?g:"Delete"},je),e.createElement("button",{className:"ds-dial-plan-config-panel__close",onClick:d,title:null!==(b=null==p?void 0:p.panel.close)&&void 0!==b?b:"Close",type:"button"},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})))),e.createElement("div",{className:"ds-dial-plan-config-panel__body"},e.createElement(_,{nodeId:n.id,onInvalidDraftChange:r,config:h,nodeData:n.data,onConfigChange:(e,o)=>l(n.id,e,o),listResources:s,onCreateResource:c,onOpenResource:u,locale:p})))},Ae=a(function({onAutoLayout:n,onSave:o,isDirty:a,hasInvalidDraft:t,locale:l}){var r;const i=null!==(r=null==l?void 0:l.toolbar)&&void 0!==r?r:{autoLayout:"Auto Layout",save:"Save"};return e.createElement("div",{className:"ds-dial-plan-editor-toolbar"},e.createElement("button",{className:"ds-dial-plan-editor-toolbar__button",onClick:n,title:i.autoLayout,type:"button"},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},e.createElement("rect",{x:"3",y:"3",width:"7",height:"7"}),e.createElement("rect",{x:"14",y:"3",width:"7",height:"7"}),e.createElement("rect",{x:"14",y:"14",width:"7",height:"7"}),e.createElement("line",{x1:"6.5",y1:"10",x2:"6.5",y2:"17"}),e.createElement("line",{x1:"6.5",y1:"17",x2:"14",y2:"17.5"})),e.createElement("span",null,i.autoLayout)),o&&e.createElement("button",{className:"ds-dial-plan-editor-toolbar__button",onClick:o,title:i.save,type:"button",disabled:!a||t},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2"},e.createElement("path",{d:"M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z"}),e.createElement("polyline",{points:"17 21 17 13 7 13 7 21"}),e.createElement("polyline",{points:"7 3 7 8 15 8"})),e.createElement("span",null,i.save)))});var Ie;const Fe=!("undefined"==typeof window||void 0===window.document||"function"!=typeof HTMLElement.prototype.attachShadow||"undefined"==typeof navigator||/jsdom/i.test(null!==(Ie=navigator.userAgent)&&void 0!==Ie?Ie:"")||"undefined"!=typeof window&&"__STORYBOOK_PREVIEW__"in window),De=({children:a,stylesheets:l,className:i,style:d})=>{const[s,c]=n(null),u=t(null),p=r(e=>{var n;if(u.current=e,!Fe||!e)return;const o=null!==(n=e.shadowRoot)&&void 0!==n?n:e.attachShadow({mode:"open"});c(o)},[]);o(()=>{Fe&&u.current&&function(e,n){const o=e.shadowRoot;o&&(o.adoptedStyleSheets=n.map(e=>{const n=new CSSStyleSheet;return n.replaceSync(e),n}))}(u.current,l)},[l]);const f=t(null);return o(()=>{if(!Fe&&0!==l.length)return f.current||(f.current=document.createElement("style"),document.head.appendChild(f.current)),f.current.textContent=l.join("\n"),()=>{f.current&&(f.current.remove(),f.current=null)}},[l]),Fe?e.createElement("div",{ref:p,className:i,style:d},s&&R(a,s)):e.createElement("div",{className:i,style:d},a)},Pe={nodeTypes:{start:"Start",schedule:"Schedule",internalDial:"Internal Extension",voicemail:"Voicemail",externalDial:"External Number",ringAllUsers:"Ring All Users",voiceApp:"Voice App",menu:"IVR Menu",audioClip:"Audio Clip",hangUp:"Hang Up"},exits:{open:"Open",closed:"Closed",holiday:"Holiday",next:"Next",timeout:"Timeout",invalid:"Invalid"},nodeDescriptions:{schedule:"Route calls by schedule",internalDial:"Ring a user, group, or plan",voicemail:"Send to voicemail",ringAllUsers:"Ring all users",externalDial:"Ring an external phone number",voiceApp:"Route to a voice application",menu:"Play prompt and route by keypress",audioClip:"Play an audio clip",hangUp:"End the call"},targetTypes:{user:"User",ringGroup:"Ring Group",dialPlan:"Dial Plan",queue:"Queue",voiceApp:"Voice App",sharedVoicemail:"Shared Voicemail"},resourceGroups:{users:"Users",ringGroups:"Ring Groups",dialPlans:"Dial Plans",queues:"Queues",voiceApps:"Voice Apps",sharedVoicemails:"Shared Voicemails",schedules:"Schedules",audioClips:"Audio Clips",phoneNumbers:"Phone Numbers"},configLabels:{timeout:"Timeout (seconds)",target:"Target",schedule:"Schedule",search:"Search...",searchTargets:"Search targets...",searchSchedules:"Search schedules...",openInNewTab:"Open target details",promptClip:"Prompt",audioClip:"Audio Clip",digit:"Digit",options:"Options",addOption:"Add Option",removeOption:"Remove",optionLabel:"Label",optionLabelPlaceholder:"e.g. Sales",routeHolidaySeparately:"Route holidays separately",routeHolidaySeparatelyHint:"When on, holidays route to a dedicated branch you wire below. Otherwise holidays follow the Closed exit.",mode:"Mode",phoneNumber:"Phone Number",phoneNumberInvalid:"Enter a valid phone number, for example (415) 555-1234.",clearPhoneNumber:"Clear phone number",timeoutOverride:"Override resource timeout",timeoutOverrideOn:"On",timeoutOverrideOff:"Off",extensionEntry:"Allow extension dialing",extensionEntryHint:"When on, callers can key an extension instead of choosing an option.",callerId:"Caller ID",callerIdOriginal:"Original caller",callerIdCalledNumber:"Number called",callerIdSpecific:"Specific number",callerIdHint:"Show the number that was called so the person you forward to knows it's coming from your office.",callerIdNumber:"Number to show",searchPhoneNumbers:"Search phone numbers..."},voiceAppMode:{control:"Control",notify:"Notify",controlBadge:"Control mode",notifyBadge:"Notify mode",controlHint:"Hands the call off to the voice app, which takes over the conversation.",notifyHint:"Notifies the voice app of the call in the background. The dial plan keeps routing via Next without waiting."},toolbar:{autoLayout:"Auto Layout",save:"Save"},panel:{delete_:"Delete",close:"Close",connection:"Connection",from:"From",exit:"Exit",to:"To"},combobox:{select:"— Select —",search:"Search...",noResults:"No results found",loading:"Loading...",createNew:"+ Create new...",extensionLabel:"Ext.",noName:"(No name)"},status:{loading:"Loading dial plan...",loadError:"Failed to load dial plan",notFound:"No dial plan found",saveError:"Failed to save dial plan",newDialPlan:"New Dial Plan"}},Me={schedule:"A schedule must be selected in the Schedule node",schedule_id:"A schedule must be selected in the Schedule node",target:"A target must be selected in the Internal Extension node",target_id:"A target must be selected in the Internal Extension node",prompt_clip:"A prompt must be selected in the IVR Menu node",prompt_clip_id:"A prompt must be selected in the IVR Menu node",clip:"An audio clip must be selected in the Audio Clip node",clip_id:"An audio clip must be selected in the Audio Clip node",voice_app:"A voice app must be selected in the Voice App node",voice_app_id:"A voice app must be selected in the Voice App node",phone_number:"Enter a valid US phone number in the External Number node"},$e={schedule:"Schedule",internal_dial:"Internal Extension",ring_all_users:"Ring All",external_dial:"External Number"};const He={view:{editable:!1,interactive:!0,showChrome:!0},edit:{editable:!0,interactive:!0,showChrome:!0},preview:{editable:!1,interactive:!1,showChrome:!1}},Ke={id:"",name:"New Dial Plan",entry_node:"",nodes:[],created_at:"",updated_at:""},Be=Object.assign({start:Se},_e.getNodeTypesMap()),Ve={[T]:n=>{const{sourceX:o,sourceY:a,targetX:t,targetY:l,sourcePosition:r,targetPosition:i,markerEnd:d,style:s}=n,c=Math.abs(a-l),[g]=c<=1?u({sourceX:o,sourceY:a,targetX:t,targetY:l}):p({sourceX:o,sourceY:a,targetX:t,targetY:l,sourcePosition:r,targetPosition:i,borderRadius:8});return e.createElement(f,{path:g,markerEnd:d,style:s})}};function We(e,n,o){return j(this,void 0,void 0,function*(){var a;const t=new Set,l=new Set,r=new Set,i=e=>!(null==o?void 0:o.only)||o.only.has(e);for(const n of e.nodes){const e=_e.resolveType(n),o=e?we.find(n=>{var o;return n.type===(null!==(o=e.apiType)&&void 0!==o?o:e.type)}):null;null===(a=null==o?void 0:o.collectResourceIds)||void 0===a||a.call(o,n.config,{addSchedule:e=>{i(e)&&t.add(e)},addTarget:e=>{i(e)&&l.add(e)},addAudioClip:e=>{i(e)&&r.add(e)}})}const d=r.size>0?n.audioClips.list().catch(()=>[]):Promise.resolve([]),[s,c,...u]=yield Promise.all([Promise.all(Array.from(t).map(e=>j(this,void 0,void 0,function*(){try{return yield n.schedules.retrieve(e)}catch(e){return null}}))),d,...Array.from(l).map(e=>j(this,void 0,void 0,function*(){var a,t;const l=yield n.resolveRoutingTarget(e,o);return l?{id:l.id,name:l.name||l.id,extension_number:null!==(a=l.extension_number)&&void 0!==a?a:void 0,timeout_seconds:null!==(t=l.timeout_seconds)&&void 0!==t?t:void 0}:null}))]),p=new Map,f=new Map,g=new Map;for(const e of s)e&&p.set(e.id,e);for(const e of u)e&&f.set(e.id,e);for(const e of c)g.set(e.id,e);return{schedules:p,users:f,audioClips:g}})}const Ue=e.forwardRef(function({dialPlanId:a,mode:l="view",locale:i=Pe,onNodeClick:s,onLoaderStart:c,onLoaderEnd:u,onLoadError:p,onSave:f,onDirtyChange:g,onError:C,className:L,style:O,onCreateResource:z,onOpenResource:S},R){var I;const{editable:F,interactive:D,showChrome:M}=He[l],{dialstack:H}=N(),K=b(),B=m(),[V,W]=n(!F||!!a),[U,q]=n(null),[G,Y]=v([]),[X,Z,Q]=h([]),[J,ee]=n(null),[ne,oe]=n(null),[ae,te]=n(!1),[le,re]=n(!1);o(()=>{var e,n;null===(n=(e=be.current).onDirtyChange)||void 0===n||n.call(e,ae)},[ae]);const[de,se]=n(null),[ce,ue]=n(0),pe=t(null),fe=t(G),ge=t(X);fe.current=G,ge.current=X;const be=t({onLoaderStart:c,onLoaderEnd:u,onLoadError:p,onError:C,onSave:f,onDirtyChange:g});be.current={onLoaderStart:c,onLoaderEnd:u,onLoadError:p,onError:C,onSave:f,onDirtyChange:g};const me=t(null),ve=t({schedules:new Map,users:new Map,audioClips:new Map}),he=t(!1);o(()=>{let e=!1;return function(){j(this,void 0,void 0,function*(){var n,o,t,l,r,d,s,c;if(F&&!a){const{nodes:n,edges:o}=Ne(Object.assign(Object.assign({},Ke),{name:i.status.newDialPlan}),_e);return void(e||(Y(n),Z(o),me.current={nodes:n,edges:o},W(!1)))}W(!0),q(null),null===(o=(n=be.current).onLoaderStart)||void 0===o||o.call(n);try{const n=yield H.dialPlans.retrieve(a);if(e)return;const o=yield We(n,H);if(e)return;ve.current=o;const{nodes:r,edges:d}=Ne(n,_e),s=function(e,n,o){return e.map(e=>{var a;const t=_e.getByFlowType(null!==(a=e.type)&&void 0!==a?a:""),l=t?we.find(e=>{var n;return e.type===(null!==(n=t.apiType)&&void 0!==n?n:t.type)}):null;return(null==l?void 0:l.enrichNode)?Object.assign(Object.assign({},e),{data:l.enrichNode(e.data,n,o)}):Object.assign(Object.assign({},e),{data:Object.assign(Object.assign({},e.data),{locale:o})})})}(r,o,i);Y(s),Z(d),me.current={nodes:s,edges:d},se({id:n.id,name:n.name}),W(!1),null===(l=(t=be.current).onLoaderEnd)||void 0===l||l.call(t,n)}catch(n){if(!e){const e=n instanceof Error?n:new Error(String(n));q(e),W(!1),null===(d=(r=be.current).onLoadError)||void 0===d||d.call(r,e),null===(c=(s=be.current).onError)||void 0===c||c.call(s,e)}}})}(),()=>{e=!0}},[H,a,Y,Z]);const xe=r((e,n)=>{if(!me.current)return;const o=(e,n)=>JSON.stringify({nodes:e.map(e=>({id:e.id,data:e.data,position:e.position})),edges:n.map(e=>({id:e.id,source:e.source,target:e.target,sourceHandle:e.sourceHandle}))}),a=o(me.current.nodes,me.current.edges)!==o(e,n);te(a)},[]);o(()=>{he.current&&(he.current=!1,xe(G,X))},[G,X,xe]);const ye=r(e=>{Q(e),e.some(e=>"remove"===e.type)&&queueMicrotask(()=>xe(fe.current,ge.current))},[Q,xe]),ke=r(e=>{const n=fe.current.filter(n=>n.id!==e).map(n=>{var o;const a=null===(o=n.data)||void 0===o?void 0:o.originalNode;if(!a)return n;const t=a.config;if(!t)return n;const l=Object.assign({},t);let r=!1;for(const n of Object.keys(l))l[n]===e&&(l[n]=void 0,r=!0);return r?Object.assign(Object.assign({},n),{data:Object.assign(Object.assign({},n.data),{originalNode:Object.assign(Object.assign({},a),{config:l})})}):n}),o=ge.current.filter(n=>n.source!==e&&n.target!==e);Y(n),Z(o),xe(n,o),J===e&&ee(null)},[Y,Z,J,xe]),Ee=r(e=>{const n=new Set(e.filter(e=>"remove"===e.type&&"id"in e&&"__start__"!==e.id).map(e=>"id"in e?e.id:""));if(n.size>0){const e=fe.current.filter(e=>!n.has(e.id)).map(e=>{var o;const a=null===(o=e.data)||void 0===o?void 0:o.originalNode;if(!a)return e;const t=a.config;if(!t)return e;const l=Object.assign({},t);let r=!1;for(const e of Object.keys(l))"string"==typeof l[e]&&n.has(l[e])&&(l[e]=void 0,r=!0);return r?Object.assign(Object.assign({},e),{data:Object.assign(Object.assign({},e.data),{originalNode:Object.assign(Object.assign({},a),{config:l})})}):e}),o=ge.current.filter(e=>!n.has(e.source)&&!n.has(e.target));Y(e),Z(o),xe(e,o),J&&n.has(J)&&ee(null)}const o=e.filter(e=>"remove"!==e.type&&!("position"===e.type&&"id"in e&&"__start__"===e.id));0!==o.length&&(o.some(e=>"position"===e.type&&!e.dragging)&&(he.current=!0),Y(e=>_(o,e)))},[Y,Z,xe,J]),Le=r((e,n,o)=>{var a,t;const l=_e.get(e);if(!l)return;const r=`${e}_${crypto.randomUUID().replace(/-/g,"").slice(0,12)}`;let i=n;if(!i){const e=null===(a=pe.current)||void 0===a?void 0:a.getBoundingClientRect(),n=e?e.left+e.width/2:400,o=e?e.top+e.height/2:300;i=K.screenToFlowPosition({x:n,y:o})}const d={id:r,type:null!==(t=l.apiType)&&void 0!==t?t:e,config:Object.assign({},l.defaultConfig)},s=l.toFlowNode(d),c={id:r,type:l.flowType,position:i,data:s,selected:!0};if(Y(e=>{const n=e.map(e=>e.selected?Object.assign(Object.assign({},e),{selected:!1}):e);return n.push(c),xe(n,ge.current),n}),ee(r),o){const e=i;requestAnimationFrame(()=>{var n;const a=null===(n=pe.current)||void 0===n?void 0:n.querySelector(`[data-id="${CSS.escape(r)}"]`);if(!a)return;const t=a.offsetWidth,l=a.offsetHeight;t&&l&&Y(n=>n.map(n=>n.id===r?Object.assign(Object.assign({},n),{position:{x:e.x-o.x*t,y:e.y-o.y*l}}):n))})}},[K,Y,xe]),Se=r(e=>{e.preventDefault();const n=e.dataTransfer.getData("application/reactflow");if(!n)return;const[o,a]=e.dataTransfer.getData("application/reactflow-grab-frac").split(","),t={x:Number(o),y:Number(a)},l=K.screenToFlowPosition({x:e.clientX,y:e.clientY});Le(n,l,t)},[K,Le]),Ie=r(e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"},[]),Fe=r(e=>{var n,o,a;const t={id:`${e.source}-${null!==(n=e.sourceHandle)&&void 0!==n?n:""}->${e.target}`,source:e.source,target:e.target,sourceHandle:null!==(o=e.sourceHandle)&&void 0!==o?o:void 0,targetHandle:null!==(a=e.targetHandle)&&void 0!==a?a:void 0,type:T,markerEnd:{type:x.ArrowClosed,width:12,height:12,color:"#94a3b8"}};Z(n=>{const o=n.filter(n=>{var o,a;return!(n.source===e.source&&(null!==(o=n.sourceHandle)&&void 0!==o?o:null)===(null!==(a=e.sourceHandle)&&void 0!==a?a:null))}),a=[...o,t];return xe(fe.current,a),a})},[Z,xe]),De=r((e,n)=>{Z(o=>{var a,t,l;const r=o.filter(o=>{var a,t;return o.id!==e.id&&!(o.source===n.source&&(null!==(a=o.sourceHandle)&&void 0!==a?a:null)===(null!==(t=n.sourceHandle)&&void 0!==t?t:null))}),i=[...r,{id:`${n.source}-${null!==(a=n.sourceHandle)&&void 0!==a?a:""}->${n.target}`,source:n.source,target:n.target,sourceHandle:null!==(t=n.sourceHandle)&&void 0!==t?t:void 0,targetHandle:null!==(l=n.targetHandle)&&void 0!==l?l:void 0,type:T,markerEnd:{type:x.ArrowClosed,width:12,height:12,color:"#94a3b8"}}];return xe(fe.current,i),i})},[Z,xe]),Ue=r(e=>{var n;if(!e.source||!e.target||e.source!==e.target)return!0;const o=fe.current.find(n=>n.id===e.source),a=_e.getByFlowType(null!==(n=null==o?void 0:o.type)&&void 0!==n?n:"");return!0===(null==a?void 0:a.allowSelfLoop)},[fe]),qe=r((e,n,o)=>{var a,t;Y(a=>{const t=a.map(a=>{var t;if(a.id!==e)return a;const l=function({flowType:e,data:n,configUpdates:o,displayUpdates:a,maps:t,locale:l}){const r=n.originalNode;if(!r)return null;const i=Object.assign(Object.assign({},r),{config:Object.assign(Object.assign({},r.config),o)}),d=_e.getByFlowType(e),s=d?d.toFlowNode(i):Object.assign(Object.assign({},n),{originalNode:i}),c=P(o,"target")||void 0,u=c?$(c,l):void 0,p=d?we.find(e=>{var n;return e.type===(null!==(n=d.apiType)&&void 0!==n?n:d.type)}):null,f=Object.assign(Object.assign({},n),s),g=(null==p?void 0:p.enrichNode)?p.enrichNode(f,t,l):f;return Object.assign(Object.assign(Object.assign({},g),a),u&&{targetType:u})}({flowType:null!==(t=a.type)&&void 0!==t?t:"",data:a.data,configUpdates:n,displayUpdates:o,maps:ve.current,locale:i});return l?Object.assign(Object.assign({},a),{data:l}):a});return xe(t,ge.current),t});const l=fe.current.find(n=>n.id===e),r=_e.getByFlowType(null!==(a=null==l?void 0:l.type)&&void 0!==a?a:"");if(r){const o=null==l?void 0:l.data.originalNode,a=function(e,n){const o=A(e,n);return new Set(e.exits.filter(e=>!o.includes(e)).map(e=>e.id))}(r,Object.assign(Object.assign({},null==o?void 0:o.config),n));a.size>0&&Z(n=>{const o=n.filter(n=>{var o;return!(n.source===e&&a.has(null!==(o=n.sourceHandle)&&void 0!==o?o:""))});return o.length===n.length?n:(xe(fe.current,o),o)})}const d=r?we.find(e=>{var n;return e.type===(null!==(n=r.apiType)&&void 0!==n?n:r.type)}):null;null===(t=null==d?void 0:d.onConfigChange)||void 0===t||t.call(d,e,n,{setEdges:Z,updateNodeInternals:B,nodesRef:fe,updateDirty:xe});const s=P(n,"target");s&&requestAnimationFrame(()=>B(e)),s&&!ve.current.users.has(s)&&H.resolveRoutingTarget(s).then(n=>{var o,a;n&&(ve.current.users.set(s,{id:n.id,name:n.name||n.id,extension_number:null!==(o=n.extension_number)&&void 0!==o?o:void 0,timeout_seconds:null!==(a=n.timeout_seconds)&&void 0!==a?a:void 0}),Y(n=>n.map(n=>{var o;return n.id===e?Object.assign(Object.assign({},n),{data:ze(null!==(o=n.type)&&void 0!==o?o:"",n.data,ve.current,i)}):n})))})},[H,Y,Z,xe,B]),Ge=r(()=>{const{nodes:e,edges:n}=Oe(G,X);Y(e),Z(n),xe(e,n),requestAnimationFrame(()=>K.fitView({padding:.2}))},[G,X,Y,Z,xe,K]),Ye=r((e,n)=>j(this,void 0,void 0,function*(){var o;try{const t={expand:["extensions"]};switch(e){case"schedule":return yield H.schedules.list();case"user":return(yield H.users.list(t)).map(e=>{var n,o,a;return{id:e.id,name:e.name||i.combobox.noName,extension_number:null===(a=null===(o=null===(n=e.extensions)||void 0===n?void 0:n.data)||void 0===o?void 0:o[0])||void 0===a?void 0:a.number}});case"ring_group":return yield H.ringGroups.list(t);case"queue":return yield H.queues.list({expand:t.expand});case"dial_plan":{const e=yield H.dialPlans.list(t),n=null!==(o=null==de?void 0:de.id)&&void 0!==o?o:a;return e.filter(e=>e.id!==n)}case"voice_app":{const e=yield H.voiceApps.list(t);if(!(null==n?void 0:n.notifyEligible))return e;try{const n=yield H.aiAgents.list({limit:100}),o=new Set(n.map(e=>e.voice_app_id));return e.filter(e=>!o.has(e.id))}catch(n){return e}}case"shared_voicemail":return yield H.sharedVoicemailBoxes.list();case"audio_clip":return yield H.audioClips.list();case"phone_number":return(yield H.fetchAllPages(e=>H.phoneNumbers.list(e))).filter(e=>"active"===e.status&&e.outbound_enabled).sort((e,n)=>e.phone_number.localeCompare(n.phone_number)).map(e=>({id:e.id,name:e.caller_id_name?`${ie(e.phone_number)} · ${e.caller_id_name}`:ie(e.phone_number)}));default:return[]}}catch(e){return[]}}),[H,a,de,i,ce]),Xe=r(e=>j(this,void 0,void 0,function*(){const n=(e,n)=>Ce(e,n,_e).nodes,o=me.current,a=[...n(fe.current,ge.current),...o?n(o.nodes,o.edges):[]],t=yield We({nodes:a},H,{refresh:!0,only:e?new Set(e):void 0}),l=ve.current,r={schedules:new Map([...l.schedules,...t.schedules]),users:new Map([...l.users,...t.users]),audioClips:new Map([...l.audioClips,...t.audioClips])};ve.current=r;const d=e=>e.map(e=>{var n;return Object.assign(Object.assign({},e),{data:ze(null!==(n=e.type)&&void 0!==n?n:"",e.data,r,i)})}),s=me.current;s&&(me.current=Object.assign(Object.assign({},s),{nodes:d(s.nodes)})),Y(e=>d(e)),ue(e=>e+1)}),[H,Y]),Ze=r(()=>j(this,void 0,void 0,function*(){var e,n,o,t,l,r;try{const l=fe.current,r=ge.current,d=Ce(l,r,_e),s=a?yield H.dialPlans.update(a,d):yield H.dialPlans.create(Object.assign({name:i.status.newDialPlan},d));me.current={nodes:[...l],edges:[...r]},te(!1),null===(n=(e=be.current).onDirtyChange)||void 0===n||n.call(e,!1),null===(t=(o=be.current).onSave)||void 0===t||t.call(o,s)}catch(e){const n=e instanceof Error?e:new Error(String(e)),o=n.message.includes("/nodes/")?Ce(fe.current,ge.current,_e):null;if(o){const e=n.message.match(/^\/nodes\/(\d+)\//);if(null==e?void 0:e[1]){const n=o.nodes[parseInt(e[1],10)];n&&ee(n.id)}}throw null===(r=(l=be.current).onError)||void 0===r||r.call(l,new Error(function(e,n){var o,a,t;if(e.startsWith("voice_app notify mode is not supported on AI agent voice apps"))return"A Voice App used in Notify mode is backed by a Managed VoiceAI agent. Managed VoiceAI voice apps must use Control mode.";const l=e.indexOf(": "),r=l>0&&e.startsWith("/")?e.slice(0,l):"",i=l>0?e.slice(l+2):e,d=r.split("/").filter(Boolean);if("entry_node"===d[0])return"The Start node must be connected to another node";if("nodes"===d[0]&&i.includes("minItems"))return"The dial plan must have at least one node";if("nodes"===d[0]&&"config"===d[2]&&d[3]){const e=d[3];if(Me[e])return Me[e];const l=parseInt(null!==(o=d[1])&&void 0!==o?o:"",10),r=isNaN(l)||null===(a=null==n?void 0:n[l])||void 0===a?void 0:a.type,i=r?null!==(t=$e[r])&&void 0!==t?t:r:void 0;return i?`Invalid ${e.replace(/_/g," ")} in the ${i} node`:`Invalid ${e.replace(/_/g," ")}`}return r?i:e}(n.message,null==o?void 0:o.nodes))),e}}),[H,a]);d(R,()=>({save:Ze,refreshResources:Xe}),[Ze,Xe]);const Qe=r((e,n)=>{"__start__"!==n.id&&(ee(n.id),oe(null))},[]),Je=r((e,n)=>{oe(n.id),ee(null)},[]),en=r(e=>{const n=ge.current.filter(n=>n.id!==e);Z(n),xe(fe.current,n),oe(null)},[Z,xe]),nn=r(()=>{ee(null),oe(null)},[]),on=r((e,n)=>{var o;if(!s)return;if("__start__"===n.id)return;const a=null===(o=n.data)||void 0===o?void 0:o.originalNode;a&&s(n.id,a)},[s]),an=J?G.find(e=>e.id===J):null,tn=an?_e.getByFlowType(null!==(I=an.type)&&void 0!==I?I:""):null,ln=ne?X.find(e=>e.id===ne):null,rn=!(!an||!tn)||!!ln;if(V)return e.createElement("div",{className:`ds-dial-plan-viewer ds-dial-plan-viewer--loading ${L||""}`,style:O},e.createElement("div",{className:"ds-dial-plan-viewer__loading"},e.createElement("div",{className:"ds-dial-plan-viewer__spinner"}),e.createElement("span",null,i.status.loading)));if(U)return e.createElement("div",{className:`ds-dial-plan-viewer ds-dial-plan-viewer--error ${L||""}`,style:O},e.createElement("div",{className:"ds-dial-plan-viewer__error"},e.createElement("span",null,i.status.loadError),e.createElement("span",{className:"ds-dial-plan-viewer__error-message"},U.message)));if(!F&&0===G.length)return e.createElement("div",{className:`ds-dial-plan-viewer ds-dial-plan-viewer--empty ${L||""}`,style:O},e.createElement("div",{className:"ds-dial-plan-viewer__empty"},e.createElement("span",null,i.status.notFound)));const dn=e.createElement(y,{nodes:G,edges:X,nodeTypes:Be,edgeTypes:Ve,onNodesChange:F?Ee:void 0,onEdgesChange:F?ye:void 0,onConnect:F?Fe:void 0,onReconnect:F?De:void 0,onEdgeClick:F?Je:void 0,isValidConnection:F?Ue:void 0,edgesReconnectable:F,onNodeClick:F?Qe:s?on:void 0,onPaneClick:F?nn:void 0,nodesDraggable:F,nodesConnectable:F,elementsSelectable:F,selectionOnDrag:!1,selectNodesOnDrag:!1,panOnDrag:D,panOnScroll:!1,zoomOnScroll:D,zoomOnPinch:D,zoomOnDoubleClick:D,preventScrolling:D,connectionLineType:w.SmoothStep,selectionKeyCode:null,multiSelectionKeyCode:null,deleteKeyCode:F?["Backspace","Delete"]:null,fitView:!0,fitViewOptions:{padding:D?.2:.15,minZoom:D?.5:0,maxZoom:1.5},minZoom:D?.3:0,maxZoom:2,defaultEdgeOptions:{type:T,animated:!1,markerEnd:{type:x.ArrowClosed,width:12,height:12,color:"#94a3b8"}},proOptions:{hideAttribution:!0}},M&&e.createElement(k,{gap:20,size:1}),M&&e.createElement(E,{showInteractive:!1}),F&&e.createElement(Ae,{onAutoLayout:Ge,onSave:()=>{Ze().catch(()=>{})},isDirty:ae,hasInvalidDraft:le}));return e.createElement("div",{className:`ds-dial-plan-editor ${"preview"===l?"ds-dial-plan-editor--preview":""} ${L||""}`,style:O},F&&e.createElement("div",{className:"ds-dial-plan-node-library-wrapper"},e.createElement(Re,{registry:_e,onAddNode:Le})),e.createElement("div",{ref:pe,className:"ds-dial-plan-editor__canvas",onDrop:F?Se:void 0,onDragOver:F?Ie:void 0},dn),F&&e.createElement("div",{className:"ds-dial-plan-config-panel-wrapper"+(rn?" ds-dial-plan-config-panel-wrapper--open":"")},an&&tn&&e.createElement(Te,{node:an,registration:tn,onConfigChange:qe,onInvalidDraftChange:re,onDelete:ke,onClose:()=>{ee(null),Y(e=>e.map(e=>e.selected?Object.assign(Object.assign({},e),{selected:!1}):e))},listResources:Ye,onCreateResource:z,onOpenResource:S,locale:i}),ln&&e.createElement("div",{className:"ds-dial-plan-config-panel"},e.createElement("div",{className:"ds-dial-plan-config-panel__header"},e.createElement("span",{className:"ds-dial-plan-config-panel__header-icon"},e.createElement("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("path",{d:"M4 8h8v8h8"}),e.createElement("polyline",{points:"17 13 20 16 17 19"}))),e.createElement("span",{className:"ds-dial-plan-config-panel__header-label"},i.panel.connection),e.createElement("button",{type:"button",className:"ds-dial-plan-config-panel__delete",onClick:()=>en(ln.id),title:i.panel.delete_},je),e.createElement("button",{type:"button",className:"ds-dial-plan-config-panel__close",onClick:()=>{oe(null),Z(e=>e.map(e=>e.selected?Object.assign(Object.assign({},e),{selected:!1}):e))},title:i.panel.close},e.createElement("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},e.createElement("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),e.createElement("line",{x1:"6",y1:"6",x2:"18",y2:"18"})))),e.createElement("div",{className:"ds-dial-plan-config-panel__body"},e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("span",{className:"ds-dial-plan-config-field__label"},i.panel.from),e.createElement("span",{className:"ds-dial-plan-edge-panel__value"},(()=>{var e,n,o;const a=G.find(e=>e.id===ln.source),t=a?_e.getByFlowType(null!==(e=a.type)&&void 0!==e?e:""):null,l=null!==(o=null!==(n=null==t?void 0:t.label)&&void 0!==n?n:null==a?void 0:a.type)&&void 0!==o?o:ln.source;return l.charAt(0).toUpperCase()+l.slice(1)})())),ln.sourceHandle&&e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("span",{className:"ds-dial-plan-config-field__label"},i.panel.exit),e.createElement("span",{className:"ds-dial-plan-edge-panel__value"},(()=>{var e,n,o,a,t;const l=ln.sourceHandle,r=G.find(e=>e.id===ln.source),i=r?_e.getByFlowType(null!==(e=r.type)&&void 0!==e?e:""):null,d=i?we.find(e=>{var n;return e.type===(null!==(n=i.apiType)&&void 0!==n?n:i.type)}):null;return null!==(t=null!==(o=null===(n=null==d?void 0:d.resolveExitLabel)||void 0===n?void 0:n.call(d,l))&&void 0!==o?o:null===(a=null==i?void 0:i.exits.find(e=>e.id===l))||void 0===a?void 0:a.label)&&void 0!==t?t:l})())),e.createElement("div",{className:"ds-dial-plan-config-field"},e.createElement("span",{className:"ds-dial-plan-config-field__label"},i.panel.to),e.createElement("span",{className:"ds-dial-plan-edge-panel__value"},(()=>{var e,n,o;const a=G.find(e=>e.id===ln.target),t=a?_e.getByFlowType(null!==(e=a.type)&&void 0!==e?e:""):null,l=null!==(o=null!==(n=null==t?void 0:t.label)&&void 0!==n?n:null==a?void 0:a.type)&&void 0!==o?o:ln.target;return l.charAt(0).toUpperCase()+l.slice(1)})()))))))}),qe=["/* this gets exported as style.css and can be used for the default theming */\n/* these are the necessary styles for React/Svelte Flow, they get used by base.css and style.css */\n.react-flow {\n direction: ltr;\n\n --xy-edge-stroke-default: #b1b1b7;\n --xy-edge-stroke-width-default: 1;\n --xy-edge-stroke-selected-default: #555;\n\n --xy-connectionline-stroke-default: #b1b1b7;\n --xy-connectionline-stroke-width-default: 1;\n\n --xy-attribution-background-color-default: rgba(255, 255, 255, 0.5);\n\n --xy-minimap-background-color-default: #fff;\n --xy-minimap-mask-background-color-default: rgba(240, 240, 240, 0.6);\n --xy-minimap-mask-stroke-color-default: transparent;\n --xy-minimap-mask-stroke-width-default: 1;\n --xy-minimap-node-background-color-default: #e2e2e2;\n --xy-minimap-node-stroke-color-default: transparent;\n --xy-minimap-node-stroke-width-default: 2;\n\n --xy-background-color-default: transparent;\n --xy-background-pattern-dots-color-default: #91919a;\n --xy-background-pattern-lines-color-default: #eee;\n --xy-background-pattern-cross-color-default: #e2e2e2;\n background-color: var(--xy-background-color, var(--xy-background-color-default));\n --xy-node-color-default: inherit;\n --xy-node-border-default: 1px solid #1a192b;\n --xy-node-background-color-default: #fff;\n --xy-node-group-background-color-default: rgba(240, 240, 240, 0.25);\n --xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(0, 0, 0, 0.08);\n --xy-node-boxshadow-selected-default: 0 0 0 0.5px #1a192b;\n --xy-node-border-radius-default: 3px;\n\n --xy-handle-background-color-default: #1a192b;\n --xy-handle-border-color-default: #fff;\n\n --xy-selection-background-color-default: rgba(0, 89, 220, 0.08);\n --xy-selection-border-default: 1px dotted rgba(0, 89, 220, 0.8);\n\n --xy-controls-button-background-color-default: #fefefe;\n --xy-controls-button-background-color-hover-default: #f4f4f4;\n --xy-controls-button-color-default: inherit;\n --xy-controls-button-color-hover-default: inherit;\n --xy-controls-button-border-color-default: #eee;\n --xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, 0.08);\n\n --xy-edge-label-background-color-default: #ffffff;\n --xy-edge-label-color-default: inherit;\n --xy-resize-background-color-default: #3367d9;\n}\n.react-flow.dark {\n --xy-edge-stroke-default: #3e3e3e;\n --xy-edge-stroke-width-default: 1;\n --xy-edge-stroke-selected-default: #727272;\n\n --xy-connectionline-stroke-default: #b1b1b7;\n --xy-connectionline-stroke-width-default: 1;\n\n --xy-attribution-background-color-default: rgba(150, 150, 150, 0.25);\n\n --xy-minimap-background-color-default: #141414;\n --xy-minimap-mask-background-color-default: rgba(60, 60, 60, 0.6);\n --xy-minimap-mask-stroke-color-default: transparent;\n --xy-minimap-mask-stroke-width-default: 1;\n --xy-minimap-node-background-color-default: #2b2b2b;\n --xy-minimap-node-stroke-color-default: transparent;\n --xy-minimap-node-stroke-width-default: 2;\n\n --xy-background-color-default: #141414;\n --xy-background-pattern-dots-color-default: #555;\n --xy-background-pattern-lines-color-default: #333;\n --xy-background-pattern-cross-color-default: #333;\n --xy-node-color-default: #f8f8f8;\n --xy-node-border-default: 1px solid #3c3c3c;\n --xy-node-background-color-default: #1e1e1e;\n --xy-node-group-background-color-default: rgba(240, 240, 240, 0.25);\n --xy-node-boxshadow-hover-default: 0 1px 4px 1px rgba(255, 255, 255, 0.08);\n --xy-node-boxshadow-selected-default: 0 0 0 0.5px #999;\n\n --xy-handle-background-color-default: #bebebe;\n --xy-handle-border-color-default: #1e1e1e;\n\n --xy-selection-background-color-default: rgba(200, 200, 220, 0.08);\n --xy-selection-border-default: 1px dotted rgba(200, 200, 220, 0.8);\n\n --xy-controls-button-background-color-default: #2b2b2b;\n --xy-controls-button-background-color-hover-default: #3e3e3e;\n --xy-controls-button-color-default: #f8f8f8;\n --xy-controls-button-color-hover-default: #fff;\n --xy-controls-button-border-color-default: #5b5b5b;\n --xy-controls-box-shadow-default: 0 0 2px 1px rgba(0, 0, 0, 0.08);\n\n --xy-edge-label-background-color-default: #141414;\n --xy-edge-label-color-default: #f8f8f8;\n}\n.react-flow__background {\n background-color: var(--xy-background-color-props, var(--xy-background-color, var(--xy-background-color-default)));\n pointer-events: none;\n z-index: -1;\n}\n.react-flow__container {\n position: absolute;\n width: 100%;\n height: 100%;\n top: 0;\n left: 0;\n}\n.react-flow__pane {\n z-index: 1;\n touch-action: none;\n}\n.react-flow__pane.draggable {\n cursor: grab;\n }\n.react-flow__pane.dragging {\n cursor: grabbing;\n }\n.react-flow__pane.selection {\n cursor: pointer;\n }\n.react-flow__viewport {\n transform-origin: 0 0;\n z-index: 2;\n pointer-events: none;\n}\n.react-flow__renderer {\n z-index: 4;\n}\n.react-flow__selection {\n z-index: 6;\n}\n.react-flow__nodesselection-rect:focus,\n.react-flow__nodesselection-rect:focus-visible {\n outline: none;\n}\n.react-flow__edge-path {\n stroke: var(--xy-edge-stroke, var(--xy-edge-stroke-default));\n stroke-width: var(--xy-edge-stroke-width, var(--xy-edge-stroke-width-default));\n fill: none;\n}\n.react-flow__connection-path {\n stroke: var(--xy-connectionline-stroke, var(--xy-connectionline-stroke-default));\n stroke-width: var(--xy-connectionline-stroke-width, var(--xy-connectionline-stroke-width-default));\n fill: none;\n}\n.react-flow .react-flow__edges {\n position: absolute;\n}\n.react-flow .react-flow__edges svg {\n overflow: visible;\n position: absolute;\n pointer-events: none;\n }\n.react-flow__edge {\n pointer-events: visibleStroke;\n}\n.react-flow__edge.selectable {\n cursor: pointer;\n }\n.react-flow__edge.animated path {\n stroke-dasharray: 5;\n animation: dashdraw 0.5s linear infinite;\n }\n.react-flow__edge.animated path.react-flow__edge-interaction {\n stroke-dasharray: none;\n animation: none;\n }\n.react-flow__edge.inactive {\n pointer-events: none;\n }\n.react-flow__edge.selected,\n .react-flow__edge:focus,\n .react-flow__edge:focus-visible {\n outline: none;\n }\n.react-flow__edge.selected .react-flow__edge-path,\n .react-flow__edge.selectable:focus .react-flow__edge-path,\n .react-flow__edge.selectable:focus-visible .react-flow__edge-path {\n stroke: var(--xy-edge-stroke-selected, var(--xy-edge-stroke-selected-default));\n }\n.react-flow__edge-textwrapper {\n pointer-events: all;\n }\n.react-flow__edge .react-flow__edge-text {\n pointer-events: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n }\n/* Arrowhead marker styles - use CSS custom properties as default */\n.react-flow__arrowhead polyline {\n stroke: var(--xy-edge-stroke, var(--xy-edge-stroke-default));\n}\n.react-flow__arrowhead polyline.arrowclosed {\n fill: var(--xy-edge-stroke, var(--xy-edge-stroke-default));\n}\n.react-flow__connection {\n pointer-events: none;\n}\n.react-flow__connection .animated {\n stroke-dasharray: 5;\n animation: dashdraw 0.5s linear infinite;\n }\nsvg.react-flow__connectionline {\n z-index: 1001;\n overflow: visible;\n position: absolute;\n}\n.react-flow__nodes {\n pointer-events: none;\n transform-origin: 0 0;\n}\n.react-flow__node {\n position: absolute;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n pointer-events: all;\n transform-origin: 0 0;\n box-sizing: border-box;\n cursor: default;\n}\n.react-flow__node.selectable {\n cursor: pointer;\n }\n.react-flow__node.draggable {\n cursor: grab;\n pointer-events: all;\n }\n.react-flow__node.draggable.dragging {\n cursor: grabbing;\n }\n.react-flow__nodesselection {\n z-index: 3;\n transform-origin: left top;\n pointer-events: none;\n}\n.react-flow__nodesselection-rect {\n position: absolute;\n pointer-events: all;\n cursor: grab;\n }\n.react-flow__handle {\n position: absolute;\n pointer-events: none;\n min-width: 5px;\n min-height: 5px;\n width: 6px;\n height: 6px;\n background-color: var(--xy-handle-background-color, var(--xy-handle-background-color-default));\n border: 1px solid var(--xy-handle-border-color, var(--xy-handle-border-color-default));\n border-radius: 100%;\n}\n.react-flow__handle.connectingfrom {\n pointer-events: all;\n }\n.react-flow__handle.connectionindicator {\n pointer-events: all;\n cursor: crosshair;\n }\n.react-flow__handle-bottom {\n top: auto;\n left: 50%;\n bottom: 0;\n transform: translate(-50%, 50%);\n }\n.react-flow__handle-top {\n top: 0;\n left: 50%;\n transform: translate(-50%, -50%);\n }\n.react-flow__handle-left {\n top: 50%;\n left: 0;\n transform: translate(-50%, -50%);\n }\n.react-flow__handle-right {\n top: 50%;\n right: 0;\n transform: translate(50%, -50%);\n }\n.react-flow__edgeupdater {\n cursor: move;\n pointer-events: all;\n}\n.react-flow__pane.selection .react-flow__panel {\n pointer-events: none;\n}\n.react-flow__panel {\n position: absolute;\n z-index: 5;\n margin: 15px;\n}\n.react-flow__panel.top {\n top: 0;\n }\n.react-flow__panel.bottom {\n bottom: 0;\n }\n.react-flow__panel.top.center, .react-flow__panel.bottom.center {\n left: 50%;\n transform: translateX(-15px) translateX(-50%);\n }\n.react-flow__panel.left {\n left: 0;\n }\n.react-flow__panel.right {\n right: 0;\n }\n.react-flow__panel.left.center, .react-flow__panel.right.center {\n top: 50%;\n transform: translateY(-15px) translateY(-50%);\n }\n.react-flow__attribution {\n font-size: 10px;\n background: var(--xy-attribution-background-color, var(--xy-attribution-background-color-default));\n padding: 2px 3px;\n margin: 0;\n}\n.react-flow__attribution a {\n text-decoration: none;\n color: #999;\n }\n@keyframes dashdraw {\n from {\n stroke-dashoffset: 10;\n }\n}\n.react-flow__edgelabel-renderer {\n position: absolute;\n width: 100%;\n height: 100%;\n pointer-events: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n left: 0;\n top: 0;\n}\n.react-flow__viewport-portal {\n position: absolute;\n width: 100%;\n height: 100%;\n left: 0;\n top: 0;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n}\n.react-flow__minimap {\n background: var(\n --xy-minimap-background-color-props,\n var(--xy-minimap-background-color, var(--xy-minimap-background-color-default))\n );\n}\n.react-flow__minimap-svg {\n display: block;\n }\n.react-flow__minimap-mask {\n fill: var(\n --xy-minimap-mask-background-color-props,\n var(--xy-minimap-mask-background-color, var(--xy-minimap-mask-background-color-default))\n );\n stroke: var(\n --xy-minimap-mask-stroke-color-props,\n var(--xy-minimap-mask-stroke-color, var(--xy-minimap-mask-stroke-color-default))\n );\n stroke-width: var(\n --xy-minimap-mask-stroke-width-props,\n var(--xy-minimap-mask-stroke-width, var(--xy-minimap-mask-stroke-width-default))\n );\n }\n.react-flow__minimap-node {\n fill: var(\n --xy-minimap-node-background-color-props,\n var(--xy-minimap-node-background-color, var(--xy-minimap-node-background-color-default))\n );\n stroke: var(\n --xy-minimap-node-stroke-color-props,\n var(--xy-minimap-node-stroke-color, var(--xy-minimap-node-stroke-color-default))\n );\n stroke-width: var(\n --xy-minimap-node-stroke-width-props,\n var(--xy-minimap-node-stroke-width, var(--xy-minimap-node-stroke-width-default))\n );\n }\n.react-flow__background-pattern.dots {\n fill: var(\n --xy-background-pattern-color-props,\n var(--xy-background-pattern-color, var(--xy-background-pattern-dots-color-default))\n );\n }\n.react-flow__background-pattern.lines {\n stroke: var(\n --xy-background-pattern-color-props,\n var(--xy-background-pattern-color, var(--xy-background-pattern-lines-color-default))\n );\n }\n.react-flow__background-pattern.cross {\n stroke: var(\n --xy-background-pattern-color-props,\n var(--xy-background-pattern-color, var(--xy-background-pattern-cross-color-default))\n );\n }\n.react-flow__controls {\n display: flex;\n flex-direction: column;\n box-shadow: var(--xy-controls-box-shadow, var(--xy-controls-box-shadow-default));\n}\n.react-flow__controls.horizontal {\n flex-direction: row;\n }\n.react-flow__controls-button {\n display: flex;\n justify-content: center;\n align-items: center;\n height: 26px;\n width: 26px;\n padding: 4px;\n border: none;\n background: var(--xy-controls-button-background-color, var(--xy-controls-button-background-color-default));\n border-bottom: 1px solid\n var(\n --xy-controls-button-border-color-props,\n var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default))\n );\n color: var(\n --xy-controls-button-color-props,\n var(--xy-controls-button-color, var(--xy-controls-button-color-default))\n );\n cursor: pointer;\n -webkit-user-select: none;\n -moz-user-select: none;\n user-select: none;\n }\n.react-flow__controls-button svg {\n width: 100%;\n max-width: 12px;\n max-height: 12px;\n fill: currentColor;\n }\n.react-flow__edge.updating .react-flow__edge-path {\n stroke: #777;\n }\n.react-flow__edge-text {\n font-size: 10px;\n }\n.react-flow__node.selectable:focus,\n .react-flow__node.selectable:focus-visible {\n outline: none;\n }\n.react-flow__node-input,\n.react-flow__node-default,\n.react-flow__node-output,\n.react-flow__node-group {\n padding: 10px;\n border-radius: var(--xy-node-border-radius, var(--xy-node-border-radius-default));\n width: 150px;\n font-size: 12px;\n color: var(--xy-node-color, var(--xy-node-color-default));\n text-align: center;\n border: var(--xy-node-border, var(--xy-node-border-default));\n background-color: var(--xy-node-background-color, var(--xy-node-background-color-default));\n}\n.react-flow__node-input.selectable:hover, .react-flow__node-default.selectable:hover, .react-flow__node-output.selectable:hover, .react-flow__node-group.selectable:hover {\n box-shadow: var(--xy-node-boxshadow-hover, var(--xy-node-boxshadow-hover-default));\n }\n.react-flow__node-input.selectable.selected,\n .react-flow__node-input.selectable:focus,\n .react-flow__node-input.selectable:focus-visible,\n .react-flow__node-default.selectable.selected,\n .react-flow__node-default.selectable:focus,\n .react-flow__node-default.selectable:focus-visible,\n .react-flow__node-output.selectable.selected,\n .react-flow__node-output.selectable:focus,\n .react-flow__node-output.selectable:focus-visible,\n .react-flow__node-group.selectable.selected,\n .react-flow__node-group.selectable:focus,\n .react-flow__node-group.selectable:focus-visible {\n box-shadow: var(--xy-node-boxshadow-selected, var(--xy-node-boxshadow-selected-default));\n }\n.react-flow__node-group {\n background-color: var(--xy-node-group-background-color, var(--xy-node-group-background-color-default));\n}\n.react-flow__nodesselection-rect,\n.react-flow__selection {\n background: var(--xy-selection-background-color, var(--xy-selection-background-color-default));\n border: var(--xy-selection-border, var(--xy-selection-border-default));\n}\n.react-flow__nodesselection-rect:focus,\n .react-flow__nodesselection-rect:focus-visible,\n .react-flow__selection:focus,\n .react-flow__selection:focus-visible {\n outline: none;\n }\n.react-flow__controls-button:hover {\n background: var(\n --xy-controls-button-background-color-hover-props,\n var(--xy-controls-button-background-color-hover, var(--xy-controls-button-background-color-hover-default))\n );\n color: var(\n --xy-controls-button-color-hover-props,\n var(--xy-controls-button-color-hover, var(--xy-controls-button-color-hover-default))\n );\n }\n.react-flow__controls-button:disabled {\n pointer-events: none;\n }\n.react-flow__controls-button:disabled svg {\n fill-opacity: 0.4;\n }\n.react-flow__controls-button:last-child {\n border-bottom: none;\n }\n.react-flow__controls.horizontal .react-flow__controls-button {\n border-bottom: none;\n border-right: 1px solid\n var(\n --xy-controls-button-border-color-props,\n var(--xy-controls-button-border-color, var(--xy-controls-button-border-color-default))\n );\n }\n.react-flow__controls.horizontal .react-flow__controls-button:last-child {\n border-right: none;\n }\n.react-flow__resize-control {\n position: absolute;\n}\n.react-flow__resize-control.left,\n.react-flow__resize-control.right {\n cursor: ew-resize;\n}\n.react-flow__resize-control.top,\n.react-flow__resize-control.bottom {\n cursor: ns-resize;\n}\n.react-flow__resize-control.top.left,\n.react-flow__resize-control.bottom.right {\n cursor: nwse-resize;\n}\n.react-flow__resize-control.bottom.left,\n.react-flow__resize-control.top.right {\n cursor: nesw-resize;\n}\n/* handle styles */\n.react-flow__resize-control.handle {\n width: 5px;\n height: 5px;\n border: 1px solid #fff;\n border-radius: 1px;\n background-color: var(--xy-resize-background-color, var(--xy-resize-background-color-default));\n translate: -50% -50%;\n}\n.react-flow__resize-control.handle.left {\n left: 0;\n top: 50%;\n}\n.react-flow__resize-control.handle.right {\n left: 100%;\n top: 50%;\n}\n.react-flow__resize-control.handle.top {\n left: 50%;\n top: 0;\n}\n.react-flow__resize-control.handle.bottom {\n left: 50%;\n top: 100%;\n}\n.react-flow__resize-control.handle.top.left {\n left: 0;\n}\n.react-flow__resize-control.handle.bottom.left {\n left: 0;\n}\n.react-flow__resize-control.handle.top.right {\n left: 100%;\n}\n.react-flow__resize-control.handle.bottom.right {\n left: 100%;\n}\n/* line styles */\n.react-flow__resize-control.line {\n border-color: var(--xy-resize-background-color, var(--xy-resize-background-color-default));\n border-width: 0;\n border-style: solid;\n}\n.react-flow__resize-control.line.left,\n.react-flow__resize-control.line.right {\n width: 1px;\n transform: translate(-50%, 0);\n top: 0;\n height: 100%;\n}\n.react-flow__resize-control.line.left {\n left: 0;\n border-left-width: 1px;\n}\n.react-flow__resize-control.line.right {\n left: 100%;\n border-right-width: 1px;\n}\n.react-flow__resize-control.line.top,\n.react-flow__resize-control.line.bottom {\n height: 1px;\n transform: translate(0, -50%);\n left: 0;\n width: 100%;\n}\n.react-flow__resize-control.line.top {\n top: 0;\n border-top-width: 1px;\n}\n.react-flow__resize-control.line.bottom {\n border-bottom-width: 1px;\n top: 100%;\n}\n.react-flow__edge-textbg {\n fill: var(--xy-edge-label-background-color, var(--xy-edge-label-background-color-default));\n}\n.react-flow__edge-text {\n fill: var(--xy-edge-label-color, var(--xy-edge-label-color-default));\n}\n",'\n/* ============================================================================\n Shadow DOM Reset\n ============================================================================ */\n\n:host {\n display: flex;\n flex-direction: column;\n width: 100%;\n height: 100%;\n}\n\n*, *::before, *::after {\n box-sizing: border-box;\n}\n\n/* ============================================================================\n Container\n ============================================================================ */\n\n.ds-dial-plan-viewer {\n width: 100%;\n height: 100%;\n background: var(--ds-color-background, #ffffff);\n border-radius: var(--ds-border-radius, 8px);\n overflow: hidden;\n}\n\n/* ============================================================================\n Base Node Styles\n ============================================================================ */\n\n.ds-dial-plan-node {\n padding: 12px 16px;\n border-radius: var(--ds-border-radius, 8px);\n border: 2px solid var(--ds-color-border, #e2e8f0);\n background: var(--ds-color-background, #ffffff);\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n transition: border-color 0.15s ease, box-shadow 0.15s ease, outline-color 0.15s ease;\n min-width: 140px;\n outline: 3px solid transparent;\n outline-offset: 2px;\n}\n\n.ds-dial-plan-node--selected {\n border-color: var(--ds-color-primary, #3b82f6);\n outline-color: var(--ds-color-primary, #3b82f6);\n box-shadow: 0 0 16px 2px rgba(59, 130, 246, 0.4), 0 4px 12px rgba(59, 130, 246, 0.2);\n}\n\n.ds-dial-plan-node__content,\n.ds-dial-plan-node__header {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n}\n\n.ds-dial-plan-node__icon {\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-dial-plan-node__label {\n font-weight: 600;\n color: var(--ds-color-text, #1e293b);\n text-align: center;\n}\n\n.ds-dial-plan-node__type-label {\n font-size: var(--ds-font-size-xs, 12px);\n font-weight: 500;\n color: var(--ds-color-text-secondary, #64748b);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n}\n\n.ds-dial-plan-node__name {\n font-weight: 600;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text, #1e293b);\n text-align: center;\n}\n\n.ds-dial-plan-node__type {\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-dial-plan-node__exits {\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin-top: 12px;\n padding-top: 10px;\n border-top: 1px solid var(--ds-color-border, #e2e8f0);\n}\n\n.ds-dial-plan-node__exit-row {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 8px;\n position: relative;\n}\n\n.ds-dial-plan-node__exit-label {\n font-size: 11px;\n color: var(--ds-color-text-secondary, #64748b);\n white-space: nowrap;\n}\n\n/* Position handles at the right edge of exit rows */\n.ds-dial-plan-node__exit-row .ds-dial-plan-handle {\n position: absolute;\n right: -16px;\n}\n\n/* ============================================================================\n Start Node\n ============================================================================ */\n\n.ds-dial-plan-node--start {\n background: var(--ds-color-primary, #3b82f6);\n border-color: var(--ds-color-primary, #3b82f6);\n border-radius: 50%;\n width: 60px;\n height: 60px;\n min-width: auto;\n padding: 0;\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.ds-dial-plan-node--start .ds-dial-plan-node__content {\n flex-direction: row;\n}\n\n.ds-dial-plan-node--start .ds-dial-plan-node__label {\n color: #ffffff;\n font-size: var(--ds-font-size-sm, 14px);\n}\n\n/* ============================================================================\n Node color theming (driven by --node-color CSS variable from registration)\n ============================================================================ */\n\n.ds-dial-plan-node--themed {\n border-color: var(--node-color);\n background: color-mix(in srgb, var(--node-color) 8%, white);\n}\n\n.ds-dial-plan-node--themed .ds-dial-plan-node__icon {\n color: var(--node-color);\n}\n\n.ds-dial-plan-node--themed.ds-dial-plan-node--selected {\n border-color: var(--node-color);\n outline-color: var(--node-color);\n box-shadow: 0 0 16px 2px color-mix(in srgb, var(--node-color) 40%, transparent),\n 0 4px 12px color-mix(in srgb, var(--node-color) 20%, transparent);\n}\n\n/* ============================================================================\n Per-type node colors (override --themed fallback with hand-crafted gradients)\n ============================================================================ */\n\n.ds-dial-plan-node--schedule {\n background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);\n border-color: var(--ds-color-info, #0ea5e9);\n min-height: 80px;\n}\n.ds-dial-plan-node--schedule .ds-dial-plan-node__icon { color: var(--ds-color-info, #0ea5e9); }\n.ds-dial-plan-node--schedule.ds-dial-plan-node--selected {\n border-color: var(--ds-color-info, #0ea5e9);\n outline-color: var(--ds-color-info, #0ea5e9);\n box-shadow: 0 0 16px 2px rgba(14, 165, 233, 0.4), 0 4px 12px rgba(14, 165, 233, 0.2);\n}\n\n.ds-dial-plan-node--internal-dial {\n background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);\n border-color: var(--ds-color-success, #22c55e);\n}\n.ds-dial-plan-node--internal-dial .ds-dial-plan-node__icon { color: var(--ds-color-success, #22c55e); }\n.ds-dial-plan-node--internal-dial.ds-dial-plan-node--selected {\n border-color: var(--ds-color-success, #22c55e);\n outline-color: var(--ds-color-success, #22c55e);\n box-shadow: 0 0 16px 2px rgba(34, 197, 94, 0.4), 0 4px 12px rgba(34, 197, 94, 0.2);\n}\n\n.ds-dial-plan-node--voicemail {\n background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%);\n border-color: var(--ds-color-purple, #a855f7);\n}\n.ds-dial-plan-node--voicemail .ds-dial-plan-node__icon { color: var(--ds-color-purple, #a855f7); }\n.ds-dial-plan-node--voicemail.ds-dial-plan-node--selected {\n border-color: var(--ds-color-purple, #a855f7);\n outline-color: var(--ds-color-purple, #a855f7);\n box-shadow: 0 0 16px 2px rgba(168, 85, 247, 0.4), 0 4px 12px rgba(168, 85, 247, 0.2);\n}\n\n.ds-dial-plan-node--ring-all-users {\n background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);\n border-color: var(--ds-color-warning, #f59e0b);\n}\n.ds-dial-plan-node--ring-all-users .ds-dial-plan-node__icon { color: var(--ds-color-warning, #f59e0b); }\n.ds-dial-plan-node--ring-all-users.ds-dial-plan-node--selected {\n border-color: var(--ds-color-warning, #f59e0b);\n outline-color: var(--ds-color-warning, #f59e0b);\n box-shadow: 0 0 16px 2px rgba(245, 158, 11, 0.4), 0 4px 12px rgba(245, 158, 11, 0.2);\n}\n\n.ds-dial-plan-node--external-dial {\n background: linear-gradient(135deg, #fff1f2 0%, #fecdd3 100%);\n border-color: var(--ds-color-rose, #f43f5e);\n}\n.ds-dial-plan-node--external-dial .ds-dial-plan-node__icon { color: var(--ds-color-rose, #f43f5e); }\n.ds-dial-plan-node--external-dial.ds-dial-plan-node--selected {\n border-color: var(--ds-color-rose, #f43f5e);\n outline-color: var(--ds-color-rose, #f43f5e);\n box-shadow: 0 0 16px 2px rgba(244, 63, 94, 0.4), 0 4px 12px rgba(244, 63, 94, 0.2);\n}\n\n.ds-dial-plan-node--voice-app {\n border: 2px solid transparent;\n background:\n linear-gradient(135deg, #c7d2fe 0%, #ddd6fe 40%, #bae6fd 100%) padding-box,\n linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box;\n position: relative;\n transition: box-shadow 0.15s ease;\n}\n.ds-dial-plan-node--voice-app .ds-dial-plan-node__icon { color: #4f46e5; }\n.ds-dial-plan-node--voice-app.ds-dial-plan-node--selected {\n border-color: transparent;\n outline: none;\n box-shadow: 0 0 16px 2px rgba(99, 102, 241, 0.4), 0 4px 12px rgba(56, 189, 248, 0.2);\n}\n.ds-dial-plan-node--voice-app::after {\n content: \'\';\n position: absolute;\n inset: -7px;\n border-radius: calc(var(--ds-border-radius, 8px) + 5px);\n border: 3px solid transparent;\n background: linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box;\n -webkit-mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);\n -webkit-mask-composite: xor;\n mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);\n mask-composite: exclude;\n pointer-events: none;\n opacity: 0;\n transition: opacity 0.15s ease;\n z-index: -1;\n}\n.ds-dial-plan-node--voice-app.ds-dial-plan-node--selected::after { opacity: 1; }\n\n.ds-dial-plan-node--menu {\n background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%);\n border-color: #ec4899;\n}\n.ds-dial-plan-node--menu .ds-dial-plan-node__icon { color: #ec4899; }\n.ds-dial-plan-node--menu.ds-dial-plan-node--selected {\n border-color: #ec4899;\n outline-color: #ec4899;\n box-shadow: 0 0 16px 2px rgba(236, 72, 153, 0.4), 0 4px 12px rgba(236, 72, 153, 0.2);\n}\n\n.ds-dial-plan-node--audio-clip {\n background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%);\n border-color: #14b8a6;\n}\n.ds-dial-plan-node--audio-clip .ds-dial-plan-node__icon { color: #14b8a6; }\n.ds-dial-plan-node--audio-clip.ds-dial-plan-node--selected {\n border-color: #14b8a6;\n outline-color: #14b8a6;\n box-shadow: 0 0 16px 2px rgba(20, 184, 166, 0.4), 0 4px 12px rgba(20, 184, 166, 0.2);\n}\n\n/* ============================================================================\n Menu Config Panel — Options List\n ============================================================================ */\n\n.ds-dial-plan-config-field__header {\n display: flex;\n align-items: center;\n justify-content: space-between;\n margin-bottom: 6px;\n}\n\n.ds-dial-plan-config-field__header .ds-dial-plan-config-field__label {\n margin: 0;\n}\n\n.ds-dial-plan-menu-options {\n display: flex;\n flex-direction: column;\n gap: 6px;\n}\n\n.ds-dial-plan-menu-options__card {\n display: flex;\n align-items: flex-end;\n gap: 6px;\n}\n\n.ds-dial-plan-menu-options__field {\n display: flex;\n flex-direction: column;\n gap: 4px;\n min-width: 0;\n}\n\n.ds-dial-plan-menu-options__field--digit {\n flex: 0 0 64px;\n}\n\n.ds-dial-plan-menu-options__field--label {\n flex: 1;\n}\n\n.ds-dial-plan-menu-options__field-label {\n font-size: 10px;\n font-weight: 600;\n letter-spacing: 0.05em;\n text-transform: uppercase;\n color: var(--ds-color-text-muted, #94a3b8);\n}\n\n.ds-dial-plan-menu-options__field-hint {\n font-weight: 400;\n text-transform: none;\n letter-spacing: 0;\n opacity: 0.8;\n}\n\n.ds-dial-plan-menu-options__remove {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border: none;\n background: none;\n color: var(--ds-color-text-muted, #94a3b8);\n cursor: pointer;\n border-radius: 4px;\n flex-shrink: 0;\n}\n\n.ds-dial-plan-menu-options__remove:hover {\n color: var(--ds-color-danger, #ef4444);\n background: rgba(239, 68, 68, 0.1);\n}\n\n.ds-dial-plan-menu-options__add {\n padding: 3px 10px;\n border: 1px solid var(--ds-color-primary, #6366f1);\n background: none;\n color: var(--ds-color-primary, #6366f1);\n cursor: pointer;\n border-radius: 4px;\n font-size: 11px;\n font-weight: 500;\n white-space: nowrap;\n}\n\n.ds-dial-plan-menu-options__add:hover:not(:disabled) {\n background: var(--ds-color-primary, #6366f1);\n color: #ffffff;\n}\n\n.ds-dial-plan-menu-options__add:disabled {\n opacity: 0.4;\n cursor: default;\n}\n\n/* ============================================================================\n Handles\n ============================================================================ */\n\n.ds-dial-plan-handle {\n width: 10px;\n height: 10px;\n background: var(--ds-color-border, #e2e8f0);\n border: 2px solid var(--ds-color-background, #ffffff);\n}\n\n.ds-dial-plan-handle--next {\n background: var(--ds-color-text-secondary, #64748b);\n}\n\n/* ============================================================================\n React Flow Overrides (both viewer and editor)\n ============================================================================ */\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge-path {\n stroke: var(--ds-color-border, #94a3b8);\n stroke-width: 2;\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge.selected .react-flow__edge-path {\n stroke: var(--ds-color-primary, #3b82f6);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge-text {\n font-size: var(--ds-font-size-xs, 12px);\n fill: var(--ds-color-text-secondary, #64748b);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__background {\n background-color: var(--ds-color-background, #ffffff);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__minimap {\n background: var(--ds-color-background, #ffffff);\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls {\n border-radius: var(--ds-border-radius, 8px);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls-button {\n background: var(--ds-color-background, #ffffff);\n border-color: var(--ds-color-border, #e2e8f0);\n color: var(--ds-color-text, #1e293b);\n}\n\n:is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls-button:hover {\n background: var(--ds-color-background-hover, #f8fafc);\n}\n\n/* ============================================================================\n Loading, Error, and Empty States\n ============================================================================ */\n\n.ds-dial-plan-viewer--loading,\n.ds-dial-plan-viewer--error,\n.ds-dial-plan-viewer--empty {\n display: flex;\n align-items: center;\n justify-content: center;\n}\n\n.ds-dial-plan-viewer__loading,\n.ds-dial-plan-viewer__error,\n.ds-dial-plan-viewer__empty {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 12px;\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-dial-plan-viewer__spinner {\n width: 32px;\n height: 32px;\n border: 3px solid var(--ds-color-border, #e2e8f0);\n border-top-color: var(--ds-color-primary, #3b82f6);\n border-radius: 50%;\n animation: ds-dial-plan-spin 0.8s linear infinite;\n}\n\n@keyframes ds-dial-plan-spin {\n to {\n transform: rotate(360deg);\n }\n}\n\n.ds-dial-plan-viewer__error {\n color: var(--ds-color-danger, #ef4444);\n}\n\n.ds-dial-plan-viewer__error-message {\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-text-secondary, #64748b);\n max-width: 300px;\n text-align: center;\n}\n\n/* ============================================================================\n Config Panel\n ============================================================================ */\n\n.ds-dial-plan-config-panel {\n width: 260px;\n height: 100%;\n background: var(--ds-color-background, #ffffff);\n border-left: 1px solid var(--ds-color-border, #e2e8f0);\n display: flex;\n flex-direction: column;\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n overflow-y: auto;\n}\n\n.ds-dial-plan-config-panel__header {\n display: flex;\n align-items: center;\n gap: 8px;\n padding: 12px 16px;\n border-bottom: 1px solid var(--ds-color-border, #e2e8f0);\n}\n\n.ds-dial-plan-config-panel__header-icon {\n color: var(--ds-color-text-secondary, #64748b);\n display: flex;\n align-items: center;\n}\n\n.ds-dial-plan-config-panel__header-label {\n flex: 1;\n font-weight: 600;\n color: var(--ds-color-text, #1e293b);\n}\n\n.ds-dial-plan-config-panel__delete {\n color: var(--ds-color-danger, #ef4444);\n background: none;\n border: none;\n padding: 2px;\n cursor: pointer;\n display: flex;\n align-items: center;\n}\n\n.ds-dial-plan-config-panel__delete:hover {\n color: #dc2626;\n}\n\n.ds-dial-plan-config-panel__close {\n background: none;\n border: none;\n color: var(--ds-color-text-secondary, #64748b);\n cursor: pointer;\n padding: 2px;\n display: flex;\n align-items: center;\n}\n\n.ds-dial-plan-config-panel__close:hover {\n color: var(--ds-color-text, #1e293b);\n}\n\n.ds-dial-plan-config-panel__body {\n padding: 16px;\n display: flex;\n flex-direction: column;\n gap: 12px;\n}\n\n.ds-dial-plan-config-field {\n display: flex;\n flex-direction: column;\n gap: 4px;\n}\n\n.ds-dial-plan-config-field__label {\n font-size: var(--ds-font-size-xs, 12px);\n font-weight: 500;\n color: var(--ds-color-text-secondary, #64748b);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n}\n\n.ds-dial-plan-config-field__select,\n.ds-dial-plan-config-field__input {\n width: 100%;\n padding: 6px 8px;\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n background: var(--ds-color-background, #ffffff);\n color: var(--ds-color-text, #1e293b);\n font-size: var(--ds-font-size-sm, 14px);\n font-family: inherit;\n outline: none;\n box-sizing: border-box;\n}\n\n.ds-dial-plan-config-field__checkbox {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text, #1e293b);\n cursor: pointer;\n}\n\n.ds-dial-plan-config-field__hint {\n margin: 4px 0 0;\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-text-secondary, #64748b);\n line-height: 1.4;\n}\n\n.ds-dial-plan-config-field__error {\n margin: 4px 0 0;\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-danger, #ef4444);\n line-height: 1.4;\n}\n\n.ds-dial-plan-config-field__input[aria-invalid=\'true\'] {\n border-color: var(--ds-color-danger, #ef4444);\n}\n\n.ds-dial-plan-edge-panel__value {\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text, #1e293b);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-edge-panel__value {\n color: #e2e8f0;\n}\n\n.ds-dial-plan-config-field__open-link {\n display: inline-flex;\n align-items: center;\n gap: 4px;\n background: none;\n border: none;\n padding: 0;\n margin-top: 4px;\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-primary, #3b82f6);\n cursor: pointer;\n font-family: inherit;\n}\n\n.ds-dial-plan-config-field__open-link:hover {\n text-decoration: underline;\n}\n\n.ds-dial-plan-config-field__select:focus,\n.ds-dial-plan-config-field__input:focus {\n border-color: var(--ds-color-primary, #3b82f6);\n box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15);\n}\n\n.ds-dial-plan-config-field__input:disabled {\n background: #f1f5f9;\n color: var(--ds-color-text-secondary, #64748b);\n cursor: not-allowed;\n opacity: 0.7;\n}\n\n.ds-dial-plan-config-field__input-wrapper {\n position: relative;\n display: flex;\n align-items: center;\n}\n\n.ds-dial-plan-config-field__input-wrapper .ds-dial-plan-config-field__input {\n padding-right: 28px;\n}\n\n.ds-dial-plan-config-field__clear {\n position: absolute;\n right: 6px;\n display: flex;\n align-items: center;\n justify-content: center;\n width: 20px;\n height: 20px;\n padding: 0;\n border: none;\n border-radius: 50%;\n background: transparent;\n color: var(--ds-color-text-secondary, #64748b);\n cursor: pointer;\n}\n\n.ds-dial-plan-config-field__clear:hover {\n background: var(--ds-color-border, #e2e8f0);\n color: var(--ds-color-text, #1e293b);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__clear:hover {\n background: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n.ds-dial-plan-config-field__segmented {\n display: flex;\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n overflow: hidden;\n background: var(--ds-color-background, #ffffff);\n}\n\n.ds-dial-plan-config-field__segmented-option {\n flex: 1;\n padding: 6px 8px;\n border: none;\n background: transparent;\n color: var(--ds-color-text-secondary, #64748b);\n font-size: var(--ds-font-size-sm, 14px);\n font-family: inherit;\n cursor: pointer;\n}\n\n.ds-dial-plan-config-field__segmented-option + .ds-dial-plan-config-field__segmented-option {\n border-left: 1px solid var(--ds-color-border, #e2e8f0);\n}\n\n.ds-dial-plan-config-field__segmented-option--active {\n background: var(--ds-color-primary, #3b82f6);\n color: #ffffff;\n font-weight: 500;\n}\n\n.ds-dial-plan-config-field__hint {\n margin: 4px 0 0;\n font-size: var(--ds-font-size-xs, 11px);\n line-height: 1.4;\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-dial-plan-node__badge {\n display: block;\n width: fit-content;\n margin: 4px auto 0;\n padding: 2px 8px;\n border-radius: 999px;\n background: var(--ds-color-muted, #eef2ff);\n color: var(--ds-color-text-secondary, #64748b);\n font-size: var(--ds-font-size-xs, 11px);\n font-weight: 500;\n letter-spacing: 0.3px;\n text-align: center;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__badge {\n background: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n/* ============================================================================\n Resource Combobox\n ============================================================================ */\n\n.ds-resource-combobox {\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n background: var(--ds-color-background, #ffffff);\n overflow: hidden;\n}\n\n.ds-resource-combobox__trigger {\n width: 100%;\n padding: 6px 8px;\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n background: var(--ds-color-background, #ffffff);\n color: var(--ds-color-text, #1e293b);\n font-size: var(--ds-font-size-sm, 14px);\n font-family: inherit;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n text-align: left;\n}\n\n.ds-resource-combobox__trigger:hover {\n border-color: var(--ds-color-primary, #3b82f6);\n}\n\n.ds-resource-combobox__trigger-placeholder {\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-resource-combobox__trigger-chevron {\n color: var(--ds-color-text-secondary, #64748b);\n opacity: 0.5;\n flex-shrink: 0;\n}\n\n.ds-resource-combobox__input {\n width: 100%;\n padding: 8px 10px;\n border: none;\n border-bottom: 1px solid var(--ds-color-border, #e2e8f0);\n background: transparent;\n color: var(--ds-color-text, #1e293b);\n font-size: var(--ds-font-size-sm, 14px);\n font-family: inherit;\n outline: none;\n box-sizing: border-box;\n}\n\n.ds-resource-combobox__input::placeholder {\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n.ds-resource-combobox__list {\n max-height: 400px;\n overflow-y: auto;\n padding: 4px 0;\n}\n\n.ds-resource-combobox__group [cmdk-group-heading] {\n padding: 6px 10px 2px;\n font-size: var(--ds-font-size-xs, 12px);\n font-weight: 500;\n color: var(--ds-color-text-secondary, #64748b);\n text-transform: uppercase;\n letter-spacing: 0.5px;\n}\n\n.ds-resource-combobox__item {\n padding: 6px 10px;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text, #1e293b);\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: space-between;\n border-radius: 0;\n}\n\n.ds-resource-combobox__item[data-selected="true"] {\n background: var(--ds-color-primary, #3b82f6);\n color: #ffffff;\n}\n\n.ds-resource-combobox__item--selected {\n font-weight: 500;\n}\n\n.ds-resource-combobox__name {\n flex: 1;\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.ds-resource-combobox__ext {\n font-size: var(--ds-font-size-xs, 12px);\n color: var(--ds-color-text-secondary, #64748b);\n margin-left: auto;\n padding-left: 8px;\n white-space: nowrap;\n flex-shrink: 0;\n}\n\n.ds-resource-combobox__check {\n font-size: 12px;\n opacity: 0.7;\n width: 16px;\n text-align: center;\n flex-shrink: 0;\n}\n\n.ds-resource-combobox__create {\n padding: 6px 10px;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-primary, #3b82f6);\n cursor: pointer;\n font-style: italic;\n}\n\n.ds-resource-combobox__create[data-selected="true"] {\n background: var(--ds-color-primary, #3b82f6);\n color: #ffffff;\n}\n\n.ds-resource-combobox__empty {\n padding: 12px 10px;\n font-size: var(--ds-font-size-sm, 14px);\n color: var(--ds-color-text-secondary, #64748b);\n text-align: center;\n}\n\n/* ============================================================================\n Dark Mode\n Activated by .dark class on an ancestor (Tailwind / next-themes convention)\n or data-theme="dark" attribute.\n ============================================================================ */\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-viewer,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor {\n background: #1a1a2e;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node {\n background: #1e1e32;\n border-color: rgba(255, 255, 255, 0.1);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__label,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__name {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__icon,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__type-label,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__type,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__exit-label {\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node__exits {\n border-top-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--themed {\n background: color-mix(in srgb, var(--node-color) 20%, #1a1a2e);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--schedule {\n background: linear-gradient(135deg, #0c2d48 0%, #0a3761 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--internal-dial {\n background: linear-gradient(135deg, #052e16 0%, #064e3b 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--voicemail {\n background: linear-gradient(135deg, #2e1065 0%, #3b0764 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--ring-all-users {\n background: linear-gradient(135deg, #451a03 0%, #78350f 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--external-dial {\n background: linear-gradient(135deg, #4c0519 0%, #881337 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--voice-app {\n background:\n linear-gradient(135deg, #252262 0%, #3b1d7e 40%, #0c3a5e 100%) padding-box,\n linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box;\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--menu {\n background: linear-gradient(135deg, #500724 0%, #831843 100%);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node--audio-clip {\n background: linear-gradient(135deg, #042f2e 0%, #115e59 100%);\n}\n\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-handle {\n border-color: #1e1e32;\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__background {\n background-color: #1a1a2e;\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge-path {\n stroke: rgba(255, 255, 255, 0.2);\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__edge-text {\n fill: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__minimap {\n background: #1e1e32;\n border-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls {\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls-button {\n background: #1e1e32;\n border-color: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) :is(.ds-dial-plan-viewer, .ds-dial-plan-editor) .react-flow__controls-button:hover {\n background: #2a2a45;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-viewer__loading,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-viewer__empty {\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-viewer__spinner {\n border-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel {\n background: #1e1e32;\n border-left-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel__header {\n border-bottom-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel__header-label {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel__close {\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-panel__close:hover {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__label {\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__checkbox {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__select,\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__input {\n background: #12122a;\n border-color: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-config-field__input:disabled {\n background: #1e1e38;\n color: #94a3b8;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox__trigger {\n background: #12122a;\n border-color: rgba(255, 255, 255, 0.1);\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox {\n border-color: rgba(255, 255, 255, 0.1);\n background: #12122a;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox__input {\n color: #e2e8f0;\n border-bottom-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox__item {\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-resource-combobox__item--selected {\n color: #e2e8f0;\n}\n\n/* Node Library */\n\n.ds-dial-plan-node-library {\n width: 200px;\n height: 100%;\n background: var(--ds-color-background, #ffffff);\n border-right: 1px solid var(--ds-color-border, #e2e8f0);\n display: flex;\n flex-direction: column;\n gap: 10px;\n padding: 12px;\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n overflow-y: auto;\n}\n\n.ds-dial-plan-node-library__item {\n display: flex;\n flex-direction: column;\n align-items: center;\n gap: 4px;\n padding: 10px 12px;\n border-radius: var(--ds-border-radius, 8px);\n border: 2px solid var(--node-color, var(--ds-color-border, #e2e8f0));\n background: color-mix(in srgb, var(--node-color, #ffffff) 10%, white);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);\n cursor: grab;\n transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;\n}\n\n.ds-dial-plan-node-library__item:hover {\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);\n transform: translateY(-1px);\n}\n\n.ds-dial-plan-node-library__item:active {\n cursor: grabbing;\n transform: scale(0.97);\n}\n\n/* Per-type library item colors */\n.ds-dial-plan-node-library__item--schedule { background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%); border-color: var(--ds-color-info, #0ea5e9); }\n.ds-dial-plan-node-library__item--internal_dial { background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%); border-color: var(--ds-color-success, #22c55e); }\n.ds-dial-plan-node-library__item--voicemail { background: linear-gradient(135deg, #faf5ff 0%, #f3e8ff 100%); border-color: var(--ds-color-purple, #a855f7); }\n.ds-dial-plan-node-library__item--ring_all_users { background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%); border-color: var(--ds-color-warning, #f59e0b); }\n.ds-dial-plan-node-library__item--external_dial { background: linear-gradient(135deg, #fff1f2 0%, #fecdd3 100%); border-color: var(--ds-color-rose, #f43f5e); }\n.ds-dial-plan-node-library__item--voice_app,\n.ds-dial-plan-node-library__item--voice_app:hover {\n border: 2px solid transparent;\n background: linear-gradient(135deg, #c7d2fe 0%, #ddd6fe 40%, #bae6fd 100%) padding-box, linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box;\n}\n.ds-dial-plan-node-library__item--menu { background: linear-gradient(135deg, #fdf2f8 0%, #fce7f3 100%); border-color: #ec4899; }\n.ds-dial-plan-node-library__item--audio_clip { background: linear-gradient(135deg, #f0fdfa 0%, #ccfbf1 100%); border-color: #14b8a6; }\n\n.ds-dial-plan-node-library__item-icon {\n display: flex;\n align-items: center;\n color: var(--node-color);\n}\n.ds-dial-plan-node-library__item--schedule .ds-dial-plan-node-library__item-icon { color: var(--ds-color-info, #0ea5e9); }\n.ds-dial-plan-node-library__item--internal_dial .ds-dial-plan-node-library__item-icon { color: var(--ds-color-success, #22c55e); }\n.ds-dial-plan-node-library__item--voicemail .ds-dial-plan-node-library__item-icon { color: var(--ds-color-purple, #a855f7); }\n.ds-dial-plan-node-library__item--ring_all_users .ds-dial-plan-node-library__item-icon { color: var(--ds-color-warning, #f59e0b); }\n.ds-dial-plan-node-library__item--external_dial .ds-dial-plan-node-library__item-icon { color: var(--ds-color-rose, #f43f5e); }\n.ds-dial-plan-node-library__item--voice_app .ds-dial-plan-node-library__item-icon { color: #4f46e5; }\n.ds-dial-plan-node-library__item--menu .ds-dial-plan-node-library__item-icon { color: #ec4899; }\n.ds-dial-plan-node-library__item--audio_clip .ds-dial-plan-node-library__item-icon { color: #14b8a6; }\n\n.ds-dial-plan-node-library__item-label {\n font-size: var(--ds-font-size-xs, 12px);\n font-weight: 600;\n color: var(--ds-color-text, #1e293b);\n text-align: center;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library {\n background: #1e1e32;\n border-right-color: rgba(255, 255, 255, 0.1);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item {\n background: color-mix(in srgb, var(--node-color, #1e1e32) 20%, #1e1e32);\n border-color: rgba(255, 255, 255, 0.1);\n box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);\n}\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--schedule { background: linear-gradient(135deg, #0c2d48 0%, #0a3761 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--internal_dial { background: linear-gradient(135deg, #052e16 0%, #064e3b 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--voicemail { background: linear-gradient(135deg, #2e1065 0%, #3b0764 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--ring_all_users { background: linear-gradient(135deg, #451a03 0%, #78350f 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--external_dial { background: linear-gradient(135deg, #4c0519 0%, #881337 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--voice_app { background: linear-gradient(135deg, #252262 0%, #3b1d7e 40%, #0c3a5e 100%) padding-box, linear-gradient(135deg, #38bdf8 0%, #818cf8 35%, #a855f7 60%, #ec4899 100%) border-box; }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--menu { background: linear-gradient(135deg, #500724 0%, #831843 100%); }\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item--audio_clip { background: linear-gradient(135deg, #042f2e 0%, #115e59 100%); }\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-node-library__item-label {\n color: #e2e8f0;\n}\n\n/* ============================================================================\n Editor Toolbar\n ============================================================================ */\n\n.ds-dial-plan-editor-toolbar {\n position: absolute;\n top: 16px;\n right: 16px;\n z-index: 10;\n display: flex;\n gap: 8px;\n}\n\n.ds-dial-plan-editor-toolbar__button {\n display: flex;\n align-items: center;\n gap: 6px;\n padding: 8px 12px;\n background: var(--ds-color-background, #ffffff);\n border: 1px solid var(--ds-color-border, #e2e8f0);\n border-radius: var(--ds-border-radius, 8px);\n color: var(--ds-color-text, #1e293b);\n font-family: var(--ds-font-family, -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, sans-serif);\n font-size: var(--ds-font-size-sm, 14px);\n font-weight: 500;\n cursor: pointer;\n transition: all 0.15s ease;\n}\n\n.ds-dial-plan-editor-toolbar__button:hover {\n background: var(--ds-color-background-hover, #f1f5f9);\n border-color: var(--ds-color-border, #cbd5e1);\n}\n\n.ds-dial-plan-editor-toolbar__button:active {\n transform: scale(0.98);\n}\n\n.ds-dial-plan-editor-toolbar__button:disabled {\n opacity: 0.4;\n cursor: not-allowed;\n}\n\n.ds-dial-plan-editor-toolbar__button:disabled:hover {\n background: var(--ds-color-background, #ffffff);\n border-color: var(--ds-color-border, #e2e8f0);\n}\n\n.ds-dial-plan-editor-toolbar__button svg {\n color: var(--ds-color-text-secondary, #64748b);\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor-toolbar__button {\n background: #1e293b;\n border-color: #334155;\n color: #e2e8f0;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor-toolbar__button:hover {\n background: #334155;\n border-color: #475569;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor-toolbar__button:disabled:hover {\n background: #1e293b;\n border-color: #334155;\n}\n\n:is(.dark, [data-theme="dark"]) .ds-dial-plan-editor-toolbar__button svg {\n color: #cbd5e1;\n}\n\n/* Editor Layout */\n\n.ds-dial-plan-editor {\n display: flex;\n width: 100%;\n height: 100%;\n flex: 1;\n min-height: 400px;\n background: var(--ds-color-background, #ffffff);\n overflow: hidden;\n}\n\n.ds-dial-plan-editor--preview {\n min-height: 0;\n}\n\n.ds-dial-plan-editor__canvas {\n flex: 1;\n position: relative;\n}\n\n/* Node Library wrapper */\n\n.ds-dial-plan-node-library-wrapper {\n width: 200px;\n flex-shrink: 0;\n align-self: stretch;\n overflow: hidden;\n}\n\n/* Config panel wrapper (slide-in animation) */\n\n.ds-dial-plan-config-panel-wrapper {\n width: 0;\n flex-shrink: 0;\n align-self: stretch;\n overflow: hidden;\n transition: width 0.2s ease;\n}\n\n@media (prefers-reduced-motion: reduce) {\n .ds-dial-plan-config-panel-wrapper {\n transition: none;\n }\n}\n\n.ds-dial-plan-config-panel-wrapper--open {\n width: 260px;\n}\n\n\n'],Ge=e.forwardRef((a,t)=>{var l;const{dialstack:r}=N();C("dial-plan");const i=function(e){const[a,t]=n(()=>e.getAppearance());return o(()=>{if("undefined"==typeof document)return;const n=document.createElement("div"),o=e=>{const n=e.detail;t(null==n?void 0:n.appearance)};return n.addEventListener("dialstack-appearance-update",o),e.addAppearanceTarget(n),()=>{e.removeAppearanceTarget(n),n.removeEventListener("dialstack-appearance-update",o)}},[e]),a}(r),d="dark"===(null==i?void 0:i.theme)?"dark":"light",s=null!==(l=a.theme)&&void 0!==l?l:d;return e.createElement(De,{stylesheets:qe,className:a.className,style:Object.assign({width:"100%",height:"100%",flex:1,minHeight:0},a.style)},e.createElement("div",{"data-theme":s,style:{display:"flex",flexDirection:"column",flex:1,minHeight:0}},e.createElement(g,null,e.createElement(Ue,Object.assign({ref:t},a)))))});Ge.displayName="DialPlan";export{Ge as DialPlan};
2
2
  //# sourceMappingURL=dial-plan.mjs.map